From: "Andre Przywara" <andre.przywara@amd.com>
To: Keir.Fraser@cl.cam.ac.uk
Cc: xen-devel@lists.xensource.com
Subject: [PATCH] hvm: Fix APIC-ID cpuid intercept
Date: Wed, 06 Feb 2008 23:44:54 +0100 [thread overview]
Message-ID: <47AA3866.8050606@amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]
Hi,
the HVM CPUID intercept does not mask out the local APIC ID bits in
CPUID Fn0000_0001, bits 24-31 in EBX. This results in inconsistent
values of subsequent calls to cpuid on the same VCPU (delivering the
value of the physical CPU), depending on the current scheduling. This
for instance confuses Linux' NUMA code.
The attached patch fixes this by replacing the physical APIC ID with the
VCPU number, both in the VMX and SVM branches.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
I hope this does not trigger any side effects...
Regards,
Andre
--
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 277-84917
----to satisfy European Law for business letters:
AMD Saxony Limited Liability Company & Co. KG,
Wilschdorfer Landstr. 101, 01109 Dresden, Germany
Register Court Dresden: HRA 4896, General Partner authorized
to represent: AMD Saxony LLC (Wilmington, Delaware, US)
General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy
[-- Attachment #2: apic_id.patch --]
[-- Type: text/plain, Size: 1159 bytes --]
diff -r f8db1c6baad9 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c Tue Feb 05 23:27:12 2008 +0000
+++ b/xen/arch/x86/hvm/svm/svm.c Wed Feb 06 13:36:50 2008 +0100
@@ -1015,6 +1015,8 @@ static void svm_vmexit_do_cpuid(struct v
__clear_bit(X86_FEATURE_HT & 31, &edx);
ebx &= 0xFF00FFFF; /* clear the logical processor count when HTT=0 */
ebx |= 0x00010000; /* set to 1 just for precaution */
+ ebx &= 0x00FFFFFF; /* clear the APIC ID */
+ ebx |= (current->vcpu_id&0xFF)<<24; /* replace with vcpu_id */
break;
case 0x80000001:
diff -r f8db1c6baad9 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Tue Feb 05 23:27:12 2008 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c Wed Feb 06 13:36:50 2008 +0100
@@ -1311,6 +1311,8 @@ void vmx_cpuid_intercept(
case 0x00000001:
*ecx &= ~VMX_VCPU_CPUID_L1_ECX_RESERVED;
*ebx &= NUM_THREADS_RESET_MASK;
+ *ebx &= 0x00FFFFFF;
+ *ebx |= (current->vcpu_id&0xFF)<<24;
*ecx &= ~(bitmaskof(X86_FEATURE_VMXE) |
bitmaskof(X86_FEATURE_EST) |
bitmaskof(X86_FEATURE_TM2) |
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2008-02-06 22:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-06 22:44 Andre Przywara [this message]
2008-02-07 8:19 ` [PATCH] hvm: Fix APIC-ID cpuid intercept Keir Fraser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47AA3866.8050606@amd.com \
--to=andre.przywara@amd.com \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.