public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Marc Zyngier <marc.zyngier@arm.com>
Subject: [PATCH] genirq: Consider domain hierarchy when checking for IRQCHIP_ONESHOT_SAFE
Date: Fri, 3 Aug 2018 21:27:21 +0200	[thread overview]
Message-ID: <a0407813-dbc3-4d4a-4feb-2c4865dfd4f5@gmail.com> (raw)

In case of a domain hierarchy we may miss the IRQCHIP_ONESHOT_SAFE
flag because we look at top of the stack only. See also discussion
here: https://marc.info/?l=linux-kernel&m=153301773524685&w=2

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
Uups, PATCH tag was missing.
---
 kernel/irq/manage.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index a66c58f9..1a28f068 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1156,6 +1156,16 @@ setup_irq_thread(struct irqaction *new, unsigned int irq, bool secondary)
 	return 0;
 }
 
+static bool irq_data_oneshot_safe(struct irq_data *data)
+{
+#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
+	/* check topmost irq_chip only */
+	while (data->parent_data)
+		data = data->parent_data;
+#endif
+	return !!(data->chip->flags & IRQCHIP_ONESHOT_SAFE);
+}
+
 /*
  * Internal function to register an irqaction - typically used to
  * allocate special interrupts that are part of the architecture.
@@ -1243,7 +1253,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
 	 * chip flags, so we can avoid the unmask dance at the end of
 	 * the threaded handler for those.
 	 */
-	if (desc->irq_data.chip->flags & IRQCHIP_ONESHOT_SAFE)
+	if (irq_data_oneshot_safe(&desc->irq_data))
 		new->flags &= ~IRQF_ONESHOT;
 
 	/*
-- 
2.18.0


             reply	other threads:[~2018-08-03 19:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03 19:27 Heiner Kallweit [this message]
     [not found] ` <alpine.DEB.2.21.1808032155570.1658@nanos.tec.linutronix.de>
2018-08-03 20:46   ` [PATCH] genirq: Consider domain hierarchy when checking for IRQCHIP_ONESHOT_SAFE Heiner Kallweit
2018-08-03 22:13     ` Thomas Gleixner

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=a0407813-dbc3-4d4a-4feb-2c4865dfd4f5@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --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