From nobody Fri Jun 24 19:37:02 2022 X-Original-To: dev-commits-src-branches@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 DD2AA864B82; Fri, 24 Jun 2022 19:37:03 +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 4LV6nq3JRLz4XC2; Fri, 24 Jun 2022 19:37:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656099423; 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=wEofHKLggmofq/3N4g6k5yLpGyjRcN9GZIttOA1G3A0=; b=ktY9Fp1yGOaHAdVucgxwqlJy+YNRtfttIk1xuN1ru+prwB/Dx9eseyqPE6+RkQmT01gqFQ lp4dykXFXB8QrbVcwuKKpZmmcgBf5Fj83qg2Vy+ZmBPZccL2fDOzJ+qsA2gZsQz0JL0Yah zXFlnyPzKyrCyV0fp+REsp6y0zwgfmi7w3JjzQ7VJzcmVJKUTe4/tFhAy/mTMt6cEaFyye htUZ/91T9fLdPY4+F0uqqH1PxN80NDBynWaijLAAvfij+5sdDl5Hj2wSSYxXbxbVDOcmsn APxf8Rwjyx/rUF8HTwim/Rf/0cANlmxFzXNvLTl2vAVsrFoP7YTd6N8wh3a4Yg== 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 12F5516400; Fri, 24 Jun 2022 19:37:03 +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 25OJb2fr084339; Fri, 24 Jun 2022 19:37:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25OJb2Dm084338; Fri, 24 Jun 2022 19:37:02 GMT (envelope-from git) Date: Fri, 24 Jun 2022 19:37:02 GMT Message-Id: <202206241937.25OJb2Dm084338@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: ea6a7512d299 - stable/13 - thread_unsuspend(): do not unuspend the suspended leader thread doing SINGLE_ALLPROC List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: ea6a7512d299eb75b411b80a2f649054dd332afd Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656099423; 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=wEofHKLggmofq/3N4g6k5yLpGyjRcN9GZIttOA1G3A0=; b=tUs76Q/Aaf/gESqHnyesNmEHG6CmOC7Nn/uIuT0Ey9gDESc/YxEMu0jyrUQLEvdTW/RzAc pWIZkpk/c/u3029CMRe7JFLTLmodSV2nUoH18hlJVzZ1d27CD4PO7SiTFTOaFoJJms3Qom 9w+YjWJrZOzxUXRCDk9M+C9HzojBNtpFVryJfMq5fNc8dWyzT3Elp4DsvCjDV5cs9BmD8E 5Q/Y+wyJvsXMrLcwIhyRJl40cnHai0hY2rxW+hUIP4oZKEj2eXeXcpWxr2QOXMCyP5pitL Z1Wlq47lkWtsoKedJgLuioD19vs04hSSz05uGxuQyNy2LnIMBR042iwJiGnxIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656099423; a=rsa-sha256; cv=none; b=DoGl0tzvvVZlqTUwCj8Nq0Yg2V8P+asvJYkIJIGdIyUrDvqS6zYc1y1Wl1mSed6Jrn+FWA Xd1So/9IJtsxyBPKLfl1YVWABy237gX1RlVsBmpqeFdgP99ZVzBC1/ihAXQS+hC5NFGn5M 3mSFOBK13g7d5bkUKfVXZMkqJZB0Z5wfPfjPq+hjRzO9XcPCMrL2fOMwgo9Jl2hi9Wbom/ gMrtnYdlEDkOaJgv2Cyx+kIrliTFzNv4o84LoppL+7F1+kEIzWnOn6sYSKDu0P1h5DVYMe k0a7M84mid6L5/6NruTj2nIS+nmUAKT3rR5XailaSgJiGESiLEuInS7542+7jQ== 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=ea6a7512d299eb75b411b80a2f649054dd332afd commit ea6a7512d299eb75b411b80a2f649054dd332afd Author: Konstantin Belousov AuthorDate: 2022-06-08 01:27:30 +0000 Commit: Konstantin Belousov CommitDate: 2022-06-24 14:45:46 +0000 thread_unsuspend(): do not unuspend the suspended leader thread doing SINGLE_ALLPROC (cherry picked from commit 1b4701fe1e840f9ce5dae557b4dd99bda8a85735) --- sys/kern/kern_thread.c | 14 ++++++++++++-- sys/sys/proc.h | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index f10752cf682c..37aaa0b02bd0 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -1216,8 +1216,12 @@ thread_single(struct proc *p, int mode) else p->p_flag &= ~P_SINGLE_BOUNDARY; } - if (mode == SINGLE_ALLPROC) + if (mode == SINGLE_ALLPROC) { p->p_flag |= P_TOTAL_STOP; + thread_lock(td); + td->td_flags |= TDF_DOING_SA; + thread_unlock(td); + } p->p_flag |= P_STOPPED_SINGLE; PROC_SLOCK(p); p->p_singlethread = td; @@ -1304,6 +1308,11 @@ stopme: } } PROC_SUNLOCK(p); + if (mode == SINGLE_ALLPROC) { + thread_lock(td); + td->td_flags &= ~TDF_DOING_SA; + thread_unlock(td); + } return (0); } @@ -1590,7 +1599,8 @@ thread_unsuspend(struct proc *p) if (!P_SHOULDSTOP(p)) { FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); - if (TD_IS_SUSPENDED(td)) { + if (TD_IS_SUSPENDED(td) && (td->td_flags & + TDF_DOING_SA) == 0) { wakeup_swapper |= thread_unsuspend_one(td, p, true); } else diff --git a/sys/sys/proc.h b/sys/sys/proc.h index f9d60a6b9935..26280998f00b 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -460,7 +460,7 @@ do { \ #define TDF_THRWAKEUP 0x00100000 /* Libthr thread must not suspend itself. */ #define TDF_SEINTR 0x00200000 /* EINTR on stop attempts. */ #define TDF_SWAPINREQ 0x00400000 /* Swapin request due to wakeup. */ -#define TDF_UNUSED23 0x00800000 /* --available-- */ +#define TDF_DOING_SA 0x00800000 /* Doing SINGLE_ALLPROC, do not unsuspend me */ #define TDF_SCHED0 0x01000000 /* Reserved for scheduler private use */ #define TDF_SCHED1 0x02000000 /* Reserved for scheduler private use */ #define TDF_SCHED2 0x04000000 /* Reserved for scheduler private use */