From: Reinette Chatre <reinette.chatre@intel.com>
To: Tony Luck <tony.luck@intel.com>, Fenghua Yu <fenghuay@nvidia.com>,
"Maciej Wieczor-Retman" <maciej.wieczor-retman@intel.com>,
Peter Newman <peternewman@google.com>,
James Morse <james.morse@arm.com>,
Babu Moger <babu.moger@amd.com>,
Drew Fustini <dfustini@baylibre.com>,
Dave Martin <Dave.Martin@arm.com>,
Anil Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: <linux-kernel@vger.kernel.org>, <patches@lists.linux.dev>
Subject: Re: [PATCH v3 03/26] fs/resctrl: Change how events are initialized
Date: Fri, 18 Apr 2025 14:22:31 -0700 [thread overview]
Message-ID: <e3ee6d77-6b83-4b8b-8ea0-bafc2946aa80@intel.com> (raw)
In-Reply-To: <20250407234032.241215-4-tony.luck@intel.com>
Hi Tony,
On 4/7/25 4:40 PM, Tony Luck wrote:
> New monitor events break some assumptions:
This changelog jumps into a problem without any context.
Please follow changelog guidance from maintainer-tip.rst.
Specifically, "A good structure is to explain the context,
the problem and the solution in separate paragraphs and this
order."
>
> 1) New events can be in resources other than L3.
> 2) Enumeration of events may not be complete during early
> boot.
>
> Prepare for events in other resources.
Please include what this preparation involves.
>
> Delay building the event lists until first mount of the resctrl
> file system.
Please include in context what is meant by "event lists".
But ... previous patch reminded reader about all the event state
that is allocated during domain online, which usually happens
*before* mount of resctrl. This work thus goes from "use enumeration
of events during boot to allocate necessary event state" in one patch to
"enumeration of events are not complete during boot so build event lists on
resctrl mount" in the next patch. This is a big contradiction to
me.
I think it is clear that not all events can be treated equally but this
implementation pretends to treat them equally when convenient (this patch)
and relies on code flow assumptions (previous patch that only allocated state
for L3 events during domain online) for things to "work out" in the end.
>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
> fs/resctrl/internal.h | 3 +++
> fs/resctrl/monitor.c | 30 +++++++++++++++++++-----------
> fs/resctrl/rdtgroup.c | 2 ++
> 3 files changed, 24 insertions(+), 11 deletions(-)
>
> diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h
> index 7a65ea02d442..08dbf89939ac 100644
> --- a/fs/resctrl/internal.h
> +++ b/fs/resctrl/internal.h
> @@ -76,6 +76,7 @@ static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc)
> */
> struct mon_evt {
> enum resctrl_event_id evtid;
> + enum resctrl_res_level rid;
This structure has some kernel-doc that is not visible in this hunk but
also needs a change when adding a new member.
> char *name;
> bool configurable;
> struct list_head list;
> @@ -390,6 +391,8 @@ int rdt_lookup_evtid_by_name(char *name);
>
> char *rdt_event_name(enum resctrl_event_id evt);
>
> +void resctrl_init_mon_events(void);
> +
> #ifdef CONFIG_RESCTRL_FS_PSEUDO_LOCK
> int rdtgroup_locksetup_enter(struct rdtgroup *rdtgrp);
>
> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
> index 66e613906f3e..472754d082cb 100644
> --- a/fs/resctrl/monitor.c
> +++ b/fs/resctrl/monitor.c
> @@ -846,14 +846,17 @@ static struct mon_evt all_events[QOS_NUM_EVENTS] = {
> [QOS_L3_OCCUP_EVENT_ID] = {
> .name = "llc_occupancy",
> .evtid = QOS_L3_OCCUP_EVENT_ID,
> + .rid = RDT_RESOURCE_L3,
> },
> [QOS_L3_MBM_TOTAL_EVENT_ID] = {
> .name = "mbm_total_bytes",
> .evtid = QOS_L3_MBM_TOTAL_EVENT_ID,
> + .rid = RDT_RESOURCE_L3,
> },
> [QOS_L3_MBM_LOCAL_EVENT_ID] = {
> .name = "mbm_local_bytes",
> .evtid = QOS_L3_MBM_LOCAL_EVENT_ID,
> + .rid = RDT_RESOURCE_L3,
> },
> };
>
> @@ -878,22 +881,29 @@ char *rdt_event_name(enum resctrl_event_id evt)
> }
>
> /*
> - * Initialize the event list for the resource.
> + * Initialize the event list for all mon_capable resources.
> *
> - * Note that MBM events are also part of RDT_RESOURCE_L3 resource
> - * because as per the SDM the total and local memory bandwidth
> - * are enumerated as part of L3 monitoring.
> - *
> - * mon_put_default_kn_priv_all() also assumes monitor events are only supported
> - * on the L3 resource.
> + * Called on each mount of the resctrl file system when all
> + * events have been enumerated. Only needs to build the per-resource
> + * event lists once.
> */
> -static void l3_mon_evt_init(struct rdt_resource *r)
> +void resctrl_init_mon_events(void)
> {
> + struct rdt_resource *r;
> + static bool only_once;
> int evt;
>
> - INIT_LIST_HEAD(&r->evt_list);
> + if (only_once)
> + return;
> + only_once = true;
> +
> + for_each_mon_capable_rdt_resource(r)
> + INIT_LIST_HEAD(&r->evt_list);
>
> for_each_set_bit(evt, rdt_mon_features, QOS_NUM_EVENTS) {
This is fs code so this needs to be done without peeking into
rdt_mon_features.
> + r = resctrl_arch_get_resource(all_events[evt].rid);
> + if (!r->mon_capable)
> + continue;
> list_add_tail(&all_events[evt].list, &r->evt_list);
> }
> }
> @@ -922,8 +932,6 @@ int resctrl_mon_resource_init(void)
> if (ret)
> return ret;
>
> - l3_mon_evt_init(r);
> -
> if (resctrl_arch_is_evt_configurable(QOS_L3_MBM_TOTAL_EVENT_ID)) {
> all_events[QOS_L3_MBM_TOTAL_EVENT_ID].configurable = true;
> resctrl_file_fflags_init("mbm_total_bytes_config",
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index 8d15d53fae76..1433fc098a90 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c
> @@ -2574,6 +2574,8 @@ static int rdt_get_tree(struct fs_context *fc)
> goto out;
> }
>
> + resctrl_init_mon_events();
> +
> ret = rdtgroup_setup_root(ctx);
> if (ret)
> goto out;
Reinette
next prev parent reply other threads:[~2025-04-18 21:22 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 23:40 [PATCH v3 00/26] x86/resctrl telemetry monitoring Tony Luck
2025-04-07 23:40 ` [PATCH v3 01/26] fs/resctrl: Simplify allocation of mon_data structures Tony Luck
2025-04-18 21:13 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 02/26] fs-x86/resctrl: Prepare for more monitor events Tony Luck
2025-04-18 21:17 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 03/26] fs/resctrl: Change how events are initialized Tony Luck
2025-04-18 21:22 ` Reinette Chatre [this message]
2025-04-07 23:40 ` [PATCH v3 04/26] fs/resctrl: Set up Kconfig options for telemetry events Tony Luck
2025-04-18 21:23 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 05/26] x86/rectrl: Fake OOBMSM interface Tony Luck
2025-04-18 21:27 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 06/26] fs-x86/rectrl: Improve domain type checking Tony Luck
2025-04-18 21:40 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 07/26] x86/resctrl: Move L3 initialization out of domain_add_cpu_mon() Tony Luck
2025-04-18 21:51 ` Reinette Chatre
2025-04-21 20:01 ` Luck, Tony
2025-04-22 18:18 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 08/26] x86/resctrl: Refactor domain_remove_cpu_mon() ready for new domain types Tony Luck
2025-04-18 21:53 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 09/26] x86/resctrl: Change generic monitor functions to use struct rdt_domain_hdr Tony Luck
2025-04-18 22:42 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 10/26] fs/resctrl: Improve handling for events that can be read from any CPU Tony Luck
2025-04-18 22:54 ` Reinette Chatre
2025-04-21 20:28 ` Luck, Tony
2025-04-22 18:19 ` Reinette Chatre
2025-04-23 0:51 ` Luck, Tony
2025-04-23 3:37 ` Reinette Chatre
2025-04-23 13:27 ` Peter Newman
2025-04-23 15:47 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 11/26] fs/resctrl: Add support for additional monitor event display formats Tony Luck
2025-04-18 23:02 ` Reinette Chatre
2025-04-21 19:34 ` Luck, Tony
2025-04-22 18:20 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 12/26] fs/resctrl: Add hook for architecture code to set monitor event attributes Tony Luck
2025-04-18 23:11 ` Reinette Chatre
2025-04-21 19:50 ` Luck, Tony
2025-04-22 18:20 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 13/26] fs/resctrl: Add an architectural hook called for each mount Tony Luck
2025-04-18 23:47 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 14/26] x86/resctrl: Add first part of telemetry event enumeration Tony Luck
2025-04-19 0:08 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 15/26] x86/resctrl: Second stage " Tony Luck
2025-04-19 0:30 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 16/26] x86/resctrl: Third phase " Tony Luck
2025-04-19 0:45 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 17/26] x86/resctrl: Build a lookup table for each resctrl event id Tony Luck
2025-04-19 0:48 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 18/26] x86/resctrl: Add code to read core telemetry events Tony Luck
2025-04-19 1:53 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 19/26] x86/resctrl: Sanity check telemetry RMID values Tony Luck
2025-04-19 5:14 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 20/26] x86/resctrl: Add and initialize rdt_resource for package scope core monitor Tony Luck
2025-04-07 23:40 ` [PATCH v3 21/26] fs-x86/resctrl: Handle RDT_RESOURCE_PERF_PKG in domain create/delete Tony Luck
2025-04-19 5:22 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 22/26] fs/resctrl: Add type define for PERF_PKG files Tony Luck
2025-04-07 23:40 ` [PATCH v3 23/26] fs/resctrl: Add new telemetry event id and structures Tony Luck
2025-04-07 23:40 ` [PATCH v3 24/26] x86/resctrl: Final steps to enable RDT_RESOURCE_PERF_PKG Tony Luck
2025-04-07 23:40 ` [PATCH v3 25/26] fs-x86/resctrl: Add detailed descriptions for Clearwater Forest events Tony Luck
2025-04-19 5:30 ` Reinette Chatre
2025-04-07 23:40 ` [PATCH v3 26/26] x86/resctrl: Update Documentation for package events Tony Luck
2025-04-19 5:40 ` Reinette Chatre
2025-04-18 21:13 ` [PATCH v3 00/26] x86/resctrl telemetry monitoring Reinette Chatre
2025-04-21 18:57 ` Luck, Tony
2025-04-21 22:59 ` Reinette Chatre
2025-04-22 16:20 ` Luck, Tony
2025-04-22 21:30 ` Reinette Chatre
2025-04-19 5:47 ` Reinette Chatre
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=e3ee6d77-6b83-4b8b-8ea0-bafc2946aa80@intel.com \
--to=reinette.chatre@intel.com \
--cc=Dave.Martin@arm.com \
--cc=anil.s.keshavamurthy@intel.com \
--cc=babu.moger@amd.com \
--cc=dfustini@baylibre.com \
--cc=fenghuay@nvidia.com \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.wieczor-retman@intel.com \
--cc=patches@lists.linux.dev \
--cc=peternewman@google.com \
--cc=tony.luck@intel.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