public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: adharmap@codeaurora.org
To: tglx@linutronix.de
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-msm-owner@vger.kernel.org,
	Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Subject: [RFC IRQ] genirq: fix handle_nested_irq for lazy disable
Date: Tue, 26 Oct 2010 18:50:09 -0700	[thread overview]
Message-ID: <1288144209-28086-1-git-send-email-adharmap@codeaurora.org> (raw)

From: Abhijeet Dharmapurikar <adharmap@codeaurora.org>

When lazy disabling is implemented and an interrupt is disabled the
genirq code ends up marking it as IRQ_DISABLED in the descriptor.
The interrupt stays enabled in the controller.  If the interrupt
fires after disabling, the flow handlers namely handle_level_irq and
handle_edge_irq mask the interrupt in the controller.

This is not the case with handle_nested_irq. The interrupt stays enabled in
the controller and if it were a level interrupt it keeps firing only to be
ignored by handle_nested_irq.

Update handle_nested_irq to mask such an interrupt.

Change-Id: Id0fa3280c49a36aa8b8db1d5cc20472bf5e53c5f
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
---
 This problem shows up on my hardware because the interrupt controller is
 over a slow bus and it doesnt deactivate the interrupt line to the processor
 until an ack or mask operation is carried out for each of its active
 interrupts.

 I could have updated the interrupt controller thread itself to check if the
 interrupt is marked IRQ_DISABLED but didn't seem right to take the
 desc->lock in there. Instead updating handle_nested_irq to handle this
 seemed like the right thing to do.

 kernel/irq/chip.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index baa5c4a..35ccc41 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -419,6 +419,7 @@ void handle_nested_irq(unsigned int irq)
 {
 	struct irq_desc *desc = irq_to_desc(irq);
 	struct irqaction *action;
+	int mask_this_irq = 0;
 	irqreturn_t action_ret;
 
 	might_sleep();
@@ -428,8 +429,10 @@ void handle_nested_irq(unsigned int irq)
 	kstat_incr_irqs_this_cpu(irq, desc);
 
 	action = desc->action;
-	if (unlikely(!action || (desc->status & IRQ_DISABLED)))
+	if (unlikely(!action || (desc->status & IRQ_DISABLED))) {
+		mask_this_irq = 1;
 		goto out_unlock;
+	}
 
 	desc->status |= IRQ_INPROGRESS;
 	raw_spin_unlock_irq(&desc->lock);
@@ -443,6 +446,11 @@ void handle_nested_irq(unsigned int irq)
 
 out_unlock:
 	raw_spin_unlock_irq(&desc->lock);
+	if (unlikely(mask_this_irq)) {
+		chip_bus_lock(irq, desc);
+		desc->chip->mask(irq);
+		chip_bus_sync_unlock(irq, desc);
+	}
 }
 EXPORT_SYMBOL_GPL(handle_nested_irq);
 
-- 
1.7.1
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.


             reply	other threads:[~2010-10-27  1:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27  1:50 adharmap [this message]
2010-10-27  8:01 ` [RFC IRQ] genirq: fix handle_nested_irq for lazy disable Thomas Gleixner
2010-10-28 17:22   ` Abhijeet Dharmapurikar
2010-10-28 18:52     ` Thomas Gleixner
2010-10-29  0:04       ` Abhijeet Dharmapurikar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1288144209-28086-1-git-send-email-adharmap@codeaurora.org \
    --to=adharmap@codeaurora.org \
    --cc=hpa@zytor.com \
    --cc=linux-arm-msm-owner@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox