Page MenuHomeFreeBSD

D6059.id15491.diff
No OneTemporary

D6059.id15491.diff

Index: sys/amd64/amd64/initcpu.c
===================================================================
--- sys/amd64/amd64/initcpu.c
+++ sys/amd64/amd64/initcpu.c
@@ -58,6 +58,7 @@
static void
init_amd(void)
{
+ uint64_t msr;
/*
* Work around Erratum 721 for Family 10h and 12h processors.
@@ -80,6 +81,20 @@
wrmsr(0xc0011029, rdmsr(0xc0011029) | 1);
break;
}
+
+ /*
+ * 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);
+ }
+ }
}
/*

File Metadata

Mime Type
text/plain
Expires
Sat, Jul 18, 12:52 AM (11 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35181909
Default Alt Text
D6059.id15491.diff (820 B)

Event Timeline