[PATCH v11 0/5] riscv: Add initial CBQRI resctrl support
Zeng Heng
zengheng at picoheart.com
Mon Nov 9 05:06:09 PST 2026
Hi Drew,
在 11/9/26 上午7:20, Drew Fustini 写道:
> This series adds initial RISC-V QoS support through the CBQRI
> controller interface [1] integrated with resctrl [2], plus a DT-based
> platform driver for cache controllers. It builds on the Ssqosid
> extension [3] (srmcfg CSR) support that landed in the v7.3 merge
> window. It has been tested on both the Tenstorrent Ascalon Shared Cache
> controller and a QEMU implementation [4].
>
> qemu-system-riscv64 -M virt,aia=aplic-imsic -nographic -m 1G -smp 8 \
> -kernel arch/riscv/boot/Image \
> -append "root=/dev/vda ro console=ttyS0 rootwait" \
> -drive if=none,file=rootfs.ext2,format=raw,id=hd0 \
> -device virtio-blk-device,drive=hd0 \
> -device riscv.cbqri.capacity,max_mcids=256,max_rcids=64,ncblks=16,mmio_base=0x04820000
>
> Cache allocation can be exercised on the booted system. Mount resctrl
> and read the default schemata. The L2 controller has 16 capacity
> blocks, so the default capacity bitmask (CBM) is 0xffff:
>
> # mount -t resctrl resctrl /sys/fs/resctrl
> # cat /sys/fs/resctrl/schemata
> L2:0=ffff
>
> Write a narrower CBM to a new control group and read it back to confirm
> the L2 controller applied it:
>
> # mkdir /sys/fs/resctrl/group0
> # echo "L2:0=ff" > /sys/fs/resctrl/group0/schemata
> # cat /sys/fs/resctrl/group0/schemata
> L2:0=ff
>
> Note that this series only implements support for resctrl L2 and L3
> cache resources using CBQRI capacity allocation control. cc_block_mask
> maps onto resctrl's existing cbm schema. However, cc_cunits is not
> supported as there is no existing equivalent for capacity units in the
> resctrl schemata.
>
> I previously iterated on an RFC series [5] that implemented all of
> CBQRI, including capacity monitoring, bandwidth allocation and
> monitoring. The bandwidth controls for CBQRI do not fit well into
> resctrl's existing throttle-based MB schemata. I believe that the path
> forward is Reinette's generic schema description proof of concept [6].
> My plan is to rebase the full support of CBQRI onto the generic schema
> once it is ready.
>
> Tony Luck's AET series [7] replaces resctrl_arch_alloc_capable() and
> resctrl_arch_mon_capable() with generic helpers that walk the resources.
> This series keeps the two hooks because resctrl on v7.4-rc1 still
> calls them, and answers the alloc hook from rdt_resource::alloc_capable
> so whichever series lands second only has to delete them. If the AET
> series lands first, the CBQRI glue will also need the three arch hooks
> it adds, resctrl_arch_system_max_rmid_idx(),
> resctrl_arch_get_num_rmid_idx() and resctrl_arch_unmount().
>
> [1] https://github.com/riscv-non-isa/riscv-cbqri/releases/tag/v1.0
> [2] https://docs.kernel.org/filesystems/resctrl.html
> [3] https://github.com/riscv/riscv-ssqosid/releases/tag/v1.0
> [4] https://github.com/tt-fustini/qemu/tree/riscv-cbqri-cache
> [5] https://lore.kernel.org/linux-riscv/20260601-ssqosid-cbqri-rqsc-v7-0-v6-0-baf00f50028a@kernel.org/
> [6] https://lore.kernel.org/all/d258a32f-12d5-464d-abe9-4720fb3e44b3@intel.com/
> [7] https://lore.kernel.org/lkml/20261019205031.16977-1-tony.luck@intel.com/
>
I have tested the CBQRI patch series, covering the following:
* Boot-time initialization
* Mounting and remounting the resctrl filesystem
* Creating resctrl control groups
* Configuring schemata for L3 block_mask resource allocation
All of the above worked as expected.
Tested-by: Zeng Heng <zengheng at picoheart.com>
Reviewed-by: Zeng Heng <zengheng at picoheart.com>
Best regards,
Zeng Heng
More information about the linux-riscv
mailing list