Re: [PATCH RFC 08/19] 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 <actiYi6ACcOrvz9J@gen8>
On Thu, Mar 26, 2026 at 07:05:48PM +0800, [email protected] 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(+)
> >
> > ...
> >
> > +
> > +int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_ctrl_domain *d,
> > +                           u32 closid, enum resctrl_conf_type t, u32 cfg_val)
> > +{
> > +       struct cbqri_controller *ctrl;
> > +       struct cbqri_resctrl_dom *dom;
> > +       struct cbqri_config cfg;
> > +       int err = 0;
> > +
> > +       dom = container_of(d, struct cbqri_resctrl_dom, resctrl_ctrl_dom);
> > +       ctrl = dom->hw_ctrl;
> > +
> > +       if (!r->alloc_capable)
> > +               return -EINVAL;
> > +
> > +       switch (r->rid) {
> > +       case RDT_RESOURCE_L2:
> > +       case RDT_RESOURCE_L3:
> > +               cfg.cbm = cfg_val;
> > +               err = cbqri_apply_cache_config(dom, closid, t, &cfg);
> > +               break;
> > +       case RDT_RESOURCE_MBA:
> > +               /* covert from percentage to bandwidth blocks */
> > +               cfg.rbwb = cfg_val * ctrl->bc.nbwblks / 100;
> 
> Should use bc.mrbwb to calculate rbwb? 
> I think bc.nbwblks represent the available bw blks in the controller.
> It should should decrease as they are allocated.

The resctrl MBA resource is supposed to be the percentage of total
memory bandwidth. nbwblks is the total number of bandwidth blocks, so I
think the existing calucation is correct.

From the example SoC configuration, the number of bandwidth blocks is
1024, and mrbwb is meant to be 80% of nbwblks which is 819.

Setting MB to 80% in schemata would yield: 80 * 1024 / 100 = 819

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.