Date: Mon, 15 Aug 2016 09:06:33 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r304132 - stable/9/sys/amd64/amd64 Message-ID: <201608150906.u7F96Xht061339@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Mon Aug 15 09:06:33 2016 New Revision: 304132 URL: https://svnweb.freebsd.org/changeset/base/304132 Log: MFC r302835: fix-up for configuration of AMD Family 10h processors borrowed from Linux Modified: stable/9/sys/amd64/amd64/initcpu.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/9/sys/amd64/amd64/initcpu.c Mon Aug 15 09:04:31 2016 (r304131) +++ stable/9/sys/amd64/amd64/initcpu.c Mon Aug 15 09:06:33 2016 (r304132) @@ -120,6 +120,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); + } + } } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608150906.u7F96Xht061339>