summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/entry.S
diff options
context:
space:
mode:
authorJulien Thierry <julien.thierry@arm.com>2019-01-31 14:59:01 +0000
committerCatalin Marinas <catalin.marinas@arm.com>2019-02-06 10:06:31 +0000
commit1234ad686fb1bde5a9c2447fc4c9df8430358763 (patch)
treea0ccfcd8724cc240966a7b15c12dc9856dc359b9 /arch/arm64/kernel/entry.S
parent7d31464adf20fb8c075a3a3dfe2002a195566510 (diff)
downloadblackbird-op-linux-1234ad686fb1bde5a9c2447fc4c9df8430358763.tar.gz
blackbird-op-linux-1234ad686fb1bde5a9c2447fc4c9df8430358763.zip
arm64: Skip preemption when exiting an NMI
Handling of an NMI should not set any TIF flags. For NMIs received from EL0 the current exit path is safe to use. However, an NMI received at EL1 could have interrupted some task context that has set the TIF_NEED_RESCHED flag. Preempting a task should not happen as a result of an NMI. Skip preemption after handling an NMI from EL1. Signed-off-by: Julien Thierry <julien.thierry@arm.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/entry.S')
-rw-r--r--arch/arm64/kernel/entry.S10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 02f809a5c823..35ed48469506 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -624,7 +624,15 @@ el1_irq:
#ifdef CONFIG_PREEMPT
ldr x24, [tsk, #TSK_TI_PREEMPT] // get preempt count
- cbnz x24, 1f // preempt count != 0
+alternative_if ARM64_HAS_IRQ_PRIO_MASKING
+ /*
+ * DA_F were cleared at start of handling. If anything is set in DAIF,
+ * we come back from an NMI, so skip preemption
+ */
+ mrs x0, daif
+ orr x24, x24, x0
+alternative_else_nop_endif
+ cbnz x24, 1f // preempt count != 0 || NMI return path
bl preempt_schedule_irq // irq en/disable is done inside
1:
#endif
OpenPOWER on IntegriCloud