Re: [PATCH v2 22/45] arm_mpam: resctrl: Add CDP emulation

Ben Horgan
2026-01-06T11:21:27Z

Hi Jonathan,

On 1/5/26 18:07, Jonathan Cameron wrote:
> On Fri, 19 Dec 2025 18:11:24 +0000
> Ben Horgan <ben.horgan@arm.com> wrote:
>
>> From: James Morse <james.morse@arm.com>
>>
>> Intel RDT's CDP feature allows the cache to use a different control value
>> depending on whether the accesses was for instruction fetch or a data
>> access. MPAM's equivalent feature is the other way up: the CPU assigns a
>> different partid label to traffic depending on whether it was instruction
>> fetch or a data access, which causes the cache to use a different control
>> value based solely on the partid.
>>
>> MPAM can emulate CDP, with the side effect that the alternative partid is
>> seen by all MSC, it can't be enabled per-MSC.
>>
>> Add the resctrl hooks to turn this on or off. Add the helpers that match a
>> closid against a task, which need to be aware that the value written to
>> hardware is not the same as the one resctrl is using.
>>
>> Update the 'arm64_mpam_global_default' variable the arch code uses during
>> context switch to know when the per-cpu value should be used instead.
>>
>> Awkwardly, the MB controls don't implement CDP. To emulate this, the MPAM
>> equivalent needs programming twice by the resctrl glue, as resctrl expects
>> the bandwidth controls to be applied independently for both data and
>> instruction-fetch.
>>
>> CC: Dave Martin <Dave.Martin@arm.com>
>> CC: Amit Singh Tomar <amitsinght@marvell.com>
>> Signed-off-by: James Morse <james.morse@arm.com>
>> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
>
> Minor thing below.
> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
>
>
>> diff --git a/include/linux/arm_mpam.h b/include/linux/arm_mpam.h
>> index 5a78299ec464..ba0312b55d9f 100644
>> --- a/include/linux/arm_mpam.h
>> +++ b/include/linux/arm_mpam.h
>> @@ -5,6 +5,7 @@
>> #define __LINUX_ARM_MPAM_H
>>
>> #include <linux/acpi.h>
>> +#include <linux/resctrl_types.h>
>
> This seems odd as nothing added to the header in this path appears to need it.
> Maybe should be down in the c file or in a different patch?

Yep, moved it to patch 33, arm_mpam: resctrl: Allow resctrl to allocate
monitors.

>
>> #include <linux/types.h>
>>
>> struct mpam_msc;
>> @@ -56,6 +57,8 @@ void resctrl_arch_set_cpu_default_closid(int cpu, u32 closid);
>> void resctrl_arch_set_closid_rmid(struct task_struct *tsk, u32 closid, u32 rmid);
>> void resctrl_arch_set_cpu_default_closid_rmid(int cpu, u32 closid, u32 rmid);
>> void resctrl_arch_sched_in(struct task_struct *tsk);
>> +bool resctrl_arch_match_closid(struct task_struct *tsk, u32 closid);
>> +bool resctrl_arch_match_rmid(struct task_struct *tsk, u32 closid, u32 rmid);
>>
>> /**
>> * mpam_register_requestor() - Register a requestor with the MPAM driver
>

Thanks,

Ben