From: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Anthony PERARD <anthony.perard@vates.tech>,
Grygorii Strashko <grygorii_strashko@epam.com>,
Roger Pau Monne <roger.pau@citrix.com>,
<xen-devel@lists.xenproject.org>,
Xen-devel <xen-devel-bounces@lists.xenproject.org>
Subject: Re: [PATCH] libacpi: Remove CPU hotplug and GPE handling from PVH DSDTs
Date: Thu, 11 Sep 2025 13:09:28 +0200 [thread overview]
Message-ID: <DCPXAHDC4FYX.3DH1XG3S916ME@amd.com> (raw)
In-Reply-To: <96b58fe4-668f-44be-9469-0ec7f4f28c6f@suse.com>
On Thu Sep 11, 2025 at 9:44 AM CEST, Jan Beulich wrote:
> On 10.09.2025 19:29, Alejandro Vallejo wrote:
>> On Wed Sep 10, 2025 at 7:01 PM CEST, Alejandro Vallejo wrote:
>>> On Wed Sep 10, 2025 at 5:31 PM CEST, Jan Beulich wrote:
>>>> On 10.09.2025 17:16, Alejandro Vallejo wrote:
>>>>> On Wed Sep 10, 2025 at 5:02 PM CEST, Jan Beulich wrote:
>>>>>> On 10.09.2025 16:49, Alejandro Vallejo wrote:
>>>>>>> CPU hotplug relies on the guest having access to the legacy online CPU
>>>>>>> bitmap that QEMU provides at PIO 0xAF00. But PVH guests have no DM, so
>>>>>>> this causes the MADT to get corrupted due to spurious modifications of
>>>>>>> the "online" flag in MADT entries and the table checksum during the
>>>>>>> initial acpica passes.
>>>>>>
>>>>>> I don't understand this MADT corruption aspect, which - aiui - is why
>>>>>> there's a Fixes: tag here. The code change itself looks plausible.
>>>>>
>>>>> When there's no DM to provide a real and honest online CPU bitmap on PIO 0xAF00
>>>>> then we get all 1s (because there's no IOREQ server). Which confuses the GPE
>>>>> handler.
>>>>>
>>>>> Somehow, the GPE handler is being triggered. Whether this is due to a real SCI
>>>>> or just it being spuriously executed as part of the initial acpica pass, I don't
>>>>> know.
>>>>>
>>>>> Both statements combined means the checksum and online flags in the MADT get
>>>>> changed after initial parsing making it appear as-if all 128 CPUs were plugged.
>>>>
>>>> I can follow this part (the online flags one, that is).
>>>>
>>>>> This patch makes the checksums be correct after acpica init.
>>>>
>>>> I'm still in trouble with this one. If MADT is modified in the process, there's
>>>> only one of two possible options:
>>>> 1) It's expected for the checksum to no longer be correct.
>>>> 2) The checksum is being fixed up in the process.
>>>> That's independent of being HVM or PVH and independent of guest boot or later.
>>>> (Of course there's a sub-variant of 2, where the adjusting of the checksum
>>>> would be broken, but that wouldn't be covered by your change.)
>>>
>>> I see what you mean now. The checksum correction code LOOKS correct. But I
>>> wonder about the table length... We report a table as big as it needs to be,
>>> but the checksum update is done irrespective of FLG being inside the valid range
>>> of the MADT. If a guest with 2 vCPUs (in max_vcpus) sees vCPU127 being signalled
>>> that'd trigger the (unseen) online flag to be enabled and the checksum adjusted,
>>> except the checksum must not being adjusted.
>>>
>>> I could add even more AML to cover that, but that'd be QEMU misbehaving (or
>>> being absent). This patch covers the latter case, but it might be good to
>>> change the commit message to reflect the real problem.
>>
>> It doesn't quite add up in the mismatch though. There might be something else
>> lurking in there.
>>
>> Regardless, I don't want this junk in PVH. Would a commit reword suffice to have
>> it acked?
>
> I think so, yes.
>
> Jan
The problem is present in HVM too, I think. It just clicked to me that if AML
overflows the MADT it WILL corrupt whatever is after it, and how many times (and
in what direction) the checksum changes is undefined because the memory after the
MADT is undefined. I somehow thought we allocated a full 128-CPU MADT, but that
doesn't seem to be the case (rightfully so).
So this is a general ACPI memory corruption bug. The saving grace is that tables
are already parsed by the time execute AML, and the corruption doesn't seem to
reach the DSDT.
Modifying the DSDT to avoid the overflow seems unavoidable. That should fix the
root cause.
I still want to remove it all on PVH, but HVM should be fixed too.
Cheers,
Alejandro
next prev parent reply other threads:[~2025-09-11 11:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-10 14:49 [PATCH] libacpi: Remove CPU hotplug and GPE handling from PVH DSDTs Alejandro Vallejo
2025-09-10 15:02 ` Jan Beulich
2025-09-10 15:16 ` Alejandro Vallejo
2025-09-10 15:31 ` Jan Beulich
2025-09-10 17:01 ` Alejandro Vallejo
2025-09-10 17:29 ` Alejandro Vallejo
2025-09-11 7:44 ` Jan Beulich
2025-09-11 11:09 ` Alejandro Vallejo [this message]
2025-09-10 15:34 ` Grygorii Strashko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DCPXAHDC4FYX.3DH1XG3S916ME@amd.com \
--to=alejandro.garciavallejo@amd.com \
--cc=anthony.perard@vates.tech \
--cc=grygorii_strashko@epam.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel-bounces@lists.xenproject.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.