[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] There are instances where we DO NOT want an hvm guest to run an



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID ff553bb82e93f57e0aa0ae2b5891c276f0c3e860
# Parent  f79656988ecf191e75fd3cc63889c2893f0bdcec
There are instances where we DO NOT want an hvm guest to run an
MP enabled kernel.  In such situations we should have a workaround to
guarantee hvm guests will not detect MP.

For example, in the absence of ACPI and MPS the installation code in some
linux distributions key off the presence of cpuid edx/HTT bit (indicating
the presence of Hyper-Threading Technology) to determine if another
logical processor is present and if so load an MP enabled kernel instead
of a uniprocessor kernel.  SMBIOS is also looked at for the same purpose
and presents a potential problem as well.  While both approaches for
selecting an MP kernel are debatable (since using MPS or ACPI have long
been the standard for MP detection), these approaches are something we
have to live and work around with because making a change in the fully
virtualized guest is not an option.

To solve the problem we need to hide all secondary processors from the hvm
guest.  Since the hvm does not surface MPS tables, we only need to deal
with ACPI, cpuid HTT, and possibly SMBIOS.   (I did not have time right
now to look closely at the hvm BIOS to know if SMBIOS is also going to be
a problem.)

Also fixes a logic problem the code path where apic=0 was not
being handled correctly (vmx path only).

Signed-off-by:  Clyde Griffin <cgriffin@xxxxxxxxxx>

diff -r f79656988ecf -r ff553bb82e93 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Fri Apr 21 09:38:20 2006 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Fri Apr 21 09:57:29 2006 +0100
@@ -919,7 +919,13 @@ static void svm_vmexit_do_cpuid(struct v
     {
         if ( !hvm_apic_support(v->domain) ||
                 !vlapic_global_enabled((VLAPIC(v))) )
+        {
             clear_bit(X86_FEATURE_APIC, &edx);
+            /* Since the apic is disabled, avoid any confusion about SMP cpus 
being available */
+            clear_bit(X86_FEATURE_HT, &edx);  /* clear the hyperthread bit */
+            ebx &= 0xFF00FFFF;  /* set the logical processor count to 1 */
+            ebx |= 0x00010000;
+        }
            
 #if CONFIG_PAGING_LEVELS < 3
         clear_bit(X86_FEATURE_PAE, &edx);
diff -r f79656988ecf -r ff553bb82e93 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Fri Apr 21 09:38:20 2006 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Fri Apr 21 09:57:29 2006 +0100
@@ -827,9 +827,16 @@ static void vmx_vmexit_do_cpuid(struct c
 
     if ( input == 1 )
     {
-        if ( hvm_apic_support(v->domain) &&
+        if ( !hvm_apic_support(v->domain) ||
              !vlapic_global_enabled((VLAPIC(v))) )
+        {
             clear_bit(X86_FEATURE_APIC, &edx);
+            /* Since the apic is disabled, avoid any confusion about SMP cpus 
being available */
+            clear_bit(X86_FEATURE_HT, &edx);  /* clear the hyperthread bit */
+            ebx &= 0xFF00FFFF;  /* set the logical processor count to 1 */
+            ebx |= 0x00010000;
+        }
+
 
 #if CONFIG_PAGING_LEVELS < 3
         clear_bit(X86_FEATURE_PAE, &edx);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.