[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <02f008a8-1bd6-4044-99f0-553d441d6d4b@arm.com>
Date: Thu, 6 Nov 2025 16:10:33 +0000
From: Ben Horgan <ben.horgan@....com>
To: Jonathan Cameron <jonathan.cameron@...wei.com>,
James Morse <james.morse@....com>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-acpi@...r.kernel.org,
D Scott Phillips OS <scott@...amperecomputing.com>,
carl@...amperecomputing.com, lcherian@...vell.com,
bobo.shaobowang@...wei.com, tan.shaopeng@...itsu.com,
baolin.wang@...ux.alibaba.com, Jamie Iles <quic_jiles@...cinc.com>,
Xin Hao <xhao@...ux.alibaba.com>, peternewman@...gle.com,
dfustini@...libre.com, amitsinght@...vell.com,
David Hildenbrand <david@...hat.com>, Dave Martin <dave.martin@....com>,
Koba Ko <kobak@...dia.com>, Shanker Donthineni <sdonthineni@...dia.com>,
fenghuay@...dia.com, baisheng.gao@...soc.com, Rob Herring <robh@...nel.org>,
Rohit Mathew <rohit.mathew@....com>, Rafael Wysocki <rafael@...nel.org>,
Len Brown <lenb@...nel.org>, Lorenzo Pieralisi <lpieralisi@...nel.org>,
Hanjun Guo <guohanjun@...wei.com>, Sudeep Holla <sudeep.holla@....com>,
Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Danilo Krummrich <dakr@...nel.org>, Jeremy Linton <jeremy.linton@....com>,
Gavin Shan <gshan@...hat.com>
Subject: Re: [PATCH v3 02/29] ACPI / PPTT: Stop acpi_count_levels() expecting
callers to clear levels
Hi Jonathan,
On 10/24/25 12:29, Jonathan Cameron wrote:
> On Fri, 17 Oct 2025 18:56:18 +0000
> James Morse <james.morse@....com> wrote:
>
>> In acpi_count_levels(), the initial value of *levels passed by the
>> caller is really an implementation detail of acpi_count_levels(), so it
>> is unreasonable to expect the callers of this function to know what to
>> pass in for this parameter. The only sensible initial value is 0,
>> which is what the only upstream caller (acpi_get_cache_info()) passes.
>>
>> Use a local variable for the starting cache level in acpi_count_levels(),
>> and pass the result back to the caller via the function return value.
>>
>> Get rid of the levels parameter, which has no remaining purpose.
>>
>> Fix acpi_get_cache_info() to match.
>>
>> Suggested-by: Jonathan Cameron <jonathan.cameron@...wei.com>
>> Signed-off-by: James Morse <james.morse@....com>
>> Reviewed-by: Lorenzo Pieralisi <lpieralisi@...nel.org>
>> Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>
>> Reviewed-by: Fenghua Yu <fenghuay@...dia.com>
>> Tested-by: Fenghua Yu <fenghuay@...dia.com>
>
> Another meh, the name is confusing type comment.
>
>> -static void acpi_count_levels(struct acpi_table_header *table_hdr,
>> - struct acpi_pptt_processor *cpu_node,
>> - unsigned int *levels, unsigned int *split_levels)
>> +static int acpi_count_levels(struct acpi_table_header *table_hdr,
>> + struct acpi_pptt_processor *cpu_node,
>> + unsigned int *split_levels)
>> {
>> + int starting_level = 0;
>> +
>> do {
>> - acpi_find_cache_level(table_hdr, cpu_node, levels, split_levels, 0, 0);
>> + acpi_find_cache_level(table_hdr, cpu_node, &starting_level, split_levels, 0, 0);
>> cpu_node = fetch_pptt_node(table_hdr, cpu_node->parent);
>> } while (cpu_node);
>> +
>> + return starting_level;
> Given it's not the starting level at this point... Maybe just call it level or current_level.
Makes sense. I've made this update.
>> }
>>
>> /**
>> @@ -645,7 +649,7 @@ int acpi_get_cache_info(unsigned int cpu, unsigned int *levels,
>> if (!cpu_node)
>> return -ENOENT;
>>
>> - acpi_count_levels(table, cpu_node, levels, split_levels);
>> + *levels = acpi_count_levels(table, cpu_node, split_levels);
>>
>> pr_debug("Cache Setup: last_level=%d split_levels=%d\n",
>> *levels, split_levels ? *split_levels : -1);
>
>
Thanks,
Ben
Powered by blists - more mailing lists