Re: resctrl2 - status

From: Tony Luck
Date: Wed Sep 20 2023 - 20:21:19 EST


On Fri, Sep 15, 2023 at 01:38:16PM -0700, Tony Luck wrote:
> My PoC code went full throttle on pushing all the schemata code to the
> driver. But you are right that this may be too drastic. Drivers could
> just indicate that they need one of the basic types "bitmap, percentage,
> number, bandwidth" together with some parameters (number of bits for
> bitmap, granularity for percentage, high/low values for number, ditto
> for bandwidth) and have core code handle the inital parsing. Then give
> to the module for validation (e.g. for the Intel requirement that
> cache bit masks have contiguous "1" bits), and some CPU models require
> that a minimum of two bits are set). Also pass to the module to apply
> (wrmsr() on a CPU in the domain for x86, MMIO from anywhere for ARM).
>
> For bitmasks - MPAM seems to allow very long masks. Perhaps the kernel
> can make use of the "%*pb" format to scanf/printk to cope with those?
> It would mean commas in the masks like 0000,00000fff,ffffff00,0000000f

James,

Your earlier e-mail came at a fortuitous moment. I am breaking my
giant patches into smaller pieces. I had just got to the "add the
schemata file" section of the series. I took your advice and put
the majority of the parsing code into the core, leaving the arch
specific modules just a hook to handle weird quirks.

Modules specify the "type" of their schemata entries, together with
a parameter that the core can use. I implemented two types so far.
But should be easy to add additional types like "bandwidth" as you
had suggested.

1) Bitmask. Parameter is the number of bits.
2) Unsigned long. Parameter is the max value.

Examples of quirks:
1) Intel L3 CAT requires all "1" bits to be in a consecutive block.
In this case core code will accept any bitmask that doesn't exceed
the number of bits. The module can reject if the user doesn't
follow the consecutive bits rule.
2) Intel L3 MBA requires that throttle percentage values be a multiple of the
h/w enumerated granularity (e.g. 10%). Here the module does a
roundup() to quietly fix invalid input (same as legacy resctrl).

I've only got through the "control" section of converting to patches.
But I think this is well past the halfway point.

Current snapshot of code is here:


git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git resctrl2_patches


* Comes with just the rdt_l3_cat and rdt_l3_mba modules.
Without the AMD support bits at this point.
* No "cpus", "mode", "size" files yet.
* Just CTRL_MON directories.
* No monitoring support yet.

-Tony