[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <370d63d1-3ab9-4da5-bac1-29b4229df3bd@arm.com>
Date: Tue, 5 Aug 2025 18:08:10 +0100
From: James Morse <james.morse@....com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Rob Herring <robh@...nel.org>, Ben Horgan <ben.horgan@....com>,
Rohit Mathew <rohit.mathew@....com>,
Shanker Donthineni <sdonthineni@...dia.com>, Zeng Heng
<zengheng4@...wei.com>, Lecopzer Chen <lecopzerc@...dia.com>,
Carl Worth <carl@...amperecomputing.com>,
shameerali.kolothum.thodi@...wei.com,
D Scott Phillips OS <scott@...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>, Rex Nie <rex.nie@...uarmicro.com>,
Dave Martin <dave.martin@....com>, Koba Ko <kobak@...dia.com>
Subject: Re: [RFC PATCH 10/36] ACPI / MPAM: Parse the MPAM table
Hi Jonathan,
On 28/07/2025 11:08, Jonathan Cameron wrote:
>>> +static struct acpi_table_header *get_table(void)
>>> +{
>>> + struct acpi_table_header *table;
>>> + acpi_status status;
>>> +
>>> + if (acpi_disabled || !system_supports_mpam())
>>> + return NULL;
>>> +
>>> + status = acpi_get_table(ACPI_SIG_MPAM, 0, &table);
>>> + if (ACPI_FAILURE(status))
>>> + return NULL;
>>> +
>>> + if (table->revision != 1)
>
> Missing an acpi_put_table()
Oops,
> I'm messing around with ACQUIRE() that is queued in the CXL tree
> for the coming merge window and noticed this.
> https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git/log/?h=for-6.17/cleanup-acquire
(not more C++!)
> Interestingly this is a new corner case where we want conditional locking
> style handling but with return_ptr() style handling. Maybe too much of a niche
> to bother with infrastructure.
>
> Worth noting though that one layer up it is probably worth something like:
>
> DEFINE_FREE(acpi_table_mpam, struct acpi_table_header *, if (_T) acpi_put_table(_T));
>
> That enables nice clean code like:
>
>
> static int __init acpi_mpam_parse(void)
> {
> struct acpi_table_header *mpam = __free(acpi_table_mpam) = get_table();
>
> if (!mpam)
> return 0;
>
> return _parse_table;
> }
I've got bits of that from your PPTT suggestions. I ended up folding the get_table()
helper in here.
count_msc() gets the same treatment and the cleanup thing lets _count_msc() be folded into it.
Thanks,
James
> This series was big enough that I'm spinning a single 'suggested changes'
> patch on top of it that includes stuff like this. Might take another day or so.
>
> Jonathan
Powered by blists - more mailing lists