Re: [PATCH v7 37/49] x86/resctrl: Expand the width of dom_id by replacing mon_data_bits

James Morse
2025-04-04T16:53:24Z

Hi Tony,

On 03/04/2025 20:16, Luck, Tony wrote:
> On Mon, Mar 24, 2025 at 05:52:37PM -0700, Luck, Tony wrote:
>> Is this all overly complex trying to re-use the "priv" fields from
>> the default resctrl group?

I was trying to keep the kernfs hierarchy as the source of truth for this, and
keep the extra memory allocated to a minimum.

>> Would it be easier to just keep a list
>> of each combinations of region id, domain id, sum, and event id that have
>> already been allocated and re-use existing ones, or add to the list
>> for new ones.

I agree this is much simpler!

>> Scanning this list may be less overhead that all the
>> sprintf() and kernfs_find_and_get() searches.

> I played around with the simplification some more and tested on both
> normal and SNC systems. Below is a patch against:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git mpam/move_to_fs/v7
>
> Note that this is *after* the move to fs/resctrl as I was too chicken
> to try applying this before the move and then re-run the script to
> move things. But if you take this suggestion, just mash it into your
> "Expand the width of dom_id by replacing mon_data_bits" patch.
> Maybe give me Co-developed-by credit, but that's not important.

Done!

> Note that your expansion of mon_data is going to be very useful going
> forward. I want to add extra information to struct mon_data:
>
> 1) Flag to note that an event counter can be read from any CPU, not
> just the ones in the domain specified by the mon_data/mon_L3_XX/*
> file.

Awesome - (some) arm64 and risc-v have this too.

> 2) Type field to specify how to display the value of each counter
> (since I want floating point instead of integer for the energy
> counters).

Thanks,

James