[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: Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Simon Gaiser <simon@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 29 Aug 2023 16:25:20 +0200
  • 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=LP/LdwFiec20IrDICoiz/rBWHYj1B+a/9/5mAJAYe/w=; b=OrvfFcfkinpa8VgWCuctnd4cxy2dpgYq51t9/82Spn0rQfGcPuanZDErayUh6wfH3/HLB5Emy8RcrPoPY72laScJGEze7cXtBRWAbwI2VIkB8yHehMKYvkYhskfFIR/EJcM1UNd5AU6c4rUmrh0mzZ0p8HhRza/8PFLib197PrEixMB5JEijtqqGMd+jAPS1/m8XV5uf+uab9j/yICKaCdupHEVzZzRw5EZAEPF9IREUnz5QjIQipec7WsPubZE9J/WxC+k9JMJ7Icyjs5nEGJ5HKKdWLoKxW1L8Tgk19rq+NO1iz0kEGlWWkX2uadoE9cGld9raAwKStixhz0D61Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eEhbit0IZLTQkmxumi8PMNU6O03Jl7i5228EyVUBRsRVUmhCIGMLERjtRcyFUebj/bq4l3yJMfp6pQoPHuilj2rcU6RdPjVyKd/iw3YJSjtzvDNfuYefg4/UKB7rZhUabTahr+Z2efExFVjpQvrrv/PpR4qBFeU2UqzkMk81EOZnFGgBE6RZs8WmjA2GZsDtwMLbMdlwA13OH4M1JHpmU1hD7E5refxDPjo8MjZSNw6rWuYAHuRVU2F/9YssZuWHg8yFR0RQ8vxSc7dXNptVurMx8D+rjailteuQzK+PeKzlJalcNxwD106ZbJ842FQba4IgYaDgUKZ9MpHlmOhzSg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 29 Aug 2023 14:25:44 +0000
  • Ironport-data: A9a23:2FSTDqC9mhM3chVW/9viw5YqxClBgxIJ4kV8jS/XYbTApGsh1jFVz moXUWzSOKmCMWOje4gnO47g80tS7ZKDxoRiQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nOHuGmYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbCRMscpvlDs15K6p4GNC7wRnDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIw1sN4W3Fr2 8QkDxsva0ugm7qrzLSiRbw57igjBJGD0II3nFhFlGmcKMl8BJfJTuPN+MNS2yo2ioZWB/HCa sEFaD1pKhPdfxlIPVRRA5U79AuqriCnL3sE9xTI+Oxuuzm7IA9ZidABNPLPfdOHX4NNl1uwr WPa5WXpRBodMbRzzBLcqCvw37KWx3iTtIQ6M5aE0/5E2W+v9n0vKDAuWFW4haeplRvrMz5YA wlOksY0loAu+0i7Zt38WQCkunmCvw5aV9c4O+8w5RyJy6HUyx2EHWVCRTlEAPQ9tcoxQxQr0 EGIhNLjATFzsLyTRmmZ/73SpjS3UQAKKUcSaClCShEKi/HmqZs2hwjCTf5iFrC0ldz/HTzsw zGMozM6jr9VhskOv42r8FaCjz+yq5zhSg8u+h6RTm+j9hl+ZoOue8qv81ez0BpbBIOQT13Eu WdencGbtbgKFcvUzH3LR/gRFra04frDKCfbnVNkA5gm8XKq5mKneodTpjp5IS+FL/o5RNMgW 2eL0Ss52XOZFCH3BUOrS+pd0/gX8JU=
  • Ironport-hdrordr: A9a23:/IfsGKgrZf+w6bu1oFjGLCr77nBQXtoji2hC6mlwRA09TyX4rb HJoB1/73XJYVkqKRMdcLO7WJVoI0mskKKdiLN5VdzCYOCMghrNEGgN1/qE/9QiIUHDHyxmuJ uIv5IQNDQ4NzZHZWCW2njaL+od
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Sun, Aug 27, 2023 at 05:44:15PM +0200, Thomas Gleixner wrote:
> On Wed, Aug 23 2023 at 14:56, Jan Beulich wrote:
> > On 23.08.2023 11:21, Andrew Cooper wrote:
> >> In the spec, exactly where you'd expect to find them...
> >> 
> >> "OSPM does not expect the information provided in this table to be
> >> updated if the processor information changes during the lifespan of an
> >> OS boot."
> >
> > I don't think this tells us anything about the ID not possibly changing.
> > It merely tells us that OSPM is not expected to parse this table again
> > (IOW firmware updating just this table isn't going to be enough). IDs
> > possibly changing is expressed by (a) the "if the processor information
> > changes", and (b) the next sentence, forbidding them to change while the
> > system is asleep: "While in the sleeping state, logical processors must
> > not be added or removed, nor can their ... ID or ... Flags change."
> >
> >> Which is wordsmithing for "Some firmware was found to be modifying them
> >> and this was deemed to be illegal under the spec".
> >
> > That's your reading of it; I certainly don't infer such from that
> > sentence.
> 
> The APIC/X2APIC description of MADT specifies flags:
> 
> 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 Capable        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.

Sadly this flag is only present starting with MADT v5.

> This is also related to SRAT which defines the proximity of memory to
> processors at boot time with a similar set of flags.
> 
> Also 8.4 says:
> 
>   Each processor in the system must be declared in the ACPI namespace in
>   the \_SB scope. .... A Device definition for a processor is declared
>   using the ACPI0007 hardware identifier (HID). Processor configuration
>   information is provided exclusively by objects in the processor
>   device’s object list.
> 
>   When the platform uses the APIC interrupt model, UID object values
>   under a processor device are used to associate processor devices with
>   entries in the MADT.
> 
> 
> MADT is the authoritative table for processor enumeration, whether
> present or not. This is required because that's the only way to size
> resources, which depend on the possible maximum topology.
> 
> Otherwise you'd end up with a CPU hotplugged which is outside of the
> resource space allocated during init.

It's my understating that ACPI UIDs 0xff and 0xfffffff for local ACPI
and x2APIC structures respectively are invalid, as that's the
broadcast value used by the local (x2)APIC NMI Structures.

I think Jan's point (if I understood correctly) is that Processor or
Device objects can have a _MAT method that returns updated MADT
entries, and some ACPI implementations might modify the original
entries on the MADT and return them from that method when CPU
hotplug takes place.  The spec notes that "OSPM does not expect the
information provided in this table to be updated if the processor
information changes during the lifespan of an OS boot." so that the
MADT doesn't need to be updated when CPU hotplug happens, but I don't
see that sentence as preventing the MADT to be updated if CPU hotplug
takes place, it's just not required.

I don't see anywhere in the spec that states that APIC IDs 0xff and
0xffffffff are invalid and entries using those IDs should be ignored,
but I do think that any system that supports CPU hotplug better has
those IDs defined since boot.  Also it seems vendors have started
relying on using 0xff and 0xffffffff APIC IDs to signal non-present
CPUs, and Linux has been ignoring such entries for quite some time
already  without reported issues.  Overall I'm inclined to say we
should take this change, as it avoids flagging a lot of systems as CPU
hotplug capable when they are not.

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

I think Andrew had some minor comments.

I wonder whether the check should be done after the entry has been
printed if `opt_cpu_info` is set, but seeing as the ONLINE_CAPABLE is
also done before possibly printing the entry I guess it's fine.

Thanks, Roger.



 


Rackspace

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