Re: [PATCH v5 19/24] x86/resctrl: Add helpers for system wide mon/alloc capable

From: James Morse
Date: Thu Aug 24 2023 - 12:59:02 EST


Hi Fenghua,

On 17/08/2023 19:34, Fenghua Yu wrote:
> On 7/28/23 09:42, James Morse wrote:
>> resctrl reads rdt_alloc_capable or rdt_mon_capable to determine
>> whether any of the resources support the corresponding features.
>> resctrl also uses the static-keys that affect the architecture's
>> context-switch code to determine the same thing.
>>
>> This forces another architecture to have the same static-keys.
>>
>> As the static-key is enabled based on the capable flag, and none of
>> the filesystem uses of these are in the scheduler path, move the
>> capable flags behind helpers, and use these in the filesystem
>> code instead of the static-key.
>>
>> After this change, only the architecture code manages and uses
>> the static-keys to ensure __resctrl_sched_in() does not need
>> runtime checks.
>>
>> This avoids multiple architectures having to define the same
>> static-keys.
>>
>> Cases where the static-key implicitly tested if the resctrl
>> filesystem was mounted all have an explicit check added by a
>> previous patch.

> Why isn't rdt_alloc_capable in get_rdt_alloc_resources() replaced by the helper?
>
> static __init bool get_rdt_alloc_resources(void)
> {
> ...
>         if (rdt_alloc_capable)
> ...

Because its in core.c, and is only called by get_rdt_resources as part of the arch codes
resctrl_late_init(). This can stay as it is once the filesystem code is moved out to
/fs/resctrl, there was no need to touch it.


Thanks,

James