Re: [PATCH v5 21/40] x86/resctrl: Change mon_event_config_{read,write}() to be arch helpers
From: James Morse
Date: Fri Feb 07 2025 - 10:46:45 EST
Hi Reinette,
On 23/10/2024 23:19, Reinette Chatre wrote:
> On 10/4/24 11:03 AM, James Morse wrote:
>> @@ -315,6 +322,24 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid);
>>
>> bool __init resctrl_arch_is_evt_configurable(enum resctrl_event_id evt);
>>
>> +/**
>> + * resctrl_arch_mon_event_config_write() - Write the config for a counter.
>
> Please avoid the term "counter" for events ... the upcoming AMD work adds support
> for counters*.
Fixed.
>> + * @info: struct resctrl_mon_config_info describing the resource, domain
>> + * and event.
>
> Expected "config" to appear as part of information about function
> that claims to writes config?
I'll rename the variable.
>> + *
>> + * Must be called on a CPU that is a member of the specified domain.
> I am not sure about this. Is this documentation intended to support authors of
> arch code? In that case it may be instead useful to know that this function will be
> called on a CPU that is a member of the specified domain to avoid confusion from arch
> side whether it needs to take some action to ensure function is called on right CPU.
>
> Called on a CPU that is a member of the specified domain.
I don't think we have clear idea who this documentation is for - I'm assuming its for the
caller...
I'll change this to "Called via IPI to reach a CPU that is a member of the specified
domain", as that covers both views, and adds that its called in irq context.
>> + */
>> +void resctrl_arch_mon_event_config_write(void *info);
>> +
>> +/**
>> + * resctrl_arch_mon_event_config_read() - Read the config for a counter.
>
> counter -> event
>
>> + * @info: struct resctrl_mon_config_info describing the resource, domain
>> + * and event.
>
> Copy&paste? No information on how config is returned.
Laziness - there is only one possible place it could be! I've added:
| * Reads resource, domain and eventid from @config_info and reads the
| * hardware config value into config_info->mon_config.
and similar on the other function.
Thanks,
James