All of lore.kernel.org
 help / color / mirror / Atom feed
From: Drew Fustini <fustini@kernel.org>
To: yunhui cui <cuiyunhui@bytedance.com>
Cc: "Paul Walmsley" <pjw@kernel.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Radim Krčmář" <rkrcmar@ventanamicro.com>,
	"Samuel Holland" <samuel.holland@sifive.com>,
	"Adrien Ricciardi" <aricciardi@baylibre.com>,
	"Nicolas Pitre" <npitre@baylibre.com>,
	"Kornel Dulęba" <mindal@semihalf.com>,
	"Atish Patra" <atish.patra@linux.dev>,
	"Atish Kumar Patra" <atishp@rivosinc.com>,
	"Vasudevan Srinivasan" <vasu@rivosinc.com>,
	"Ved Shanbhogue" <ved@rivosinc.com>,
	"Chen Pei" <cp0613@linux.alibaba.com>,
	"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
	"Weiwei Li" <liwei1518@gmail.com>,
	guo.wenjia23@zte.com.cn, liu.qingtao2@zte.com.cn,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Reinette Chatre" <reinette.chatre@intel.com>,
	"Tony Luck" <tony.luck@intel.com>,
	"Babu Moger" <babu.moger@amd.com>,
	"Peter Newman" <peternewman@google.com>,
	"Fenghua Yu" <fenghua.yu@intel.com>,
	"James Morse" <james.morse@arm.com>,
	"Ben Horgan" <ben.horgan@arm.com>,
	"Dave Martin" <Dave.Martin@arm.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, x86@kernel.org
Subject: Re: [External] [PATCH RFC 08/19] RISC-V: QoS: add resctrl interface for CBQRI controllers
Date: Tue, 27 Jan 2026 14:10:22 -0800	[thread overview]
Message-ID: <aXk3zq26cU8r/COG@x1> (raw)
In-Reply-To: <aXfWVPg7YTToDKcQ@x1>

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@kernel.org> wrote:
> > >
> > > Add interface for CBQRI controller drivers to make use of the resctrl
> > > filesystem.
> > >
> > > Co-developed-by: Adrien Ricciardi <aricciardi@baylibre.com>
> > > Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
> > > Signed-off-by: Drew Fustini <fustini@kernel.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

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

WARNING: multiple messages have this Message-ID (diff)
From: Drew Fustini <fustini@kernel.org>
To: yunhui cui <cuiyunhui@bytedance.com>
Cc: "Paul Walmsley" <pjw@kernel.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Radim Krčmář" <rkrcmar@ventanamicro.com>,
	"Samuel Holland" <samuel.holland@sifive.com>,
	"Adrien Ricciardi" <aricciardi@baylibre.com>,
	"Nicolas Pitre" <npitre@baylibre.com>,
	"Kornel Dulęba" <mindal@semihalf.com>,
	"Atish Patra" <atish.patra@linux.dev>,
	"Atish Kumar Patra" <atishp@rivosinc.com>,
	"Vasudevan Srinivasan" <vasu@rivosinc.com>,
	"Ved Shanbhogue" <ved@rivosinc.com>,
	"Chen Pei" <cp0613@linux.alibaba.com>,
	"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
	"Weiwei Li" <liwei1518@gmail.com>,
	guo.wenjia23@zte.com.cn, liu.qingtao2@zte.com.cn,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Reinette Chatre" <reinette.chatre@intel.com>,
	"Tony Luck" <tony.luck@intel.com>,
	"Babu Moger" <babu.moger@amd.com>,
	"Peter Newman" <peternewman@google.com>,
	"Fenghua Yu" <fenghua.yu@intel.com>,
	"James Morse" <james.morse@arm.com>,
	"Ben Horgan" <ben.horgan@arm.com>,
	"Dave Martin" <Dave.Martin@arm.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, x86@kernel.org
Subject: Re: [External] [PATCH RFC 08/19] RISC-V: QoS: add resctrl interface for CBQRI controllers
Date: Tue, 27 Jan 2026 14:10:22 -0800	[thread overview]
Message-ID: <aXk3zq26cU8r/COG@x1> (raw)
In-Reply-To: <aXfWVPg7YTToDKcQ@x1>

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@kernel.org> wrote:
> > >
> > > Add interface for CBQRI controller drivers to make use of the resctrl
> > > filesystem.
> > >
> > > Co-developed-by: Adrien Ricciardi <aricciardi@baylibre.com>
> > > Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
> > > Signed-off-by: Drew Fustini <fustini@kernel.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

  reply	other threads:[~2026-01-27 22:10 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20  4:14 [PATCH RFC 00/19] RISC-V: QoS: add CBQRI resctrl interface Drew Fustini
2026-01-20  4:14 ` Drew Fustini
2026-01-20  4:14 ` [PATCH RFC 01/19] dt-bindings: riscv: Add Ssqosid extension description Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH RFC 02/19] RISC-V: Detect the Ssqosid extension Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH RFC 03/19] RISC-V: Add support for srmcfg CSR from Ssqosid ext Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH RFC 04/19] RISC-V: QoS: define properties of CBQRI controllers Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH RFC 05/19] RISC-V: QoS: define CBQRI capacity and bandwidth capabilities Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH RFC 06/19] RISC-V: QoS: define CBQRI resctrl resources and domains Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH RFC 07/19] RISC-V: QoS: define prototypes for resctrl interface Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH RFC 08/19] RISC-V: QoS: add resctrl interface for CBQRI controllers Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-26 13:01   ` [External] " yunhui cui
2026-01-26 13:01     ` yunhui cui
2026-01-26 21:02     ` Drew Fustini
2026-01-26 21:02       ` Drew Fustini
2026-01-27 22:10       ` Drew Fustini [this message]
2026-01-27 22:10         ` Drew Fustini
2026-03-26 11:05   ` guo.wenjia23
2026-03-26 11:05     ` guo.wenjia23
2026-03-31  5:57     ` Drew Fustini
2026-03-31  5:57       ` Drew Fustini
2026-03-31  8:14       ` guo.wenjia23
2026-03-31  8:14         ` guo.wenjia23
2026-01-20  4:14 ` [PATCH RFC 09/19] RISC-V: QoS: expose implementation to resctrl Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH RFC 10/19] RISC-V: QoS: add late_initcall to setup resctrl interface Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH RFC 11/19] RISC-V: QoS: add to build when CONFIG_RISCV_ISA_SSQOSID set Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH RFC 12/19] RISC-V: QoS: make CONFIG_RISCV_ISA_SSQOSID select resctrl Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH RFC 13/19] dt-bindings: riscv: add riscv,cbqri bindings Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH NFU RFC 14/19] resctrl: riscv: add CBQRI cache controller driver Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH NFU RFC 15/19] resctrl: riscv: add CBQRI bandwidth " Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH NFU RFC 16/19] resctrl: riscv: build CBQRI drivers Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH NFU RFC 17/19] riscv: dts: qemu: add dump from virt machine Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH NFU RFC 18/19] riscv: dts: qemu: add CBQRI controller nodes Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-20  4:14 ` [PATCH NFU RFC 19/19] riscv: dts: build qemu dtb for CONFIG_ARCH_VIRT Drew Fustini
2026-01-20  4:14   ` Drew Fustini
2026-01-22 22:31 ` [PATCH RFC 00/19] RISC-V: QoS: add CBQRI resctrl interface Reinette Chatre
2026-01-22 22:31   ` Reinette Chatre
2026-01-24 18:00   ` Drew Fustini
2026-01-24 18:00     ` Drew Fustini
2026-01-26 13:14 ` [External] " yunhui cui
2026-01-26 13:14   ` yunhui cui
2026-01-26 20:11   ` Drew Fustini
2026-01-26 20:11     ` Drew Fustini
2026-01-27  2:33     ` yunhui cui
2026-01-27  2:33       ` yunhui cui

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=aXk3zq26cU8r/COG@x1 \
    --to=fustini@kernel.org \
    --cc=Dave.Martin@arm.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=aricciardi@baylibre.com \
    --cc=atish.patra@linux.dev \
    --cc=atishp@rivosinc.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=cp0613@linux.alibaba.com \
    --cc=cuiyunhui@bytedance.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fenghua.yu@intel.com \
    --cc=guo.wenjia23@zte.com.cn \
    --cc=james.morse@arm.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=liu.qingtao2@zte.com.cn \
    --cc=liwei1518@gmail.com \
    --cc=mindal@semihalf.com \
    --cc=npitre@baylibre.com \
    --cc=palmer@dabbelt.com \
    --cc=peternewman@google.com \
    --cc=pjw@kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=rkrcmar@ventanamicro.com \
    --cc=robh+dt@kernel.org \
    --cc=samuel.holland@sifive.com \
    --cc=tony.luck@intel.com \
    --cc=vasu@rivosinc.com \
    --cc=ved@rivosinc.com \
    --cc=x86@kernel.org \
    --cc=zhiwei_liu@linux.alibaba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.