]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/resctrl: Move get_{mon,ctrl}_domain_from_cpu() to live with their callers
authorJames Morse <james.morse@arm.com>
Tue, 11 Mar 2025 18:37:15 +0000 (18:37 +0000)
committerBorislav Petkov (AMD) <bp@alien8.de>
Wed, 12 Mar 2025 11:24:58 +0000 (12:24 +0100)
Each of get_{mon,ctrl}_domain_from_cpu() only has one caller.

Once the filesystem code is moved to /fs/, there is no equivalent to
core.c.

Move these functions to each live next to their caller. This allows
them to be made static and the header file entries to be removed.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Fenghua Yu <fenghuay@nvidia.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Babu Moger <babu.moger@amd.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Peter Newman <peternewman@google.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Amit Singh Tomar <amitsinght@marvell.com> # arm64
Tested-by: Shanker Donthineni <sdonthineni@nvidia.com> # arm64
Tested-by: Babu Moger <babu.moger@amd.com>
Link: https://lore.kernel.org/r/20250311183715.16445-31-james.morse@arm.com
arch/x86/kernel/cpu/resctrl/core.c
arch/x86/kernel/cpu/resctrl/internal.h
arch/x86/kernel/cpu/resctrl/monitor.c
arch/x86/kernel/cpu/resctrl/rdtgroup.c

index e590dd347fa7cc3fe258bedefe3028e7dd65c36c..cf29681d01e04e308dc9963b2714bff8ebf72222 100644 (file)
@@ -347,36 +347,6 @@ static void cat_wrmsr(struct msr_param *m)
                wrmsrl(hw_res->msr_base + i, hw_dom->ctrl_val[i]);
 }
 
-struct rdt_ctrl_domain *get_ctrl_domain_from_cpu(int cpu, struct rdt_resource *r)
-{
-       struct rdt_ctrl_domain *d;
-
-       lockdep_assert_cpus_held();
-
-       list_for_each_entry(d, &r->ctrl_domains, hdr.list) {
-               /* Find the domain that contains this CPU */
-               if (cpumask_test_cpu(cpu, &d->hdr.cpu_mask))
-                       return d;
-       }
-
-       return NULL;
-}
-
-struct rdt_mon_domain *get_mon_domain_from_cpu(int cpu, struct rdt_resource *r)
-{
-       struct rdt_mon_domain *d;
-
-       lockdep_assert_cpus_held();
-
-       list_for_each_entry(d, &r->mon_domains, hdr.list) {
-               /* Find the domain that contains this CPU */
-               if (cpumask_test_cpu(cpu, &d->hdr.cpu_mask))
-                       return d;
-       }
-
-       return NULL;
-}
-
 u32 resctrl_arch_get_num_closid(struct rdt_resource *r)
 {
        return resctrl_to_arch_res(r)->num_closid;
index 0d13006e920b3f513740c2d286cd4d43a588f3c0..c44c5b4963558b7367c9eb0ece9171e69ce54469 100644 (file)
@@ -475,8 +475,6 @@ unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r, struct rdt_ctrl_domain
                                  unsigned long cbm);
 enum rdtgrp_mode rdtgroup_mode_by_closid(int closid);
 int rdtgroup_tasks_assigned(struct rdtgroup *r);
-struct rdt_ctrl_domain *get_ctrl_domain_from_cpu(int cpu, struct rdt_resource *r);
-struct rdt_mon_domain *get_mon_domain_from_cpu(int cpu, struct rdt_resource *r);
 int closids_supported(void);
 void closid_free(int closid);
 int alloc_rmid(u32 closid);
index 83f90128d7688bba8397d2152ac173134606fb82..a93ed7d2a1602956bf2e6a42f41f2fbb129e4bcd 100644 (file)
@@ -718,6 +718,22 @@ void mon_event_count(void *info)
                rr->err = 0;
 }
 
+static struct rdt_ctrl_domain *get_ctrl_domain_from_cpu(int cpu,
+                                                       struct rdt_resource *r)
+{
+       struct rdt_ctrl_domain *d;
+
+       lockdep_assert_cpus_held();
+
+       list_for_each_entry(d, &r->ctrl_domains, hdr.list) {
+               /* Find the domain that contains this CPU */
+               if (cpumask_test_cpu(cpu, &d->hdr.cpu_mask))
+                       return d;
+       }
+
+       return NULL;
+}
+
 /*
  * Feedback loop for MBA software controller (mba_sc)
  *
index 5fc60c9ce28f8fe10eb90853c594ba848e85ff8e..c6274d40b217c6d420abff5f90a0b65893a57c82 100644 (file)
@@ -4257,6 +4257,22 @@ static void clear_childcpus(struct rdtgroup *r, unsigned int cpu)
        }
 }
 
+static struct rdt_mon_domain *get_mon_domain_from_cpu(int cpu,
+                                                     struct rdt_resource *r)
+{
+       struct rdt_mon_domain *d;
+
+       lockdep_assert_cpus_held();
+
+       list_for_each_entry(d, &r->mon_domains, hdr.list) {
+               /* Find the domain that contains this CPU */
+               if (cpumask_test_cpu(cpu, &d->hdr.cpu_mask))
+                       return d;
+       }
+
+       return NULL;
+}
+
 void resctrl_offline_cpu(unsigned int cpu)
 {
        struct rdt_resource *l3 = resctrl_arch_get_resource(RDT_RESOURCE_L3);