[PATCH RFC v3 05/11] RISC-V: QoS: add resctrl arch callbacks for CBQRI controllers

Drew Fustini fustini at kernel.org
Thu Apr 30 16:37:18 PDT 2026


On Thu, Apr 30, 2026 at 04:17:22PM -0700, Reinette Chatre wrote:
> Hi Drew,
> 
> On 4/14/26 6:53 PM, Drew Fustini wrote:
> 
> > +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:
> > +		/* convert from percentage to bandwidth blocks */
> > +		cfg.rbwb = cfg_val * ctrl->bc.nbwblks / 100;
> > +		cfg.rbwb = min_t(u64, cfg.rbwb, ctrl->bc.mrbwb);
> > +		err = cbqri_apply_bw_config(dom, closid, t, &cfg);
> 
> (Earlier comment wondered about whether rbwb cannot just be provided
> directly to cbqri_apply_bw_config().)
> 
> Apart from that it looks like this can benefit from "emulated controls"
> that we mused about at https://lore.kernel.org/lkml/e788ca62-ec63-4552-978b-9569f369afd5@intel.com/
> 
> At this time this MBA resource is constrained by the 1% steps that the
> default MB control supports and clearly it is emulated with a control that
> can support finer granularities. I am currently working on a PoC of the
> base schema descriptions on which the support for emulated controls can
> be built that should be able to expose full hardware capability.
> 
> Reinette

Thank you for your review. I have been working on a large overhaul to
the series in v4 and was about to send it. I finally realized the
sematic mismatch between resctl MB resource and what the RISC-V CBQRI
spec offers. I decided to create MB_MIN for reserved bandwidth and
MB_WGHT (weight) for shared bandwidth porpotional weight.

I didn't expect adding two new resources to be the best solution but I
wanted to offer something tangible to move the discussion forward. I
look forward to your proof of concept as I expect I can then build
proper support CBQRI bandwidth allocation (reservation and proportional
share) on top of that.

Thanks,
Drew



More information about the linux-riscv mailing list