Date: Fri, 24 Jun 2022 19:36:50 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: a03a5ac3ba76 - stable/13 - Add stop_all_proc_block(9) Message-ID: <202206241936.25OJaoO7084060@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a03a5ac3ba761032ec50faf87d52198747562b65 commit a03a5ac3ba761032ec50faf87d52198747562b65 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-04-23 22:55:04 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-06-24 14:45:45 +0000 Add stop_all_proc_block(9) (cherry picked from commit 2e7595ef2f53f6debec3c3d89bb9e0cd10394ed3) --- sys/kern/kern_proc.c | 19 +++++++++++++++++++ sys/sys/proc.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 063fe2eb1fe2..5faa5641c566 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -3319,6 +3319,21 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC_SIGFASTBLK, sigfastblk, CTLFLAG_RD | CTLFLAG_ANYBODY | CTLFLAG_MPSAFE, sysctl_kern_proc_sigfastblk, "Thread sigfastblock address"); +static struct sx stop_all_proc_blocker; +SX_SYSINIT(stop_all_proc_blocker, &stop_all_proc_blocker, "sapblk"); + +void +stop_all_proc_block(void) +{ + sx_xlock(&stop_all_proc_blocker); +} + +void +stop_all_proc_unblock(void) +{ + sx_xunlock(&stop_all_proc_blocker); +} + int allproc_gen; /* @@ -3334,6 +3349,8 @@ stop_all_proc(void) int r, gen; bool restart, seen_stopped, seen_exiting, stopped_some; + stop_all_proc_block(); + cp = curproc; allproc_loop: sx_xlock(&allproc_lock); @@ -3425,6 +3442,8 @@ again: goto again; } sx_xunlock(&allproc_lock); + + stop_all_proc_unblock(); } /* #define TOTAL_STOP_DEBUG 1 */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 38675248b22d..3db7ce620176 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1205,6 +1205,8 @@ void thread_unlink(struct thread *td); void thread_unsuspend(struct proc *p); void thread_wait(struct proc *p); +void stop_all_proc_block(void); +void stop_all_proc_unblock(void); void stop_all_proc(void); void resume_all_proc(void);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206241936.25OJaoO7084060>