From nobody Mon May 15 15:46:00 2023 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 4QKkHD61Wbz4Blmn; Mon, 15 May 2023 15:46:00 +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 4QKkHD5Fr7z3JLX; Mon, 15 May 2023 15:46:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684165560; 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=k19arvvDpT3ODoLeOH272SSfwmX+F5BUXyhSlr+WmJY=; b=YcbNKT31lONxoWoczKgD6MM5riO0jcmrygtuGvXSe5QxEOnI09PclXwAhSP+3btUo6HxoV agW4X0v8/kjR3odNrzIa5y9r+kKz3Zz5ipzsT0rWjp3KX6Rtx/MIWV6vFWCuExdZL9OcVo 230/YMmUGMxPF0cANTXEWc+DMfywpj36BhEAc2U2endd23LiJsafTXiQVumvrwNGfA4uyH XbMFzRsWyJvZK1fZrxgAs4zNTI1LJVC2May1LlNByrM3oL+p+5gYJJJE9+C+vATsLnzDp4 E8PSlgJgwkcwLlW3S0j4rYE6UtdJ3gasRkBihx4lht33hPCu76UWN7ESOwnYdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684165560; 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=k19arvvDpT3ODoLeOH272SSfwmX+F5BUXyhSlr+WmJY=; b=AkshlmQ3Cyz7pUV9dSSoX1jJdJ5YhtGW8xAM6fFBGNCNyVZIT0/LtZ/MFd8hn1yBVmgV2m iZBIwtbyJy98O23jyWavFX/O5ihW5bi/vDTRZdiZ92GIFjisInWkFpkV1vYbUuLTeVqRId uJgiIlP06+YWA83AzuDiAhcOyklPct4z3DxjT2aswGts4wvjzqPnK5GRKjDw8K7z8hWs6G 4p4jhNR+qgprdopvW67grJpoUkDJcC/F1PYUZ77vGXcU41PJIXBVLiOUMSVyLVC2fIZMw2 F+TAW4fbn+NWvsZJkty73G5fvmksz+ClDhi+yLw0xJvUQJtQ8iN5caVeqglBVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684165560; a=rsa-sha256; cv=none; b=uGYbSsmv2NzJS11nR7Uzab3I+cpO1geK5LSAeEONX+OC4Ek5owkMXZAScpjZieqKXoMPRf 69Tir0Jb9+x+7aGo3cX1GZyGJaAkmGvH3eBZohoq65Hw+KdX/8ozwXSiJHOzw88MVZIQxs zxS9WYbAk9aXX+EDp0zDOBNp/9by+eezb0Y2nbBQLakpc4nJbrvhfM32LwvunWjTLwIqvG uR0hJOAJpgYybhPvy1QRSTM5BDWCdnggYcJ/ff1AXkZWi18IEkdBf2CuFkmoiIHsgjJ99y 6K0qN5VF18ly7CtTjWXPARQxWt6dTpUJrZH5aDeRE36TccVAUzMN1a7aD7uxFg== 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 4QKkHD49kNzmJ7; Mon, 15 May 2023 15:46:00 +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 34FFk0l6073474; Mon, 15 May 2023 15:46:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34FFk02F073473; Mon, 15 May 2023 15:46:00 GMT (envelope-from git) Date: Mon, 15 May 2023 15:46:00 GMT Message-Id: <202305151546.34FFk02F073473@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 622875663c82 - stable/13 - Always store the arm64 VFP context 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 622875663c82c4493da3cd27870f0a3dcb21c4fb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=622875663c82c4493da3cd27870f0a3dcb21c4fb commit 622875663c82c4493da3cd27870f0a3dcb21c4fb Author: Andrew Turner AuthorDate: 2023-01-18 09:30:32 +0000 Commit: Andrew Turner CommitDate: 2023-05-15 10:54:40 +0000 Always store the arm64 VFP context If a thread enters a kernel FP context the PCB_FP_STARTED may be unset when calling get_fpcontext even if the VFP unit has been used by the current thread. Reduce the use of this flag to just decide when to store the VFP state. While here add an assert to check the assumption that the passed in thread is the current thread and remove the unneeded critical section. The latter is unneeded as the only place we would need it is in vfp_save_state and this already has a critical section when needed. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D37998 (cherry picked from commit 61f5462fde6c38c1f4f5c34a05fab506b6869375) --- sys/arm64/arm64/exec_machdep.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/sys/arm64/arm64/exec_machdep.c b/sys/arm64/arm64/exec_machdep.c index a55048461682..fab0ee2ba993 100644 --- a/sys/arm64/arm64/exec_machdep.c +++ b/sys/arm64/arm64/exec_machdep.c @@ -482,30 +482,27 @@ get_fpcontext(struct thread *td, mcontext_t *mcp) #ifdef VFP struct pcb *curpcb; - critical_enter(); + MPASS(td == curthread); curpcb = curthread->td_pcb; - if ((curpcb->pcb_fpflags & PCB_FP_STARTED) != 0) { /* * If we have just been running VFP instructions we will * need to save the state to memcpy it below. */ vfp_save_state(td, curpcb); - - KASSERT(curpcb->pcb_fpusaved == &curpcb->pcb_fpustate, - ("Called get_fpcontext while the kernel is using the VFP")); - KASSERT((curpcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, - ("Non-userspace FPU flags set in get_fpcontext")); - memcpy(mcp->mc_fpregs.fp_q, curpcb->pcb_fpustate.vfp_regs, - sizeof(mcp->mc_fpregs.fp_q)); - mcp->mc_fpregs.fp_cr = curpcb->pcb_fpustate.vfp_fpcr; - mcp->mc_fpregs.fp_sr = curpcb->pcb_fpustate.vfp_fpsr; - mcp->mc_fpregs.fp_flags = curpcb->pcb_fpflags; - mcp->mc_flags |= _MC_FP_VALID; } - critical_exit(); + KASSERT(curpcb->pcb_fpusaved == &curpcb->pcb_fpustate, + ("Called get_fpcontext while the kernel is using the VFP")); + KASSERT((curpcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, + ("Non-userspace FPU flags set in get_fpcontext")); + memcpy(mcp->mc_fpregs.fp_q, curpcb->pcb_fpustate.vfp_regs, + sizeof(mcp->mc_fpregs.fp_q)); + mcp->mc_fpregs.fp_cr = curpcb->pcb_fpustate.vfp_fpcr; + mcp->mc_fpregs.fp_sr = curpcb->pcb_fpustate.vfp_fpsr; + mcp->mc_fpregs.fp_flags = curpcb->pcb_fpflags; + mcp->mc_flags |= _MC_FP_VALID; #endif }