Re: [PATCH v5 14/40] x86/resctrl: Add a resctrl helper to reset all the resources

From: James Morse
Date: Fri Feb 07 2025 - 10:44:40 EST


Hi Reinette,

On 23/10/2024 22:32, Reinette Chatre wrote:
> On 10/4/24 11:03 AM, James Morse wrote:
>> 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.
>>
>> Add an architecture helper to reset all resources.

>> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> index 61c8add103fe..a15198f90b29 100644
>> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> @@ -2883,6 +2883,14 @@ static int reset_all_ctrls(struct rdt_resource *r)
>> return 0;
>> }
>>
>> +void resctrl_arch_reset_resources(void)
>> +{
>> + struct rdt_resource *r;
>> +
>> + for_each_alloc_capable_rdt_resource(r)
>> + reset_all_ctrls(r);
>> +}

> Wouldn't this require all archs to have a duplicate helper as above with
> only the resctrl_all_ctrls() actually being arch specific?

I was hoping to be able to save a few IPI by doing the per-core work once, instead of
per-resource-per-core ... but its only done on umount, so I doubt anyone will complain!


> What if it is instead:
> resctrl_reset_alloc_resources() or reset_alloc_resources() or ...
> {
> struct rdt_resource *r;
>
> for_each_alloc_capable_rdt_resource(r)
> resctrl_arch_reset_all_ctrls(r);
> }
>
> With above archs only need to implement the actual reset code.

I opted for one helper that does everything as that is the only example today.
This has the advantage that the filesystem code can now reset a specific resource.

Sure, lets do that.


Thanks,

James

[0] https://lore.kernel.org/all/20230419111111.477118-8-dfustini@xxxxxxxxxxxx/