linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] AHCI: Fix threaded interrupt setup
@ 2014-10-23 16:49 Marc Zyngier
  2014-10-27 13:20 ` Alexander Gordeev
  0 siblings, 1 reply; 6+ messages in thread
From: Marc Zyngier @ 2014-10-23 16:49 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-sunxi, Alexander Gordeev, linux-ide

Commit 18dcf433f3de (AHCI: Optimize single IRQ interrupt processing)
switched the single IRQ case of the AHCI driver to use threaded
threaded interrupts.

During this conversion, only the IRQF_SHARED flag was provided. The net
effect of this in the presence of level interrupts is that the
interrupt will not be masked during the execution of the treaded
handler, leading to a screaming interrupt if the thread is not
scheduled quickly enough, specially in error conditions:

[    2.728051] ahci-sunxi 1c18000.sata: controller can't do PMP, turning off CAP_PMP
[    2.735578] ahci-sunxi 1c18000.sata: SSS flag set, parallel bus scan disabled
[    2.742792] ahci-sunxi 1c18000.sata: AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl platform mode
[    2.751789] ahci-sunxi 1c18000.sata: flags: ncq sntf stag pm led clo only pio slum part ccc
[    2.761539] scsi host0: ahci_platform
[    2.765754] ata1: SATA max UDMA/133 mmio [mem 0x01c18000-0x01c18fff] port 0x100 irq 88
[...]
[    3.127977] ata1: SATA link down (SStatus 0 SControl 300)
[...]
[    3.162035] Waiting for root device /dev/sda1...
[    3.163700] random: nonblocking pool is initialized
[    3.326593] irq 88: nobody cared (try booting with the "irqpoll" option)
[    3.333296] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-rc1+ #3077
[    3.339936] [<c002b318>] (unwind_backtrace) from [<c0026980>] (show_stack+0x20/0x24)
[    3.347681] [<c0026980>] (show_stack) from [<c067dd18>] (dump_stack+0x9c/0xd4)
[    3.354904] [<c067dd18>] (dump_stack) from [<c007ac08>] (__report_bad_irq+0x38/0xd4)
[    3.362643] [<c007ac08>] (__report_bad_irq) from [<c007b1dc>] (note_interrupt+0x280/0x2d0)
[    3.370903] [<c007b1dc>] (note_interrupt) from [<c0078a70>] (handle_irq_event_percpu+0x210/0x27c)
[    3.379771] [<c0078a70>] (handle_irq_event_percpu) from [<c0078b28>] (handle_irq_event+0x4c/0x6c)
[    3.388636] [<c0078b28>] (handle_irq_event) from [<c007b860>] (handle_fasteoi_irq+0xbc/0x1a0)
[    3.397156] [<c007b860>] (handle_fasteoi_irq) from [<c0077f5c>] (generic_handle_irq+0x3c/0x4c)
[    3.405764] [<c0077f5c>] (generic_handle_irq) from [<c0078220>] (__handle_domain_irq+0x6c/0xb4)
[    3.414456] [<c0078220>] (__handle_domain_irq) from [<c0008754>] (gic_handle_irq+0x34/0x6c)
[    3.422802] [<c0008754>] (gic_handle_irq) from [<c0027540>] (__irq_svc+0x40/0x74)
[    3.430274] Exception stack(0xc09c1df8 to 0xc09c1e40)
[    3.435321] 1de0:                                                       00000001 c0a27ec0
[    3.443491] 1e00: 00000000 00000000 c09c0028 0000001e 00000282 00000000 ee00c400 c0a239f8
[    3.451660] 1e20: c09c0000 c09c1ea4 c0a27ec0 c09c1e40 00200000 c003c7cc 20000113 ffffffff
[    3.459835] [<c0027540>] (__irq_svc) from [<c003c7cc>] (__do_softirq+0xbc/0x34c)
[    3.467229] [<c003c7cc>] (__do_softirq) from [<c003cd44>] (irq_exit+0xbc/0x104)
[    3.474536] [<c003cd44>] (irq_exit) from [<c0078224>] (__handle_domain_irq+0x70/0xb4)
[    3.482362] [<c0078224>] (__handle_domain_irq) from [<c0008754>] (gic_handle_x74)
[    3.498169] Exception stack(0xc09c1f10 to 0xc09c1f58)
[    3.503216] 1f00:                                     ee7ca310 00000000 00000ab4 c0035560
[    3.511386] 1f20: c09c0000 00000000 c0a23f84 c09c8474 c09c84bc c09c0000 c0688bf8 c09c1f64
[    3.519554] 1f40: c09c1f68 c09c1f58 c00235d8 c00235dc 60000113 ffffffff
[    3.526165] [<c0027540>] (__irq_svc) from [<c00235dc>] (arch_cpu_idle+0x48/0x4c)
[    3.533557] [<c00235dc>] (arch_cpu_idle) from [<c00701fc>] (cpu_startup_entry+0x13c/0x27c)
[    3.541816] [<c00701fc>] (cpu_startup_entry) from [<c067af1c>] (rest_init+0x94/0x98)
[    3.549557] [<c067af1c>] (rest_init) from [<c093dd38>] (start_kernel+0x3f0/0x3fc)
[    3.557036] [<c093dd38>] (start_kernel) from [<40008084>] (0x40008084)
[    3.563555] handlers:
[    3.565830] [<c03a1a80>] ahci_single_irq_intr threaded [<c03a223c>] ahci_thread_fn
[    3.573415] Disabling IRQ #88
[    3.576532] ata1: exception Emask 0x10 SAct 0x0 SErr 0x4050002 action 0xe frozen
[    3.583977] ata1: irq_stat 0x00400040, connection status changed
[    3.590006] ata1: SError: { RecovComm PHYRdyChg CommWake DevExch }
[    3.596209] ata1: hard resetting link
[...]

Not good. The culprit is a missing IRQF_ONESHOT flag, which addition
solves the problem entierly. The number of interrupts drops radically:

[Booting Debian Jessie to a prompt]
Before fix:
 88:       3562          0       GIC  88  ahci-sunxi
After fix:
 88:       1992          0       GIC  88  ahci-sunxi

Tested on a A20 board (ahci-sunxi).

Cc: Alexander Gordeev <agordeev@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/ata/libahci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 5eb61c9..49c649f 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -2492,7 +2492,7 @@ static int ahci_host_activate_single_irq(struct ata_host *host, int irq,
 		return rc;
 
 	rc = devm_request_threaded_irq(host->dev, irq, ahci_single_irq_intr,
-				       ahci_thread_fn, IRQF_SHARED,
+				       ahci_thread_fn, IRQF_SHARED | IRQF_ONESHOT,
 				       dev_driver_string(host->dev), host);
 	if (rc)
 		return rc;
-- 
2.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] AHCI: Fix threaded interrupt setup
  2014-10-23 16:49 [PATCH] AHCI: Fix threaded interrupt setup Marc Zyngier
@ 2014-10-27 13:20 ` Alexander Gordeev
       [not found]   ` <20141027132045.GA30198-QOHinCyTyHu/4bX3TIDHR/XAX3CI6PSWQQ4Iyu8u01E@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Gordeev @ 2014-10-27 13:20 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: Tejun Heo, linux-sunxi, linux-ide

On Thu, Oct 23, 2014 at 05:49:30PM +0100, Marc Zyngier wrote:
> Commit 18dcf433f3de (AHCI: Optimize single IRQ interrupt processing)
> switched the single IRQ case of the AHCI driver to use threaded
> threaded interrupts.
> 
> During this conversion, only the IRQF_SHARED flag was provided. The net
> effect of this in the presence of level interrupts is that the
> interrupt will not be masked during the execution of the treaded
> handler, leading to a screaming interrupt if the thread is not
> scheduled quickly enough, specially in error conditions:

[...]

> Not good. The culprit is a missing IRQF_ONESHOT flag, which addition
> solves the problem entierly. The number of interrupts drops radically:

I worried how many devices hanging off the same IRQ line in legacy mode
would fail to initialize after this update due to IRQF_ONESHOT mismatch.

Given that I did not observe nor anticipate this kind of problem and
LKP test shows a perf drop I am thinking may be we need to revert 18dcf43
for now.

Tejun?

> [Booting Debian Jessie to a prompt]
> Before fix:
>  88:       3562          0       GIC  88  ahci-sunxi
> After fix:
>  88:       1992          0       GIC  88  ahci-sunxi
> 
> Tested on a A20 board (ahci-sunxi).
> 
> Cc: Alexander Gordeev <agordeev@redhat.com>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: linux-ide@vger.kernel.org
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  drivers/ata/libahci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
> index 5eb61c9..49c649f 100644
> --- a/drivers/ata/libahci.c
> +++ b/drivers/ata/libahci.c
> @@ -2492,7 +2492,7 @@ static int ahci_host_activate_single_irq(struct ata_host *host, int irq,
>  		return rc;
>  
>  	rc = devm_request_threaded_irq(host->dev, irq, ahci_single_irq_intr,
> -				       ahci_thread_fn, IRQF_SHARED,
> +				       ahci_thread_fn, IRQF_SHARED | IRQF_ONESHOT,
>  				       dev_driver_string(host->dev), host);
>  	if (rc)
>  		return rc;
> -- 
> 2.0.4
> 

-- 
Regards,
Alexander Gordeev
agordeev@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH libata/for-3.18-fixes] Revert "AHCI: Optimize single IRQ interrupt processing"
       [not found]   ` <20141027132045.GA30198-QOHinCyTyHu/4bX3TIDHR/XAX3CI6PSWQQ4Iyu8u01E@public.gmane.org>
@ 2014-10-27 13:58     ` Tejun Heo
       [not found]       ` <20141027135802.GI4436-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Tejun Heo @ 2014-10-27 13:58 UTC (permalink / raw)
  To: Alexander Gordeev
  Cc: Marc Zyngier, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-ide-u79uwXL29TY76Z2rM5mHXA

>From 61e268068c92ed000f078dc1ab71d1228439fecd Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Date: Mon, 27 Oct 2014 09:50:36 -0400

This reverts commit 18dcf433f3ded61eb140a55e7048ec2fef79e723.
IRQF_ONESHOT was missing from the conversion causing screaming
interrupts problems on some setups and LKP detected measureable drop
in IO performance.  It looks like we'll first need to drop the
threaded IRQ handling first before splitting locking.

Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Alexander Gordeev <agordeev-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Reported-by: kernel test robot <fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reported-by: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>
Link: http://lkml.kernel.org/g/20141027021651.GF27038-PVvIA+FzE60D0+JXs3kMbRL4W9x8LtSr@public.gmane.org
Link: http://lkml.kernel.org/g/1414082970-20775-1-git-send-email-marc.zyngier-5wv7dgnIgG8@public.gmane.org
---
 drivers/ata/libahci.c | 74 +++++++++------------------------------------------
 1 file changed, 13 insertions(+), 61 deletions(-)

diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 5eb61c9..5b0cccc 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1778,16 +1778,15 @@ static void ahci_handle_port_interrupt(struct ata_port *ap,
 	}
 }
 
-static void ahci_update_intr_status(struct ata_port *ap)
+static void ahci_port_intr(struct ata_port *ap)
 {
 	void __iomem *port_mmio = ahci_port_base(ap);
-	struct ahci_port_priv *pp = ap->private_data;
 	u32 status;
 
 	status = readl(port_mmio + PORT_IRQ_STAT);
 	writel(status, port_mmio + PORT_IRQ_STAT);
 
-	atomic_or(status, &pp->intr_status);
+	ahci_handle_port_interrupt(ap, port_mmio, status);
 }
 
 static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance)
@@ -1808,34 +1807,6 @@ static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance)
 	return IRQ_HANDLED;
 }
 
-irqreturn_t ahci_thread_fn(int irq, void *dev_instance)
-{
-	struct ata_host *host = dev_instance;
-	struct ahci_host_priv *hpriv = host->private_data;
-	u32 irq_masked = hpriv->port_map;
-	unsigned int i;
-
-	for (i = 0; i < host->n_ports; i++) {
-		struct ata_port *ap;
-
-		if (!(irq_masked & (1 << i)))
-			continue;
-
-		ap = host->ports[i];
-		if (ap) {
-			ahci_port_thread_fn(irq, ap);
-			VPRINTK("port %u\n", i);
-		} else {
-			VPRINTK("port %u (no irq)\n", i);
-			if (ata_ratelimit())
-				dev_warn(host->dev,
-					 "interrupt on disabled port %u\n", i);
-		}
-	}
-
-	return IRQ_HANDLED;
-}
-
 static irqreturn_t ahci_multi_irqs_intr(int irq, void *dev_instance)
 {
 	struct ata_port *ap = dev_instance;
@@ -1883,7 +1854,7 @@ static irqreturn_t ahci_single_irq_intr(int irq, void *dev_instance)
 
 		ap = host->ports[i];
 		if (ap) {
-			ahci_update_intr_status(ap);
+			ahci_port_intr(ap);
 			VPRINTK("port %u\n", i);
 		} else {
 			VPRINTK("port %u (no irq)\n", i);
@@ -1908,7 +1879,7 @@ static irqreturn_t ahci_single_irq_intr(int irq, void *dev_instance)
 
 	VPRINTK("EXIT\n");
 
-	return handled ? IRQ_WAKE_THREAD : IRQ_NONE;
+	return IRQ_RETVAL(handled);
 }
 
 unsigned int ahci_qc_issue(struct ata_queued_cmd *qc)
@@ -2320,8 +2291,13 @@ static int ahci_port_start(struct ata_port *ap)
 	 */
 	pp->intr_mask = DEF_PORT_IRQ;
 
-	spin_lock_init(&pp->lock);
-	ap->lock = &pp->lock;
+	/*
+	 * Switch to per-port locking in case each port has its own MSI vector.
+	 */
+	if ((hpriv->flags & AHCI_HFLAG_MULTI_MSI)) {
+		spin_lock_init(&pp->lock);
+		ap->lock = &pp->lock;
+	}
 
 	ap->private_data = pp;
 
@@ -2482,31 +2458,6 @@ out_free_irqs:
 	return rc;
 }
 
-static int ahci_host_activate_single_irq(struct ata_host *host, int irq,
-					 struct scsi_host_template *sht)
-{
-	int i, rc;
-
-	rc = ata_host_start(host);
-	if (rc)
-		return rc;
-
-	rc = devm_request_threaded_irq(host->dev, irq, ahci_single_irq_intr,
-				       ahci_thread_fn, IRQF_SHARED,
-				       dev_driver_string(host->dev), host);
-	if (rc)
-		return rc;
-
-	for (i = 0; i < host->n_ports; i++)
-		ata_port_desc(host->ports[i], "irq %d", irq);
-
-	rc = ata_host_register(host, sht);
-	if (rc)
-		devm_free_irq(host->dev, irq, host);
-
-	return rc;
-}
-
 /**
  *	ahci_host_activate - start AHCI host, request IRQs and register it
  *	@host: target ATA host
@@ -2532,7 +2483,8 @@ int ahci_host_activate(struct ata_host *host, int irq,
 	if (hpriv->flags & AHCI_HFLAG_MULTI_MSI)
 		rc = ahci_host_activate_multi_irqs(host, irq, sht);
 	else
-		rc = ahci_host_activate_single_irq(host, irq, sht);
+		rc = ata_host_activate(host, irq, ahci_single_irq_intr,
+				       IRQF_SHARED, sht);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(ahci_host_activate);
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH libata/for-3.18-fixes] Revert "AHCI: Optimize single IRQ interrupt processing"
       [not found]           ` <20141027160546.GB30198-QOHinCyTyHu/4bX3TIDHR/XAX3CI6PSWQQ4Iyu8u01E@public.gmane.org>
@ 2014-10-27 16:03             ` Tejun Heo
  0 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2014-10-27 16:03 UTC (permalink / raw)
  To: Alexander Gordeev
  Cc: Marc Zyngier, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-ide-u79uwXL29TY76Z2rM5mHXA

On Mon, Oct 27, 2014 at 04:05:47PM +0000, Alexander Gordeev wrote:
> On Mon, Oct 27, 2014 at 09:58:02AM -0400, Tejun Heo wrote:
> > From 61e268068c92ed000f078dc1ab71d1228439fecd Mon Sep 17 00:00:00 2001
> > From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > Date: Mon, 27 Oct 2014 09:50:36 -0400
> > 
> > This reverts commit 18dcf433f3ded61eb140a55e7048ec2fef79e723.
> > IRQF_ONESHOT was missing from the conversion causing screaming
> > interrupts problems on some setups and LKP detected measureable drop
> > in IO performance.  It looks like we'll first need to drop the
> > threaded IRQ handling first before splitting locking.
> 
> Tejun,
> 
> Sorry for missing to mention - I think it is better to revert 33fb0d0
> ("AHCI: Do not acquire ata_host::lock from single IRQ handler") first,
> unless you examined it is fine to leave (I did not).

Alright, redid the revert and rebased the tree.  Can you please take a
look at libata/for-3.18-fixes and see whether it looks okay?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH libata/for-3.18-fixes] Revert "AHCI: Optimize single IRQ interrupt processing"
       [not found]       ` <20141027135802.GI4436-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
@ 2014-10-27 16:05         ` Alexander Gordeev
       [not found]           ` <20141027160546.GB30198-QOHinCyTyHu/4bX3TIDHR/XAX3CI6PSWQQ4Iyu8u01E@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Gordeev @ 2014-10-27 16:05 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Marc Zyngier, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-ide-u79uwXL29TY76Z2rM5mHXA

On Mon, Oct 27, 2014 at 09:58:02AM -0400, Tejun Heo wrote:
> From 61e268068c92ed000f078dc1ab71d1228439fecd Mon Sep 17 00:00:00 2001
> From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Date: Mon, 27 Oct 2014 09:50:36 -0400
> 
> This reverts commit 18dcf433f3ded61eb140a55e7048ec2fef79e723.
> IRQF_ONESHOT was missing from the conversion causing screaming
> interrupts problems on some setups and LKP detected measureable drop
> in IO performance.  It looks like we'll first need to drop the
> threaded IRQ handling first before splitting locking.

Tejun,

Sorry for missing to mention - I think it is better to revert 33fb0d0
("AHCI: Do not acquire ata_host::lock from single IRQ handler") first,
unless you examined it is fine to leave (I did not).

Thanks!

-- 
Regards,
Alexander Gordeev
agordeev-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] AHCI: Fix threaded interrupt setup
  2014-11-13  9:44 [PATCH resend regression?] AHCI: Fix threaded interrupt setup Hans de Goede
@ 2014-11-13  9:44 ` Hans de Goede
  0 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2014-11-13  9:44 UTC (permalink / raw)
  To: Tejun Heo, Marc Zyngier; +Cc: linux-ide, Alexander Gordeev

From: Marc Zyngier <marc.zyngier@arm.com>

Commit 18dcf433f3de (AHCI: Optimize single IRQ interrupt processing)
switched the single IRQ case of the AHCI driver to use threaded
threaded interrupts.

During this conversion, only the IRQF_SHARED flag was provided. The net
effect of this in the presence of level interrupts is that the
interrupt will not be masked during the execution of the treaded
handler, leading to a screaming interrupt if the thread is not
scheduled quickly enough, specially in error conditions:

[    2.728051] ahci-sunxi 1c18000.sata: controller can't do PMP, turning off CAP_PMP
[    2.735578] ahci-sunxi 1c18000.sata: SSS flag set, parallel bus scan disabled
[    2.742792] ahci-sunxi 1c18000.sata: AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl platform mode
[    2.751789] ahci-sunxi 1c18000.sata: flags: ncq sntf stag pm led clo only pio slum part ccc
[    2.761539] scsi host0: ahci_platform
[    2.765754] ata1: SATA max UDMA/133 mmio [mem 0x01c18000-0x01c18fff] port 0x100 irq 88
[...]
[    3.127977] ata1: SATA link down (SStatus 0 SControl 300)
[...]
[    3.162035] Waiting for root device /dev/sda1...
[    3.163700] random: nonblocking pool is initialized
[    3.326593] irq 88: nobody cared (try booting with the "irqpoll" option)
[    3.333296] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-rc1+ #3077
[    3.339936] [<c002b318>] (unwind_backtrace) from [<c0026980>] (show_stack+0x20/0x24)
[    3.347681] [<c0026980>] (show_stack) from [<c067dd18>] (dump_stack+0x9c/0xd4)
[    3.354904] [<c067dd18>] (dump_stack) from [<c007ac08>] (__report_bad_irq+0x38/0xd4)
[    3.362643] [<c007ac08>] (__report_bad_irq) from [<c007b1dc>] (note_interrupt+0x280/0x2d0)
[    3.370903] [<c007b1dc>] (note_interrupt) from [<c0078a70>] (handle_irq_event_percpu+0x210/0x27c)
[    3.379771] [<c0078a70>] (handle_irq_event_percpu) from [<c0078b28>] (handle_irq_event+0x4c/0x6c)
[    3.388636] [<c0078b28>] (handle_irq_event) from [<c007b860>] (handle_fasteoi_irq+0xbc/0x1a0)
[    3.397156] [<c007b860>] (handle_fasteoi_irq) from [<c0077f5c>] (generic_handle_irq+0x3c/0x4c)
[    3.405764] [<c0077f5c>] (generic_handle_irq) from [<c0078220>] (__handle_domain_irq+0x6c/0xb4)
[    3.414456] [<c0078220>] (__handle_domain_irq) from [<c0008754>] (gic_handle_irq+0x34/0x6c)
[    3.422802] [<c0008754>] (gic_handle_irq) from [<c0027540>] (__irq_svc+0x40/0x74)
[    3.430274] Exception stack(0xc09c1df8 to 0xc09c1e40)
[    3.435321] 1de0:                                                       00000001 c0a27ec0
[    3.443491] 1e00: 00000000 00000000 c09c0028 0000001e 00000282 00000000 ee00c400 c0a239f8
[    3.451660] 1e20: c09c0000 c09c1ea4 c0a27ec0 c09c1e40 00200000 c003c7cc 20000113 ffffffff
[    3.459835] [<c0027540>] (__irq_svc) from [<c003c7cc>] (__do_softirq+0xbc/0x34c)
[    3.467229] [<c003c7cc>] (__do_softirq) from [<c003cd44>] (irq_exit+0xbc/0x104)
[    3.474536] [<c003cd44>] (irq_exit) from [<c0078224>] (__handle_domain_irq+0x70/0xb4)
[    3.482362] [<c0078224>] (__handle_domain_irq) from [<c0008754>] (gic_handle_x74)
[    3.498169] Exception stack(0xc09c1f10 to 0xc09c1f58)
[    3.503216] 1f00:                                     ee7ca310 00000000 00000ab4 c0035560
[    3.511386] 1f20: c09c0000 00000000 c0a23f84 c09c8474 c09c84bc c09c0000 c0688bf8 c09c1f64
[    3.519554] 1f40: c09c1f68 c09c1f58 c00235d8 c00235dc 60000113 ffffffff
[    3.526165] [<c0027540>] (__irq_svc) from [<c00235dc>] (arch_cpu_idle+0x48/0x4c)
[    3.533557] [<c00235dc>] (arch_cpu_idle) from [<c00701fc>] (cpu_startup_entry+0x13c/0x27c)
[    3.541816] [<c00701fc>] (cpu_startup_entry) from [<c067af1c>] (rest_init+0x94/0x98)
[    3.549557] [<c067af1c>] (rest_init) from [<c093dd38>] (start_kernel+0x3f0/0x3fc)
[    3.557036] [<c093dd38>] (start_kernel) from [<40008084>] (0x40008084)
[    3.563555] handlers:
[    3.565830] [<c03a1a80>] ahci_single_irq_intr threaded [<c03a223c>] ahci_thread_fn
[    3.573415] Disabling IRQ #88
[    3.576532] ata1: exception Emask 0x10 SAct 0x0 SErr 0x4050002 action 0xe frozen
[    3.583977] ata1: irq_stat 0x00400040, connection status changed
[    3.590006] ata1: SError: { RecovComm PHYRdyChg CommWake DevExch }
[    3.596209] ata1: hard resetting link
[...]

Not good. The culprit is a missing IRQF_ONESHOT flag, which addition
solves the problem entierly. The number of interrupts drops radically:

[Booting Debian Jessie to a prompt]
Before fix:
 88:       3562          0       GIC  88  ahci-sunxi
After fix:
 88:       1992          0       GIC  88  ahci-sunxi

Tested on a A20 board (ahci-sunxi).

Cc: Alexander Gordeev <agordeev@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/ata/libahci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 5eb61c9..49c649f 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -2492,7 +2492,7 @@ static int ahci_host_activate_single_irq(struct ata_host *host, int irq,
 		return rc;
 
 	rc = devm_request_threaded_irq(host->dev, irq, ahci_single_irq_intr,
-				       ahci_thread_fn, IRQF_SHARED,
+				       ahci_thread_fn, IRQF_SHARED | IRQF_ONESHOT,
 				       dev_driver_string(host->dev), host);
 	if (rc)
 		return rc;
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-11-13  9:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-23 16:49 [PATCH] AHCI: Fix threaded interrupt setup Marc Zyngier
2014-10-27 13:20 ` Alexander Gordeev
     [not found]   ` <20141027132045.GA30198-QOHinCyTyHu/4bX3TIDHR/XAX3CI6PSWQQ4Iyu8u01E@public.gmane.org>
2014-10-27 13:58     ` [PATCH libata/for-3.18-fixes] Revert "AHCI: Optimize single IRQ interrupt processing" Tejun Heo
     [not found]       ` <20141027135802.GI4436-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-10-27 16:05         ` Alexander Gordeev
     [not found]           ` <20141027160546.GB30198-QOHinCyTyHu/4bX3TIDHR/XAX3CI6PSWQQ4Iyu8u01E@public.gmane.org>
2014-10-27 16:03             ` Tejun Heo
  -- strict thread matches above, loose matches on Subject: below --
2014-11-13  9:44 [PATCH resend regression?] AHCI: Fix threaded interrupt setup Hans de Goede
2014-11-13  9:44 ` [PATCH] " Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).