]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86,fs/resctrl: Rename some L3 specific functions
authorTony Luck <tony.luck@intel.com>
Wed, 17 Dec 2025 17:20:56 +0000 (09:20 -0800)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 5 Jan 2026 10:21:55 +0000 (11:21 +0100)
With the arrival of monitor events tied to new domains associated with a
different resource it would be clearer if the L3 resource specific functions
are more accurately named.

Rename three groups of functions:

Functions that allocate/free architecture per-RMID MBM state information:
arch_domain_mbm_alloc() -> l3_mon_domain_mbm_alloc()
mon_domain_free() -> l3_mon_domain_free()

Functions that allocate/free filesystem per-RMID MBM state information:
domain_setup_mon_state() -> domain_setup_l3_mon_state()
domain_destroy_mon_state() -> domain_destroy_l3_mon_state()

Initialization/exit:
rdt_get_mon_l3_config() -> rdt_get_l3_mon_config()
resctrl_mon_resource_init() -> resctrl_l3_mon_resource_init()
resctrl_mon_resource_exit() -> resctrl_l3_mon_resource_exit()

Ensure kernel-doc descriptions of these functions' return values are present
and correctly formatted.

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
arch/x86/kernel/cpu/resctrl/core.c
arch/x86/kernel/cpu/resctrl/internal.h
arch/x86/kernel/cpu/resctrl/monitor.c
fs/resctrl/internal.h
fs/resctrl/monitor.c
fs/resctrl/rdtgroup.c

index cc1b846f964513dc64add50ecaa0349dee10a807..b3a2dc56155d7f1efe5b2a1a65e243407a7f68c0 100644 (file)
@@ -368,7 +368,7 @@ static void ctrl_domain_free(struct rdt_hw_ctrl_domain *hw_dom)
        kfree(hw_dom);
 }
 
-static void mon_domain_free(struct rdt_hw_l3_mon_domain *hw_dom)
+static void l3_mon_domain_free(struct rdt_hw_l3_mon_domain *hw_dom)
 {
        int idx;
 
@@ -401,11 +401,13 @@ static int domain_setup_ctrlval(struct rdt_resource *r, struct rdt_ctrl_domain *
 }
 
 /**
- * arch_domain_mbm_alloc() - Allocate arch private storage for the MBM counters
+ * l3_mon_domain_mbm_alloc() - Allocate arch private storage for the MBM counters
  * @num_rmid:  The size of the MBM counter array
  * @hw_dom:    The domain that owns the allocated arrays
+ *
+ * Return:     0 for success, or -ENOMEM.
  */
-static int arch_domain_mbm_alloc(u32 num_rmid, struct rdt_hw_l3_mon_domain *hw_dom)
+static int l3_mon_domain_mbm_alloc(u32 num_rmid, struct rdt_hw_l3_mon_domain *hw_dom)
 {
        size_t tsize = sizeof(*hw_dom->arch_mbm_states[0]);
        enum resctrl_event_id eventid;
@@ -519,7 +521,7 @@ static void l3_mon_domain_setup(int cpu, int id, struct rdt_resource *r, struct
        ci = get_cpu_cacheinfo_level(cpu, RESCTRL_L3_CACHE);
        if (!ci) {
                pr_warn_once("Can't find L3 cache for CPU:%d resource %s\n", cpu, r->name);
-               mon_domain_free(hw_dom);
+               l3_mon_domain_free(hw_dom);
                return;
        }
        d->ci_id = ci->id;
@@ -527,8 +529,8 @@ static void l3_mon_domain_setup(int cpu, int id, struct rdt_resource *r, struct
 
        arch_mon_domain_online(r, d);
 
-       if (arch_domain_mbm_alloc(r->mon.num_rmid, hw_dom)) {
-               mon_domain_free(hw_dom);
+       if (l3_mon_domain_mbm_alloc(r->mon.num_rmid, hw_dom)) {
+               l3_mon_domain_free(hw_dom);
                return;
        }
 
@@ -538,7 +540,7 @@ static void l3_mon_domain_setup(int cpu, int id, struct rdt_resource *r, struct
        if (err) {
                list_del_rcu(&d->hdr.list);
                synchronize_rcu();
-               mon_domain_free(hw_dom);
+               l3_mon_domain_free(hw_dom);
        }
 }
 
@@ -664,7 +666,7 @@ static void domain_remove_cpu_mon(int cpu, struct rdt_resource *r)
                resctrl_offline_mon_domain(r, hdr);
                list_del_rcu(&hdr->list);
                synchronize_rcu();
-               mon_domain_free(hw_dom);
+               l3_mon_domain_free(hw_dom);
                break;
        }
        default:
@@ -917,7 +919,7 @@ static __init bool get_rdt_mon_resources(void)
        if (!ret)
                return false;
 
-       return !rdt_get_mon_l3_config(r);
+       return !rdt_get_l3_mon_config(r);
 }
 
 static __init void __check_quirks_intel(void)
index d73c0adf10260a930f44aa97960a6031a55fee54..11d06995810e0bc13fadd372223349b94518bb81 100644 (file)
@@ -213,7 +213,7 @@ union l3_qos_abmc_cfg {
 
 void rdt_ctrl_update(void *arg);
 
-int rdt_get_mon_l3_config(struct rdt_resource *r);
+int rdt_get_l3_mon_config(struct rdt_resource *r);
 
 bool rdt_cpu_has(int flag);
 
index 04b8f1e1f3149ea96533746d9550bcc255c9d425..20605212656c4fd5d39fc0c895c986fb1400b770 100644 (file)
@@ -424,7 +424,7 @@ static __init int snc_get_config(void)
        return ret;
 }
 
-int __init rdt_get_mon_l3_config(struct rdt_resource *r)
+int __init rdt_get_l3_mon_config(struct rdt_resource *r)
 {
        unsigned int mbm_offset = boot_cpu_data.x86_cache_mbm_width_offset;
        struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
index af47b6ddef62d961ebcb7bdb636cb1011b5fd6b0..9768341aa21cc7adf26498a9c6cf9aad950c7f10 100644 (file)
@@ -357,7 +357,9 @@ int alloc_rmid(u32 closid);
 
 void free_rmid(u32 closid, u32 rmid);
 
-void resctrl_mon_resource_exit(void);
+int resctrl_l3_mon_resource_init(void);
+
+void resctrl_l3_mon_resource_exit(void);
 
 void mon_event_count(void *info);
 
@@ -367,8 +369,6 @@ void mon_event_read(struct rmid_read *rr, struct rdt_resource *r,
                    struct rdt_domain_hdr *hdr, struct rdtgroup *rdtgrp,
                    cpumask_t *cpumask, int evtid, int first);
 
-int resctrl_mon_resource_init(void);
-
 void mbm_setup_overflow_handler(struct rdt_l3_mon_domain *dom,
                                unsigned long delay_ms,
                                int exclude_cpu);
index 9edbe9805d331130c6dff3a0bc7b970adae2c3a8..d5ae0ef4c947bbe3d4878f2e4ab68d33a74e7381 100644 (file)
@@ -1780,7 +1780,7 @@ ssize_t mbm_L3_assignments_write(struct kernfs_open_file *of, char *buf,
 }
 
 /**
- * resctrl_mon_resource_init() - Initialise global monitoring structures.
+ * resctrl_l3_mon_resource_init() - Initialise global monitoring structures.
  *
  * Allocate and initialise global monitor resources that do not belong to a
  * specific domain. i.e. the rmid_ptrs[] used for the limbo and free lists.
@@ -1789,9 +1789,9 @@ ssize_t mbm_L3_assignments_write(struct kernfs_open_file *of, char *buf,
  * Resctrl's cpuhp callbacks may be called before this point to bring a domain
  * online.
  *
- * Returns 0 for success, or -ENOMEM.
+ * Return: 0 for success, or -ENOMEM.
  */
-int resctrl_mon_resource_init(void)
+int resctrl_l3_mon_resource_init(void)
 {
        struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
        int ret;
@@ -1841,7 +1841,7 @@ int resctrl_mon_resource_init(void)
        return 0;
 }
 
-void resctrl_mon_resource_exit(void)
+void resctrl_l3_mon_resource_exit(void)
 {
        struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
 
index 2ed435db19237b88fc4ed0fb7329ffed10252152..b57e1e78bbc25d77f33647447a156540f481de8f 100644 (file)
@@ -4246,7 +4246,7 @@ static void rdtgroup_setup_default(void)
        mutex_unlock(&rdtgroup_mutex);
 }
 
-static void domain_destroy_mon_state(struct rdt_l3_mon_domain *d)
+static void domain_destroy_l3_mon_state(struct rdt_l3_mon_domain *d)
 {
        int idx;
 
@@ -4301,13 +4301,13 @@ void resctrl_offline_mon_domain(struct rdt_resource *r, struct rdt_domain_hdr *h
                cancel_delayed_work(&d->cqm_limbo);
        }
 
-       domain_destroy_mon_state(d);
+       domain_destroy_l3_mon_state(d);
 out_unlock:
        mutex_unlock(&rdtgroup_mutex);
 }
 
 /**
- * domain_setup_mon_state() -  Initialise domain monitoring structures.
+ * domain_setup_l3_mon_state() -  Initialise domain monitoring structures.
  * @r: The resource for the newly online domain.
  * @d: The newly online domain.
  *
@@ -4315,11 +4315,11 @@ out_unlock:
  * Called when the first CPU of a domain comes online, regardless of whether
  * the filesystem is mounted.
  * During boot this may be called before global allocations have been made by
- * resctrl_mon_resource_init().
+ * resctrl_l3_mon_resource_init().
  *
- * Returns 0 for success, or -ENOMEM.
+ * Return: 0 for success, or -ENOMEM.
  */
-static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_l3_mon_domain *d)
+static int domain_setup_l3_mon_state(struct rdt_resource *r, struct rdt_l3_mon_domain *d)
 {
        u32 idx_limit = resctrl_arch_system_num_rmid_idx();
        size_t tsize = sizeof(*d->mbm_states[0]);
@@ -4386,7 +4386,7 @@ int resctrl_online_mon_domain(struct rdt_resource *r, struct rdt_domain_hdr *hdr
                goto out_unlock;
 
        d = container_of(hdr, struct rdt_l3_mon_domain, hdr);
-       err = domain_setup_mon_state(r, d);
+       err = domain_setup_l3_mon_state(r, d);
        if (err)
                goto out_unlock;
 
@@ -4503,13 +4503,13 @@ int resctrl_init(void)
 
        io_alloc_init();
 
-       ret = resctrl_mon_resource_init();
+       ret = resctrl_l3_mon_resource_init();
        if (ret)
                return ret;
 
        ret = sysfs_create_mount_point(fs_kobj, "resctrl");
        if (ret) {
-               resctrl_mon_resource_exit();
+               resctrl_l3_mon_resource_exit();
                return ret;
        }
 
@@ -4544,7 +4544,7 @@ int resctrl_init(void)
 
 cleanup_mountpoint:
        sysfs_remove_mount_point(fs_kobj, "resctrl");
-       resctrl_mon_resource_exit();
+       resctrl_l3_mon_resource_exit();
 
        return ret;
 }
@@ -4580,7 +4580,7 @@ static bool resctrl_online_domains_exist(void)
  * When called by the architecture code, all CPUs and resctrl domains must be
  * offline. This ensures the limbo and overflow handlers are not scheduled to
  * run, meaning the data structures they access can be freed by
- * resctrl_mon_resource_exit().
+ * resctrl_l3_mon_resource_exit().
  *
  * After resctrl_exit() returns, the architecture code should return an
  * error from all resctrl_arch_ functions that can do this.
@@ -4607,5 +4607,5 @@ void resctrl_exit(void)
         * it can be used to umount resctrl.
         */
 
-       resctrl_mon_resource_exit();
+       resctrl_l3_mon_resource_exit();
 }