mbox series

[RFC,0/2] RISC-V: Detect Ssqosid extension and handle sqoscfg CSR

Message ID 20230410043646.3138446-1-dfustini@baylibre.com (mailing list archive)
Headers show
Series RISC-V: Detect Ssqosid extension and handle sqoscfg CSR | expand

Message

Drew Fustini April 10, 2023, 4:36 a.m. UTC
This RFC series adds initial support for the Ssqosid extension and the
sqoscfg CSR as specified in Chapter 2 of the RISC-V Capacity and
Bandwidth Controller QoS Register Interface (CBQRI) specification [1].

QoS (Quality of Service) in this context is concerned with shared
resources on an SoC such as cache capacity and memory bandwidth. Intel
and AMD already have QoS features on x86, and there is an existing user
interface in Linux: the resctrl virtual filesystem [2].

The sqoscfg CSR provides a mechanism by which a software workload (e.g.
a process or a set of processes) can be associated with a resource
control ID (RCID) and a monitoring counter ID (MCID) that accompanies
each request made by the hart to shared resources like cache. CBQRI
defines operations to configure resource usage limits, in the form of
capacity or bandwidth, for an RCID. CBQRI also defines operations to
configure counters to track the resource utilization of an MCID.

The CBQRI spec is still in draft state and is undergoing review [3]. It
is possible there will be changes to the Ssqosid extension and the CBQRI
spec. For example, the CSR address for sqoscfg is not yet finalized.

My goal for this RFC is to determine if the 2nd patch is an acceptable
approach to handling sqoscfg when switching tasks. This RFC was tested
against a QEMU branch that implements the Ssqosid extension [4]. A test
driver [5] was used to set thread_struct.sqoscfg for the current
process. This allowed __qos_sched_in() to be tested without resctrl.

A forthcoming RFC series will enable resctrl to support systems that
implement CBQRI and will reference a QEMU branch that implements CBQRI.

NOTE: CBQRI was previously known as CMQRI and the github repo with the
spec has not yet been renamed [6].

[1] https://github.com/riscv-non-isa/riscv-cmqri/blob/main/riscv-cbqri.pdf
[2] https://docs.kernel.org/x86/resctrl.html
[3] https://lists.riscv.org/g/tech-cmqri/message/38
[4] https://github.com/pdp7/qemu/tree/ssqosid_v8.0.0-rc1
[5] https://github.com/pdp7/linux/commits/ssqosid_sqoscfg_v6.3
[6] https://lists.riscv.org/g/tech-cmqri/message/41

Drew Fustini (1):
  RISC-V: Add support for sqoscfg CSR

Kornel Dulęba (1):
  RISC-V: Detect the Ssqosid extension

 arch/riscv/Kconfig                 | 19 ++++++++++++++
 arch/riscv/include/asm/csr.h       |  8 ++++++
 arch/riscv/include/asm/hwcap.h     |  2 ++
 arch/riscv/include/asm/processor.h |  3 +++
 arch/riscv/include/asm/qos.h       | 40 ++++++++++++++++++++++++++++++
 arch/riscv/include/asm/switch_to.h |  2 ++
 arch/riscv/kernel/cpu.c            |  1 +
 arch/riscv/kernel/cpufeature.c     |  1 +
 8 files changed, 76 insertions(+)
 create mode 100644 arch/riscv/include/asm/qos.h


base-commit: d34a6b715a23ccd9c9d0bc7a475bea59dc3e28b2