Re: [PATCH v6 41/42] x86/resctrl: Move the filesystem bits to headers visible to fs/resctrl

From: Reinette Chatre
Date: Thu Feb 20 2025 - 01:01:05 EST


Hi James,

On 2/7/25 10:18 AM, James Morse wrote:
> Once the filesystem parts of resctrl move to fs/resctrl, it cannot rely
> on definitions in x86's internal.h.
>
> Move definitions in internal.h that need to be shared between the
> filesystem and architecture code to header files that fs/resctrl can
> include.
>
> Doing this separately means the filesystem code only moves between files
> of the same name, instead of having these changes mixed in too.
>
> Co-developed-by: Dave Martin <Dave.Martin@xxxxxxx>
> Signed-off-by: Dave Martin <Dave.Martin@xxxxxxx>
> Signed-off-by: James Morse <james.morse@xxxxxxx>
> Tested-by: Carl Worth <carl@xxxxxxxxxxxxxxxxxxxxxx> # arm64
> Tested-by: Shaopeng Tan <tan.shaopeng@xxxxxxxxxxxxxx>
> Reviewed-by: Shaopeng Tan <tan.shaopeng@xxxxxxxxxxxxxx>
> Reviewed-by: Tony Luck <tony.luck@xxxxxxxxx>
> ---

..

> ---
> arch/x86/include/asm/resctrl.h | 3 +++
> arch/x86/kernel/cpu/resctrl/core.c | 5 +++++
> arch/x86/kernel/cpu/resctrl/internal.h | 9 ---------
> include/linux/resctrl_types.h | 3 +++
> 4 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h
> index 7a39728b0743..6eb7d5c94c7a 100644
> --- a/arch/x86/include/asm/resctrl.h
> +++ b/arch/x86/include/asm/resctrl.h
> @@ -210,6 +210,9 @@ int resctrl_arch_measure_l2_residency(void *_plr);
> int resctrl_arch_measure_l3_residency(void *_plr);
> void resctrl_cpu_detect(struct cpuinfo_x86 *c);
>
> +bool resctrl_arch_get_cdp_enabled(enum resctrl_res_level l);
> +int resctrl_arch_set_cdp_enabled(enum resctrl_res_level l, bool enable);
> +
> #else
>
> static inline void resctrl_arch_sched_in(struct task_struct *tsk) {}
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index 6303c0ee0ae2..f2cd7ba39fcc 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -288,6 +288,11 @@ static void rdt_get_cdp_l2_config(void)
> rdt_get_cdp_config(RDT_RESOURCE_L2);
> }
>
> +bool resctrl_arch_get_cdp_enabled(enum resctrl_res_level l)
> +{
> + return rdt_resources_all[l].cdp_enabled;
> +}
> +

This moves resctrl_arch_get_cdp_enabled() to arch/x86/kernel/cpu/resctrl/core.c
while resctrl_arch_set_cdp_enabled() is already in arch/x86/kernel/cpu/resctrl/rdtgroup.c.
Most of resctrl_arch_get_cdp_enabled()'s callers are
in arch/x86/kernel/cpu/resctrl/rdtgroup.c so it seems appropriate to keep it with
its partner resctrl_arch_set_cdp_enabled()?

Reinette