From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Yicong Yang <yangyicong@huawei.com>, <lenb@kernel.org>,
<linux-acpi@vger.kernel.org>, <jmeurin@google.com>,
<jeremy.linton@arm.com>, <zhanjie9@hisilicon.com>,
<prime.zeng@hisilicon.com>, <yangyicong@hisilicon.com>,
<linuxarm@huawei.com>, <alireza.sanaee@huawei.com>
Subject: Re: [PATCH] ACPI: PPTT: Fix table length check when parsing processor nodes
Date: Wed, 7 May 2025 15:35:50 +0100 [thread overview]
Message-ID: <20250507153550.0000340f@huawei.com> (raw)
In-Reply-To: <20250507-obedient-knowing-galago-245e7c@sudeepholla>
On Wed, 7 May 2025 12:55:00 +0100
Sudeep Holla <sudeep.holla@arm.com> wrote:
> On Wed, May 07, 2025 at 01:51:58PM +0200, Rafael J. Wysocki wrote:
> > On Wed, May 7, 2025 at 1:47 PM Sudeep Holla <sudeep.holla@arm.com> wrote:
> > >
> > > On Wed, May 07, 2025 at 01:44:26PM +0200, Rafael J. Wysocki wrote:
> > > > On Wed, May 7, 2025 at 1:40 PM Sudeep Holla <sudeep.holla@arm.com> wrote:
> > > > >
> > > > > On Wed, May 07, 2025 at 11:51:24AM +0800, Yicong Yang wrote:
> > > > > > From: Yicong Yang <yangyicong@hisilicon.com>
> > > > > >
> > > > > > Below error is met on my board and QEMU VM on SMT or non-SMT machine:
> > > > > > ACPI PPTT: PPTT table found, but unable to locate core 31 (31)
> > > > > >
> > > > > > This is because the processor node is found by iterating the PPTT
> > > > > > table under condition (for both acpi_find_processor_node() and
> > > > > > acpi_pptt_leaf_node()):
> > > > > > while (entry + proc_sz < table_end)
> > > > > > [parse the processor node]
> > > > > >
> > > > > > If the last processor node is happened to be the last node in the
> > > > > > PPTT table, above condition will always be false since
> > > > > > entry + proc_sz == table_end. Thus the last CPU is not parsed.
> > > > > > Fix the loop condition to resolve the issue.
> > > > > >
> > > > > > This issue is exposed by [1] but the root cause is explained above.
> > > > > > Before [1] entry + proc_sz is always smaller than table_end.
> > > > > >
> > > > >
> > > > > Another thread [1] with similar patch.
> > > >
> > > > OK, so is this a correct fix?
> > >
> > > While it may fix the issue on the surface, I just want to be sure there
> > > are no other issues with the PPTT table presented from the firmware.
> > > I will asked some questions on that thread before I can agree on the solution.
> >
> > Yeah, it looks like table_end points to the last byte of the table
> > instead of pointing to the first byte after the end of the table.
>
> Indeed and also we should have private resources like L1 cache described
> after the initial 20 bytes of the node. So I am bit worried if this will
> just hide other problems while it may solve this problem by looks of it.
> This example doesn't look like a proper PPTT matching real systems.
>
Assuming I'm understanding the bug correctly...
SMT systems will hit this. There will typically be no private resources
for a thread as the L1I/D shared by multiple threads (which are processor
nodes IIRC). Note we are trying to improve the cache description in QEMU
at the moment as it would definitely be better to present caches in PPTT,
but that isn't the main issue here.
Jonathan
next prev parent reply other threads:[~2025-05-07 14:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 3:51 [PATCH] ACPI: PPTT: Fix table length check when parsing processor nodes Yicong Yang
2025-05-07 11:40 ` Sudeep Holla
2025-05-07 11:44 ` Rafael J. Wysocki
2025-05-07 11:47 ` Sudeep Holla
2025-05-07 11:51 ` Rafael J. Wysocki
2025-05-07 11:55 ` Sudeep Holla
2025-05-07 14:35 ` Jonathan Cameron [this message]
2025-05-07 15:35 ` Sudeep Holla
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=20250507153550.0000340f@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=alireza.sanaee@huawei.com \
--cc=jeremy.linton@arm.com \
--cc=jmeurin@google.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=prime.zeng@hisilicon.com \
--cc=rafael@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=yangyicong@hisilicon.com \
--cc=yangyicong@huawei.com \
--cc=zhanjie9@hisilicon.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox