Skip to content

Commit 9be68b1

Browse files
James Morsebp3tk0v
authored andcommitted
x86/resctrl: Add an arch helper to reset one resource
On umount(), resctrl resets each resource back to its default configuration. It only ever does this for all resources in one go. reset_all_ctrls() is architecture specific as it works with struct rdt_hw_resource. Make reset_all_ctrls() an arch helper that resets one resource. Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Tony Luck <tony.luck@intel.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Reviewed-by: Fenghua Yu <fenghuay@nvidia.com> Reviewed-by: Babu Moger <babu.moger@amd.com> Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Peter Newman <peternewman@google.com> Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Amit Singh Tomar <amitsinght@marvell.com> # arm64 Tested-by: Shanker Donthineni <sdonthineni@nvidia.com> # arm64 Tested-by: Babu Moger <babu.moger@amd.com> Link: https://lore.kernel.org/r/20250311183715.16445-15-james.morse@arm.com
1 parent f16adba commit 9be68b1

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

arch/x86/kernel/cpu/resctrl/rdtgroup.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2867,7 +2867,7 @@ static int rdt_init_fs_context(struct fs_context *fc)
28672867
return 0;
28682868
}
28692869

2870-
static int reset_all_ctrls(struct rdt_resource *r)
2870+
void resctrl_arch_reset_all_ctrls(struct rdt_resource *r)
28712871
{
28722872
struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
28732873
struct rdt_hw_ctrl_domain *hw_dom;
@@ -2896,7 +2896,7 @@ static int reset_all_ctrls(struct rdt_resource *r)
28962896
smp_call_function_any(&d->hdr.cpu_mask, rdt_ctrl_update, &msr_param, 1);
28972897
}
28982898

2899-
return 0;
2899+
return;
29002900
}
29012901

29022902
/*
@@ -3015,9 +3015,10 @@ static void rdt_kill_sb(struct super_block *sb)
30153015

30163016
rdt_disable_ctx();
30173017

3018-
/*Put everything back to default values. */
3018+
/* Put everything back to default values. */
30193019
for_each_alloc_capable_rdt_resource(r)
3020-
reset_all_ctrls(r);
3020+
resctrl_arch_reset_all_ctrls(r);
3021+
30213022
rmdir_all_sub();
30223023
rdt_pseudo_lock_release();
30233024
rdtgroup_default.mode = RDT_MODE_SHAREABLE;

include/linux/resctrl.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,15 @@ void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_mon_domain *d,
394394
*/
395395
void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_mon_domain *d);
396396

397+
/**
398+
* resctrl_arch_reset_all_ctrls() - Reset the control for each CLOSID to its
399+
* default.
400+
* @r: The resctrl resource to reset.
401+
*
402+
* This can be called from any CPU.
403+
*/
404+
void resctrl_arch_reset_all_ctrls(struct rdt_resource *r);
405+
397406
extern unsigned int resctrl_rmid_realloc_threshold;
398407
extern unsigned int resctrl_rmid_realloc_limit;
399408

0 commit comments

Comments
 (0)