Skip to content
Snippets Groups Projects
  1. May 01, 2023
  2. Apr 30, 2023
    • Drew Fustini's avatar
      RISC-V: Detect Ssqosid extension and handle sqoscfg CSR · 1752e680
      Drew Fustini authored
      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 sqoscfg for the current process. This allows
      __switch_to_sqoscfg() to be tested without resctrl.
      
      This series is based on riscv/for-next at:
      
       b09313dd ("RISC-V: hwprobe: Explicity check for -1 in vdso init")
      
      Changes from v1:
       - change DEFINE_PER_CPU to DECLARE_PER_CPU for cpu_sqoscfg in qos.h to
         prevent linking error about multiple definition. Move DEFINE_PER_CPU
         for cpu_sqoscfg into qos.c
       - renamed qos prefix in function names to sqoscfg to be less generic
       - handle sqoscfg the same way has_vector and has_fpu are handled in the
         vector patch series [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-cbqri/message/38
      [4] https://gitlab.baylibre.com/baylibre/qemu/-/tree/riscv-cbqri-rfc-v2
      [5] https://gitlab.baylibre.com/baylibre/linux/-/tree/riscv-sqoscfg-rfc-v2
      [6] https://lore.kernel.org/linux-riscv/20230414155843.12963-1-andy.chiu@sifive.com/
      
      ---
      Changes in v3:
      - EDITME: describe what is new in this series revision.
      - EDITME: use bulletpoints and terse descriptions.
      - Link to v2: https://lore.kernel.org/r/20230430-riscv-cbqri-rfc-v2-v2-0-8e3725c4a473@baylibre.com
      
      
      
      --- b4-submit-tracking ---
      # This section is used internally by b4 prep for tracking purposes.
      {
        "series": {
          "revision": 3,
          "change-id": "20230430-riscv-cbqri-rfc-v2-b007fcd19549",
          "base-branch": "riscv-cbqri-rfc-v2",
          "prefixes": [
            "RFC"
          ],
          "history": {
            "v2": [
              "20230430-riscv-cbqri-rfc-v2-v2-0-8e3725c4a473@baylibre.com"
            ]
          }
        }
      }
      1752e680
  3. Apr 26, 2023
  4. Apr 19, 2023
  5. Apr 12, 2023
  6. Apr 11, 2023
Loading