Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm Reap LWP_VFPUSED and use PCU internal tracking.
details: https://anonhg.NetBSD.org/src/rev/f3b6e29a6347
branches: trunk
changeset: 789575:f3b6e29a6347
user: matt <matt%NetBSD.org@localhost>
date: Fri Aug 23 05:22:01 2013 +0000
description:
Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);
diffstat:
sys/arch/arm/arm/arm_machdep.c | 6 +++---
sys/arch/arm/arm/process_machdep.c | 7 +++----
sys/arch/arm/arm32/sys_machdep.c | 6 +++---
sys/arch/arm/arm32/vm_machdep.c | 5 ++---
sys/arch/arm/include/locore.h | 3 ++-
sys/arch/arm/include/proc.h | 3 +--
sys/arch/arm/vfp/vfp_init.c | 21 ++++++++++++---------
7 files changed, 26 insertions(+), 25 deletions(-)
diffs (206 lines):
diff -r 56239b714b78 -r f3b6e29a6347 sys/arch/arm/arm/arm_machdep.c
--- a/sys/arch/arm/arm/arm_machdep.c Fri Aug 23 05:02:46 2013 +0000
+++ b/sys/arch/arm/arm/arm_machdep.c Fri Aug 23 05:22:01 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_machdep.c,v 1.37 2013/08/18 06:28:18 matt Exp $ */
+/* $NetBSD: arm_machdep.c,v 1.38 2013/08/23 05:22:01 matt Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -78,7 +78,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.37 2013/08/18 06:28:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.38 2013/08/23 05:22:01 matt Exp $");
#include <sys/exec.h>
#include <sys/proc.h>
@@ -187,7 +187,7 @@
l->l_md.md_flags |= MDLWP_NOALIGNFLT;
#endif
#ifdef FPU_VFP
- vfp_discardcontext();
+ vfp_discardcontext(false);
#endif
}
diff -r 56239b714b78 -r f3b6e29a6347 sys/arch/arm/arm/process_machdep.c
--- a/sys/arch/arm/arm/process_machdep.c Fri Aug 23 05:02:46 2013 +0000
+++ b/sys/arch/arm/arm/process_machdep.c Fri Aug 23 05:22:01 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: process_machdep.c,v 1.26 2013/08/18 06:28:18 matt Exp $ */
+/* $NetBSD: process_machdep.c,v 1.27 2013/08/23 05:22:01 matt Exp $ */
/*
* Copyright (c) 1993 The Regents of the University of California.
@@ -133,7 +133,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.26 2013/08/18 06:28:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.27 2013/08/23 05:22:01 matt Exp $");
#include <sys/proc.h>
#include <sys/ptrace.h>
@@ -227,8 +227,7 @@
return EINVAL;
}
struct pcb * const pcb = lwp_getpcb(l);
- vfp_discardcontext();
- l->l_md.md_flags |= MDLWP_VFPUSED;
+ vfp_discardcontext(true);
pcb->pcb_vfp = regs->fpr_vfp;
pcb->pcb_vfp.vfp_fpexc &= ~VFP_FPEXC_EN;
#endif
diff -r 56239b714b78 -r f3b6e29a6347 sys/arch/arm/arm32/sys_machdep.c
--- a/sys/arch/arm/arm32/sys_machdep.c Fri Aug 23 05:02:46 2013 +0000
+++ b/sys/arch/arm/arm32/sys_machdep.c Fri Aug 23 05:22:01 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_machdep.c,v 1.17 2013/08/18 06:28:18 matt Exp $ */
+/* $NetBSD: sys_machdep.c,v 1.18 2013/08/23 05:22:01 matt Exp $ */
/*
* Copyright (c) 1995-1997 Mark Brinicombe.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.17 2013/08/18 06:28:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.18 2013/08/23 05:22:01 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -123,7 +123,7 @@
arm32_fpu_used(struct lwp *l, const void *uap, register_t *retval)
{
/* No args */
- retval[0] = (curlwp->l_md.md_flags & MDLWP_VFPUSED) != 0;
+ retval[0] = vfp_used_p();
return 0;
}
diff -r 56239b714b78 -r f3b6e29a6347 sys/arch/arm/arm32/vm_machdep.c
--- a/sys/arch/arm/arm32/vm_machdep.c Fri Aug 23 05:02:46 2013 +0000
+++ b/sys/arch/arm/arm32/vm_machdep.c Fri Aug 23 05:22:01 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.66 2013/05/11 07:35:58 skrll Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.67 2013/08/23 05:22:01 matt Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.66 2013/05/11 07:35:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.67 2013/08/23 05:22:01 matt Exp $");
#include "opt_armfpe.h"
#include "opt_pmap_debug.h"
@@ -131,7 +131,6 @@
* VFP state is valid.
*/
pcb2->pcb_vfp.vfp_fpexc &= ~VFP_FPEXC_EN;
- l2->l_md.md_flags = l1->l_md.md_flags & MDLWP_VFPUSED;
#endif
/*
diff -r 56239b714b78 -r f3b6e29a6347 sys/arch/arm/include/locore.h
--- a/sys/arch/arm/include/locore.h Fri Aug 23 05:02:46 2013 +0000
+++ b/sys/arch/arm/include/locore.h Fri Aug 23 05:22:01 2013 +0000
@@ -191,10 +191,11 @@
/* vfp_init.c */
void vfp_attach(void);
-void vfp_discardcontext(void);
+void vfp_discardcontext(bool);
void vfp_savecontext(void);
void vfp_kernel_acquire(void);
void vfp_kernel_release(void);
+bool vfp_used_p(void);
extern const pcu_ops_t arm_vfp_ops;
#endif /* !_LOCORE */
diff -r 56239b714b78 -r f3b6e29a6347 sys/arch/arm/include/proc.h
--- a/sys/arch/arm/include/proc.h Fri Aug 23 05:02:46 2013 +0000
+++ b/sys/arch/arm/include/proc.h Fri Aug 23 05:22:01 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.h,v 1.13 2012/12/25 22:34:36 matt Exp $ */
+/* $NetBSD: proc.h,v 1.14 2013/08/23 05:22:01 matt Exp $ */
/*
* Copyright (c) 1994 Mark Brinicombe.
@@ -48,7 +48,6 @@
};
/* Flags setttings for md_flags */
-#define MDLWP_VFPUSED 0x00000001 /* LWP used the VFP */
#define MDLWP_NOALIGNFLT 0x00000002 /* For EXEC_AOUT */
#define MDLWP_VFPINTR 0x00000004 /* VFP used in intr */
diff -r 56239b714b78 -r f3b6e29a6347 sys/arch/arm/vfp/vfp_init.c
--- a/sys/arch/arm/vfp/vfp_init.c Fri Aug 23 05:02:46 2013 +0000
+++ b/sys/arch/arm/vfp/vfp_init.c Fri Aug 23 05:22:01 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfp_init.c,v 1.24 2013/08/22 19:50:54 drochner Exp $ */
+/* $NetBSD: vfp_init.c,v 1.25 2013/08/23 05:22:01 matt Exp $ */
/*
* Copyright (c) 2008 ARM Ltd
@@ -191,8 +191,7 @@
return 1;
#endif
- if (__predict_false((l->l_md.md_flags & MDLWP_VFPUSED) == 0)) {
- l->l_md.md_flags |= MDLWP_VFPUSED;
+ if (__predict_false(!vfp_used_p())) {
pcb->pcb_vfp.vfp_fpscr =
(VFP_FPSCR_DN | VFP_FPSCR_FZ); /* Runfast */
}
@@ -485,9 +484,8 @@
* If a process has used the VFP, count a "used VFP, and took
* a trap to use it again" event.
*/
- if (__predict_false((l->l_md.md_flags & MDLWP_VFPUSED) == 0)) {
+ if (__predict_false((flags & PCU_LOADED) == 0)) {
vfpevent_use.ev_count++;
- l->l_md.md_flags |= MDLWP_VFPUSED;
pcb->pcb_vfp.vfp_fpscr = /* Runfast */
(VFP_FPSCR_DN | VFP_FPSCR_FZ | VFP_FPSCR_RN);
} else {
@@ -599,9 +597,15 @@
}
void
-vfp_discardcontext(void)
+vfp_discardcontext(bool used_p)
{
- pcu_discard(&arm_vfp_ops, false);
+ pcu_discard(&arm_vfp_ops, used_p);
+}
+
+bool
+vfp_used_p(void)
+{
+ return pcu_used_p(&arm_vfp_ops);
}
void
@@ -643,7 +647,7 @@
void
vfp_getcontext(struct lwp *l, mcontext_t *mcp, int *flagsp)
{
- if (l->l_md.md_flags & MDLWP_VFPUSED) {
+ if (vfp_used_p()) {
const struct pcb * const pcb = lwp_getpcb(l);
pcu_save(&arm_vfp_ops);
mcp->__fpu.__vfpregs.__vfp_fpscr = pcb->pcb_vfp.vfp_fpscr;
@@ -658,7 +662,6 @@
{
pcu_discard(&arm_vfp_ops, true);
struct pcb * const pcb = lwp_getpcb(l);
- l->l_md.md_flags |= MDLWP_VFPUSED;
pcb->pcb_vfp.vfp_fpscr = mcp->__fpu.__vfpregs.__vfp_fpscr;
memcpy(pcb->pcb_vfp.vfp_regs, mcp->__fpu.__vfpregs.__vfp_fstmx,
sizeof(mcp->__fpu.__vfpregs.__vfp_fstmx));
Home |
Main Index |
Thread Index |
Old Index