[PATCH] intel_uncore.c - Horrible, ugly hack to avoid dmesg spam

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] intel_uncore.c - Horrible, ugly hack to avoid dmesg spam

Bryan Linton
Hello tech@

First, I want to say that I'm in no way advocating that this patch
be committed to the tree.  I'm sending it solely for the others
who have encountered the same issue I have.  It's only purpose is
to suppress dmesg spam on boot and thereby speed up booting by
10-15 seconds, as well as to not flush out potentially important
information from the dmesg buffer.

This patch is ugly, hackish, and (poorly) paints over the underlying
problem.  It may cause headaches and nausea in certain
individuals.

In brief, on boot, the system prints out a tremendous amount of
variations of the following error:

error: [drm:pid3322:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt

This has been reported to occur on a Thinkpad T440p, Thinkpad T440s,
Dell M3800, and a Toshiba Portege R30-A.

The system otherwise works fine, so it doesn't appear that
whatever is causing the messages to print has any other
deleterious effects on the system.

Enough lines are printed out to completely fill the dmesg buffer
as such:

% dmesg | sort -n | uniq -c
   6 error: [drm:pid22060:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
 209 error: [drm:pid25769:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
   3 error: [drm:pid25817:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
  44 error: [drm:pid30074:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
 402 error: [drm:pid3322:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
  28 error: [drm:pid33672:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
   5 error: [drm:pid39271:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
   2 error: [drm:pid40435:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
   2 error: [drm:pid5194:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
  12 error: [drm:pid92159:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
   1 pid92159:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt

The patch below simply stops printing additional messages after 10
lines have been printed.

--
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 14 Oct 2017 04:05:20 -0000
@@ -1565,9 +1565,17 @@
 {
  struct drm_i915_private *dev_priv = dev->dev_private;
 
+ static long i =0;
+
  if (HAS_FPGA_DBG_UNCLAIMED(dev) &&
     (__raw_i915_read32(dev_priv, FPGA_DBG) & FPGA_DBG_RM_NOCLAIM)) {
- DRM_ERROR("Unclaimed register before interrupt\n");
+ if (i < 10)
+ DRM_ERROR("Unclaimed register before interrupt\n");
+ if (i == 10)
+ DRM_ERROR("Suspending printing of more unclaimed"
+ " register errors.\n");
+
  __raw_i915_write32(dev_priv, FPGA_DBG, FPGA_DBG_RM_NOCLAIM);
+ i++;
  }
 }
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] intel_uncore.c - Horrible, ugly hack to avoid dmesg spam

Miod Vallat
> 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.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] intel_uncore.c - Horrible, ugly hack to avoid dmesg spam

Bryan Linton
On 2017-10-29 06:40:35, Miod Vallat <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: [PATCH] intel_uncore.c - Horrible, ugly hack to avoid dmesg spam

Martin Pieuchot
In reply to this post by Bryan Linton
On 29/10/17(Sun) 14:20, Bryan Linton wrote:
> Hello tech@
>
> First, I want to say that I'm in no way advocating that this patch
> be committed to the tree.  I'm sending it solely for the others
> who have encountered the same issue I have.  It's only purpose is
> to suppress dmesg spam on boot and thereby speed up booting by
> 10-15 seconds, as well as to not flush out potentially important
> information from the dmesg buffer.

I have that in my tree, apparently this message goes away in later
DRM/linux versions.

Index: i915/i915_irq.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/i915/i915_irq.c,v
retrieving revision 1.32
diff -u -p -r1.32 i915_irq.c
--- i915/i915_irq.c 30 Sep 2017 07:36:56 -0000 1.32
+++ i915/i915_irq.c 1 Oct 2017 09:42:16 -0000
@@ -2133,9 +2133,11 @@ static irqreturn_t ironlake_irq_handler(
  if (!intel_irqs_enabled(dev_priv))
  return IRQ_NONE;
 
+#ifdef __linux__
  /* We get interrupts on unclaimed registers, so check for this before we
  * do any I915_{READ,WRITE}. */
  intel_uncore_check_errors(dev);
+#endif
 
  /* disable master interrupt before clearing iir  */
  de_ier = I915_READ(DEIER);

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] intel_uncore.c - Horrible, ugly hack to avoid dmesg spam

x9p-3
In reply to this post by Bryan Linton

> Enough lines are printed out to completely fill the dmesg buffer
> as such:
>
> % dmesg | sort -n | uniq -c
>    6 error: [drm:pid22060:intel_uncore_check_errors] *ERROR* Unclaimed
> register before interrupt
>  209 error: [drm:pid25769:intel_uncore_check_errors] *ERROR* Unclaimed
> register before interrupt
>    3 error: [drm:pid25817:intel_uncore_check_errors] *ERROR* Unclaimed
> register before interrupt
>   44 error: [drm:pid30074:intel_uncore_check_errors] *ERROR* Unclaimed
> register before interrupt
>  402 error: [drm:pid3322:intel_uncore_check_errors] *ERROR* Unclaimed
> register before interrupt
>   28 error: [drm:pid33672:intel_uncore_check_errors] *ERROR* Unclaimed
> register before interrupt
>    5 error: [drm:pid39271:intel_uncore_check_errors] *ERROR* Unclaimed
> register before interrupt
>    2 error: [drm:pid40435:intel_uncore_check_errors] *ERROR* Unclaimed
> register before interrupt
>    2 error: [drm:pid5194:intel_uncore_check_errors] *ERROR* Unclaimed
> register before interrupt
>   12 error: [drm:pid92159:intel_uncore_check_errors] *ERROR* Unclaimed
> register before interrupt
>    1 pid92159:intel_uncore_check_errors] *ERROR* Unclaimed register
> before interrupt
>
> The patch below simply stops printing additional messages after 10
> lines have been printed.


I wonder why you get so many error messages from different PIDs.

In my HP Probook G640 I got a similar message, just once, at boot time:

[root@localhost ~#]dmesg | egrep uncore
error: [drm:pid0:intel_uncore_check_errors] *ERROR* Unclaimed register
before interrupt