The NetBSD Project

CVS log for src/sys/arch/arm/vfp/vfp_init.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / arch / arm / vfp

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: matt-nb8-mediatek


Revision 1.53.2.1.2.1 / (download) - annotate - [select for diffs], Wed Dec 13 00:57:58 2017 UTC (6 years, 4 months ago) by matt
Branch: matt-nb8-mediatek
Changes since 1.53.2.1: +2 -1 lines
Diff to previous 1.53.2.1 (colored) next main 1.54 (colored)

Make the VFP is disabled after disabling it.

Revision 1.53.2.1 / (download) - annotate - [select for diffs], Tue Oct 24 09:14:59 2017 UTC (6 years, 5 months ago) by snj
Branch: netbsd-8
CVS Tags: netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, matt-nb8-mediatek-base
Branch point for: matt-nb8-mediatek
Changes since 1.53: +9 -10 lines
Diff to previous 1.53 (colored) next main 1.54 (colored)

Pull up following revision(s) (requested by bouyer in ticket #326):
	sys/arch/arm/vfp/vfp_init.c: revision 1.54-1.55
	sys/kern/subr_pcu.c: revision 1.21
PR port-arm/52603:
There is a race here, as seen on arm with FPU:
LWP L is running but not on CPU, has its FPU state on CPU2 which
has not been released yet, so fpexc still has VFP_FPEXC_EN set in the PCB copy.
LWP L is scheduled on CPU1, CPU1 calls cpu_switchto() for L in mi_switch().
cpu_switchto() will set VFP_FPEXC_EN in the FPU's fpexc register per the
PCB fpexc copy.
Before CPU1 calls pcu_switchpoint() for L, CPU2 calls
pcu_do_op(PCU_CMD_SAVE | PCU_CMD_RELEASE) for L because it still holds its
FPU state and wants to load another lwp. This cause VFP_FPEXC_EN to
be cleared in the PCB copy, but not in CPU1's register. L's l_pcu_cpu is
set to NULL.
When CPU1 calls pcu_switchpoint() for L it see l_pcu_cpu is NULL, and doesn't
call the release callback.
Now CPU1 has its FPU enabled but with the wrong FPU state.
Fix by releasing the PCU even if l_pcu_cpu is NULL.
--
In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.
--
We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>