Re: [PATCH v11 2/8] x86/resctrl: Prepare for per-CTRL_MON group mba_MBps control

From: Luck, Tony
Date: Mon Dec 09 2024 - 19:01:04 EST


On Mon, Dec 09, 2024 at 03:40:12PM -0800, Reinette Chatre wrote:
> Hi Tony,
>
> On 12/9/24 2:35 PM, Luck, Tony wrote:
> >>> mba_mbps_default_event isn't architecture specific. The mba_MBps
> >>> feedback code could be implemented on any architecture that supports
> >>> both measurement and control of memory bandwidth.
> >>
> >> Yes, and it should be moved to that header then, right?
> >>
> >> But not earlier.
> >
> > If you feel strongly about it then go ahead and cut the line from <linux/rectrl.h>
> > and paste it into <asm/resctrl.h>
>
> I am not sure about this ... I expect the code needing this initially will
> form part of the filesystem code so it may be more intuitive to have it
> be located in arch/x86/kernel/cpu/resctrl/internal.h as Boris suggested.
> As part of the arch/fs split it may then move to fs/resctrl/internal.h
>
> mba_mbps_default_event may even stay internal to the fs/resctrl code with an
> arch helper created later to initialize it. This is because I think
> the initialization of mba_mbps_default_event may move out of
> get_rdt_mon_resources() into resctrl_mon_resource_init() that is being
> created as part of the MPAM work [1]. An example of current fs initialization
> done in arch code that is moved to it can be found in [2].

Reinette is right. The post-split home of this is not <linux/resctrl.h>
but fs/resctrl/internal.h which doesn't exist yet.

So Boris is right, this declaration should be added to arch/x86/kernel/cpu/resctrl/internal.h
by this patch to be moved later.

>
> [1] https://lore.kernel.org/all/20241004180347.19985-17-james.morse@xxxxxxx/
> [2] https://lore.kernel.org/all/20241004180347.19985-20-james.morse@xxxxxxx/

-Tony