From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSq8W-0006Yk-4e for qemu-devel@nongnu.org; Wed, 26 Mar 2014 11:53:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSq8Q-0005Iw-4b for qemu-devel@nongnu.org; Wed, 26 Mar 2014 11:53:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSq8P-0005Il-SY for qemu-devel@nongnu.org; Wed, 26 Mar 2014 11:52:58 -0400 Message-ID: <5332F7D3.7000209@redhat.com> Date: Wed, 26 Mar 2014 16:52:51 +0100 From: Laszlo Ersek MIME-Version: 1.0 References: <20140326064510.5518.72436.malonedeb@chaenomeles.canonical.com> <20140326064510.5518.72436.malonedeb@chaenomeles.canonical.com> <20140326103112.GA20219@redhat.com> <5332C7D2.3030901@redhat.com> <20140326125828.GA2192@redhat.com> <20140326144829.52f72b74@nial.usersys.redhat.com> In-Reply-To: <20140326144829.52f72b74@nial.usersys.redhat.com> Content-Type: multipart/mixed; boundary="------------060306060103020308050503" Subject: Re: [Qemu-devel] [Bug 1297651] [NEW] KVM create a win7 guest with Qemu, it boots up fail List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov , "Michael S. Tsirkin" Cc: robert.hu@intel.com, Bug 1297651 <1297651@bugs.launchpad.net>, qemu-devel@nongnu.org, ehabkost@redhat.com This is a multi-part message in MIME format. --------------060306060103020308050503 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 03/26/14 14:48, Igor Mammedov wrote: > On Wed, 26 Mar 2014 14:58:28 +0200 > "Michael S. Tsirkin" wrote: >> If we want to change ACPI rev, I think we should do this >> conditionally when max_cpus > 255. >> Would be worth it if this fixes some guests. >> >> As for reverting, I think it's a problem that we seem to >> allow max_cpus = 256 but then it doesn't really work. > more clean would be to abort if CPON index (i.e. APIC ID) > is more than 255. That would affect small number of weird > topologies but sould be fine for most usecases. The question is not about a CPON index / APIC ID that *exceeds* 255. Eduardo's patches already make sure that the APIC ID *width* is at most 8 bits, so the highest APIC ID that any VCPU can take is already at most 255. (IOW the exclusive limit for APIC IDs is already 256.) In other words, the CPON index already can't exceed 255. The question is about the CPON index / APIC ID that is *precisely* 255. Eduardo's patches allow this (correctly), but the SSDT generator used *not* to create a CPON array element for the index 255. The generator limited the CPON element *count* in 255, hence the maximum CPON index (== APIC ID) that was available for hotplugging used to be 254. My patch wanted to bump this CPON size one higher (to 256), so that the VCPU with APIC ID 255 (== CPON array index 255) becomes hotpluggable. However. Given that (a) for PC, we limit the *number* of VCPUs in 255, inclusive (ie. max vcpu *index* is 254), and (b) Eduardo's patches (correctly) restrict the accepted topologies so that any APIC ID fits into 8 bits, it turns out that there simply isn't a (VCPU count, topology) pair, accepted by (a) and (b) simultaneously, that would enable a VCPU APIC ID of 255. The attached program prints nothing. (Note that as soon as you break (a), ie. increase MAX_CPUS to 256 in the attached program, you immediately get a bunch of topologies where APIC ID (CPON index) 255 becomes possible, while keeping (b) intact.) Hence my patches fix a case that is purely academical (never happens in practice) as long as (a) and (b) are guaranteed *together*. I should have done more research before posting my patches. Thanks (and sorry about the churn), Laszlo --------------060306060103020308050503 Content-Type: text/plain; charset=ISO-8859-2; name="x.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="x.c" I2RlZmluZSBfWE9QRU5fU09VUkNFIDUwMAoKI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRl IDxhc3NlcnQuaD4KCi8qIHRoaXMgaXMgYW4gaW5jbHVzaXZlIGxpbWl0IG9uIHRoZSBudW1i ZXIgb2YgVkNQVXMgKi8KI2RlZmluZSBNQVhfQ1BVUyAyNTUKCi8qIEBsaW1pdCBpcyBleGNs dXNpdmUgKi8Kc3RhdGljIHVuc2lnbmVkCndpZHRoKHVuc2lnbmVkIGxpbWl0KQp7CiAgICBh c3NlcnQobGltaXQgIT0gMCk7CiAgICBpZiAobGltaXQgPT0gICAxKSB7IHJldHVybiAwOyB9 CiAgICBpZiAobGltaXQgPT0gICAyKSB7IHJldHVybiAxOyB9CiAgICBpZiAobGltaXQgPD0g ICA0KSB7IHJldHVybiAyOyB9CiAgICBpZiAobGltaXQgPD0gICA4KSB7IHJldHVybiAzOyB9 CiAgICBpZiAobGltaXQgPD0gIDE2KSB7IHJldHVybiA0OyB9CiAgICBpZiAobGltaXQgPD0g IDMyKSB7IHJldHVybiA1OyB9CiAgICBpZiAobGltaXQgPD0gIDY0KSB7IHJldHVybiA2OyB9 CiAgICBpZiAobGltaXQgPD0gMTI4KSB7IHJldHVybiA3OyB9CiAgICBhc3NlcnQobGltaXQg PD0gMjU2KTsKICAgIHJldHVybiA4Owp9CgppbnQKbWFpbih2b2lkKQp7CiAgICB1bnNpZ25l ZCBwa2dzLCBjb3JlcywgdGhyZWFkczsKCiAgICBmb3IgKCAgICAgICAgcGtncyAgICA9IDE7 IHBrZ3MgICAgICAgICAgICAgICAgICAgPD0gTUFYX0NQVVM7ICsrcGtncyAgICkgewogICAg ICAgIGZvciAoICAgIGNvcmVzICAgPSAxOyBwa2dzICogY29yZXMgICAgICAgICAgIDw9IE1B WF9DUFVTOyArK2NvcmVzICApIHsKICAgICAgICAgICAgZm9yICh0aHJlYWRzID0gMTsgcGtn cyAqIGNvcmVzICogdGhyZWFkcyA8PSBNQVhfQ1BVUzsgKyt0aHJlYWRzKSB7CiAgICAgICAg ICAgICAgICAvKiB0aGlzIGlzIGFuIGFjdHVhbCBBUElDIElELCBub3QgYW4gZXhjbHVzaXZl IGxpbWl0ICovCiAgICAgICAgICAgICAgICB1bnNpZ25lZCBtYXhfYXBpY19pZDsKCiAgICAg ICAgICAgICAgICAvKiB3ZSBsaW1pdCB0aGUgd2lkdGggb2YgQVBJQyBJRHMgaW4gOCBiaXRz ICovCiAgICAgICAgICAgICAgICBpZiAod2lkdGgocGtncykgKyB3aWR0aChjb3JlcykgKyB3 aWR0aCh0aHJlYWRzKSA+IDgpIHsKICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAg ICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBtYXhfYXBpY19pZCA9ICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgcGtncyAgICAtIDE7CiAgICAgICAgICAgICAg ICBtYXhfYXBpY19pZCA9IChtYXhfYXBpY19pZCA8PCB3aWR0aChjb3JlcykgICkgfCAoY29y ZXMgICAtIDEpOwogICAgICAgICAgICAgICAgbWF4X2FwaWNfaWQgPSAobWF4X2FwaWNfaWQg PDwgd2lkdGgodGhyZWFkcykpIHwgKHRocmVhZHMgLSAxKTsKCiAgICAgICAgICAgICAgICBh c3NlcnQobWF4X2FwaWNfaWQgPCAyNTYpOwogICAgICAgICAgICAgICAgaWYgKG1heF9hcGlj X2lkID09IDI1NSkgewogICAgICAgICAgICAgICAgICAgIGZwcmludGYoc3Rkb3V0LCAiKCUz dSwgJTN1LCAlM3UpOiAiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiY3B1cz0lM3Ug bWF4X2FwaWNfaWQ9JTN1XG4iLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGtncywg Y29yZXMsIHRocmVhZHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwa2dzICogY29y ZXMgKiB0aHJlYWRzLCBtYXhfYXBpY19pZCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAg ICAgIH0KICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gMDsKfQo= --------------060306060103020308050503--