freebsd-nq/sys/arm/arm
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
..
autoconf.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
bcopy_page.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
bcopyinout_xscale.S Revert r336773: it removed too much. 2018-07-27 21:25:01 +00:00
bcopyinout.S Revert r336773: it removed too much. 2018-07-27 21:25:01 +00:00
blockio.S
bus_space_asm_generic.S
bus_space_base.c
bus_space_generic.c sys/arm: further adoption of SPDX licensing ID tags. 2017-11-27 15:04:10 +00:00
busdma_machdep-v4.c Initialize the bounce pages list in armv[4|6] DMA maps. 2019-12-24 23:43:29 +00:00
busdma_machdep-v6.c uma: reorganize flags 2020-01-09 02:03:03 +00:00
copystr.S Remove unused implementations of copyoutstr(). 2018-04-17 17:20:04 +00:00
cpu_asm-v6.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
cpufunc_asm_arm9.S Remove old CPU_ values from the arm cpufunc code. These have been removed. 2018-07-28 12:00:32 +00:00
cpufunc_asm_arm11x6.S
cpufunc_asm_armv4.S Fix the spelling of armv4_idcache_inv_all in an END macro. 2018-08-14 15:42:27 +00:00
cpufunc_asm_armv5_ec.S Only build the cache handling code we need when building the arm ELF 2018-07-28 12:50:09 +00:00
cpufunc_asm_armv7.S Remove the dead code from ARM cpufunc_* files. 2018-07-18 10:33:07 +00:00
cpufunc_asm_pj4b.S
cpufunc_asm_sheeva.S Only build the cache handling code we need when building the arm ELF 2018-07-28 12:50:09 +00:00
cpufunc_asm.S Remove an old comment now the code it references has been removed. 2018-08-14 15:48:13 +00:00
cpufunc.c Use the cp15 functions to read cp15 registers rather than using assembly 2018-07-28 17:21:34 +00:00
cpuinfo.c Implement mitigation for Spectre version 2 attacks on ARMv7. 2018-01-27 11:19:41 +00:00
db_disasm.c sys/arm: further adoption of SPDX licensing ID tags. 2017-11-27 15:04:10 +00:00
db_interface.c
db_trace.c
debug_monitor.c
disassem.c sys/arm: further adoption of SPDX licensing ID tags. 2017-11-27 15:04:10 +00:00
dump_machdep.c Revert r336773: it removed too much. 2018-07-27 21:25:01 +00:00
elf_machdep.c Add #ifdef option-test wrappers around another call to an arm/unwind.c 2020-01-07 21:13:34 +00:00
elf_note.S
exception.S Revert r336773: it removed too much. 2018-07-27 21:25:01 +00:00
fiq_subr.S
fiq.c sys/arm: further adoption of SPDX licensing ID tags. 2017-11-27 15:04:10 +00:00
fusu.S Provide protection against starvation of the ll/sc loops when accessing userpace. 2019-07-12 18:43:24 +00:00
gdb_machdep.c sys/arm: further adoption of SPDX licensing ID tags. 2017-11-27 15:04:10 +00:00
genassym.c Implement mitigation for Spectre version 2 attacks on ARMv7. 2018-01-27 11:19:41 +00:00
generic_timer.c Only set up the interrupts that will actually be used in arm generic_timer. 2019-04-17 15:27:11 +00:00
gic_acpi.c Add missing ACPI GICv2 MSI/MSI-X attachment 2019-06-28 01:17:33 +00:00
gic_common.h Move common GIC interrupt numbers to the common header. These are the same 2018-06-19 16:14:23 +00:00
gic_fdt.c Remove teh non-INTRNG code from the ARM GIC interrupt controller driver. 2018-07-30 10:55:02 +00:00
gic.c Remove the check that the Arm generic interrupt controller variant is 2018-09-06 17:25:01 +00:00
gic.h Remove teh non-INTRNG code from the ARM GIC interrupt controller driver. 2018-07-30 10:55:02 +00:00
hypervisor-stub.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
identcpu-v4.c Remove cpu_pfr from arm. It's unused. 2018-08-14 16:01:25 +00:00
identcpu-v6.c Add a hw.model sysctl oid for armv6/7 which reports the CPU model, similar 2018-02-26 23:58:56 +00:00
in_cksum_arm.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
in_cksum.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
intr.c follow-up to r336635, update TAILQ to CK_SLIST for ie_handlers 2018-07-23 15:36:55 +00:00
locore-v4.S Set a "kernbase" symbol in 32-bit arm locore.S and use it with ldscript.arm. 2019-12-30 23:20:46 +00:00
locore-v6.S Set a "kernbase" symbol in 32-bit arm locore.S and use it with ldscript.arm. 2019-12-30 23:20:46 +00:00
locore.S
machdep_boot.c Eliminate an unused var warning-error; the var is used only when parsing 2018-07-14 16:33:11 +00:00
machdep_intr.c
machdep_kdb.c Plug memory disclosures via ptrace(2). 2018-12-03 20:54:17 +00:00
machdep_ptrace.c Implement 'domainset', a cpuset based NUMA policy mechanism. This allows 2018-01-12 22:48:23 +00:00
machdep.c Repeat the spinlock_enter/exit pattern from amd64 on other architectures to 2019-12-16 20:15:04 +00:00
mem.c Move phys_avail definition into MI code. It is consumed in the MI layer and 2019-08-16 00:45:14 +00:00
minidump_machdep.c Move phys_avail definition into MI code. It is consumed in the MI layer and 2019-08-16 00:45:14 +00:00
mp_machdep.c Declare the global kernel symbols created by ldscript.arm in arm's machdep.h, 2019-12-06 03:48:35 +00:00
mpcore_timer.c Add a missing \n to a bootverbose printf. 2019-01-07 16:36:45 +00:00
mpcore_timervar.h
nexus.c Enable setting the dma tag at the nexus level 2017-06-21 18:25:35 +00:00
nexusvar.h Enable setting the dma tag at the nexus level 2017-06-21 18:25:35 +00:00
ofw_machdep.c
physmem.c ARM kernel can get RAM regions three ways: 2019-08-31 21:28:06 +00:00
pl190.c Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
pl310.c Revert r339421 due to unintended files included to commit. 2018-10-18 15:17:58 +00:00
platform_if.m
platform_pl310_if.m Add external PLATFORM access on arm, and use it in the pl310 driver. 2017-07-11 16:30:16 +00:00
platform.c Add external PLATFORM access on arm, and use it in the pl310 driver. 2017-07-11 16:30:16 +00:00
pmap-v4.c Remove page locking from pmap_mincore(). 2019-10-16 22:03:27 +00:00
pmap-v6.c Remove page locking from pmap_mincore(). 2019-10-16 22:03:27 +00:00
pmu.c hwpmc: simplify calling convention for hwpmc interrupt handling 2018-06-08 04:58:03 +00:00
ptrace_machdep.c Drop "All rights reserved" from my copyright statements. 2019-03-06 22:11:45 +00:00
sc_machdep.c sc(4) md bits: stop setting sc->kbd entirely 2019-12-30 02:07:55 +00:00
setcpsr.S
setstack.s
stack_machdep.c Reimplement stack capture of running threads on i386 and amd64. 2020-01-31 15:43:33 +00:00
stdatomic.c sys/arm: further adoption of SPDX licensing ID tags. 2017-11-27 15:04:10 +00:00
support.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
swtch-v4.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
swtch-v6.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
swtch.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
sys_machdep.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
syscall.c Don't pass error from syscallenter() to syscallret(). 2019-07-15 21:25:16 +00:00
trap-v4.c Improve MD page fault handlers. 2019-09-27 18:43:36 +00:00
trap-v6.c Improve MD page fault handlers. 2019-09-27 18:43:36 +00:00
uio_machdep.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
undefined.c Raise a proper SIGTRAP / TRAP_TRACE signal for a PT_STEP step on arm. 2018-07-25 18:11:37 +00:00
unwind.c Rewrite arm kernel stack unwind code to work when unwinding through modules. 2019-12-15 21:16:35 +00:00
vfp.c Use the correct register when storing the arm VFP state. 2018-08-27 10:08:27 +00:00
vm_machdep.c amd64 KPTI: add control from procctl(2). 2019-03-16 11:44:33 +00:00