From: Marc Zyngier <marc.zyngier@arm.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Jason Cooper <jason@lakedaemon.net>,
Russell King <linux@arm.linux.org.uk>
Cc: <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/4] arm: kexec: Deactivate in-flight interrupts
Date: Mon, 16 Nov 2015 19:13:25 +0000 [thread overview]
Message-ID: <1447701208-18150-2-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1447701208-18150-1-git-send-email-marc.zyngier@arm.com>
machine_kexec_mask_interrupts iterates over the system interrupts
and tries to mask all interrupts, including those that are currently
being handled.
The current method includes finding out if an interrupt is in progress,
and call the EOI method if that's the case. This methods has a few
issues when used with the GIC:
- In a hypothetical GIC centric world where we can handle
interrupts at different priorities, nothing guarantees that
we're going to EOI the interrupts in the mandated reverse order
we have taken them.
- With the split EOI/Deactivate mode the GIC runs in when using
virtualization, an interrupt can be EOIed, and still be active.
The current code would not recognize that state (the interrupt
is not flagged as being in progress from a host PoV).
A sensible way of avoiding these issues is to forcefully deactivate
the interrupt at the distributor level, and to only use EOI if
the deactivation has failed (which probably means that the irqchip
is not a GIC).
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/kernel/machine_kexec.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 8bf3b7c..66662e6 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -8,6 +8,7 @@
#include <linux/reboot.h>
#include <linux/io.h>
#include <linux/irq.h>
+#include <linux/interrupt.h>
#include <linux/memblock.h>
#include <asm/pgtable.h>
#include <linux/of_fdt.h>
@@ -98,12 +99,20 @@ static void machine_kexec_mask_interrupts(void)
for_each_irq_desc(i, desc) {
struct irq_chip *chip;
+ int ret;
chip = irq_desc_get_chip(desc);
if (!chip)
continue;
- if (chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
+ /*
+ * First try to remove the active state. If this
+ * fails, try to EOI the interrupt.
+ */
+ ret = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false);
+
+ if (ret && irqd_irq_inprogress(&desc->irq_data) &&
+ chip->irq_eoi)
chip->irq_eoi(&desc->irq_data);
if (chip->irq_mask)
--
2.1.4
next prev parent reply other threads:[~2015-11-16 19:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-16 19:13 [PATCH 0/4] irqchip/gic: Deal with the active state across kexec and suspend/resume Marc Zyngier
2015-11-16 19:13 ` Marc Zyngier [this message]
2015-11-16 19:13 ` [PATCH 2/4] irqchip/gic: Make sure all interrupts are deactivated at boot Marc Zyngier
2015-11-17 13:30 ` [tip:irq/urgent] " tip-bot for Marc Zyngier
2015-11-16 19:13 ` [PATCH 3/4] irqchip/gic: Clear enable bits before restoring them Marc Zyngier
2015-11-17 13:30 ` [tip:irq/urgent] " tip-bot for Marc Zyngier
2015-11-16 19:13 ` [PATCH 4/4] irqchip/gic: Add save/restore of the active state Marc Zyngier
2015-11-17 13:31 ` [tip:irq/urgent] irqchip/gic: Add save/ restore " tip-bot for Marc Zyngier
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=1447701208-18150-2-git-send-email-marc.zyngier@arm.com \
--to=marc.zyngier@arm.com \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--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
all inboxes | Powered by JetHome®