From: James Morse <james.morse@arm.com>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: linux-acpi@vger.kernel.org, Rafael Wysocki <rafael@kernel.org>,
Len Brown <lenb@kernel.org>,
jeremy.linton@arm.com
Subject: Re: [PATCH 2/4] ACPI / PPTT: Stop acpi_count_levels() expecting callers to clear levels
Date: Thu, 26 Jun 2025 18:11:03 +0100 [thread overview]
Message-ID: <994a8207-30cb-4c6a-a232-b8dec735ed50@arm.com> (raw)
In-Reply-To: <20250623-fancy-quizzical-ostrich-32d305@sudeepholla>
Hi Sudeep,
On 23/06/2025 14:10, Sudeep Holla wrote:
> On Thu, Jun 12, 2025 at 05:13:34PM +0000, James Morse wrote:
>> acpi_count_levels() passes the number of levels back via a pointer argument.
>> It also passes this to acpi_find_cache_level() as the starting_level, and
>> preserves this value as it walks up the cpu_node tree counting the levels.
>>
>> The only caller acpi_get_cache_info() happens to have already initialised
>> levels to zero, which acpi_count_levels() depends on to get the correct
>> result.
>>
>> Explicitly zero the levels variable, so the count always starts at zero.
>> This saves any additional callers having to work out they need to do this.
>> diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
>> index aaf9b5a26d07..72e6bfc1e358 100644
>> --- a/drivers/acpi/pptt.c
>> +++ b/drivers/acpi/pptt.c
>> @@ -183,7 +183,7 @@ acpi_find_cache_level(struct acpi_table_header *table_hdr,
>> * @cpu_node: processor node we wish to count caches for
>> * @levels: Number of levels if success.
>> * @split_levels: Number of split cache levels (data/instruction) if
>> - * success. Can by NULL.
>> + * success. Can be NULL.
>> *
>> * Given a processor node containing a processing unit, walk into it and count
>> * how many levels exist solely for it, and then walk up each level until we hit
>> @@ -196,6 +196,8 @@ static void acpi_count_levels(struct acpi_table_header *table_hdr,
>> struct acpi_pptt_processor *cpu_node,
>> unsigned int *levels, unsigned int *split_levels)
>> {
>> + *levels = 0;
>> +
>
> Does it make sense to drop similar reset to 0 in acpi_get_cache_info(), just
> to be consistent across all callers of acpi_count_levels().
acpi_get_cache_info() does this because it can return early, it makes sense that it
already cleared the values it passes back.
> Otherwise, LGTM:
>
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Thanks!
James
next prev parent reply other threads:[~2025-06-26 17:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 17:13 [PATCH 0/4] ACPI / PPTT: Add helpers to fill cpumask from PPTT James Morse
2025-06-12 17:13 ` [PATCH 1/4] ACPI / PPTT: Add a helper to fill a cpumask from a processor container James Morse
2025-06-23 13:08 ` Sudeep Holla
2025-06-26 17:14 ` James Morse
2025-06-23 13:21 ` Sudeep Holla
2025-06-26 17:11 ` James Morse
2025-06-26 17:10 ` James Morse
2025-06-12 17:13 ` [PATCH 2/4] ACPI / PPTT: Stop acpi_count_levels() expecting callers to clear levels James Morse
2025-06-23 13:10 ` Sudeep Holla
2025-06-26 17:11 ` James Morse [this message]
2025-06-12 17:13 ` [PATCH 3/4] ACPI / PPTT: Find cache level by cache-id James Morse
2025-06-23 13:21 ` Sudeep Holla
2025-06-12 17:13 ` [PATCH 4/4] ACPI / PPTT: Add a helper to fill a cpumask from a cache_id James Morse
2025-06-23 13:22 ` 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=994a8207-30cb-4c6a-a232-b8dec735ed50@arm.com \
--to=james.morse@arm.com \
--cc=jeremy.linton@arm.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sudeep.holla@arm.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