]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
amd64: ensure that curproc->p_vmspace pmap always matches PCPU
authorKonstantin Belousov <kib@FreeBSD.org>
Tue, 14 Aug 2018 16:37:14 +0000 (16:37 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Tue, 14 Aug 2018 16:37:14 +0000 (16:37 +0000)
commit8fba5348fc5fec93d56b5d540962f94b4685e7c0
tree97c05d29284d0aba79c4cb5a4947098cd7a5a735
parent6f207f5b471efaa29a65a7ccd40dfd5d348f0a03
amd64: ensure that curproc->p_vmspace pmap always matches PCPU
curpmap.

When performing context switch on a machine without PCID, if current
%cr3 equals to the new pmap %cr3, which is typical for kernel_pmap
vs. kernel process, I overlooked to update PCPU curpmap value.  Remove
check for %cr3 not equal to pm_cr3 for doing the update.  It is
believed that this case cannot happen at all, due to other changes in
this revision.

Also, do not set the very first curpmap to kernel_pmap, it should be
vmspace0 pmap instead to match curproc.

Move the common code to activate the initial pmap both on BSP and APs
into pmap_activate_boot() helper.

Reported by: eadler, ambrisko
Discussed with: kevans
Reviewed by: alc, markj (previous version)
Tested by: ambrisko (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16618
sys/amd64/amd64/mp_machdep.c
sys/amd64/amd64/pmap.c
sys/amd64/include/pmap.h