]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs/resctrl: Emphasize that L3 monitoring resource is required for summing domains
authorTony Luck <tony.luck@intel.com>
Wed, 17 Dec 2025 17:21:02 +0000 (09:21 -0800)
committerBorislav Petkov (AMD) <bp@alien8.de>
Fri, 9 Jan 2026 15:37:07 +0000 (16:37 +0100)
The feature to sum event data across multiple domains supports systems with
Sub-NUMA Cluster (SNC) mode enabled. The top-level monitoring files in each
"mon_L3_XX" directory provide the sum of data across all SNC nodes sharing an
L3 cache instance while the "mon_sub_L3_YY" sub-directories provide the event
data of the individual nodes.

SNC is only associated with the L3 resource and domains and as a result the
flow handling the sum of event data implicitly assumes it is working with
the L3 resource and domains.

Reading of telemetry events does not require to sum event data so this feature
can remain dedicated to SNC and keep the implicit assumption of working with
the L3 resource and domains.

Add a WARN to where the implicit assumption of working with the L3 resource
is made and add comments on how the structure controlling the event sum
feature is used.

Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Link: https://lore.kernel.org/20251217172121.12030-1-tony.luck@intel.com
fs/resctrl/ctrlmondata.c
fs/resctrl/internal.h
fs/resctrl/rdtgroup.c

index f319fd1a6de31c26d9b22b76c89ad5def15ee1fc..cc4237c57cbe48839276d98504c5a0c3c47f50b9 100644 (file)
@@ -677,7 +677,6 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg)
 {
        struct kernfs_open_file *of = m->private;
        enum resctrl_res_level resid;
-       struct rdt_l3_mon_domain *d;
        struct rdt_domain_hdr *hdr;
        struct rmid_read rr = {0};
        struct rdtgroup *rdtgrp;
@@ -705,6 +704,13 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg)
        r = resctrl_arch_get_resource(resid);
 
        if (md->sum) {
+               struct rdt_l3_mon_domain *d;
+
+               if (WARN_ON_ONCE(resid != RDT_RESOURCE_L3)) {
+                       ret = -EINVAL;
+                       goto out;
+               }
+
                /*
                 * This file requires summing across all domains that share
                 * the L3 cache id that was provided in the "domid" field of the
index 0110d1175398c1ee6d556fbff71a31ed7df9c633..50d88e91e0daa799b10141db026adb361090963f 100644 (file)
@@ -92,8 +92,8 @@ extern struct mon_evt mon_event_all[QOS_NUM_EVENTS];
  * @list:            Member of the global @mon_data_kn_priv_list list.
  * @rid:             Resource id associated with the event file.
  * @evt:             Event structure associated with the event file.
- * @sum:             Set when event must be summed across multiple
- *                   domains.
+ * @sum:             Set for RDT_RESOURCE_L3 when event must be summed
+ *                   across multiple domains.
  * @domid:           When @sum is zero this is the domain to which
  *                   the event file belongs. When @sum is one this
  *                   is the id of the L3 cache that all domains to be
index a06cefd2a09e8155fc32435247dea7784a61b669..a2ad99acedd6674250861a50c86c1c5ddbde09ad 100644 (file)
@@ -3096,7 +3096,8 @@ static void rmdir_all_sub(void)
  * @rid:    The resource id for the event file being created.
  * @domid:  The domain id for the event file being created.
  * @mevt:   The type of event file being created.
- * @do_sum: Whether SNC summing monitors are being created.
+ * @do_sum: Whether SNC summing monitors are being created. Only set
+ *         when @rid == RDT_RESOURCE_L3.
  */
 static struct mon_data *mon_get_kn_priv(enum resctrl_res_level rid, int domid,
                                        struct mon_evt *mevt,