From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MJCko-0004ML-N1 for qemu-devel@nongnu.org; Tue, 23 Jun 2009 16:38:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MJCkk-0004DU-0L for qemu-devel@nongnu.org; Tue, 23 Jun 2009 16:38:06 -0400 Received: from [199.232.76.173] (port=39036 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJCkj-0004DA-Lx for qemu-devel@nongnu.org; Tue, 23 Jun 2009 16:38:01 -0400 Received: from mx2.redhat.com ([66.187.237.31]:51775) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MJCkj-0002VJ-3p for qemu-devel@nongnu.org; Tue, 23 Jun 2009 16:38:01 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5NKbxaR023964 for ; Tue, 23 Jun 2009 16:37:59 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5NKbwQE023101 for ; Tue, 23 Jun 2009 16:37:58 -0400 Received: from random.random (vpn-10-125.str.redhat.com [10.32.10.125]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5NKbuAZ030421 for ; Tue, 23 Jun 2009 16:37:57 -0400 Date: Tue, 23 Jun 2009 18:21:40 +0200 From: Andrea Arcangeli Message-ID: <20090623162140.GB4379@random.random> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] allow sysenter on 32bit guests running on vmx host List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Andrea Arcangeli model=2 is not existent when vendor is intel and an errata of P6 says that any model <= 2 when family is 6 lack sap feature, so windows and linux 32bit guests disable sap in software and slowdown for no good reason when running inside kvm on intel CPU. Fix is to set model = 3 so it'll be the duron cpu when kvm runs on amd bare metal (not anymore athlon but userland doesn't see the difference) and it'll be PII that has sysenter functional like all cpus that run KVM have too when on intel bare metal. Patch will follow, workaround without this fix is -cpu qemu64,model=3. There is a bug in skype that it checks if the sep feature is set to run sysenter on intel chip inside its binary without passing through ntdll, without verifying the model was <= 2 like windows does, so windows forbids sysenter but skype calls it anyway and crashes (this is why recent skype stopped working on KVM). This is skype bug and it would trigger on real P6 hardware too (but nobody tests skype on P6). qemu64,-sep fixed skype too. But because every time we have an intel cpu running kvm, we also have sysenter functioning, we boots the model to 3 so windows 32bit (and linux32bit) gets a performance boost with sysenter too. Signed-off-by: Andrea Arcangeli --- diff --git a/target-i386/helper.c b/target-i386/helper.c index 8a76abd..636e113 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -139,7 +139,8 @@ static x86_def_t x86_defs[] = { .vendor2 = CPUID_VENDOR_AMD_2, .vendor3 = CPUID_VENDOR_AMD_3, .family = 6, - .model = 2, + /* AMD Duron || PII Intel with sep capbility - P6 has no sep */ + .model = 3, .stepping = 3, .features = PPRO_FEATURES | /* these features are needed for Win64 and aren't fully implemented */