Skip to content

Commit c25349f

Browse files
Julien Thierryctmarinas
authored andcommitted
arm64: Skip irqflags tracing for NMI in IRQs disabled context
When an NMI is raised while interrupts where disabled, the IRQ tracing already is in the correct state (i.e. hardirqs_off) and should be left as such when returning to the interrupted context. Check whether PMR was masking interrupts when the NMI was raised and skip IRQ tracing if necessary. 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>
1 parent 1234ad6 commit c25349f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

arch/arm64/kernel/entry.S

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,18 @@ el1_irq:
617617
kernel_entry 1
618618
enable_da_f
619619
#ifdef CONFIG_TRACE_IRQFLAGS
620+
#ifdef CONFIG_ARM64_PSEUDO_NMI
621+
alternative_if ARM64_HAS_IRQ_PRIO_MASKING
622+
ldr x20, [sp, #S_PMR_SAVE]
623+
alternative_else
624+
mov x20, #GIC_PRIO_IRQON
625+
alternative_endif
626+
cmp x20, #GIC_PRIO_IRQOFF
627+
/* Irqs were disabled, don't trace */
628+
b.ls 1f
629+
#endif
620630
bl trace_hardirqs_off
631+
1:
621632
#endif
622633

623634
irq_handler
@@ -637,8 +648,18 @@ alternative_else_nop_endif
637648
1:
638649
#endif
639650
#ifdef CONFIG_TRACE_IRQFLAGS
651+
#ifdef CONFIG_ARM64_PSEUDO_NMI
652+
/*
653+
* if IRQs were disabled when we received the interrupt, we have an NMI
654+
* and we are not re-enabling interrupt upon eret. Skip tracing.
655+
*/
656+
cmp x20, #GIC_PRIO_IRQOFF
657+
b.ls 1f
658+
#endif
640659
bl trace_hardirqs_on
660+
1:
641661
#endif
662+
642663
kernel_exit 1
643664
ENDPROC(el1_irq)
644665

0 commit comments

Comments
 (0)