Re: [PATCH v7 15/24] x86/resctrl: Allow arch to allocate memory needed in resctrl_arch_rmid_read()

From: James Morse
Date: Thu Dec 14 2023 - 06:38:13 EST


Hi Babu,

On 09/11/2023 20:47, Moger, Babu wrote:
> On 10/25/23 13:03, James Morse wrote:
>> Depending on the number of monitors available, Arm's MPAM may need to
>> allocate a monitor prior to reading the counter value. Allocating a
>> contended resource may involve sleeping.
>>
>> add_rmid_to_limbo() calls resctrl_arch_rmid_read() for multiple domains,
>> the allocation should be valid for all domains.
>
> This above sentence does not look correct after your previous patch [patch
> 14]. You removed resctrl_arch_rmid_read() from add_rmid_to_limbo().

Ah, this was the justification for making the allocated resource global, when the patches
were in a different order. It's also simpler to make them global. I've removed this
paragraph, and replaced it with:
| The memory or hardware allocated is not specific to a domain.

(its fairly obvious from the interface, but I felt it needed calling out in the commit
message)

> Otherwise looks good.
>
>>
>> __check_limbo() and mon_event_count() each make multiple calls to
>> resctrl_arch_rmid_read(), to avoid extra work on contended systems,
>> the allocation should be valid for multiple invocations of
>> resctrl_arch_rmid_read().
>>
>> Add arch hooks for this allocation, which need calling before
>> resctrl_arch_rmid_read(). The allocated monitor is passed to
>> resctrl_arch_rmid_read(), then freed again afterwards. The helper
>> can be called on any CPU, and can sleep.

> Reviewed-by: Babu Moger <babu.moger@xxxxxxx>

Thanks!

James