Commit 2117a37e authored by Mark Brown's avatar Mark Brown Committed by Jie Liu
Browse files

arm64/entry: Don't call preempt_schedule_irq() with NMIs masked

kunpeng inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I90N2C
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc.git/commit/?h=arm64-nmi&id=6465ab3af5ccc2122dc468ed4c7e9c66864c9f6f



----------------------------------------------------------------------

As we do for pseudo NMIs don't call preempt_schedule_irq() when
architechted NMIs are masked. If they are masked then we are calling from
a preempting context so skip preemption.

Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarJie Liu <liujie375@h-partners.com>
parent dd8b74f0
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -246,6 +246,15 @@ static void __sched arm64_preempt_schedule_irq(void)
	if (READ_ONCE(current_thread_info()->preempt_count) != 0)
		return;

	/*
	 * Architected NMIs are unmasked prior to handling regular
	 * IRQs and masked while handling FIQs. If ALLINT is set then
	 * we are in a NMI or other preempting context so skip
	 * preemption.
	 */
	if (system_uses_nmi() && (read_sysreg_s(SYS_ALLINT) & ALLINT_ALLINT))
		return;

	/*
	 * DAIF.DA are cleared at the start of IRQ/FIQ handling, and when GIC
	 * priority masking is used the GIC irqchip driver will clear DAIF.IF