[RFC PATCH 10/36] ACPI / MPAM: Parse the MPAM table
James Morse
james.morse at arm.com
Tue Aug 5 10:08:10 PDT 2025
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
More information about the linux-arm-kernel
mailing list