From: "Clyde Griffin" Subject: [PATCH] Fix hvm cpuid to hide hyperthreaded processor when apic is disabled. Date: Wed, 19 Apr 2006 15:31:23 -0400 Message-ID: <44463A58.A6A3.00AD.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartE1C4EE1B.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=__PartE1C4EE1B.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 2 Issues: Issue 1) 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.) To avoid any confusion within the hvm guest about MP availability, I = propose that we use "acpi=3D0" and "apic=3D0" as the Xen way of indicating = to the guest that it should not make any attempt to run an MP enabled = kernel. "acpi=3D0" will hide the MADT table and "apic=3D0" will hide the = APIC and HTT cpuid feature bits from the guest. I ran this proposed change by Intel (Wilfred) and AMD (Elsie) and unless = someone comes up with other reasons why we should not hide HTT when = apic=3D0, they are okay with this change. =20 Issue 2) Also fixed a logic problem the code path where apic=3D0 was not = being handled correctly (vmx path only). Compare with the svm counterpart. Please also add to 3.0.2. Signed- off- by: Clyde Griffin --=__PartE1C4EE1B.0__= Content-Type: application/octet-stream; name="xen-hvm-cpuid-ht.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="xen-hvm-cpuid-ht.diff" SW5kZXg6IHhlbi0zLjAtdGVzdGluZy94ZW4vYXJjaC94ODYvaHZtL3N2bS9zdm0uYwo9PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09Ci0tLSB4ZW4tMy4wLXRlc3Rpbmcub3JpZy94ZW4vYXJjaC94ODYvaHZtL3N2bS9zdm0uYwor KysgeGVuLTMuMC10ZXN0aW5nL3hlbi9hcmNoL3g4Ni9odm0vc3ZtL3N2bS5jCkBAIC05MTksNyAr OTE5LDEzIEBAIHN0YXRpYyB2b2lkIHN2bV92bWV4aXRfZG9fY3B1aWQoc3RydWN0IHYKICAgICB7 CiAgICAgICAgIGlmICggIWh2bV9hcGljX3N1cHBvcnQodi0+ZG9tYWluKSB8fAogICAgICAgICAg ICAgICAgICF2bGFwaWNfZ2xvYmFsX2VuYWJsZWQoKFZMQVBJQyh2KSkpICkKKyAgICAgICAgewog ICAgICAgICAgICAgY2xlYXJfYml0KFg4Nl9GRUFUVVJFX0FQSUMsICZlZHgpOworICAgICAgICAg ICAgLyogU2luY2UgdGhlIGFwaWMgaXMgZGlzYWJsZWQsIGF2b2lkIGFueSBjb25mdXNpb24gYWJv dXQgU01QIGNwdXMgYmVpbmcgYXZhaWxhYmxlICovCisgICAgICAgICAgICBjbGVhcl9iaXQoWDg2 X0ZFQVRVUkVfSFQsICZlZHgpOyAgLyogY2xlYXIgdGhlIGh5cGVydGhyZWFkIGJpdCAqLworICAg ICAgICAgICAgZWJ4ICY9IDB4RkYwMEZGRkY7ICAvKiBzZXQgdGhlIGxvZ2ljYWwgcHJvY2Vzc29y IGNvdW50IHRvIDEgKi8KKyAgICAgICAgICAgIGVieCB8PSAweDAwMDEwMDAwOworICAgICAgICB9 CiAJICAgIAogI2lmIENPTkZJR19QQUdJTkdfTEVWRUxTIDwgMwogICAgICAgICBjbGVhcl9iaXQo WDg2X0ZFQVRVUkVfUEFFLCAmZWR4KTsKSW5kZXg6IHhlbi0zLjAtdGVzdGluZy94ZW4vYXJjaC94 ODYvaHZtL3ZteC92bXguYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSB4ZW4tMy4wLXRlc3Rpbmcub3JpZy94ZW4v YXJjaC94ODYvaHZtL3ZteC92bXguYworKysgeGVuLTMuMC10ZXN0aW5nL3hlbi9hcmNoL3g4Ni9o dm0vdm14L3ZteC5jCkBAIC04MjcsOSArODI3LDE2IEBAIHN0YXRpYyB2b2lkIHZteF92bWV4aXRf ZG9fY3B1aWQoc3RydWN0IGMKIAogICAgIGlmICggaW5wdXQgPT0gMSApCiAgICAgewotICAgICAg ICBpZiAoIGh2bV9hcGljX3N1cHBvcnQodi0+ZG9tYWluKSAmJgorICAgICAgICBpZiAoICFodm1f YXBpY19zdXBwb3J0KHYtPmRvbWFpbikgfHwKICAgICAgICAgICAgICAhdmxhcGljX2dsb2JhbF9l bmFibGVkKChWTEFQSUModikpKSApCisgICAgICAgIHsKICAgICAgICAgICAgIGNsZWFyX2JpdChY ODZfRkVBVFVSRV9BUElDLCAmZWR4KTsKKyAgICAgICAgICAgIC8qIFNpbmNlIHRoZSBhcGljIGlz IGRpc2FibGVkLCBhdm9pZCBhbnkgY29uZnVzaW9uIGFib3V0IFNNUCBjcHVzIGJlaW5nIGF2YWls YWJsZSAqLworICAgICAgICAgICAgY2xlYXJfYml0KFg4Nl9GRUFUVVJFX0hULCAmZWR4KTsgIC8q IGNsZWFyIHRoZSBoeXBlcnRocmVhZCBiaXQgKi8KKyAgICAgICAgICAgIGVieCAmPSAweEZGMDBG RkZGOyAgLyogc2V0IHRoZSBsb2dpY2FsIHByb2Nlc3NvciBjb3VudCB0byAxICovCisgICAgICAg ICAgICBlYnggfD0gMHgwMDAxMDAwMDsKKyAgICAgICAgfQorCiAKICNpZiBDT05GSUdfUEFHSU5H X0xFVkVMUyA8IDMKICAgICAgICAgY2xlYXJfYml0KFg4Nl9GRUFUVVJFX1BBRSwgJmVkeCk7Cg== --=__PartE1C4EE1B.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__PartE1C4EE1B.0__=--