[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2271224c-1796-4823-8c2c-6f529814e645@nvidia.com>
Date: Sun, 8 Feb 2026 17:16:15 -0800
From: Fenghua Yu <fenghuay@...dia.com>
To: Ben Horgan <ben.horgan@....com>
Cc: amitsinght@...vell.com, baisheng.gao@...soc.com,
baolin.wang@...ux.alibaba.com, carl@...amperecomputing.com,
dave.martin@....com, david@...nel.org, dfustini@...libre.com,
gshan@...hat.com, james.morse@....com, jonathan.cameron@...wei.com,
kobak@...dia.com, lcherian@...vell.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
peternewman@...gle.com, punit.agrawal@....qualcomm.com,
quic_jiles@...cinc.com, reinette.chatre@...el.com, rohit.mathew@....com,
scott@...amperecomputing.com, sdonthineni@...dia.com,
tan.shaopeng@...itsu.com, xhao@...ux.alibaba.com, catalin.marinas@....com,
will@...nel.org, corbet@....net, maz@...nel.org, oupton@...nel.org,
joey.gouly@....com, suzuki.poulose@....com, kvmarm@...ts.linux.dev,
zengheng4@...wei.com, linux-doc@...r.kernel.org,
Shaopeng Tan <tan.shaopeng@...fujitsu.com>
Subject: Re: [PATCH v4 20/41] arm_mpam: resctrl: Add CDP emulation
Hi, Ben,
On 2/3/26 13:43, Ben Horgan wrote:
> From: James Morse <james.morse@....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. Also,
> update these per-cpu values and sync the resulting mpam partid/pmg
> configuration to hardware.
>
> 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.
>
> Tested-by: Gavin Shan <gshan@...hat.com>
> Tested-by: Shaopeng Tan <tan.shaopeng@...fujitsu.com>
> Tested-by: Peter Newman <peternewman@...gle.com>
> CC: Dave Martin <Dave.Martin@....com>
> CC: Amit Singh Tomar <amitsinght@...vell.com>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>
> Signed-off-by: James Morse <james.morse@....com>
> Signed-off-by: Ben Horgan <ben.horgan@....com>
> ---
> Changes since rfc:
> Fail cdp initialisation if there is only one partid
> Correct data/code confusion
>
> Changes since v2:
> Don't include unused header
>
> Changes since v3:
> Update the per-cpu values and sync to h/w
> ---
> arch/arm64/include/asm/mpam.h | 1 +
> drivers/resctrl/mpam_resctrl.c | 117 +++++++++++++++++++++++++++++++++
> include/linux/arm_mpam.h | 2 +
> 3 files changed, 120 insertions(+)
>
> diff --git a/arch/arm64/include/asm/mpam.h b/arch/arm64/include/asm/mpam.h
> index 05aa71200f61..70d396e7b6da 100644
> --- a/arch/arm64/include/asm/mpam.h
> +++ b/arch/arm64/include/asm/mpam.h
> @@ -4,6 +4,7 @@
> #ifndef __ASM__MPAM_H
> #define __ASM__MPAM_H
>
> +#include <linux/arm_mpam.h>
> #include <linux/bitfield.h>
> #include <linux/jump_label.h>
> #include <linux/percpu.h>
> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
> index cd52ca279651..12017264530a 100644
> --- a/drivers/resctrl/mpam_resctrl.c
> +++ b/drivers/resctrl/mpam_resctrl.c
> @@ -38,6 +38,10 @@ static DEFINE_MUTEX(domain_list_lock);
> static bool exposed_alloc_capable;
> static bool exposed_mon_capable;
>
> +/*
> + * MPAM emulates CDP by setting different PARTID in the I/D fields of MPAM0_EL1.
> + * This applies globally to all traffic the CPU generates.
> + */
> static bool cdp_enabled;
>
> bool resctrl_arch_alloc_capable(void)
> @@ -50,6 +54,72 @@ bool resctrl_arch_mon_capable(void)
> return exposed_mon_capable;
> }
>
> +bool resctrl_arch_get_cdp_enabled(enum resctrl_res_level rid)
> +{
> + switch (rid) {
> + case RDT_RESOURCE_L2:
> + case RDT_RESOURCE_L3:
> + return cdp_enabled;
> + case RDT_RESOURCE_MBA:
> + default:
> + /*
> + * x86's MBA control doesn't support CDP, so user-space doesn't
s/x86's/ARM's/
Thanks.
-Fenghua
[SNIP]
Powered by blists - more mailing lists