From nobody Fri Jun 24 19:36:50 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8312D863DA4; Fri, 24 Jun 2022 19:36:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LV6nZ4QM0z4X3b; Fri, 24 Jun 2022 19:36:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656099410; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m1krW31WSrYze4WTBJJLUDn/WCGbYGA9UZG1YXuJWkg=; b=pyjhE+8CN0DRyNOvGT31tTZQnFYxWGiRG6MScsS2aRVfecRbXAMtNt2gICtdJbNdJnIgAT T1NzvP67Xps3hslFdR36ZEO3BiDdvT0st3oCJkj24yXGFZwGwFd7hS/Co/OpFIr8i2KKqd yran9t/HmJDwxq/5O8yvfh4B5QhSINDM41xw393Dj32wZpsEcaV+pNNs9VxhCUmOqorFhM 6JPCqmp+lZEbTahBwUKwAn6ZHjGu/kPxzWbKnyU5Ej/vloFELKWDzKPKcQ7gs5CnILtFVR Qcn3HX8ez7YSl4nOQz62oIAcEEJ8mV4bke2SSfcDQwPaq8x9PTdt61SnhhXMsw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6425316384; Fri, 24 Jun 2022 19:36:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25OJaoxR084061; Fri, 24 Jun 2022 19:36:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25OJaoO7084060; Fri, 24 Jun 2022 19:36:50 GMT (envelope-from git) Date: Fri, 24 Jun 2022 19:36:50 GMT Message-Id: <202206241936.25OJaoO7084060@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a03a5ac3ba76 - stable/13 - Add stop_all_proc_block(9) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a03a5ac3ba761032ec50faf87d52198747562b65 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656099410; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m1krW31WSrYze4WTBJJLUDn/WCGbYGA9UZG1YXuJWkg=; b=hdBS72jNF5wpkmuxZYhReKuUuhl9yQT5eG4/JkB1rPJMKpee1QKS6MB1VibGJSebjSMU8P ieyX+qfUDQitAYBil6ZD9u+Vp8JFw7OeSH9H4ocpS3XrGKkOixJmuB1+3o0NemEql4O/Ep 6vwbbZUXzPOOqTmUr1VkngEBTcTCUZKPkxt31P8d4WYXTjpHDPvzv1dcDA4pW+jGijMY9I HNmA2wZpS4KwleI9IhI6mLqWGT4qZUMlDA1D0X/z7KjPQd1K7lsoEqdPE5BchW8C9/HTTW N9zZwFUs1+GlZQtATY34KUNblo1sGpbVLDpE0KTr5U7YGWKiO/QLIRzxbcjcyw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656099410; a=rsa-sha256; cv=none; b=P1l2ljX2RVsfLxyiwy/aUJsSCO90OVVLd0zYw/5lquVYkTxm4DrVKwUEWaUue21ZzYhJME nOGwvPMnDDQavXlJwx5dS2h63ezHUy7YJs44/CiPMDuNUm9aKAxHsrGZsq8a5nL3x5srpC d9EYaUhEX+PoRevWmIrOl20scLvsmdN8ZM4LWrZ+3HUe1wL1QN6TQs8b1iDi+UcDI+Obb7 TR6jgihKfKckyUM1rkMRKI7Qz3y2nvY59prqQ47tSpl3hoG3FXcKndYUO468MvbR5s7ifC j0eJ2dNS+U7tou2iRNrS9G2lyA/AkjyqFijRxQJ4kkiUrOnzQMNm9bZm0/pCuw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a03a5ac3ba761032ec50faf87d52198747562b65 commit a03a5ac3ba761032ec50faf87d52198747562b65 Author: Konstantin Belousov AuthorDate: 2022-04-23 22:55:04 +0000 Commit: Konstantin Belousov 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);