Re: [External] [PATCH RFC v2 08/17] RISC-V: QoS: add resctrl interface for CBQRI controllers

Drew Fustini <[email protected]>
Newsgroups dev.linux.lists.acpica-devel,org.infradead.lists.linux-riscv,org.kernel.vger.linux-acpi,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <acOCt91J7ddr9I7A@gen8>
On Wed, Mar 25, 2026 at 10:09:01AM +0800, yunhui cui wrote:
> Hi Drew,
> 
> On Thu, Jan 29, 2026 at 4:28 AM Drew Fustini <[email protected]> wrote:
> >
> > Add interface for CBQRI controller drivers to make use of the resctrl
> > filesystem.
> >
> > Co-developed-by: Adrien Ricciardi <[email protected]>
> > Signed-off-by: Adrien Ricciardi <[email protected]>
> > Signed-off-by: Drew Fustini <[email protected]>
> > ---
> >  arch/riscv/kernel/qos/qos_resctrl.c | 1192 +++++++++++++++++++++++++++++++++++
> >  1 file changed, 1192 insertions(+)
> >
> > diff --git a/arch/riscv/kernel/qos/qos_resctrl.c b/arch/riscv/kernel/qos/qos_resctrl.c
> > new file mode 100644
> > index 000000000000..d500098599d2
> > --- /dev/null
> > +++ b/arch/riscv/kernel/qos/qos_resctrl.c
> > @@ -0,0 +1,1192 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +
> > +#define pr_fmt(fmt) "qos: resctrl: " fmt
> > +
> > +#include <linux/slab.h>
> > +#include <linux/err.h>
> > +#include <linux/riscv_qos.h>
> > +#include <linux/resctrl.h>
> > +#include <linux/types.h>
> > +#include <asm/csr.h>
> > +#include <asm/qos.h>
> > +#include "internal.h"
> > +
> > +#define MAX_CONTROLLERS 6
> > +static struct cbqri_controller controllers[MAX_CONTROLLERS];
> 
> We can get the total number of controllers, so we'll allocate dynamically.

I've made a lot of improvements but am still making more changes based
on the feedback from Reinette and you. I'm hoping to finish and send a
new revision of the series but in the meantime my work-in-progress is
b4/ssqosid-cbqri-rqsc [1].

I have dropped this static array and now just use a list of controllers.
It is populated by drivers/acpi/riscv/rqsc.c [2] and iterated through by
qos_resctrl_setup() in arch/riscv/kernel/qos/qos_resctrl.c [3].

[1] https://github.com/tt-fustini/linux/tree/b4/ssqosid-cbqri-rqsc
[2] https://github.com/tt-fustini/linux/blob/b4/ssqosid-cbqri-rqsc/drivers/acpi/riscv/rqsc.c
[3] https://github.com/tt-fustini/linux/blob/b4/ssqosid-cbqri-rqsc/arch/riscv/kernel/qos/qos_resctrl.c

> > +static int qos_resctrl_add_controller_domain(struct cbqri_controller *ctrl, int *id)
[..]

> 1. Wrap this into a function.
> 
> 2. Also, mweight controller support needs to be added here.
> We may need to add RDT_RESOURCE_MB_WEIGHT to the enumeration:
> enum resctrl_res_level {
> ...
> RDT_RESOURCE_MB_WEIGHT,
> ...
> };
> 
> 3. We need to implement cbqri_set_mweight() and cbqri_get_mweight().

I think this could be a good way to implement mweight but I am planning
to intiailly support justI think this could be a good way to implement
mweight but I am planning to intiailly support just rbwb
 
> 4. We need to add monitor controllers (domains) for both capacity and MBW.

I don't want to attempt to support bandwidth monitoring until there is
progress in resctrl for support of cpu-less memory devices as this is a
concern for mpam too. However, it should be possible to support cache
occupancy monitoring.

[..]
> > +       pr_info("exposed_alloc_capable = %d", exposed_alloc_capable);
> > +       pr_info("exposed_mon_capable = %d", exposed_mon_capable);
> > +       pr_info("exposed_cdp_l2_capable = %d", exposed_cdp_l2_capable);
> > +       pr_info("exposed_cdp_l3_capable = %d", exposed_cdp_l3_capable);
> 
> One line of pr_info? Print total controllers, capacity and MBW counts

Good idea, I'll do that.

Thanks,
Drew
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.