From: Rusty Russell Date: Sat, 18 Jul 2009 03:47:44 +0000 (-0600) Subject: lguest: restrict CPUID to avoid perf counter wrmsr X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7a5049205f7265620c48781814155f2763e70abb;p=linux-beck.git lguest: restrict CPUID to avoid perf counter wrmsr Avoid the following: [ 0.012093] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x2f/0x40() Rather than chase each new cpuid-detected feature, just lie about the highest valid CPUID so this code is never run. Signed-off-by: Rusty Russell --- diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 0188fd37b6c0..f2bf1f73d468 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c @@ -379,6 +379,11 @@ static void lguest_cpuid(unsigned int *ax, unsigned int *bx, native_cpuid(ax, bx, cx, dx); switch (function) { + case 0: /* ID and highest CPUID. Futureproof a little by sticking to + * older ones. */ + if (*ax > 5) + *ax = 5; + break; case 1: /* Basic feature request. */ /* We only allow kernel to see SSE3, CMPXCHG16B and SSSE3 */ *cx &= 0x00002201;