Commit Graph

4 Commits

Author SHA1 Message Date
Konstantin Belousov
4690e20eed tools/uma/smrstress: fix kthread exit
By convention, kernel threads must call kthread_exit() instead of
blindly returning from the thread function.  We have some safety measure
in fork_exit(), which checks for the P_KPROC p_flag and does
kthread_exit() for kernel thread that forgot to do it itself.

But this workaround only works for kernel threads belonging to the
kernel process.  If a kernel thread is attached to the normal process
with live userspace, and does not call kthread_exit(), then the
workaround is not activated, and for amd64 at least, the return from the
thread function/fork_exit() results in the return to userspace with the
copy of frame from the thread that did kthread_add().

Practically for smrstress, this destroys the user stack of the still
active frame in the other thread, which was the caller of kthread_add().

Fix it by adding kthread_exit() to the thread function.

Reported and tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D35999
2022-07-31 00:40:12 +03:00
Mark Johnston
36cc9d5ca5 Fix the smrstress build after r358400.
Reported by:	pho
2020-08-05 17:26:20 +00:00
Konstantin Belousov
4b919d5cdd smrstress: Add 'publishing' fences to operations on smrs_current.
Reported and tested by:	andrew
Reviewed by:	jeff
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D23440
2020-01-31 20:30:50 +00:00
Jeff Roberson
e14f729cdc Implement a simple UMA SMR stress testing tool. 2020-01-31 02:18:56 +00:00