svn commit: r304131 - stable/10/sys/amd64/amd64

Andriy Gapon avg at FreeBSD.org
Mon Aug 15 09:04:32 UTC 2016


Author: avg
Date: Mon Aug 15 09:04:31 2016
New Revision: 304131
URL: https://svnweb.freebsd.org/changeset/base/304131

Log:
  MFC r302835: fix-up for configuration of AMD Family 10h processors
  borrowed from Linux

Modified:
  stable/10/sys/amd64/amd64/initcpu.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/initcpu.c
==============================================================================
--- stable/10/sys/amd64/amd64/initcpu.c	Mon Aug 15 09:04:13 2016	(r304130)
+++ stable/10/sys/amd64/amd64/initcpu.c	Mon Aug 15 09:04:31 2016	(r304131)
@@ -125,6 +125,20 @@ init_amd(void)
 			wrmsr(MSR_NB_CFG1, msr);
 		}
 	}
+
+	/*
+	 * BIOS may configure Family 10h processors to convert WC+ cache type
+	 * to CD.  That can hurt performance of guest VMs using nested paging.
+	 * The relevant MSR bit is not documented in the BKDG,
+	 * the fix is borrowed from Linux.
+	 */
+	if (CPUID_TO_FAMILY(cpu_id) == 0x10) {
+		if ((cpu_feature2 & CPUID2_HV) == 0) {
+			msr = rdmsr(0xc001102a);
+			msr &= ~((uint64_t)1 << 24);
+			wrmsr(0xc001102a, msr);
+		}
+	}
 }
 
 /*


More information about the svn-src-stable-10 mailing list