Date: Thu, 8 Apr 2021 10:18:04 GMT From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: d6a53211a716 - main - Discard the arm64 VFP state before resetting it Message-ID: <202104081018.138AI4Eg012697@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=d6a53211a716c987de76294cff32b652fe38bb09 commit d6a53211a716c987de76294cff32b652fe38bb09 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2021-03-23 18:23:47 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2021-04-08 07:51:26 +0000 Discard the arm64 VFP state before resetting it When resetting the VFP state we need to discard any old state so we don't try to save it on a context switch. Move this first so resetting the pcb is safe to perform outside a critical section. Reviewed by: arichardson Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D29401 --- sys/arm64/arm64/vfp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c index 4935946d2430..9de27349fb8d 100644 --- a/sys/arm64/arm64/vfp.c +++ b/sys/arm64/arm64/vfp.c @@ -208,7 +208,15 @@ vfp_save_state(struct thread *td, struct pcb *pcb) void vfp_reset_state(struct thread *td, struct pcb *pcb) { + /* Discard the threads VFP state before resetting it */ critical_enter(); + vfp_discard(td); + critical_exit(); + + /* + * Clear the thread state. The VFP is disabled and is not the current + * VFP thread so we won't change any of these on context switch. + */ bzero(&pcb->pcb_fpustate.vfp_regs, sizeof(pcb->pcb_fpustate.vfp_regs)); KASSERT(pcb->pcb_fpusaved == &pcb->pcb_fpustate, ("pcb_fpusaved should point to pcb_fpustate.")); @@ -216,8 +224,6 @@ vfp_reset_state(struct thread *td, struct pcb *pcb) pcb->pcb_fpustate.vfp_fpsr = 0; pcb->pcb_vfpcpu = UINT_MAX; pcb->pcb_fpflags = 0; - vfp_discard(td); - critical_exit(); } void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104081018.138AI4Eg012697>