linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Drew Fustini <dfustini@baylibre.com>
To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Conor Dooley" <conor.dooley@microchip.com>,
	"Ved Shanbhogue" <ved@rivosinc.com>,
	"Atish Patra" <atishp@rivosinc.com>,
	"Björn Töpel" <bjorn@rivosinc.com>,
	"James Morse" <james.morse@arm.com>,
	"Kornel Dulęba" <mindal@semihalf.com>,
	"Adrien Ricciardi" <aricciardi@baylibre.com>,
	"Drew Fustini" <dfustini@baylibre.com>
Subject: [PATCH RFC v2 0/2] RISC-V: Detect Ssqosid extension and handle sqoscfg CSR
Date: Mon, 01 May 2023 14:05:20 -0700	[thread overview]
Message-ID: <20230430-riscv-cbqri-rfc-v2-v2-0-8e3725c4a473@baylibre.com> (raw)

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:

 b09313dd2e72 ("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/

---
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       | 43 ++++++++++++++++++++++++++++++++++++++
 arch/riscv/include/asm/switch_to.h |  3 +++
 arch/riscv/kernel/Makefile         |  1 +
 arch/riscv/kernel/cpu.c            |  1 +
 arch/riscv/kernel/cpufeature.c     |  1 +
 arch/riscv/kernel/qos/Makefile     |  2 ++
 arch/riscv/kernel/qos/qos.c        |  5 +++++
 11 files changed, 88 insertions(+)
---
base-commit: b09313dd2e726fe5e1fa574cd73f5e326c6030a4
change-id: 20230430-riscv-cbqri-rfc-v2-b007fcd19549

Best regards,
-- 
Drew Fustini <dfustini@baylibre.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

             reply	other threads:[~2023-05-01 21:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-01 21:05 Drew Fustini [this message]
2023-05-01 21:05 ` [PATCH RFC v2 1/2] RISC-V: Detect the Ssqosid extension Drew Fustini
2023-05-01 21:05 ` [PATCH RFC v2 2/2] RISC-V: Add support for sqoscfg CSR Drew Fustini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230430-riscv-cbqri-rfc-v2-v2-0-8e3725c4a473@baylibre.com \
    --to=dfustini@baylibre.com \
    --cc=aricciardi@baylibre.com \
    --cc=atishp@rivosinc.com \
    --cc=bjorn@rivosinc.com \
    --cc=conor.dooley@microchip.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mindal@semihalf.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=ved@rivosinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).