From: Nadav Amit Subject: 2 CPU Conformance Issue in KVM/x86 Date: Tue, 3 Mar 2015 10:34:23 +0200 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: =?utf-8?Q?Radim_Kr=C4=8Dm=C3=A1=C5=99?= To: kvm list , Paolo Bonzini Return-path: Received: from mail-we0-f178.google.com ([74.125.82.178]:36179 "EHLO mail-we0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754478AbbCCIe3 convert rfc822-to-8bit (ORCPT ); Tue, 3 Mar 2015 03:34:29 -0500 Received: by wesq59 with SMTP id q59so1337415wes.3 for ; Tue, 03 Mar 2015 00:34:28 -0800 (PST) Sender: kvm-owner@vger.kernel.org List-ID: I got two conformance issues in x86/KVM. For the first one I have no solution. For the latter, my solution is not =E2=80=9Cgreat=E2=80=9D. I= deas and feedback would be appreciated. The first problem is caused by the deprecating of FPU CS/DS in new Inte= l CPUs. Assume the VM executes a floating point instruction in real mode = (when CS !=3D 0), and later KVM exits to userspace, causing XSAVE/XRSTOR to s= ave and restore the FPU state. At this point FPU CS/DS in new CPUs are zero. If= the VM then executes FSAVE in real-mode the save FPU IP would be wrong, sin= ce it is actually calculated by the CPU as [FPU CS] * 4 + [FPU IP]. The second problem occurs when the maximum physical address width that = KVM reports to the VM is different than the real one. Assume the real one i= s greater than the reported one (which in KVM is not greater than 40). In= this case, the VM might expect exceptions when PTE bits which are higher tha= n the maximum (reported) address width are set, and it would not get such exceptions. This problem can easily be experienced by small change to t= he existing KVM unit-tests. There are many variants to this problem, and the only solution which I consider complete is to report to the VM the maximum (52) physical addr= ess width to the VM, configure the VM to exit on #PF with reserved-bit error-codes, and then emulate these faulting instructions. Thoughts/ideas? Regards, Nadav