opnsense-src/sys/mips/mips
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 sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
bcopy.S Make memmove an alias for memcpy 2018-05-24 21:11:24 +00:00
bus_space_generic.c Remove support for the now very old SiByte MIPS platform. It's not 2018-12-19 22:54:03 +00:00
busdma_machdep.c Introduce the concept of busdma tag templates. A template can be allocated 2019-12-24 14:48:46 +00:00
cache.c sys/mips: further adoption of SPDX licensing ID tags. 2017-11-27 15:07:26 +00:00
cache_mipsNN.c sys/mips: further adoption of SPDX licensing ID tags. 2017-11-27 15:07:26 +00:00
cpu.c sys/mips: further adoption of SPDX licensing ID tags. 2017-11-27 15:07:26 +00:00
db_disasm.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
db_interface.c Remove mips MD atomic_load_64 and atomic_store_64. 2017-12-22 23:27:03 +00:00
db_trace.c sys/mips: further adoption of SPDX licensing ID tags. 2017-11-27 15:07:26 +00:00
dump_machdep.c sys/mips: further adoption of SPDX licensing ID tags. 2017-11-27 15:07:26 +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
elf_trampoline.c Delete unneeded #include <sys/inflate.h> from sys/mips. 2019-05-23 05:17:18 +00:00
exception.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
fp.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
freebsd32_machdep.c Use uintptr_t instead of register_t * for the stack base. 2019-12-03 23:17:54 +00:00
gdb_machdep.c sys/mips: further adoption of SPDX licensing ID tags. 2017-11-27 15:07:26 +00:00
genassym.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
in_cksum.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
inckern.S
intr_machdep.c follow-up to r336635, update TAILQ to CK_SLIST for ie_handlers 2018-07-23 15:36:55 +00:00
libkern_machdep.c sys/mips: further adoption of SPDX licensing ID tags. 2017-11-27 15:07:26 +00:00
locore.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +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 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
mips_pic.c bhnd(4): implement MIPS and PCI(e) interrupt support 2017-11-21 23:15:20 +00:00
mp_machdep.c Eliminate kmem_malloc()'s unused arena parameter. (The arena parameter 2018-08-21 16:43:46 +00:00
mpboot.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
nexus.c Preemptively map MIPS INTRNG interrupts on non-FDT MIPS targets 2017-11-21 01:54:48 +00:00
octeon_cop2.c sys/mips: further adoption of SPDX licensing ID tags. 2017-11-27 15:07:26 +00:00
octeon_cop2_swtch.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
ofw_machdep.c Fix a copyright glitch before it gets copy-pasted again. I think this must 2016-04-07 18:19:09 +00:00
pm_machdep.c Simplify arguments to signal handlers on mips. 2020-01-06 18:02:02 +00:00
pmap.c Introduce vm_page_astate. 2019-12-10 18:14:50 +00:00
ptrace_machdep.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
sc_machdep.c sc(4) md bits: stop setting sc->kbd entirely 2019-12-30 02:07:55 +00:00
stack_machdep.c Reimplement stack capture of running threads on i386 and amd64. 2020-01-31 15:43:33 +00:00
stdatomic.c In __sync_bool_compare_and_swap(), return true if the returned value is the 2018-03-23 17:25:19 +00:00
support.S Provide protection against starvation of the ll/sc loops when accessing userpace. 2019-07-12 18:43:24 +00:00
swtch.S Move most of the contents of opt_compat.h to opt_global.h. 2018-04-06 17:35:35 +00:00
sys_machdep.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
tick.c Create a new macro for static DPCPU data. 2018-07-05 17:13:37 +00:00
tlb.c [mips] remove check that is always false (unsinged < 0) 2019-01-25 19:58:56 +00:00
trap.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
uma_machdep.c vm_wait() rework. 2018-02-20 10:13:13 +00:00
vm_machdep.c Preserve the inherited value of the status register in cpu_set_upcall(). 2020-01-14 18:00:04 +00:00