Re: [External] Re: [PATCH v12 1/5] riscv_cbqri: Add capacity controller core

From: yunhui cui

Date: Fri Nov 20 2026 - 04:31:18 EST


Hi Drew,

On Fri, Nov 20, 2026 at 8:39 AM Drew Fustini <fustini@xxxxxxxxxx> wrote:
>
> On Thu, Nov 19, 2026 at 07:00:21PM +0800, yunhui cui wrote:
> > Hi Drew,
> >
> > On Thu, Nov 19, 2026 at 8:09 AM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> > >
> > > On Sat, 14 Nov 2026 14:06:21 -0800
> > > Drew Fustini <fustini@xxxxxxxxxx> wrote:
> > >
> > > > Add the core for RISC-V CBQRI capacity controllers: the register
> > > > layout, the capability probe, and the allocation operations that
> > > > program a capacity block mask for an RCID and read it back.
> > > >
> > > > A discovery layer maps the register block and describes the controller
> > > > in a cbqri_controller_info descriptor. riscv_cbqri_register_cc() probes
> > > > the controller from that descriptor and adds it to the controller list,
> > > > which stays private to the core. The core owns the controller state
> > > > after registration, so nothing in it depends on how the controller was
> > > > discovered. The caller keeps the register mapping alive.
> > > >
> > > > Tested-by: Zeng Heng <zengheng@xxxxxxxxxxxxx>
> > > > Reviewed-by: Zeng Heng <zengheng@xxxxxxxxxxxxx>
> > > > Co-developed-by: Adrien Ricciardi <aricciardi@xxxxxxxxxxxx>
> > > > Signed-off-by: Adrien Ricciardi <aricciardi@xxxxxxxxxxxx>
> > > > Signed-off-by: Drew Fustini <fustini@xxxxxxxxxx>
> [..]
> > > > + /* The resctrl glue keys its domains on cache_id, one controller each. */
> > > > + list_for_each_entry(other, &cbqri_controllers, list) {
> > > > + if (other->cache.cache_level == info->cache_level &&
> > > > + other->cache.cache_id == info->cache_id) {
> > > > + pr_warn("CC at %pa duplicates the L%u cache id %u controller at %pa, skipping\n",
> > > > + &ctrl->addr, info->cache_level, info->cache_id,
> > > > + &other->addr);
> > > > + return -EEXIST;
> >
> > A controller with the same cache level and Cache ID is not necessarily
> > a duplicate. A distributed LLC may have multiple physical controllers
> > managing the same logical L3 resource.
> >
> > Matching controllers should instead be grouped into a logical component
> > keyed by (cache_level, cache_id), with the physical controllers kept in
> > a linked list. User space would see one logical controller as a single
> > resctrl L3 domain, while the update path would iterate the list and
> > program every physical controller.
>
> Good point that it is not a duplicate. However, I would like to keep the
> scope of this series from expanding, so I would prefer for that scenario
> to be handled in a future series. The domain id is the cache id in both
> cases, so it won't be a problem to add later.
>
> Do you have a platform with such an L3 that it could be tested on?
>
> For v13, I could change the comment and the warning so that they say a
> second controller for a cache is not supported, instead of calling it a
> duplicate. The alternative could be to skip the whole group if it is
> a problem to just leave the first of the group enabled.

Keeping only the first controller could expose one logical L3 domain to
user space while configuring only part of the physical resource. Requests
handled by the remaining controllers would not receive the same allocation.

This topology should be testable in QEMU by creating two capacity
controllers with different MMIO bases and making both RQSC resource
entries reference the same PPTT Cache ID.

One possible grouping model is:

1. Initialization
Group controllers by (cache_level, cache_id). Represent each group
as one logical component containing a linked list of its physical controllers.

2. Set
Let the resctrl domain reference the logical component. On a schemata
update, iterate over the controller list and program every physical controller.

3. Get
Read the configuration from the first controller and verify that the
remaining controllers report the same value.

4. Monitor
When monitoring support is added, read the counter for the same MCID
from every physical controller and report the sum for the logical
resctrl domain.

User space would continue to see one logical L3 domain, while all
physical controllers behind it remain synchronized.

Until this grouping is supported, it would be safer to skip the whole
component rather than enable only the first controller. Since this is a
valid RQSC topology and can be covered by QEMU, supporting the grouping
in the current work would be preferable.

Thanks,
Yunhui


>
> Thanks,
> Drew
>