Skip to content

Commit 9c214d1

Browse files
aeglbp3tk0v
authored andcommitted
x86,fs/resctrl: Rename some L3 specific functions
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
1 parent 4bc3ef4 commit 9c214d1

6 files changed

Lines changed: 32 additions & 30 deletions

File tree

arch/x86/kernel/cpu/resctrl/core.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ static void ctrl_domain_free(struct rdt_hw_ctrl_domain *hw_dom)
368368
kfree(hw_dom);
369369
}
370370

371-
static void mon_domain_free(struct rdt_hw_l3_mon_domain *hw_dom)
371+
static void l3_mon_domain_free(struct rdt_hw_l3_mon_domain *hw_dom)
372372
{
373373
int idx;
374374

@@ -401,11 +401,13 @@ static int domain_setup_ctrlval(struct rdt_resource *r, struct rdt_ctrl_domain *
401401
}
402402

403403
/**
404-
* arch_domain_mbm_alloc() - Allocate arch private storage for the MBM counters
404+
* l3_mon_domain_mbm_alloc() - Allocate arch private storage for the MBM counters
405405
* @num_rmid: The size of the MBM counter array
406406
* @hw_dom: The domain that owns the allocated arrays
407+
*
408+
* Return: 0 for success, or -ENOMEM.
407409
*/
408-
static int arch_domain_mbm_alloc(u32 num_rmid, struct rdt_hw_l3_mon_domain *hw_dom)
410+
static int l3_mon_domain_mbm_alloc(u32 num_rmid, struct rdt_hw_l3_mon_domain *hw_dom)
409411
{
410412
size_t tsize = sizeof(*hw_dom->arch_mbm_states[0]);
411413
enum resctrl_event_id eventid;
@@ -519,16 +521,16 @@ static void l3_mon_domain_setup(int cpu, int id, struct rdt_resource *r, struct
519521
ci = get_cpu_cacheinfo_level(cpu, RESCTRL_L3_CACHE);
520522
if (!ci) {
521523
pr_warn_once("Can't find L3 cache for CPU:%d resource %s\n", cpu, r->name);
522-
mon_domain_free(hw_dom);
524+
l3_mon_domain_free(hw_dom);
523525
return;
524526
}
525527
d->ci_id = ci->id;
526528
cpumask_set_cpu(cpu, &d->hdr.cpu_mask);
527529

528530
arch_mon_domain_online(r, d);
529531

530-
if (arch_domain_mbm_alloc(r->mon.num_rmid, hw_dom)) {
531-
mon_domain_free(hw_dom);
532+
if (l3_mon_domain_mbm_alloc(r->mon.num_rmid, hw_dom)) {
533+
l3_mon_domain_free(hw_dom);
532534
return;
533535
}
534536

@@ -538,7 +540,7 @@ static void l3_mon_domain_setup(int cpu, int id, struct rdt_resource *r, struct
538540
if (err) {
539541
list_del_rcu(&d->hdr.list);
540542
synchronize_rcu();
541-
mon_domain_free(hw_dom);
543+
l3_mon_domain_free(hw_dom);
542544
}
543545
}
544546

@@ -664,7 +666,7 @@ static void domain_remove_cpu_mon(int cpu, struct rdt_resource *r)
664666
resctrl_offline_mon_domain(r, hdr);
665667
list_del_rcu(&hdr->list);
666668
synchronize_rcu();
667-
mon_domain_free(hw_dom);
669+
l3_mon_domain_free(hw_dom);
668670
break;
669671
}
670672
default:
@@ -917,7 +919,7 @@ static __init bool get_rdt_mon_resources(void)
917919
if (!ret)
918920
return false;
919921

920-
return !rdt_get_mon_l3_config(r);
922+
return !rdt_get_l3_mon_config(r);
921923
}
922924

923925
static __init void __check_quirks_intel(void)

arch/x86/kernel/cpu/resctrl/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ union l3_qos_abmc_cfg {
213213

214214
void rdt_ctrl_update(void *arg);
215215

216-
int rdt_get_mon_l3_config(struct rdt_resource *r);
216+
int rdt_get_l3_mon_config(struct rdt_resource *r);
217217

218218
bool rdt_cpu_has(int flag);
219219

arch/x86/kernel/cpu/resctrl/monitor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ static __init int snc_get_config(void)
424424
return ret;
425425
}
426426

427-
int __init rdt_get_mon_l3_config(struct rdt_resource *r)
427+
int __init rdt_get_l3_mon_config(struct rdt_resource *r)
428428
{
429429
unsigned int mbm_offset = boot_cpu_data.x86_cache_mbm_width_offset;
430430
struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);

fs/resctrl/internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,9 @@ int alloc_rmid(u32 closid);
357357

358358
void free_rmid(u32 closid, u32 rmid);
359359

360-
void resctrl_mon_resource_exit(void);
360+
int resctrl_l3_mon_resource_init(void);
361+
362+
void resctrl_l3_mon_resource_exit(void);
361363

362364
void mon_event_count(void *info);
363365

@@ -367,8 +369,6 @@ void mon_event_read(struct rmid_read *rr, struct rdt_resource *r,
367369
struct rdt_domain_hdr *hdr, struct rdtgroup *rdtgrp,
368370
cpumask_t *cpumask, int evtid, int first);
369371

370-
int resctrl_mon_resource_init(void);
371-
372372
void mbm_setup_overflow_handler(struct rdt_l3_mon_domain *dom,
373373
unsigned long delay_ms,
374374
int exclude_cpu);

fs/resctrl/monitor.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,7 @@ ssize_t mbm_L3_assignments_write(struct kernfs_open_file *of, char *buf,
17801780
}
17811781

17821782
/**
1783-
* resctrl_mon_resource_init() - Initialise global monitoring structures.
1783+
* resctrl_l3_mon_resource_init() - Initialise global monitoring structures.
17841784
*
17851785
* Allocate and initialise global monitor resources that do not belong to a
17861786
* 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,
17891789
* Resctrl's cpuhp callbacks may be called before this point to bring a domain
17901790
* online.
17911791
*
1792-
* Returns 0 for success, or -ENOMEM.
1792+
* Return: 0 for success, or -ENOMEM.
17931793
*/
1794-
int resctrl_mon_resource_init(void)
1794+
int resctrl_l3_mon_resource_init(void)
17951795
{
17961796
struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
17971797
int ret;
@@ -1841,7 +1841,7 @@ int resctrl_mon_resource_init(void)
18411841
return 0;
18421842
}
18431843

1844-
void resctrl_mon_resource_exit(void)
1844+
void resctrl_l3_mon_resource_exit(void)
18451845
{
18461846
struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
18471847

fs/resctrl/rdtgroup.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4246,7 +4246,7 @@ static void rdtgroup_setup_default(void)
42464246
mutex_unlock(&rdtgroup_mutex);
42474247
}
42484248

4249-
static void domain_destroy_mon_state(struct rdt_l3_mon_domain *d)
4249+
static void domain_destroy_l3_mon_state(struct rdt_l3_mon_domain *d)
42504250
{
42514251
int idx;
42524252

@@ -4301,25 +4301,25 @@ void resctrl_offline_mon_domain(struct rdt_resource *r, struct rdt_domain_hdr *h
43014301
cancel_delayed_work(&d->cqm_limbo);
43024302
}
43034303

4304-
domain_destroy_mon_state(d);
4304+
domain_destroy_l3_mon_state(d);
43054305
out_unlock:
43064306
mutex_unlock(&rdtgroup_mutex);
43074307
}
43084308

43094309
/**
4310-
* domain_setup_mon_state() - Initialise domain monitoring structures.
4310+
* domain_setup_l3_mon_state() - Initialise domain monitoring structures.
43114311
* @r: The resource for the newly online domain.
43124312
* @d: The newly online domain.
43134313
*
43144314
* Allocate monitor resources that belong to this domain.
43154315
* Called when the first CPU of a domain comes online, regardless of whether
43164316
* the filesystem is mounted.
43174317
* During boot this may be called before global allocations have been made by
4318-
* resctrl_mon_resource_init().
4318+
* resctrl_l3_mon_resource_init().
43194319
*
4320-
* Returns 0 for success, or -ENOMEM.
4320+
* Return: 0 for success, or -ENOMEM.
43214321
*/
4322-
static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_l3_mon_domain *d)
4322+
static int domain_setup_l3_mon_state(struct rdt_resource *r, struct rdt_l3_mon_domain *d)
43234323
{
43244324
u32 idx_limit = resctrl_arch_system_num_rmid_idx();
43254325
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
43864386
goto out_unlock;
43874387

43884388
d = container_of(hdr, struct rdt_l3_mon_domain, hdr);
4389-
err = domain_setup_mon_state(r, d);
4389+
err = domain_setup_l3_mon_state(r, d);
43904390
if (err)
43914391
goto out_unlock;
43924392

@@ -4503,13 +4503,13 @@ int resctrl_init(void)
45034503

45044504
io_alloc_init();
45054505

4506-
ret = resctrl_mon_resource_init();
4506+
ret = resctrl_l3_mon_resource_init();
45074507
if (ret)
45084508
return ret;
45094509

45104510
ret = sysfs_create_mount_point(fs_kobj, "resctrl");
45114511
if (ret) {
4512-
resctrl_mon_resource_exit();
4512+
resctrl_l3_mon_resource_exit();
45134513
return ret;
45144514
}
45154515

@@ -4544,7 +4544,7 @@ int resctrl_init(void)
45444544

45454545
cleanup_mountpoint:
45464546
sysfs_remove_mount_point(fs_kobj, "resctrl");
4547-
resctrl_mon_resource_exit();
4547+
resctrl_l3_mon_resource_exit();
45484548

45494549
return ret;
45504550
}
@@ -4580,7 +4580,7 @@ static bool resctrl_online_domains_exist(void)
45804580
* When called by the architecture code, all CPUs and resctrl domains must be
45814581
* offline. This ensures the limbo and overflow handlers are not scheduled to
45824582
* run, meaning the data structures they access can be freed by
4583-
* resctrl_mon_resource_exit().
4583+
* resctrl_l3_mon_resource_exit().
45844584
*
45854585
* After resctrl_exit() returns, the architecture code should return an
45864586
* error from all resctrl_arch_ functions that can do this.
@@ -4607,5 +4607,5 @@ void resctrl_exit(void)
46074607
* it can be used to umount resctrl.
46084608
*/
46094609

4610-
resctrl_mon_resource_exit();
4610+
resctrl_l3_mon_resource_exit();
46114611
}

0 commit comments

Comments
 (0)