Re: [PATCH v6 17/42] x86/resctrl: Rewrite and move the for_each_*_rdt_resource() walkers

From: Reinette Chatre
Date: Wed Feb 19 2025 - 18:47:59 EST


Hi James,

On 2/7/25 10:17 AM, James Morse wrote:
> The for_each_*_rdt_resource() helpers walk the architecture's array
> of structures, using the resctrl visible part as an iterator. These
> became over-complex when the structures were split into a
> filesystem and architecture-specific struct. This approach avoided
> the need to touch every call site, and was done before there was a
> helper to retrieve a resource by rid.
>
> Once the filesystem parts of resctrl are moved to /fs/, both the
> architecture's resource array, and the definition of those structures
> is no longer accessible. To support resctrl, each architecture would
> have to provide equally complex macros.
>
> Rewrite the macro to make use of resctrl_arch_get_resource(), and
> move these to include/linux/resctrl.h so existing x86 arch code continues
> to use them.
>
> Signed-off-by: James Morse <james.morse@xxxxxxx>
> Tested-by: Shaopeng Tan <tan.shaopeng@xxxxxxxxxxxxxx>
> Reviewed-by: Shaopeng Tan <tan.shaopeng@xxxxxxxxxxxxxx>
> Reviewed-by: Tony Luck <tony.luck@xxxxxxxxx>
> ---

Reviewed-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>

Reinette