Re: [PATCH RFC v3 06/11] RISC-V: QoS: add resctrl setup and domain management
From: Drew Fustini
Date: Sat Apr 18 2026 - 18:01:32 EST
On Fri, Apr 17, 2026 at 06:52:27PM +0800, guo.wenjia23@xxxxxxxxxx wrote:
> Hi Drew,
>
> On Wed, Apr 15, 2026 at 9:57 AM Drew Fustini <fustini@xxxxxxxxxx> wrote:
>
> > Add the setup and domain management layer: domain allocation
> > (qos_new_domain), controller value initialization
> > (qos_init_domain_ctrlval), resource struct initialization for cache and
> > bandwidth resources, domain registration with the resctrl filesystem
> > (qos_resctrl_add_controller_domain), and the top-level setup function
> > (qos_resctrl_setup) that probes all controllers and calls resctrl_init().
> >
> > Also add qos_resctrl_online_cpu() and qos_resctrl_offline_cpu() for CPU
> > hotplug integration.
> >
> > Co-developed-by: Adrien Ricciardi <aricciardi@xxxxxxxxxxxx>
> > Signed-off-by: Adrien Ricciardi <aricciardi@xxxxxxxxxxxx>
> > Signed-off-by: Drew Fustini <fustini@xxxxxxxxxx>
> > ---
> > arch/riscv/kernel/qos/qos_resctrl.c | 295 +++++++++++++++++++++++++++++++++++-
> > 1 file changed, 294 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/riscv/kernel/qos/qos_resctrl.c b/arch/riscv/kernel/qos/qos_resctrl.c
> > index a4a120f89840..8d7e3b0abb75 100644
> > --- a/arch/riscv/kernel/qos/qos_resctrl.c
> > +++ b/arch/riscv/kernel/qos/qos_resctrl.c
> > @@ -675,7 +675,23 @@ void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_l3_mon_domai
> >
> > void resctrl_arch_reset_all_ctrls(struct rdt_resource *r)
> > {
> > - /* not implemented for the RISC-V resctrl implementation */
> > + struct cbqri_resctrl_res *hw_res;
> > + struct rdt_ctrl_domain *d;
> > + enum resctrl_conf_type t;
> > + u32 default_ctrl;
> > + int i;
> > +
> > + lockdep_assert_cpus_held();
> > +
> > + hw_res = container_of(r, struct cbqri_resctrl_res, resctrl_res);
> > + default_ctrl = resctrl_get_default_ctrl(r);
> > +
> > + list_for_each_entry(d, &r->ctrl_domains, hdr.list) {
> > + for (i = 0; i < hw_res->max_rcid; i++) {
> > + for (t = 0; t < CDP_NUM_TYPES; t++)
> > + resctrl_arch_update_one(r, d, i, t, default_ctrl);
>
> For the bw controller, default_ctrl = max_bw, and
> resctrl_arch_update_one will set the rbwb of all RCIDs to max_bw.
> According to the spec: The sum of Rbwb allocated across all rcids must
> not exceed MRBWB value.
>
> Does this conflict with the spec?
Good point. Yeah, this is not being done correctly. I had been doing
similar to what is done on x86 but the big difference is that CBQRI is
reservation based.
Each RCID must have at least 1 Rbwb, and the remainder should be
assigned to default group, RCID 0. It'll update the implementation.
Thanks,
Drew