From nobody Tue Sep 16 02:50:23 2025 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 4cQmbg5rWCz685fl; Tue, 16 Sep 2025 02:50:23 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cQmbg4zyWz47YV; Tue, 16 Sep 2025 02:50:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757991023; 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=GbvxPjP0SCpOHqPcZ6k9p6TLZ8k02554QHp3uVKM0LI=; b=l0iFJD4bNv6VU5WlBbMD8SZnbDHgGncamAhsO7RQuOXKHQtETdT6sYiIs0sWHaheUNEGK8 2tAswpkajq0EZeL0KPhpXKWnQVpqFL0pX2b+dz/eHjkCwBFk27cEoxoxmPQL0bGZrtA63k b7qgPTHfe0NLkEIzIwsPTEyQ7DOY738b9gUr/1sCzbkKE8AQycOFAZ2Tzo0h5q/P0m4AoB 6uHoqT1g9tyGnt4wGDiDpfzJ5iovT/FCZzbnRXaZw+2Uux4lSmSeJ2fA4kQHOPQZREyCEh 0RDpklXv/YERKg9AAx9KVauoXXT1PFvtJ3Ke1q6x89c3Pgz5DlUYQEh0IhBEHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757991023; 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=GbvxPjP0SCpOHqPcZ6k9p6TLZ8k02554QHp3uVKM0LI=; b=cArsQEYA+jD15u0utMa8Mn3EpiZd7NhZrIJq+r5o10a2rM6PVgq3Hf1SjNnXTINQfNUhP2 Dpcj1R75RP1hbvOsnl3m3tH7P3eXvb5FIyonQYsKgqeLj/cFPwQR+xsyysNV2HQqeo0ewv xyx5BpsAadsjBnfUR5hN3I3XKvwpA1lflvF1Z2fX6oAyKzimBw2U6Pqu3Bl2WxBRX5fsVI V1susMXlTzj7VY7V1wCmcLzxOlzdmxUNBQMjKzL3rJMdnukkNDuK1dTHqAh7iZ2C7M82b3 ls3OciUvihbUXVyW580ZH7WTFAJK1rienTn+a8fFSpoOCvNHxP6GhxIiSNJMuQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757991023; a=rsa-sha256; cv=none; b=rbSELjsGlJMun9SEMJ43L/UQrNKNZ2V/liYPZ10SVmkMVDz2umhlJI5IgAQGbd+BxjB+4K e2TwFG1YMbpUGHbh1MXWA00QkrrFYs0ogBT9loI87HQMyyzYeNha15pK1qmJ991TOAv7hX gj7i6679bEtN5sReh1BmLchT4lJ/mL0koCS5RCVMjkk0N3VUEpCbVUH/vEnABuVjslreD/ axIt8vGc8aoEjprZkOhKepRgTO2rOgcMAkD6miu78HVsvH8GPnTRObtlVqaJgc0Mjfusc3 SKgpVxpsGr+jPUpL+msIoDesXvQu4unXxAszPv9iizlmpZRw5muGXpcybnxgvg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cQmbg4Vj7z69G; Tue, 16 Sep 2025 02:50:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58G2oNto009039; Tue, 16 Sep 2025 02:50:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58G2oN97009036; Tue, 16 Sep 2025 02:50:23 GMT (envelope-from git) Date: Tue, 16 Sep 2025 02:50:23 GMT Message-Id: <202509160250.58G2oN97009036@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: 594982a69714 - stable/14 - kern_thr_exit(): clear kASTs in advance 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/14 X-Git-Reftype: branch X-Git-Commit: 594982a69714150ccf8616ffbce65fecab70ec03 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=594982a69714150ccf8616ffbce65fecab70ec03 commit 594982a69714150ccf8616ffbce65fecab70ec03 Author: Konstantin Belousov AuthorDate: 2025-09-08 03:43:09 +0000 Commit: Konstantin Belousov CommitDate: 2025-09-16 02:44:24 +0000 kern_thr_exit(): clear kASTs in advance PR: 289204 (cherry picked from commit f51d7d5139a76d225c9f537bd948525ababdef0c) --- sys/kern/kern_thr.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c index 8ad885b42ebe..1b5f0b1a33ad 100644 --- a/sys/kern/kern_thr.c +++ b/sys/kern/kern_thr.c @@ -339,6 +339,17 @@ kern_thr_exit(struct thread *td) p = td->td_proc; + /* + * Clear kernel ASTs in advance of selecting the last exiting + * thread and acquiring schedulers locks. It is fine to + * clear the ASTs here even if we are not going to exit after + * all. On the other hand, leaving them pending could trigger + * execution in subsystems in a context where they are not + * prepared to handle top kernel actions, even in execution of + * an unrelated thread. + */ + ast_kclear(td); + /* * If all of the threads in a process call this routine to * exit (e.g. all threads call pthread_exit()), exactly one