From nobody Wed Jan 18 09:39:49 2023 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 4Nxghk0lgXz2sjG3; Wed, 18 Jan 2023 09:39:50 +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 4Nxghj4s0jz40Z2; Wed, 18 Jan 2023 09:39:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674034789; 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=DTXtpfZAQqmyZIhiUPzcCnpLkavLseTbpRffRv5u4hY=; b=yafLs9qF/1luqUgw5e9Lwnp9iuKYMIXKoAosAN8KPgWuVoKYYyXE5ewe1IPIMsGTO6FjBM kAnSSQgpO3ARqrINmDS8Ok2Gs6rf3BlBl9ZnIFXNS/AYrn2evsHCzTZy2RBaq9OPHAk/Cl hvSY2M0F/J8HUIxNJe/F8Iz4JJZYTOCQ8NcDGrLshePEmOZQH12z6aOmaS2CtHy9Lm65AW ZC83sP3BAp6CIsGl7dSqeNa86bu5Pu/ikLwuXiZLEAOyI1cEDoPF3L8vbqzuautfYJBOB4 UlUKjHaJdjAU3lTqyeTIrKg3XFQUkny7sH8B6LIPu/7T6YtZXA/4LiCN/LZpdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674034789; 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=DTXtpfZAQqmyZIhiUPzcCnpLkavLseTbpRffRv5u4hY=; b=FO/KOs+BkFrLgre0452fgM/G2o3PYupo2XiKsDGuVH39looSy/eNwGJkk64I2XqQ78ItCG 60q+HEKcGM3soFVhnB83EyMaWE+oiP/E8wFMEardvjtzAIlhuylPrwxdJ/Sf3ufg+ac3px Bl16akII9hqiAKpzKbZryw1cWXDaOFNgTItbdyCO46ZbTr3Km9xV8/XLukXD/DjHoa8a1Y /C702vJML7LUMJSXtBsgAujaex9cNaKeJHexBrn889MsQIueRqx/Ffix7DBbZOUZXNR/Zp Ms5wtDByeXme+6XIXUxE8iVFjz7R6jHYw56oHSOsIzJEIt/fOfV1wzjL2ReziA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674034789; a=rsa-sha256; cv=none; b=nWnt5oSGej2Hwj02JGBREsyvf4Y28mFi9WZA+jCbJgzfoXnkzBThqG9ejqJNrCUgVkhmyS PfvF9BQYc7MML4Lm9wz9BdmZGL8pwgAe/turrdliIe8Vnxceu6I58K4R6JQnQYosROwguE KBUqBM5hD8SJCTqu6I7G5Fv/QGqg1vveS7PJSBn42lJaqqzaBrQ2n7T9+WgPGSQiSsd7pS 45yK2nIgS5E1AwD/0vZLqGRXyxWh13NuqXLayRaM/nFO9/SryNltYXndtIYlLr0KGqWOaZ uSHe56aGmBERv3sfmkjZ+sIsu0Nzrc7Zw20KbYf+33f3Zb4OXAdURgk7DxgXhw== 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 4Nxghj3fcmz166M; Wed, 18 Jan 2023 09:39:49 +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 30I9dnaF053077; Wed, 18 Jan 2023 09:39:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30I9dnU5053076; Wed, 18 Jan 2023 09:39:49 GMT (envelope-from git) Date: Wed, 18 Jan 2023 09:39:49 GMT Message-Id: <202301180939.30I9dnU5053076@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 61f5462fde6c - main - Always store the arm64 VFP context 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 61f5462fde6c38c1f4f5c34a05fab506b6869375 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=61f5462fde6c38c1f4f5c34a05fab506b6869375 commit 61f5462fde6c38c1f4f5c34a05fab506b6869375 Author: Andrew Turner AuthorDate: 2023-01-18 09:30:32 +0000 Commit: Andrew Turner CommitDate: 2023-01-18 09:31:45 +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 --- 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 12c23149ec7f..258cb5d26b13 100644 --- a/sys/arm64/arm64/exec_machdep.c +++ b/sys/arm64/arm64/exec_machdep.c @@ -489,30 +489,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 }