diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2018-04-24 13:44:19 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2018-04-24 13:44:19 +0000 |
commit | b7941dc91ecb95314c1faab97715761aa3e3cb3c (patch) | |
tree | 546dbd03e3040e52162dfaabdf61edca80636ecd /sys/amd64 | |
parent | 66e77f8d1cb185966fe3209dee7b5621eca44e96 (diff) | |
download | src-b7941dc91ecb95314c1faab97715761aa3e3cb3c.tar.gz src-b7941dc91ecb95314c1faab97715761aa3e3cb3c.zip |
Correct undesirable interaction between caching of %cr4 in bhyve and
invltlb_glob().
Reviewed by: grehan, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D15138
Notes
Notes:
svn path=/head/; revision=332932
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/vmm/vmm_host.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/amd64/vmm/vmm_host.c b/sys/amd64/vmm/vmm_host.c index 27b80000bdb1..4a36296beab2 100644 --- a/sys/amd64/vmm/vmm_host.c +++ b/sys/amd64/vmm/vmm_host.c @@ -61,7 +61,16 @@ vmm_host_state_init(void) */ vmm_host_cr0 = rcr0() | CR0_TS; - vmm_host_cr4 = rcr4(); + /* + * On non-PCID or PCID but without INVPCID support machines, + * we flush kernel i.e. global TLB entries, by temporary + * clearing the CR4.PGE bit, see invltlb_glob(). If + * preemption occurs at the wrong time, cached vmm_host_cr4 + * might store the value with CR4.PGE cleared. Since FreeBSD + * requires support for PG_G on amd64, just set it + * unconditionally. + */ + vmm_host_cr4 = rcr4() | CR4_PGE; /* * Only permit a guest to use XSAVE if the host is using |