Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A548C001DB for ; Mon, 7 Aug 2023 15:05:54 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.578600.906176 (Exim 4.92) (envelope-from ) id 1qT1nd-0006fH-OZ; Mon, 07 Aug 2023 15:05:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 578600.906176; Mon, 07 Aug 2023 15:05:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qT1nd-0006fA-LE; Mon, 07 Aug 2023 15:05:37 +0000 Received: by outflank-mailman (input) for mailman id 578600; Mon, 07 Aug 2023 15:05:36 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qT1nc-0006f2-9X for xen-devel@lists.xenproject.org; Mon, 07 Aug 2023 15:05:36 +0000 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id db4a478d-3533-11ee-8613-37d641c3527e; Mon, 07 Aug 2023 17:05:34 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 132BB5C00BB; Mon, 7 Aug 2023 11:05:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 07 Aug 2023 11:05:33 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Aug 2023 11:05:30 -0400 (EDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: db4a478d-3533-11ee-8613-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1691420733; x=1691507133; bh=x1PjOXBZ8MeWIkWCLhH5M7yKNK3YPDONkXO 9+vqVpf0=; b=ylRidWyz6T2jUDsFyBKPXdIyYldsjMVInGMaBuM77HLj0RxoPxF NQqVxemL2fX2xwbzdZbnXY5scTXwlF7NEOBa5+P/n3GmWyTvt5aUmrVB1jNwCDRo NLFE7/cj1fXgDGcKsALQjTcKSrtqYLCHXJF7/f6ot0gMjrZyRS7/0DopSVElv6sN KXk3kWDL5zlW+DfqcNYXCns36RIvn3CLiRO+nXPKuUnSTv7iNRQhT+edfoAbfylE vHsf3PKvua1C1QJ5uzeW+RAc7RCTh3EQMfq+TJW2Afk7rSEsJrxPlmqgOb5XG8sV hGe10UVXtzN0klarDGwG1hdEJG+feuoOK4A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1691420733; x=1691507133; bh=x1PjOXBZ8MeWI kWCLhH5M7yKNK3YPDONkXO9+vqVpf0=; b=Ejjl3VU6aM+QEvXRsdGBk6atbuUzh V6p4PWJNzqagtK2F/Yl9ToA1zpuxHReBE+dtLnQXHmqqNO4Jc52pme+Fm/b6dYpz +9SsvdqL31U8BOltlBY7UiNRg2JhYRUxiOk1/fgmAMusUipEtosVgHb+FIGLwyR6 5InWjiCPQEcUFI/SnNbXYVvaOTob64Rir/mg6qypu3gfLRKUL5gY5FbOQTmb/3Cq t/xTD0DVF+y+wLZqr/BiDm2ojBd+/0POxx+XJhuvYZqkdprQmeSUqAZH5bkEFMLV Y0Xm5aXaSgNtE/PQsybxYwux7yovHQEsxRpA4vV9mynrnr2KoSMpQ6pbQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrledtgdejkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffgguffvvehfhfgjtgesghdtreertddtjeenucfhrhhomhepufhimhhonhcu ifgrihhsvghruceoshhimhhonhesihhnvhhishhisghlvghthhhinhhgshhlrggsrdgtoh hmqeenucggtffrrghtthgvrhhnpeeftdefudeltdevhfehkeefhfeutdfhffdugeetffdv gfehfeekhfetgedvuefggfenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhimhhonhesihhn vhhishhisghlvghthhhinhhgshhlrggsrdgtohhm X-ME-Proxy: Feedback-ID: idc5945a3:Fastmail Message-ID: <3951c6fe-9912-634f-203c-6ba730cdc047@invisiblethingslab.com> Date: Mon, 7 Aug 2023 17:05:18 +0200 MIME-Version: 1.0 Subject: Re: [XEN PATCH] x86/ACPI: Ignore entries with invalid APIC IDs when parsing MADT Content-Language: en-US To: Jan Beulich Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Wei Liu , =?UTF-8?Q?Marek_Marczykowski-G=c3=b3recki?= , xen-devel@lists.xenproject.org References: <7f158a54548456daba9f2e105d099d2e5e2c2f38.1691399031.git.simon@invisiblethingslab.com> <0bd3583c-a55d-9a68-55b1-c383499d46d8@suse.com> <2c97ff5b-03b0-3c17-c7f0-9bc8c9317762@invisiblethingslab.com> From: Simon Gaiser In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------1XX4WipUR17ddjVy1wur38SO" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------1XX4WipUR17ddjVy1wur38SO Content-Type: multipart/mixed; boundary="------------8PpbNFGZn32ploxgMhDxTmoH"; protected-headers="v1" From: Simon Gaiser To: Jan Beulich Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Wei Liu , =?UTF-8?Q?Marek_Marczykowski-G=c3=b3recki?= , xen-devel@lists.xenproject.org Message-ID: <3951c6fe-9912-634f-203c-6ba730cdc047@invisiblethingslab.com> Subject: Re: [XEN PATCH] x86/ACPI: Ignore entries with invalid APIC IDs when parsing MADT References: <7f158a54548456daba9f2e105d099d2e5e2c2f38.1691399031.git.simon@invisiblethingslab.com> <0bd3583c-a55d-9a68-55b1-c383499d46d8@suse.com> <2c97ff5b-03b0-3c17-c7f0-9bc8c9317762@invisiblethingslab.com> In-Reply-To: --------------8PpbNFGZn32ploxgMhDxTmoH Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Jan Beulich: > On 07.08.2023 14:55, Simon Gaiser wrote: >> Jan Beulich: >>> On 07.08.2023 11:38, 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. >>> >>> I'm afraid it doesn't become clear to me what problem you're trying t= o >>> solve. >> >> I want Xen to not think there are possible CPUs that actually never ca= n >> be there. >=20 > Did you try using "maxcpus=3D" on the command line? If that doesn't wor= k > well enough Yes. Then Xen says, as expected "SMP: Allowing 8 CPUs (0 hotplug CPUs)", but disabled_cpus is still 8 and nr_sockets therefore calculated as 2. > (perhaps because of causing undesirable log messages), I don't mind some verbose log messages. > maybe we need some way to say "no CPU hotplug" on the command line. That indeed might make sense, but I'm not sure this is what I want here, see below. >> Without ignoring those dummy entries Xen thinks my NUC has 2 sockets a= nd >> that there are 8 logical CPUs that are currently disabled but could be= >> hotplugged. >=20 > Yet it's exactly this which ACPI is telling us here (with some vaguenes= s, > which isn't easy to get around; see below). >=20 >> I'm moderately sure that soldering in another CPU is not supported, ev= en >> less so at runtime ;] >=20 > On your system. What about others, which are hotplug-capable? Would those be listed with an invalid APIC ID in their entries? Then I understand your complaint. PS: based on your reply to Andrew, you think that this might be the case.= >>>> --- a/xen/arch/x86/acpi/boot.c >>>> +++ b/xen/arch/x86/acpi/boot.c >>>> @@ -87,14 +87,17 @@ acpi_parse_x2apic(struct acpi_subtable_header *h= eader, const unsigned long end) >>>> if (BAD_MADT_ENTRY(processor, end)) >>>> return -EINVAL; >>>> =20 >>>> + /* Ignore entries with invalid apicid */ >>>> + if (processor->local_apic_id =3D=3D 0xffffffff) >>>> + return 0; >>>> + >>>> /* Don't register processors that cannot be onlined. */ >>>> if (madt_revision >=3D 5 && >>>> !(processor->lapic_flags & ACPI_MADT_ENABLED) && >>>> !(processor->lapic_flags & ACPI_MADT_ONLINE_CAPABLE)) >>>> return 0; >>>> =20 >>>> - if ((processor->lapic_flags & ACPI_MADT_ENABLED) || >>>> - processor->local_apic_id !=3D 0xffffffff || opt_cpu_info) { >>>> + if ((processor->lapic_flags & ACPI_MADT_ENABLED) || opt_cpu_info) = { >>>> acpi_table_print_madt_entry(header); >>>> log =3D true; >>>> } >>> >>> In particular you're now suppressing log messages which may be releva= nt. >> >> I intentionally mirrored the behavior of the check directly below. >> Unlike the the version in Linux the existing code didn't log ignored >> entries. So I did the same for the entries with an invalid ID. >=20 > I'm afraid I can't bring in line the check you add early in the functio= n > with what is "directly below" [here]. I'm only inferring the "here" fro= m > the placement of your reply. Maybe instead you meant the rev >=3D 5 one= , Yes exactly. "directly below" was meant relative to the if I added. > in which case I'm afraid the two are too different to compare: That > rev >=3D 5 one tells us that the entry isn't going to be hotpluggable. = The > APIC ID check you add makes no such guarantees. As mentioned above, if that's the case I see the problem. > That's why the new flag was actually added in v5. See other branch of this thread: https://lore.kernel.org/xen-devel/80bae614-052e-0f90-cf13-0e5e4ed1a5cd@in= visiblethingslab.com/ So we might cover at least my case regardless how invalid APIC IDs should be interpreted. --------------8PpbNFGZn32ploxgMhDxTmoH-- --------------1XX4WipUR17ddjVy1wur38SO Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE3E8ezGzG3N1CTQ//kO9xfO/xly8FAmTRCDAACgkQkO9xfO/x ly9F/A//V1HnvexE/g4/sZcg7CAIVQJ8XTAHbxqmv7rAhLmuLKSZcGeOYriEYVg/ zZMaL82Ja3bYD7DlVUm5Pxan7McNdPIpldpW+ffbkS1SOCQzFpVhA5wbkDV4Z4jh ulxxO5DQWrOgTrmjqK0jL24SPHgqcsFFvHoQPW5fAMJXEU13Hk7kvOlG9PdiXbst 2/9icgzzN5ANcxGZDFbEY7KOt1VvP7lPqMkZ9As1kdfW7vpeMZD7U2gDGMqyPhxz yIoH/k9s+S2IyTO4J75Dku2kQa3PfnNIcksq/0b0W/LpnQnJhlRocBLTro/frl2R WrA+HLhb54qkMKgQD9AhIvr2GAlmFCBLGN4KjoRYqGDemDr2BxRp6Iq0dnRWIhvu HOcMCjObZfyQOyz8sddof3HTUFX7gh/HyBmhWMUoMXde8INX/UGzcysp9KB1Ieb6 oRcCy2lkb/Ly6AfGU8s7mc6x4DQ4KhR5FbIXfxtdiGX6GDH+xfst95DUYoBO1www aMa4TggRLFcagKBftUJZjqZnZEEqkBEc8U8ac9AWdSsdreE0rS7or3k1bqv63pXN BbgxtQTm03rlxsLp1TqzAEuogrkAj5g90plmA7TCdTTQpVJbAhxahgyxXRgVKYih nKDpqukFZoA59EDiixqr7rINM8ylSgeNp4pFNJii3aHnNOXKIVU= =86/z -----END PGP SIGNATURE----- --------------1XX4WipUR17ddjVy1wur38SO--