From nobody Fri Aug 14 21:00:29 2026 X-Original-To: dev-commits-src-main@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 4hMF4F71Fmz6nlPg for ; Fri, 14 Aug 2026 21:00:29 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hMF4F6WpXz3XfP for ; Fri, 14 Aug 2026 21:00:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786741229; 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=i+Pm3H/W6nEiYHmwA9HEJtZKozZwBM7S1uebrpTDoWs=; b=ehGsF8LERyirAl4klLl3H8sN9sBaNk+81vBjKVIlf2OR894DWyw/gBRHW9UEFqyo7GfHSx i2Or4vvoot4t85fCMefe455IPkxmrT+zXYiCtP8AX+WHfe0HWIU1RFCcEn8mHDEZFqIfXg p8bBth+SAtctE07FWk6PdxRuMB9TITCl0ydE2JD2RTDNAqCEqWGKoGdrKbpgrpBfgnKL/1 qdBLT1smeESQozPXAQNKiVlxju0uugAO9hI+ewPFV879w14qxf0qmb8eiGLDCJ5T6xy5Gj 2CJ5OlKdfUWsbLpPPKqU/9tEjRD6yK3InqGuhwQ1bYZJr17bs6J5Ce7USGLi5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786741229; a=rsa-sha256; cv=none; b=Dbe7Y9KtCd2C47hKXZT/gLOCgog6kfM9S96gMsT14dSYRca7hS9E0Nu+tNHXorUTGAwuJc /nyVLd+ByHjuKq+2zELucamkEnwvRzTrItKYE8Whuj1QLFxLAD/MECoxmC+qD06bBeDxfi kITMtIcFz7Er3rtuutrfd1wLh9w2617erQuzrkdOOjWpmH+pJlSHTkDwBAoSTV9AT162z0 UX+gS7Jq1jC+OBmY0/XL0wKkLqaKqltan+lbj85qhiuLjswLH+WwDvsf+ceTPUQ/QUbD/8 BdiPlMzW/4GYBS8EVuldqwuifPh7M455OOC3H2x0ZFvfQ1KAXSIfnnK5prXdkA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786741229; 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=i+Pm3H/W6nEiYHmwA9HEJtZKozZwBM7S1uebrpTDoWs=; b=Tn12lUkQTo1eXWqFluvmlDmTYhtV18x/8Uc1Sa1A7XlI3Zc/viYKAspYyl2DFT8Sl1DTuN SgVrIHJfoWhuOFP1Zsyj3zCwnJ+o42SvK4XF14ZSWStYbtasDskrWG8IPBgLWL5gKHlOjv kGrSkVCtHvEdLkH/8dzLoWG56iMVBIZaMz+auh3DqquECr2plsz1bcslMVvenI6PggWWQo fjhl/G5yQKhOguIXsbPbV8W2gor18Lmz8S+1tbBPtsOOozKIfZdR55rlDDumP1cyrcupCP Ez6V2UL41p/n53J4WQVWOaafU7OKj9f7C1RfUP+hVk743dtfV+SaFdzKyzBVIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hMF4F4y5fz9X for ; Fri, 14 Aug 2026 21:00:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3e435 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 14 Aug 2026 21:00:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 6fa9c2b1d282 - main - arm64: close a race in SVE register management List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6fa9c2b1d2824034268646e0744e5e010155ffaf Auto-Submitted: auto-generated Date: Fri, 14 Aug 2026 21:00:29 +0000 Message-Id: <6a7f81ed.3e435.11f2b2f0@gitrepo.freebsd.org> The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=6fa9c2b1d2824034268646e0744e5e010155ffaf commit 6fa9c2b1d2824034268646e0744e5e010155ffaf Author: Alan Cox AuthorDate: 2026-08-07 21:51:04 +0000 Commit: Alan Cox CommitDate: 2026-08-14 20:57:35 +0000 arm64: close a race in SVE register management While testing an unrelated pmap change, D58708, that dramatically reduces the number of TLBI instructions performed, and likely the timing of unrelated events, I started seeing "Storing an invalid VFP state" panics in vfp_save_state_common(). However, the origin of this panic is elsewhere, in the else branch of sve_restore_state(). Specifically, my pmap change seems to have increased the likelihood that the thread executing the else branch would be preempted by another thread between the critical_exit() inside the else branch's call to vfp_restore_state_common() and its own call to critical_enter(). Prior to expanding the scope of the else branch's critical section, the MPASS added by this change would fire, catching the problem at its source, rather than later in vfp_save_state_common(). Assisted-by: Claude Code (Opus 5) Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D58723 --- sys/arm64/arm64/vfp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c index d4c0eacf690c..11faa4cc21cd 100644 --- a/sys/arm64/arm64/vfp.c +++ b/sys/arm64/arm64/vfp.c @@ -797,15 +797,17 @@ sve_restore_state(struct thread *td) critical_exit(); } else { + critical_enter(); + vfp_restore_state_common(td, curpcb->pcb_fpflags); /* Enable SVE if it wasn't previously enabled */ if ((curpcb->pcb_fpflags & PCB_FP_SVEVALID) == 0) { - critical_enter(); + MPASS(PCPU_GET(fpcurthread) == td); sve_enable(); curpcb->pcb_fpflags |= PCB_FP_SVEVALID; - critical_exit(); } + critical_exit(); } return (true);