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

Re: [XEN PATCH] x86/ACPI: Ignore entries with invalid APIC IDs when parsing MADT


  • To: Simon Gaiser <simon@xxxxxxxxxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 23 Aug 2023 10:32:26 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/csi6HXDQXgudvsz+56a8rZ68eRR8lyq2H86xcgfGCs=; b=bU/Famu0mk/am9z6Gha3bG3sWBisHQkvhPrk2foMtnKgXgVuLF5Mmj2FRKUDISbU0/bumsX/6KVX2nIw/+yzKlH8tYT7dJ1r+GeIZEhVNQW7hSVFFs3BYrcBbmxRdtFMS9QRa2f73EL5OCUQEOW03lGIEWcRq8+7S4B3NXKMm2GyI+Q3HgXZo8WWUKWmUhDRgpXgoxzW2L9ZvBVM/PH8blGWq6XirkP+cpJwPgT5DHPtPJ/5TOreuVkUYcALLEHe0ciip4POsFpoLmD0TgM2IGBblIMzSAj4Q78ikGtnfC99xMqNou+OWuHNuOoainh+gdkTGVN0sBYKKUqXUa4iSA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cSH77QJJ3+ybj6gxp6XhynoaDXanBYaDrPz+vgbhMwPK6XLriKYAF1PD45SnyaFUZ7xYWrG+OaSd5OS5VXbK/rQIoVLRfQgAKf1LCzg9LS6gMur89SHn5aoOg7YTsrBmuRw6r+psMZjcrY7gX4hDcP2MuCrQVNHReZdzP6/WB/mlL40tJ7D6RyKvqGQVaTUfkGRpvQbTbcL5395yXif+R8/FD/6EYAVkRSIESBe1CKbZ7V15tr7zlcJV5JppsfJ8HB4QUQFWJKDBtMaVrWMh3gComYP3ln0pV40x7u4icYxIGwBb28FYkK7BOjUmzEmc9hMveBWIy0peVkNFLe8LwA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 23 Aug 2023 09:32:53 +0000
  • Ironport-data: A9a23:L1AO5qKUSGZfrFG5FE+RM5QlxSXFcZb7ZxGr2PjKsXjdYENS0TcDz DYfCm2POfaCMGamKYsnPo+29RlT6sfWzoI3SlRlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHvykU7Ss1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpKrfrawP9TlK6q4mhA7gZlPakjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5vWD5U/ vIVAwoVTU+8qeOu+YOpV9RV05FLwMnDZOvzu1lG5BSAVLMNZsmGRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/dppTGMkmSd05C0WDbRUvWMSd9YgQCzo WXe8n6iKhobKMae2XyO9XfEaurnxHmjAtlCT+HinhJsqBrInDUxGEwkb0Xhn9iDrxWZfvdEK ENBr0LCqoB3riRHVOLVRBy9p3isvxgCWsFRGek39AGMzKXP5w+TQGMDS1ZpeNEg8cM7WzEu/ luIhM/yQyxitqWPTnCQ/avSqim9UQAXJ2IfYS4PTSMe/sLu5oo0i3rnUdJLAKOzyNrvFlnYx jmQqSEkirY7jMgV1r6691TKnzKtoJfSSgc/oA7QWwqYAhhRYYekY8mj7gHd5PMZdYKBFADe4 j4DhtSU6/0IAdeVjiuRTe4RHbavofGYLDnbhl0pFJ4kn9iwx0OekUlryGkWDC9U3gwsIFcFv Ge7Vdtt2aJu
  • Ironport-hdrordr: A9a23:+im0XKGC1Qys6JufpLqEMceALOsnbusQ8zAXPiFKJSC9F/byqy nAppsmPGDP5gr5NEtApTmrAsm9qArnhP1ICNAqTNWftWrdyQ6Vxf9ZnO/fKmbbakrDH4dmvM 9dms5FebvN5DNB4PoSjjPTLz7VquP3iZxA/d2ut0uExmpRGtpdB40TMHfgLqXOLzM2eKYEKA ==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07/08/2023 3:45 pm, Simon Gaiser wrote:
> Andrew Cooper:
>> On 07/08/2023 10:38 am, Simon Gaiser wrote:
>>> It seems some firmwares put dummy entries in the ACPI MADT table for non
>>> existing processors. On my NUC11TNHi5 those have the invalid APIC ID
>>> 0xff. Linux already has code to handle those cases both in
>>> acpi_parse_lapic [1] as well as in acpi_parse_x2apic [2]. So add the
>>> same check to Xen.
>>>
>>> Note that on some older (2nd gen Core i) laptop of mine I also saw dummy
>>> entries with a valid APIC ID. Linux would still ignore those because
>>> they have !ACPI_MADT_ENABLED && !ACPI_MADT_ONLINE_CAPABLE. But in Xen
>>> this check is only active for madt_revision >= 5. But since this version
>>> check seems to be intentionally I leave that alone.
>> I recall there being a discussion over this, ultimately with the version
>> check being removed.  IIRC it was a defacto standard used for a long
>> time prior to actually getting written into the ACPI spec, so does exist
>> in practice in older MADTs.
> So I noticed that the check in Linux is actually slightly different than
> I thought. Since [3] it always considers the CPU usable if
> ACPI_MADT_ENABLED is set. Otherwise it consider it only usable if
> MADT revision >= 5 and ACPI_MADT_ONLINE_CAPABLE is set.
>
> So I checked what the ACPI spec says:
>
> Up to 6.2 Errata B [6] it only defines ACPI_MADT_ENABLE as:
>
>     If zero, this processor is unusable, and the operating system
>     support will not attempt to use it.
>
> And the bit that later will be ACPI_MADT_ONLINE_CAPABLE is reserved with
> "Must be zero".
>
> 6.3 [7] Then adds ACPI_MADT_ONLINE_CAPABLE and changes the meaning of
> ACPI_MADT_ENABLE:
>
>     Enabled
>         If this bit is set the processor is ready for use. If this bit
>         is clear and the Online Capable bit is set, system hardware
>         supports enabling this processor during OS runtime. If this bit
>         is clear and the Online Capable bit is also clear, this
>         processor is unusable, and OSPM shall ignore the contents of the
>         Processor Local APIC Structure.
>
>     Online Capbable
>         The information conveyed by this bit depends on the value of the
>         Enabled bit. If the Enabled bit is set, this bit is reserved and
>         must be zero. Otherwise, if this this bit is set, system
>         hardware supports enabling this processor during OS runtime.
>
> So with confirming firmwares it should be safe change the simply ignore
> the entry if !ACPI_MADT_ENABLED && !ACPI_MADT_ONLINE_CAPABLE
>
> We can also do it like Linux and ignore ACPI_MADT_ONLINE_CAPABLE
> completely if revision < 5.
>
> Note that the revision was already increased to 5 before 6.3.
>
> ACPI spec version    MADT revision
>                   
> 6.2 [4]              4
> 6.2 Errata A [5]     45 (typo I guess)
> 6.2 Errata B         5
> 6.3                  5
>
> [3]: 
> https://git.kernel.org/torvalds/c/e2869bd7af608c343988429ceb1c2fe99644a01f
> [4]: http://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf
> [5]: http://www.uefi.org/sites/default/files/resources/ACPI%206_2_A_Sept29.pdf
> [6]: https://uefi.org/sites/default/files/resources/ACPI_6_2_B_final_Jan30.pdf
> [7]: https://uefi.org/sites/default/files/resources/ACPI_6_3_May16.pdf

Honestly, the reserved must be zero means there's no need for a version
check at all.  That bit will not be set even in older MADT revisions.

That said, it's likely easier to retain the version check than to set up
a quirks infrastructure for buggy older MADTs.

~Andrew



 


Rackspace

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