On 2017-10-29 06:40:35, Miod Vallat <m...@online.fr> wrote:
> > The patch below simply stops printing additional messages after 10
> > lines have been printed.
> >
>
> You might want to use ratecheck(9) rather than a simple limit.
> 

Done.  Thanks for the tip!

-- 
Bryan

Index: intel_uncore.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/i915/intel_uncore.c,v
retrieving revision 1.5
diff -u -r1.5 intel_uncore.c
--- intel_uncore.c      3 Sep 2017 13:38:58 -0000       1.5
+++ intel_uncore.c      29 Oct 2017 07:48:38 -0000
@@ -21,6 +21,8 @@
  * IN THE SOFTWARE.
  */
 
+#include <sys/time.h>
+
 #include "i915_drv.h"
 #include "intel_drv.h"
 #include "i915_vgpu.h"
@@ -51,6 +53,14 @@
        "media",
 };
 
+/*
+* The following globals are for rate-limiting the error message in
+* the intel_uncore_check_errors() function.
+*/
+struct timeval intel_uncore_lasterrtime;
+long intel_uncore_errcount;
+static struct timeval intel_uncore_errinterval = { 5, 0 };     /* 5 seconds */
+
 const char *
 intel_uncore_forcewake_domain_to_str(const enum forcewake_domain_id id)
 {
@@ -1567,7 +1577,12 @@
 
        if (HAS_FPGA_DBG_UNCLAIMED(dev) &&
            (__raw_i915_read32(dev_priv, FPGA_DBG) & FPGA_DBG_RM_NOCLAIM)) {
-               DRM_ERROR("Unclaimed register before interrupt\n");
+               intel_uncore_errcount++;
+               if (ratecheck(&intel_uncore_lasterrtime, 
+                       &intel_uncore_errinterval)) {
+                       DRM_ERROR("Unclaimed register before interrupt\n");
+                       intel_uncore_errcount=0;
+               }
                __raw_i915_write32(dev_priv, FPGA_DBG, FPGA_DBG_RM_NOCLAIM);
        }
 }

Reply via email to