lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aYfnbc3T81RRxz5r@gen8>
Date: Sat, 7 Feb 2026 17:31:25 -0800
From: Drew Fustini <fustini@...nel.org>
To: yunhui cui <cuiyunhui@...edance.com>
Cc: Paul Walmsley <pjw@...nel.org>, Palmer Dabbelt <palmer@...belt.com>,
	Albert Ou <aou@...s.berkeley.edu>, Alexandre Ghiti <alex@...ti.fr>,
	Radim Krčmář <rkrcmar@...tanamicro.com>,
	Samuel Holland <samuel.holland@...ive.com>,
	Adrien Ricciardi <aricciardi@...libre.com>,
	Nicolas Pitre <npitre@...libre.com>,
	Kornel Dulęba <mindal@...ihalf.com>,
	Atish Patra <atish.patra@...ux.dev>,
	Atish Kumar Patra <atishp@...osinc.com>,
	Vasudevan Srinivasan <vasu@...osinc.com>,
	Ved Shanbhogue <ved@...osinc.com>,
	Chen Pei <cp0613@...ux.alibaba.com>,
	Liu Zhiwei <zhiwei_liu@...ux.alibaba.com>,
	Weiwei Li <liwei1518@...il.com>, guo.wenjia23@....com.cn,
	liu.qingtao2@....com.cn,
	Reinette Chatre <reinette.chatre@...el.com>,
	Tony Luck <tony.luck@...el.com>, Babu Moger <babu.moger@....com>,
	Peter Newman <peternewman@...gle.com>,
	Fenghua Yu <fenghua.yu@...el.com>,
	James Morse <james.morse@....com>, Ben Horgan <ben.horgan@....com>,
	Dave Martin <Dave.Martin@....com>, linux-kernel@...r.kernel.org,
	linux-riscv@...ts.infradead.org, x86@...nel.org,
	Rob Herring <robh@...nel.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Len Brown <lenb@...nel.org>, Robert Moore <robert.moore@...el.com>,
	Sunil V L <sunilvl@...tanamicro.com>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Paul Walmsley <paul.walmsley@...ive.com>,
	linux-acpi@...r.kernel.org, acpica-devel@...ts.linux.dev,
	devicetree@...r.kernel.org
Subject: Re: [External] [PATCH RFC v2 03/17] RISC-V: Add support for srmcfg
 CSR from Ssqosid ext

On Mon, Feb 02, 2026 at 11:17:52AM +0800, yunhui cui wrote:
> Hi Drew,
> 
> On Thu, Jan 29, 2026 at 4:28 AM Drew Fustini <fustini@...nel.org> wrote:
> >
> > Add support for the srmcfg CSR defined in the Ssqosid ISA extension
> > (Supervisor-mode Quality of Service ID). The CSR contains two fields:
> >
> >   - Resource Control ID (RCID) used determine resource allocation
> >   - Monitoring Counter ID (MCID) used to track resource usage
> >
> > Requests from a hart to shared resources like cache will be tagged with
> > these IDs. This allows the usage of shared resources to be associated
> > with the task currently running on the hart.
> >
> > A srmcfg field is added to thread_struct and has the same format as the
> > srmcfg CSR. This allows the scheduler to set the hart's srmcfg CSR to
> > contain the RCID and MCID for the task that is being scheduled in. The
> > srmcfg CSR is only written to if the thread_struct.srmcfg is different
> > than the current value of the CSR.
> >
> > A per-cpu variable cpu_srmcfg is used to mirror that state of the CSR.
> > This is because access to L1D hot memory should be several times faster
> > than a CSR read. Also, in the case of virtualization, accesses to this
> > CSR are trapped in the hypervisor.
> >
> > Link: https://github.com/riscv/riscv-ssqosid/releases/tag/v1.0
> > Co-developed-by: Kornel Dulęba <mindal@...ihalf.com>
> > Signed-off-by: Kornel Dulęba <mindal@...ihalf.com>
> > [fustini: rename csr, refactor switch_to, rebase on upstream]
> > Signed-off-by: Drew Fustini <fustini@...nel.org>
[..]
> > diff --git a/arch/riscv/include/asm/qos.h b/arch/riscv/include/asm/qos.h
> > new file mode 100644
> > index 000000000000..84830d7c6dc4
> > --- /dev/null
> > +++ b/arch/riscv/include/asm/qos.h
> > @@ -0,0 +1,41 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +#ifndef _ASM_RISCV_QOS_H
> > +#define _ASM_RISCV_QOS_H
> > +
> > +#ifdef CONFIG_RISCV_ISA_SSQOSID
> > +
> > +#include <linux/sched.h>
> > +#include <linux/jump_label.h>
> > +
> > +#include <asm/barrier.h>
> > +#include <asm/csr.h>
> > +#include <asm/hwcap.h>
> > +
> > +/* cached value of srmcfg csr for each cpu */
> > +DECLARE_PER_CPU(u32, cpu_srmcfg);
> > +
> > +static inline void __switch_to_srmcfg(struct task_struct *next)
> > +{
> > +       u32 *cpu_srmcfg_ptr = this_cpu_ptr(&cpu_srmcfg);
> > +       u32 thread_srmcfg;
> > +
> > +       thread_srmcfg = READ_ONCE(next->thread.srmcfg);
> 
> 
> First set the cpu_list, and then the condition thread_srmcfg !=
> *cpu_srmcfg_ptr will not be satisfied. Is a default value required
> here? Both code paths for cpu_list and tasks are compared against the
> default value; you may refer to the implementation of mpam.

I'm having trouble finding cpu_list but I think that it does make sense
to set the initial value.

Were you thinking I should look at mpam_set_cpu_defaults() in
the mpam_resctrl_glue_v4 [1] branch?

Thanks,
Drew

[1] https://gitlab.arm.com/linux-arm/linux-bh.git

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ