Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 May 2018 08:24:59 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r333167 - stable/11/sys/amd64/vmm
Message-ID:  <201805020824.w428OxpJ095242@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed May  2 08:24:59 2018
New Revision: 333167
URL: https://svnweb.freebsd.org/changeset/base/333167

Log:
  MFC r332932:
  Correct undesirable interaction between caching of %cr4 in bhyve and
  invltlb_glob().

Modified:
  stable/11/sys/amd64/vmm/vmm_host.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/vmm/vmm_host.c
==============================================================================
--- stable/11/sys/amd64/vmm/vmm_host.c	Wed May  2 08:19:06 2018	(r333166)
+++ stable/11/sys/amd64/vmm/vmm_host.c	Wed May  2 08:24:59 2018	(r333167)
@@ -59,7 +59,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805020824.w428OxpJ095242>