linux/arch/arm64/kernel
Julien Thierry 17ce302f31 arm64: Fix interrupt tracing in the presence of NMIs
In the presence of any form of instrumentation, nmi_enter() should be
done before calling any traceable code and any instrumentation code.

Currently, nmi_enter() is done in handle_domain_nmi(), which is much
too late as instrumentation code might get called before. Move the
nmi_enter/exit() calls to the arch IRQ vector handler.

On arm64, it is not possible to know if the IRQ vector handler was
called because of an NMI before acknowledging the interrupt. However, It
is possible to know whether normal interrupts could be taken in the
interrupted context (i.e. if taking an NMI in that context could
introduce a potential race condition).

When interrupting a context with IRQs disabled, call nmi_enter() as soon
as possible. In contexts with IRQs enabled, defer this to the interrupt
controller, which is in a better position to know if an interrupt taken
is an NMI.

Fixes: bc3c03ccb4 ("arm64: Enable the support of pseudo-NMIs")
Cc: <stable@vger.kernel.org> # 5.1.x-
Cc: Will Deacon <will.deacon@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Julien Thierry <julien.thierry@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2019-06-21 15:49:58 +01:00
..
probes treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
vdso arm64: vdso: Explicitly add build-id option 2019-05-16 11:45:36 +01:00
.gitignore
acpi_numa.c acpi: Create subtable parsing infrastructure 2019-04-04 18:41:12 +02:00
acpi_parking_protocol.c
acpi.c arm64: KVM/mm: Move SEA handling behind a single 'claim' interface 2019-02-07 23:10:45 +01:00
alternative.c arm64: alternative: Apply alternatives early in boot process 2019-02-06 10:05:20 +00:00
armv8_deprecated.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
asm-offsets.c * ARM: support for SVE and Pointer Authentication in guests, PMU improvements 2019-05-17 10:33:30 -07:00
cacheinfo.c arm64/mm: Correct the cache line size warning with non coherent device 2019-06-17 11:52:47 +01:00
cpu_errata.c arm64: Handle erratum 1418040 as a superset of erratum 1188873 2019-05-23 15:40:30 +01:00
cpu_ops.c arm64: cpu_ops: fix a leaked reference by adding missing of_node_put 2019-04-03 13:50:35 +01:00
cpu-reset.h arm64: kexec: always reset to EL2 if present 2018-07-04 18:34:24 +01:00
cpu-reset.S arm64: kexec_file: invoke the kernel without purgatory 2018-12-06 14:38:53 +00:00
cpufeature.c arm64/cpufeature: Convert hook_lock to raw_spin_lock_t in cpu_enable_ssbs() 2019-06-04 14:48:26 +01:00
cpuidle.c ARM64 / cpuidle: Use new cpuidle macro for entering retention state 2018-01-02 13:50:34 +00:00
cpuinfo.c arm64: Expose SVE2 features for userspace 2019-04-23 18:02:00 +01:00
crash_core.c arm64: kernel: arch_crash_save_vmcoreinfo() should depend on CONFIG_CRASH_CORE 2018-09-11 11:08:49 +01:00
crash_dump.c arm64: kdump: fix small typo 2018-11-02 17:24:17 +00:00
debug-monitors.c arm64: Clear OSDLR_EL1 on CPU boot 2019-04-09 12:38:31 +01:00
efi-entry.S arm64: Add software workaround for Falkor erratum 1041 2018-02-06 22:53:13 +00:00
efi-header.S
efi-rt-wrapper.S efi/arm64: Check whether x18 is preserved by runtime services calls 2018-03-09 08:58:22 +01:00
efi.c efi/arm64: Check whether x18 is preserved by runtime services calls 2018-03-09 08:58:22 +01:00
entry-fpsimd.S arm64/sve: Write ZCR_EL1 on context switch only if changed 2018-05-17 18:19:53 +01:00
entry-ftrace.S arm64: frace: use asm EXPORT_SYMBOL() 2018-12-10 11:50:12 +00:00
entry.S arm64: Fix interrupt tracing in the presence of NMIs 2019-06-21 15:49:58 +01:00
fpsimd.c arm64/fpsimd: Don't disable softirq when touching FPSIMD/SVE state 2019-06-04 13:17:37 +01:00
ftrace.c arm64/module: ftrace: deal with place relative nature of PLTs 2019-04-23 13:35:00 +01:00
head.S arm64: Fix size of __early_cpu_boot_status 2019-05-01 14:39:26 +01:00
hibernate-asm.S arm64: mm: Offset TTBR1 to allow 52-bit PTRS_PER_PGD 2018-12-10 18:42:17 +00:00
hibernate.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
hw_breakpoint.c perf/arch/arm64: Implement hw_breakpoint_arch_parse() 2018-06-26 09:07:56 +02:00
hyp-stub.S arm64: hyp-stub: Forbid kprobing of the hyp-stub 2019-02-01 14:10:01 +00:00
image.h Merge branch 'for-next/kexec' into aarch64/for-next/core 2018-12-10 18:57:17 +00:00
insn.c bpf, arm64: use more scalable stadd over ldxr / stxr loop in xadd 2019-04-26 18:53:40 -07:00
io.c arm64: Avoid aligning normal memory pointers in __memcpy_{to,from}io 2017-10-24 16:23:07 +01:00
irq.c arm64: Fix interrupt tracing in the presence of NMIs 2019-06-21 15:49:58 +01:00
jump_label.c jump_label: move 'asm goto' support test to Kconfig 2019-01-06 09:46:51 +09:00
kaslr.c arm64/kernel: kaslr: reduce module randomization range to 2 GB 2019-05-23 11:38:11 +01:00
kexec_image.c arm64: kexec_file: forbid kdump via kexec_file_load() 2018-12-07 15:28:21 +00:00
kgdb.c arm64: debug: Remove redundant user_mode(regs) checks from debug handlers 2019-04-09 11:21:13 +01:00
kuser32.S arm64: compat: Add KUSER_HELPERS config option 2019-04-23 18:01:58 +01:00
machine_kexec_file.c arm64: kexec_file: handle empty command-line 2019-02-05 09:34:49 +00:00
machine_kexec.c arm64: kdump: no need to mark crashkernel pages manually PG_reserved 2019-03-05 21:07:19 -08:00
Makefile arm64: compat: Add KUSER_HELPERS config option 2019-04-23 18:01:58 +01:00
module-plts.c arm64/module: switch to ADRP/ADD sequences for PLT entries 2018-11-27 19:00:45 +00:00
module.c arm64/module: revert to unsigned interpretation of ABS16/32 relocations 2019-05-28 15:15:53 +01:00
module.lds arm64: ftrace: emit ftrace-mod.o contents through code 2017-12-01 13:04:59 +00:00
paravirt.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
pci.c arm64: PCI: Remove node-local allocations when initialising host controller 2018-09-17 16:33:23 -05:00
perf_callchain.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
perf_event.c * ARM: support for SVE and Pointer Authentication in guests, PMU improvements 2019-05-17 10:33:30 -07:00
perf_regs.c compat: Move compat_timespec/ timeval to compat_time.h 2018-04-19 13:29:54 +02:00
pointer_auth.c arm64: ptr auth: Move per-thread keys from thread_info to thread_struct 2018-12-13 16:42:47 +00:00
process.c arm64: Unmask PMR before going idle 2019-02-06 10:05:18 +00:00
psci.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
ptrace.c arm64: ptrace: add support for syscall emulation 2019-06-05 17:51:24 +01:00
reloc_test_core.c arm64: fix undefined reference to 'printk' 2018-03-19 18:14:25 +00:00
reloc_test_syms.S arm64: fix undefined reference to 'printk' 2018-03-19 18:14:25 +00:00
relocate_kernel.S arm64: kexec_file: invoke the kernel without purgatory 2018-12-06 14:38:53 +00:00
return_address.c arm64: Use ftrace_graph_get_ret_stack() instead of curr_ret_stack 2018-12-22 08:21:02 -05:00
sdei.c arm64: fix wrong check of on_sdei_stack in nmi context 2019-04-04 16:02:25 +01:00
setup.c arm64: replace memblock_alloc_low with memblock_alloc 2019-03-27 18:12:41 +00:00
signal32.c arm64: compat: Alloc separate pages for vectors and sigpage 2019-04-23 18:01:31 +01:00
signal.c arm64: fpsimd: Always set TIF_FOREIGN_FPSTATE on task state flush 2019-03-29 14:41:52 +00:00
sigreturn32.S arm64: compat: Split kuser32 2019-04-23 18:01:57 +01:00
sleep.S arm64: kernel: use aff3 instead of aff2 in comment 2019-06-04 14:51:01 +01:00
smccc-call.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
smp_spin_table.c
smp.c acpi: Create subtable parsing infrastructure 2019-04-04 18:41:12 +02:00
ssbd.c arm64: ssbd: Add support for PSTATE.SSBS rather than trapping to EL3 2018-09-14 17:46:19 +01:00
stacktrace.c arm64/stacktrace: Remove the pointless ULONG_MAX marker 2019-04-14 19:58:29 +02:00
suspend.c arm64: mm: Support Common Not Private translations 2018-09-18 12:02:27 +01:00
sys32.c arm64: use the correct function type for __arm64_sys_ni_syscall 2019-05-29 13:46:00 +01:00
sys_compat.c arm64 fixes for -rc1 2019-01-05 11:28:39 -08:00
sys.c arm64: use the correct function type for __arm64_sys_ni_syscall 2019-05-29 13:46:00 +01:00
syscall.c arm64: errata: Add workaround for Cortex-A76 erratum #1463225 2019-05-23 11:38:10 +01:00
time.c arm64: Use ftrace_graph_get_ret_stack() instead of curr_ret_stack 2018-12-22 08:21:02 -05:00
topology.c arm64: topology: re-introduce numa mask check for scheduler MC selection 2018-07-06 13:18:18 +01:00
trace-events-emulation.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
traps.c signal/arm64: Use force_sig not force_sig_fault for SIGKILL 2019-05-29 11:05:25 +01:00
vdso.c arm64: compat: Add KUSER_HELPERS config option 2019-04-23 18:01:58 +01:00
vmlinux.lds.S arm64: relocatable: fix inconsistencies in linker script and options 2018-12-04 12:48:25 +00:00