opnsense-src/sys/amd64/amd64
Mark Johnston 1c29da0279 Reimplement stack capture of running threads on i386 and amd64.
After r355784 the td_oncpu field is no longer synchronized by the thread
lock, so the stack capture interrupt cannot be delievered precisely.
Fix this using a loop which drops the thread lock and restarts if the
wrong thread was sampled from the stack capture interrupt handler.

Change the implementation to use a regular interrupt instead of an NMI.
Now that we drop the thread lock, there is no advantage to the latter.

Simplify the KPIs.  Remove stack_save_td_running() and add a return
value to stack_save_td().  On platforms that do not support stack
capture of running threads, stack_save_td() returns EOPNOTSUPP.  If the
target thread is running in user mode, stack_save_td() returns EBUSY.

Reviewed by:	kib
Reported by:	mjg, pho
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23355
2020-01-31 15:43:33 +00:00
..
apic_vector.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
atpic_vector.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
bios.c sys/amd64: further adoption of SPDX licensing ID tags. 2017-11-27 15:03:07 +00:00
bpf_jit_machdep.c Make UMA and malloc(9) return non-executable memory in most cases. 2018-06-13 17:04:41 +00:00
bpf_jit_machdep.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
copyout.c Port the NetBSD KCSAN runtime to FreeBSD. 2019-11-21 11:22:08 +00:00
cpu_switch.S amd64: move common_tss into pcpu. 2019-11-10 09:28:18 +00:00
db_disasm.c ddb: Add support for disassembling 'crc32' on amd64 2019-10-16 18:27:27 +00:00
db_interface.c amd64: move common_tss into pcpu. 2019-11-10 09:28:18 +00:00
db_trace.c teach db_nextframe/x86 about [X]xen_intr_upcall interrupt handler 2019-11-12 11:00:01 +00:00
efirt_machdep.c Complete the removal of the "wire_count" field from struct vm_page. 2019-09-25 16:11:35 +00:00
efirt_support.S amd64 ef_rt_arch_call: Preserve %rflags around call into EFI RT service. 2019-06-03 15:32:42 +00:00
elf_machdep.c Unbreak build. It seems that mips and amd64 still pull in link_elf.c, so 2019-12-24 16:52:10 +00:00
exception.S amd64: in double fault handler, do not rely on sane gsbase value. 2019-11-20 11:12:19 +00:00
fpu.c vmm: pass M_WAITOK to uma_zalloc when allocating FPU save area 2019-11-08 16:30:55 +00:00
gdb_machdep.c Provide KPI for handling of rw/ro kernel text. 2018-03-20 17:43:50 +00:00
genassym.c amd64: move common_tss into pcpu. 2019-11-10 09:28:18 +00:00
in_cksum.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
initcpu.c Add support for Hygon Dhyana Family 18h processor. 2020-01-21 13:22:35 +00:00
io.c sys/amd64: further adoption of SPDX licensing ID tags. 2017-11-27 15:03:07 +00:00
locore.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
machdep.c Move the mds, irbs, and ssb mitigation knobs into machdep.mitigations. 2019-12-06 02:43:05 +00:00
mem.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
minidump_machdep.c Display the approximate space needed when a minidump fails due to lack 2019-06-30 03:14:04 +00:00
mp_machdep.c amd64: in double fault handler, do not rely on sane gsbase value. 2019-11-20 11:12:19 +00:00
mpboot.S x86: improve reservation of AP trampoline memory 2018-04-05 14:39:51 +00:00
pmap.c sysctl: mark more nodes as MPSAFE 2020-01-06 10:52:13 +00:00
prof_machdep.c Fix high resolution kernel profiling just enough to not crash at boot 2018-06-02 05:48:44 +00:00
ptrace_machdep.c Move most of the contents of opt_compat.h to opt_global.h. 2018-04-06 17:35:35 +00:00
sigtramp.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
support.S amd64: speed up failing case for memcmp 2020-01-30 19:56:22 +00:00
sys_machdep.c amd64: move common_tss into pcpu. 2019-11-10 09:28:18 +00:00
trap.c Reimplement stack capture of running threads on i386 and amd64. 2020-01-31 15:43:33 +00:00
uio_machdep.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
uma_machdep.c Use vm_page_unwire_noq() instead of directly modifying page wire counts. 2018-02-08 19:28:51 +00:00
vm_machdep.c amd64: move pcb out of kstack to struct thread. 2019-10-25 20:09:42 +00:00
xen-locore.S xen: implement early init helper for PVHv2 2018-07-19 08:44:52 +00:00