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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aXk3zq26cU8r/COG@x1>
Date: Tue, 27 Jan 2026 14:10:22 -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, Conor Dooley <conor+dt@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Rob Herring <robh+dt@...nel.org>,
	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>, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
	x86@...nel.org
Subject: Re: [External] [PATCH RFC 08/19] RISC-V: QoS: add resctrl interface
 for CBQRI controllers

On Mon, Jan 26, 2026 at 01:02:12PM -0800, Drew Fustini wrote:
> On Mon, Jan 26, 2026 at 09:01:30PM +0800, yunhui cui wrote:
> > Hi Drew,
> > 
> > On Tue, Jan 20, 2026 at 12:15 PM Drew Fustini <fustini@...nel.org> wrote:
> > >
> > > Add interface for CBQRI controller drivers to make use of the resctrl
> > > filesystem.
> > >
> > > Co-developed-by: Adrien Ricciardi <aricciardi@...libre.com>
> > > Signed-off-by: Adrien Ricciardi <aricciardi@...libre.com>
> > > Signed-off-by: Drew Fustini <fustini@...nel.org>
> > > ---
> > >  arch/riscv/kernel/qos/qos_resctrl.c | 1191 +++++++++++++++++++++++++++++++++++
> > >  1 file changed, 1191 insertions(+)
> > >
> > > diff --git a/arch/riscv/kernel/qos/qos_resctrl.c b/arch/riscv/kernel/qos/qos_resctrl.c
> > > new file mode 100644
> > > index 000000000000..5e3a65342e9b
> > > --- /dev/null
> > > +++ b/arch/riscv/kernel/qos/qos_resctrl.c
[..]
> > > +       case RDT_RESOURCE_MBA:
> > > +               /* Capacity read limit operation for RCID (closid) */
> > > +               err = cbqri_bc_alloc_op(ctrl, CBQRI_CC_ALLOC_CTL_OP_READ_LIMIT, closid);
> > > +               if (err < 0) {
> > > +                       pr_err("%s(): operation failed: err = %d", __func__, err);
> > > +                       return -EIO;
> > > +               }
> > > +
> > > +               hw_dom->ctrl_val[closid] = cbqri_get_rbwb(ctrl);
> > > +
> > > +               /* Convert from bandwidth blocks to percent */
> > > +               rbwb = hw_dom->ctrl_val[closid];
> > > +               rbwb *= 100;
> > > +               percent = rbwb / ctrl->bc.nbwblks;
> > > +               if (rbwb % ctrl->bc.nbwblks)
> > > +                       percent++;
> > 
> > set: 10, get 11 ?
> 
> The intention was to handle rounding up but I can drop this increment.

Actually, this increment of one is necessary. Without it, the default
value of 80% will be displayed as 79%. And writing a value like 55% will
result in 54%.

# mount -t resctrl resctrl /sys/fs/resctrl
# cd /sys/fs/resctrl
# cat schemata
MB:0=79;1=79;2=79
L2:4=fff;5=fff
L3:3=ffff

# echo 'MB:2=55' > schemata
# cat schemata
MB:0=79;1=79;2=54
L2:4=fff;5=fff
L3:3=ffff

# echo 'MB:2=80' > schemata
# cat schemata
MB:0=79;1=79;2=79
L2:4=fff;5=fff
L3:3=ffff

Thanks,
Drew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ