]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
irqchip/gic-v3: Workaround inconsistent PMR setting on NMI entry
authorMarc Zyngier <maz@kernel.org>
Thu, 10 Jun 2021 14:13:46 +0000 (15:13 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 13 Aug 2021 07:28:57 +0000 (09:28 +0200)
commitce5ce63d3355e6fcb8ce50797d3e98a93c6e6542
tree25d7b5b5a6da9521b78c86e393b50c8a1c6d2919
parent3d49a257c3891aebd81230f088ef5642bee7a105
irqchip/gic-v3: Workaround inconsistent PMR setting on NMI entry

BugLink: https://bugs.launchpad.net/bugs/1936688
[ Upstream commit 382e6e177bc1c02473e56591fe5083ae1e4904f6 ]

The arm64 entry code suffers from an annoying issue on taking
a NMI, as it sets PMR to a value that actually allows IRQs
to be acknowledged. This is done for consistency with other parts
of the code, and is in the process of being fixed. This shouldn't
be a problem, as we are not enabling interrupts whilst in NMI
context.

However, in the infortunate scenario that we took a spurious NMI
(retired before the read of IAR) *and* that there is an IRQ pending
at the same time, we'll ack the IRQ in NMI context. Too bad.

In order to avoid deadlocks while running something like perf,
teach the GICv3 driver about this situation: if we were in
a context where no interrupt should have fired, transiently
set PMR to a value that only allows NMIs before acking the pending
interrupt, and restore the original value after that.

This papers over the core issue for the time being, and makes
NMIs great again. Sort of.

Fixes: 4d6a38da8e79e94c ("arm64: entry: always set GIC_PRIO_PSR_I_SET during entry")
Co-developed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/lkml/20210610145731.1350460-1-maz@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/irqchip/irq-gic-v3.c