From nobody Tue Sep 16 02:49:47 2025 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 4cQmZz6m8fz685fg; Tue, 16 Sep 2025 02:49:47 +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 4cQmZz5YD2z46vl; Tue, 16 Sep 2025 02:49:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757990987; 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=OWZsHcTpuJYeK/5b79+zyHuAtx0uCd94YdBvLqv2PRk=; b=Eeei9XdB4jN9b5w+LqllZ0xcI5aQFBDlODwOzmY2mVK7L/GVzfdjWKKxiYPwk+zqamSi+w lU3VBC+KwWHGkoTL+SSUc6EZwp2ETZubm3bu3w9yDOKWywyVUdefYrsXH9b+Y2xsPfaRKM OErQbaOivxjCIKAY36kcNY3yIl2fu7B7LtER+IUiHyB3SoMkU5QaMrf8VGGzuNVrm6DG6G q+twMUvEPg7SaSqbJ3WbG+96jtM+D0vx53E8l/H4DnpfTFUPRgtinI7FsLEVuv6R5PMX2o Od7Rc+M18C7IiJfo1Q5YA51OOgujtKe6MI6oESeqvW+wo8vKtm4bUD2sFN8VxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757990987; 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=OWZsHcTpuJYeK/5b79+zyHuAtx0uCd94YdBvLqv2PRk=; b=PRZQigG841FURczJIIXrb1/4IWpeHoadc52wcpB1Rm1xjTgEXBqv5NsT3rdfRuVl+gc37h BVBvXBI/dxau0l00C2OPIhaOAqMsZim9V/692rxtw45JFKnyLq5dTXWsPf+5Ka1HksDiBq 7G16k0LpeUS254hsYiyCx23EIyhEApRFYtXdHH+9WyHCjbGQzGRKqxcMrqRZ7rgMkjrTFM cLbKqkoMrTw1DVPujdLIjO42JXZgY3PBp2WVUydiyqzupUWoSATouRCn0tOFmRPrPNXeiB w0MakV3SuarMV9bGod34Rl0XkJJJagoChvk5bFPLZvmXnCVHuKqsEE1RvIE+9Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757990987; a=rsa-sha256; cv=none; b=V2VueCqhOTy6FhY4gt/YW+2nOvJ4MFlPWGPT+AW4PP2V5O/xnOVWVLryHW6NrT8zoG5/LT 24oeT3f+d3YLFxMUsuKtlHYAeigVS4K/nC/m2cm+0gBnCkn5krLRB15JQSvRZaWwtbNVHz 1CLBY4n45XqGE2Wwd/kKRhX+PFu35/eUWeSPf4YTsQQ4Eq1tdH5rdgAQ1wo7QyNPMA7c4n k1erc15Z/ERolzkOHx8aannky1ht9Zz+TT5nSJD/Tm3VszL1Ql+Qf//kvsFIipW775nJrd eMHzUvNtjCdTLeBpaswjFqheOsdGtdNTz4QC9Frz/Me/9wAdsFDSDJiI/QuV4w== 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 4cQmZz51YLz69F; Tue, 16 Sep 2025 02:49:47 +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 58G2nl1v099882; Tue, 16 Sep 2025 02:49:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58G2nlRu099878; Tue, 16 Sep 2025 02:49:47 GMT (envelope-from git) Date: Tue, 16 Sep 2025 02:49:47 GMT Message-Id: <202509160249.58G2nlRu099878@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: 7140a4790cbc - stable/15 - kern_thr_exit(): clear kASTs in advance 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: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-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/15 X-Git-Reftype: branch X-Git-Commit: 7140a4790cbc6c897673276299a1bc3ad63dc3f8 Auto-Submitted: auto-generated The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7140a4790cbc6c897673276299a1bc3ad63dc3f8 commit 7140a4790cbc6c897673276299a1bc3ad63dc3f8 Author: Konstantin Belousov AuthorDate: 2025-09-08 03:43:09 +0000 Commit: Konstantin Belousov CommitDate: 2025-09-16 02:45:12 +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 0e8c2b9f362e..4329959a2ef4 100644 --- a/sys/kern/kern_thr.c +++ b/sys/kern/kern_thr.c @@ -346,6 +346,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