From: Drew Fustini <fustini@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH RFC v5 15/18] riscv_cbqri: resctrl: Add mbm_total_bytes bandwidth monitoring
Date: Sat, 30 May 2026 18:50:57 -0700 [thread overview]
Message-ID: <ahuUAQk-qufagp9a@gen8> (raw)
In-Reply-To: <20260525012742.7007E1F000E9@smtp.kernel.org>
On Mon, May 25, 2026 at 01:27:42AM +0000, sashiko-bot@kernel.org wrote:
> > + if (rmid >= bc->mcid_count) {
> > + err = -ERANGE;
> > + break;
> > + }
>
> This is a pre-existing issue, but will the core allocate out-of-bounds
> RMIDs that trigger this -ERANGE error? Looking at
> cbqri_resctrl_control_init(), num_rmid is bound to the local capacity
> rather than the global minimum (max_rmid). Could this lead to stale
> monitoring state and bypass the max_rmid-bounded reset loop?
I will fix in the revision.
> > + if (l3_count > 1) {
> > + pr_warn_once("multiple L3 domains (%u) detected. mbm_total_bytes disabled\n",
> > + l3_count);
> > + return;
> > + }
>
> When mbm_total_bytes is disabled here, will the unused Bandwidth
> Controller's smaller mcid_count still artificially clamp the global
> max_rmid in cbqri_resctrl_accumulate_caps()? The unused BC remains
> mon_capable, which might restrict valid occupancy monitoring system-wide.
I will change it to walk only the controllers that were actually picked
as counter sources.
> > + hw_dom->paired_bc = cbqri_find_only_mon_bc();
> > + if (hw_dom->paired_bc) {
> > + err = cbqri_init_bc_mon_counters(hw_dom->paired_bc);
>
> If mbm_total_bytes was disabled in cbqri_resctrl_pick_counters() due to
> multiple L3 domains, does this unconditionally allocate memory and issue
> MMIO resets for an unused BC? Could an initialization failure in this unused
> BC cause the entire L3 bringup to abort here?
I will change to skip the init when mbm_total_bytes is disabled.
> > cancel_delayed_work(&mon_dom->cqm_limbo);
> > + if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID))
> > + cancel_delayed_work(&mon_dom->mbm_over);
> > resctrl_offline_mon_domain(res, &mon_dom->hdr);
> > err_listdel:
> > list_del(&mon_dom->hdr.list);
> > err_free:
> > kfree(mon_dom);
> > return err;
> > }
>
> [Severity: Critical]
> This is a pre-existing issue, but since this patch introduces a new trigger
> instance for mbm_over, does this create a use-after-free window?
>
> Since cancel_delayed_work() is used without _sync, if a worker is currently
> stalled waiting on the cpus_read_lock, won't kfree(mon_dom) execute
> synchronously here? Once the write lock is dropped, couldn't the pending
> worker resume and dereference the freed memory?
I will address in the change to patch 12.
Drew
next prev parent reply other threads:[~2026-05-31 1:51 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-24 23:55 [PATCH RFC v5 00/18] riscv: add Ssqosid and CBQRI resctrl support Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 01/18] dt-bindings: riscv: Add Ssqosid extension description Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 02/18] riscv: detect the Ssqosid extension Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 03/18] riscv: add support for srmcfg CSR from " Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-25 0:30 ` sashiko-bot
2026-05-25 3:55 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 04/18] fs/resctrl: Add resctrl_is_membw() helper Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 05/18] fs/resctrl: Add RDT_RESOURCE_MB_MIN and RDT_RESOURCE_MB_WGHT Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 06/18] fs/resctrl: Let bandwidth resources default to min_bw at reset Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 07/18] riscv_cbqri: Add capacity controller probe and allocation device ops Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-25 0:30 ` sashiko-bot
2026-05-25 4:16 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 08/18] riscv_cbqri: Add capacity controller monitoring " Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-25 0:29 ` sashiko-bot
2026-05-25 6:58 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 09/18] riscv_cbqri: Add bandwidth controller probe and allocation " Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-25 0:30 ` sashiko-bot
2026-05-25 7:21 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 10/18] riscv_cbqri: Add bandwidth controller monitoring " Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-25 0:36 ` sashiko-bot
2026-05-25 7:25 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 11/18] riscv_cbqri: resctrl: Add cache allocation via capacity block mask Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-25 0:50 ` sashiko-bot
2026-05-25 7:40 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 12/18] riscv_cbqri: resctrl: Add L3 cache occupancy monitoring Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-25 0:46 ` sashiko-bot
2026-05-26 11:49 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 13/18] riscv_cbqri: resctrl: Add MB_MIN bandwidth allocation via Rbwb Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-25 0:55 ` sashiko-bot
2026-05-31 1:50 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 14/18] riscv_cbqri: resctrl: Add MB_WGHT bandwidth allocation via Mweight Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-25 0:52 ` sashiko-bot
2026-05-31 1:50 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 15/18] riscv_cbqri: resctrl: Add mbm_total_bytes bandwidth monitoring Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-25 1:27 ` sashiko-bot
2026-05-31 1:50 ` Drew Fustini [this message]
2026-05-24 23:55 ` [PATCH RFC v5 16/18] ACPI: RISC-V: Parse RISC-V Quality of Service Controller (RQSC) table Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-25 8:23 ` Sunil V L
2026-05-25 8:23 ` Sunil V L
2026-05-31 1:51 ` Drew Fustini
2026-05-31 1:51 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 17/18] ACPI: RISC-V: Add support for RISC-V Quality of Service Controller (RQSC) Drew Fustini
2026-05-24 23:55 ` Drew Fustini
2026-05-24 23:55 ` [PATCH RFC v5 18/18] riscv: enable resctrl filesystem for Ssqosid Drew Fustini
2026-05-24 23:55 ` 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=ahuUAQk-qufagp9a@gen8 \
--to=fustini@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.