[kernel] Fixup irqpoll patch to only activate on machines with ASM108x PCI bridge

Josh Boyer jwboyer at fedoraproject.org
Thu Mar 15 01:05:34 UTC 2012


commit c4069fe6d25dd24c25a16cc95cb8978c8e8d3879
Author: Josh Boyer <jwboyer at redhat.com>
Date:   Wed Mar 14 20:29:41 2012 -0400

    Fixup irqpoll patch to only activate on machines with ASM108x PCI bridge

 kernel.spec                            |    3 +
 unhandled-irqs-switch-to-polling.patch |  145 +++++++++++++-------------------
 2 files changed, 63 insertions(+), 85 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index d3dfe53..17a12bf 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -2344,6 +2344,9 @@ fi
 #                 ||----w |
 #                 ||     ||
 %changelog
+* Wed Mar 14 2012 Josh Boyer <jwboyer at redhat.com>
+- Fixup irqpoll patch to only activate on machines with ASM108x PCI bridge
+
 * Tue Mar 13 2012 John W. Linville <linville at redhat.com>
 - Remove infrastructure related to compat-wireless integration
 
diff --git a/unhandled-irqs-switch-to-polling.patch b/unhandled-irqs-switch-to-polling.patch
index 6eeaf0b..39169ba 100644
--- a/unhandled-irqs-switch-to-polling.patch
+++ b/unhandled-irqs-switch-to-polling.patch
@@ -1,62 +1,3 @@
-From davej  Mon Jan 30 16:40:11 2012
-Return-Path: linux-kernel-owner at vger.kernel.org
-X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
-	gelk.kernelslacker.org
-X-Spam-Level: 
-X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIM_ADSP_CUSTOM_MED,
-	DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,
-	T_TO_NO_BRKTS_FREEMAIL,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2
-Received: from mail.corp.redhat.com [10.5.5.52]
-	by gelk.kernelslacker.org with IMAP (fetchmail-6.3.20)
-	for <davej at localhost> (single-drop); Mon, 30 Jan 2012 16:40:11 -0500 (EST)
-Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
- zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
- zmail11.collab.prod.int.phx2.redhat.com with LMTP; Mon, 30 Jan 2012
- 16:37:45 -0500 (EST)
-Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 4BAD0114054;
-	Mon, 30 Jan 2012 16:37:45 -0500 (EST)
-X-Quarantine-ID: <1529X45BXJfc>
-Authentication-Results: zmta01.collab.prod.int.phx2.redhat.com (amavisd-new);
-	dkim=softfail (fail, body has been altered) header.i=@gmail.com
-Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id 1529X45BXJfc; Mon, 30 Jan 2012 16:37:45 -0500 (EST)
-Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 717AC11404F;
-	Mon, 30 Jan 2012 16:37:44 -0500 (EST)
-Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19])
-	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q0ULbhea005095;
-	Mon, 30 Jan 2012 16:37:43 -0500
-Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
-	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0ULQIU9002068;
-	Mon, 30 Jan 2012 16:37:42 -0500
-Received: (majordomo at vger.kernel.org) by vger.kernel.org via listexpand
-	id S1753551Ab2A3Vha (ORCPT <rfc822;lcapitulino at redhat.com>
-	+ 52 others); Mon, 30 Jan 2012 16:37:30 -0500
-Received: from mail-pz0-f46.google.com ([209.85.210.46]:44901 "EHLO
-	mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
-	with ESMTP id S1751932Ab2A3Vh2 (ORCPT
-	<rfc822;linux-kernel at vger.kernel.org>);
-	Mon, 30 Jan 2012 16:37:28 -0500
-Received: by dadi2 with SMTP id i2so3911730dad.19
-        for <linux-kernel at vger.kernel.org>; Mon, 30 Jan 2012 13:37:28 -0800 (PST)
-Received-SPF: pass (google.com: domain of jeroen.vandenkeybus at gmail.com designates 10.68.218.68 as permitted sender) client-ip=10.68.218.68;
-Authentication-Results: 	mr.google.com; spf=pass (google.com: domain of jeroen.vandenkeybus at gmail.com designates 10.68.218.68 as permitted sender) smtp.mail=jeroen.vandenkeybus at gmail.com; dkim=pass header.i=jeroen.vandenkeybus at gmail.com
-Received: from mr.google.com ([10.68.218.68])
-        by 10.68.218.68 with SMTP id pe4mr25063612pbc.97.1327959448228 (num_hops = 1);
-        Mon, 30 Jan 2012 13:37:28 -0800 (PST)
-DKIM-Signature: 	v=1; a=rsa-sha256; c=relaxed/relaxed;
-        d=gmail.com; s=gamma;
-        h=mime-version:date:message-id:subject:from:to:cc:content-type;
-        bh=acUEKJRLazlNr7PWqoJIHm/MPkfhI5SUq1Z0ntfqXSE=;
-        b=J1hmytKDfluL7NI73mVH+flbQ2+36FPRRx+DFhrPs8hiOebxJHysZZH+etW1ppCJG0
-         ORowrKZYuyXb1CVYkSAYSnZ60r0edu8VycE4wsVItKQV8f0ZFyFZi5HteL1KiBRHqTYI
-         soeRaI/zW4cJv3AbTTc1Aj/4/HXKyuPtj0Ayc=
-MIME-Version: 1.0
-Received: by 10.68.218.68 with SMTP id pe4mr20868027pbc.97.1327959448085; Mon,
- 30 Jan 2012 13:37:28 -0800 (PST)
-Received: by 10.143.38.11 with HTTP; Mon, 30 Jan 2012 13:37:28 -0800 (PST)
 Date: 	Mon, 30 Jan 2012 22:37:28 +0100
 Message-ID: <CAPRPZsAt+e3cy1YTriikpb2SNN=jOusvnPF0ByFeun+uaBa5Og at mail.gmail.com>
 Subject: [PATCH] Unhandled IRQs on AMD E-450: temporarily switch to
@@ -141,21 +82,23 @@ every time during debugging).
 
 Signed-off-by: Jeroen Van den Keybus <jeroen.vandenkeybus at gmail.com>
 
-Make it less chatty.  Josh Boyer <jwboyer at redhat.com>
+Make it less chatty.  Only kick it in if we detect an ASM1083 PCI bridge.
+
+Josh Boyer <jwboyer at redhat.com>
 ======
 
 --- linux-2.6.orig/kernel/irq/spurious.c
 +++ linux-2.6/kernel/irq/spurious.c
-@@ -18,7 +18,7 @@
+@@ -18,6 +18,8 @@
  
  static int irqfixup __read_mostly;
  
--#define POLL_SPURIOUS_IRQ_INTERVAL (HZ/10)
-+#define POLL_SPURIOUS_IRQ_INTERVAL (HZ/100)
++int irq_poll_and_retry = 0;
++
+ #define POLL_SPURIOUS_IRQ_INTERVAL (HZ/10)
  static void poll_spurious_irqs(unsigned long dummy);
  static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs, 0, 0);
- static int irq_poll_cpu;
-@@ -141,14 +141,15 @@ out:
+@@ -141,12 +143,13 @@ out:
  static void poll_spurious_irqs(unsigned long dummy)
  {
  	struct irq_desc *desc;
@@ -168,12 +111,9 @@ Make it less chatty.  Josh Boyer <jwboyer at redhat.com>
  
 +	poll_again = 0; /* Will stay false as long as no polling candidate is found */
  	for_each_irq_desc(i, desc) {
--		unsigned int state;
-+		unsigned int state, irq;
+ 		unsigned int state;
  
- 		if (!i)
- 			 continue;
-@@ -159,14 +160,29 @@ static void poll_spurious_irqs(unsigned
+@@ -159,14 +162,33 @@ static void poll_spurious_irqs(unsigned
  		if (!(state & IRQS_SPURIOUS_DISABLED))
  			continue;
  
@@ -183,19 +123,23 @@ Make it less chatty.  Josh Boyer <jwboyer at redhat.com>
 +		/* We end up here with a disabled spurious interrupt.
 +		   desc->irqs_unhandled now tracks the number of times
 +		   the interrupt has been polled */
-+
-+		irq = desc->irq_data.irq;
-+		if (desc->irqs_unhandled < 100) { /* 1 second delay with poll frequency 100 Hz */
++		if (irq_poll_and_retry) {
++			if (desc->irqs_unhandled < 100) { /* 1 second delay with poll frequency 100 Hz */
++				local_irq_disable();
++				try_one_irq(i, desc, true);
++				local_irq_enable();
++				desc->irqs_unhandled++;
++				poll_again = 1;
++			} else {
++				irq_enable(desc); /* Reenable the interrupt line */
++				desc->depth--;
++				desc->istate &= (~IRQS_SPURIOUS_DISABLED);
++				desc->irqs_unhandled = 0;
++			}
++		} else {
 +			local_irq_disable();
 +			try_one_irq(i, desc, true);
 +			local_irq_enable();
-+			desc->irqs_unhandled++;
-+			poll_again = 1;
-+		} else {
-+			irq_enable(desc); /* Reenable the interrupt line */
-+			desc->depth--;
-+			desc->istate &= (~IRQS_SPURIOUS_DISABLED);
-+			desc->irqs_unhandled = 0;
 +		}
  	}
 +	if (poll_again)
@@ -208,7 +152,7 @@ Make it less chatty.  Josh Boyer <jwboyer at redhat.com>
  }
  
  static inline int bad_action_ret(irqreturn_t action_ret)
-@@ -177,11 +193,19 @@ static inline int bad_action_ret(irqretu
+@@ -177,11 +199,19 @@ static inline int bad_action_ret(irqretu
  }
  
  /*
@@ -230,7 +174,7 @@ Make it less chatty.  Josh Boyer <jwboyer at redhat.com>
   *  functioning device sharing an IRQ with the failing one)
   */
  static void
-@@ -302,19 +326,19 @@ void note_interrupt(unsigned int irq, st
+@@ -302,19 +332,24 @@ void note_interrupt(unsigned int irq, st
  	}
  
  	desc->irq_count++;
@@ -242,15 +186,46 @@ Make it less chatty.  Josh Boyer <jwboyer at redhat.com>
 -	if (unlikely(desc->irqs_unhandled > 99900)) {
 +	if (unlikely(desc->irqs_unhandled >= 9)) {
  		/*
- 		 * The interrupt is stuck
+-		 * The interrupt is stuck
++		 * The interrupt might be stuck
  		 */
 -		__report_bad_irq(irq, desc, action_ret);
-+		/* __report_bad_irq(irq, desc, action_ret); */
++		if (!irq_poll_and_retry) {
++			__report_bad_irq(irq, desc, action_ret);
++			printk(KERN_EMERG "Disabling IRQ %d\n", irq);
++		} else {
++			printk(KERN_INFO "IRQ %d might be stuck.  Polling\n",
++				irq);
++		}
  		/*
  		 * Now kill the IRQ
  		 */
 -		printk(KERN_EMERG "Disabling IRQ #%d\n", irq);
-+		printk(KERN_EMERG "Disabling IRQ %d\n", irq);
  		desc->istate |= IRQS_SPURIOUS_DISABLED;
  		desc->depth++;
  		irq_disable(desc);
+--- linux-2.6.orig/drivers/pci/quirks.c
++++ linux-2.6/drivers/pci/quirks.c
+@@ -1677,6 +1677,22 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,	0x260a, quirk_intel_pcie_pm);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,	0x260b, quirk_intel_pcie_pm);
+ 
++/* ASM108x transparent PCI bridges apparently have broken IRQ deassert
++ * handling.  This causes interrupts to get "stuck" and eventually disabled.
++ * However, the interrupts are often shared and disabling them is fairly bad.
++ * It's been somewhat successful to switch to polling mode and retry after
++ * a bit, so let's do that.
++ */
++extern int irq_poll_and_retry;
++static void quirk_asm108x_poll_interrupts(struct pci_dev *dev)
++{
++	dev_info(&dev->dev, "Buggy bridge found [%04x:%04x]\n",
++		dev->vendor, dev->device);
++	dev_info(&dev->dev, "Stuck interrupts will be polled and retried\n");
++	irq_poll_and_retry = 1;
++}
++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ASMEDIA,	0x1080,	quirk_asm108x_poll_interrupts);
++
+ #ifdef CONFIG_X86_IO_APIC
+ /*
+  * Boot interrupts on some chipsets cannot be turned off. For these chipsets,


More information about the scm-commits mailing list