Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Tony Luck and committed by
Borislav Petkov (AMD)
9c214d10 4bc3ef46

+32 -30
+11 -9
arch/x86/kernel/cpu/resctrl/core.c
··· 368 368 kfree(hw_dom); 369 369 } 370 370 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) 372 372 { 373 373 int idx; 374 374 ··· 401 401 } 402 402 403 403 /** 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 405 405 * @num_rmid: The size of the MBM counter array 406 406 * @hw_dom: The domain that owns the allocated arrays 407 + * 408 + * Return: 0 for success, or -ENOMEM. 407 409 */ 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) 409 411 { 410 412 size_t tsize = sizeof(*hw_dom->arch_mbm_states[0]); 411 413 enum resctrl_event_id eventid; ··· 521 519 ci = get_cpu_cacheinfo_level(cpu, RESCTRL_L3_CACHE); 522 520 if (!ci) { 523 521 pr_warn_once("Can't find L3 cache for CPU:%d resource %s\n", cpu, r->name); 524 - mon_domain_free(hw_dom); 522 + l3_mon_domain_free(hw_dom); 525 523 return; 526 524 } 527 525 d->ci_id = ci->id; ··· 529 527 530 528 arch_mon_domain_online(r, d); 531 529 532 - if (arch_domain_mbm_alloc(r->mon.num_rmid, hw_dom)) { 533 - mon_domain_free(hw_dom); 530 + if (l3_mon_domain_mbm_alloc(r->mon.num_rmid, hw_dom)) { 531 + l3_mon_domain_free(hw_dom); 534 532 return; 535 533 } 536 534 ··· 540 538 if (err) { 541 539 list_del_rcu(&d->hdr.list); 542 540 synchronize_rcu(); 543 - mon_domain_free(hw_dom); 541 + l3_mon_domain_free(hw_dom); 544 542 } 545 543 } 546 544 ··· 666 664 resctrl_offline_mon_domain(r, hdr); 667 665 list_del_rcu(&hdr->list); 668 666 synchronize_rcu(); 669 - mon_domain_free(hw_dom); 667 + l3_mon_domain_free(hw_dom); 670 668 break; 671 669 } 672 670 default: ··· 919 917 if (!ret) 920 918 return false; 921 919 922 - return !rdt_get_mon_l3_config(r); 920 + return !rdt_get_l3_mon_config(r); 923 921 } 924 922 925 923 static __init void __check_quirks_intel(void)
+1 -1
arch/x86/kernel/cpu/resctrl/internal.h
··· 213 213 214 214 void rdt_ctrl_update(void *arg); 215 215 216 - int rdt_get_mon_l3_config(struct rdt_resource *r); 216 + int rdt_get_l3_mon_config(struct rdt_resource *r); 217 217 218 218 bool rdt_cpu_has(int flag); 219 219
+1 -1
arch/x86/kernel/cpu/resctrl/monitor.c
··· 424 424 return ret; 425 425 } 426 426 427 - int __init rdt_get_mon_l3_config(struct rdt_resource *r) 427 + int __init rdt_get_l3_mon_config(struct rdt_resource *r) 428 428 { 429 429 unsigned int mbm_offset = boot_cpu_data.x86_cache_mbm_width_offset; 430 430 struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
+3 -3
fs/resctrl/internal.h
··· 357 357 358 358 void free_rmid(u32 closid, u32 rmid); 359 359 360 - void resctrl_mon_resource_exit(void); 360 + int resctrl_l3_mon_resource_init(void); 361 + 362 + void resctrl_l3_mon_resource_exit(void); 361 363 362 364 void mon_event_count(void *info); 363 365 ··· 368 366 void mon_event_read(struct rmid_read *rr, struct rdt_resource *r, 369 367 struct rdt_domain_hdr *hdr, struct rdtgroup *rdtgrp, 370 368 cpumask_t *cpumask, int evtid, int first); 371 - 372 - int resctrl_mon_resource_init(void); 373 369 374 370 void mbm_setup_overflow_handler(struct rdt_l3_mon_domain *dom, 375 371 unsigned long delay_ms,
+4 -4
fs/resctrl/monitor.c
··· 1780 1780 } 1781 1781 1782 1782 /** 1783 - * resctrl_mon_resource_init() - Initialise global monitoring structures. 1783 + * resctrl_l3_mon_resource_init() - Initialise global monitoring structures. 1784 1784 * 1785 1785 * Allocate and initialise global monitor resources that do not belong to a 1786 1786 * specific domain. i.e. the rmid_ptrs[] used for the limbo and free lists. ··· 1789 1789 * Resctrl's cpuhp callbacks may be called before this point to bring a domain 1790 1790 * online. 1791 1791 * 1792 - * Returns 0 for success, or -ENOMEM. 1792 + * Return: 0 for success, or -ENOMEM. 1793 1793 */ 1794 - int resctrl_mon_resource_init(void) 1794 + int resctrl_l3_mon_resource_init(void) 1795 1795 { 1796 1796 struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3); 1797 1797 int ret; ··· 1841 1841 return 0; 1842 1842 } 1843 1843 1844 - void resctrl_mon_resource_exit(void) 1844 + void resctrl_l3_mon_resource_exit(void) 1845 1845 { 1846 1846 struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3); 1847 1847
+12 -12
fs/resctrl/rdtgroup.c
··· 4246 4246 mutex_unlock(&rdtgroup_mutex); 4247 4247 } 4248 4248 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) 4250 4250 { 4251 4251 int idx; 4252 4252 ··· 4301 4301 cancel_delayed_work(&d->cqm_limbo); 4302 4302 } 4303 4303 4304 - domain_destroy_mon_state(d); 4304 + domain_destroy_l3_mon_state(d); 4305 4305 out_unlock: 4306 4306 mutex_unlock(&rdtgroup_mutex); 4307 4307 } 4308 4308 4309 4309 /** 4310 - * domain_setup_mon_state() - Initialise domain monitoring structures. 4310 + * domain_setup_l3_mon_state() - Initialise domain monitoring structures. 4311 4311 * @r: The resource for the newly online domain. 4312 4312 * @d: The newly online domain. 4313 4313 * ··· 4315 4315 * Called when the first CPU of a domain comes online, regardless of whether 4316 4316 * the filesystem is mounted. 4317 4317 * During boot this may be called before global allocations have been made by 4318 - * resctrl_mon_resource_init(). 4318 + * resctrl_l3_mon_resource_init(). 4319 4319 * 4320 - * Returns 0 for success, or -ENOMEM. 4320 + * Return: 0 for success, or -ENOMEM. 4321 4321 */ 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) 4323 4323 { 4324 4324 u32 idx_limit = resctrl_arch_system_num_rmid_idx(); 4325 4325 size_t tsize = sizeof(*d->mbm_states[0]); ··· 4386 4386 goto out_unlock; 4387 4387 4388 4388 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); 4390 4390 if (err) 4391 4391 goto out_unlock; 4392 4392 ··· 4503 4503 4504 4504 io_alloc_init(); 4505 4505 4506 - ret = resctrl_mon_resource_init(); 4506 + ret = resctrl_l3_mon_resource_init(); 4507 4507 if (ret) 4508 4508 return ret; 4509 4509 4510 4510 ret = sysfs_create_mount_point(fs_kobj, "resctrl"); 4511 4511 if (ret) { 4512 - resctrl_mon_resource_exit(); 4512 + resctrl_l3_mon_resource_exit(); 4513 4513 return ret; 4514 4514 } 4515 4515 ··· 4544 4544 4545 4545 cleanup_mountpoint: 4546 4546 sysfs_remove_mount_point(fs_kobj, "resctrl"); 4547 - resctrl_mon_resource_exit(); 4547 + resctrl_l3_mon_resource_exit(); 4548 4548 4549 4549 return ret; 4550 4550 } ··· 4580 4580 * When called by the architecture code, all CPUs and resctrl domains must be 4581 4581 * offline. This ensures the limbo and overflow handlers are not scheduled to 4582 4582 * run, meaning the data structures they access can be freed by 4583 - * resctrl_mon_resource_exit(). 4583 + * resctrl_l3_mon_resource_exit(). 4584 4584 * 4585 4585 * After resctrl_exit() returns, the architecture code should return an 4586 4586 * error from all resctrl_arch_ functions that can do this. ··· 4607 4607 * it can be used to umount resctrl. 4608 4608 */ 4609 4609 4610 - resctrl_mon_resource_exit(); 4610 + resctrl_l3_mon_resource_exit(); 4611 4611 }