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 struct rdt_mon_domain and rdt_hw_mon_domain

The upcoming telemetry event monitoring is not tied to the L3 resource and
will have a new domain structure.

Rename the L3 resource specific domain data structures to include "l3_"
in their names to avoid confusion between the different resource specific
domain structures:
rdt_mon_domain -> rdt_l3_mon_domain
rdt_hw_mon_domain -> rdt_hw_l3_mon_domain

No functional change.

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)
4bc3ef46 6b10cf7b

+104 -104
+7 -7
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_mon_domain *hw_dom) 371 + static void mon_domain_free(struct rdt_hw_l3_mon_domain *hw_dom) 372 372 { 373 373 int idx; 374 374 ··· 405 405 * @num_rmid: The size of the MBM counter array 406 406 * @hw_dom: The domain that owns the allocated arrays 407 407 */ 408 - static int arch_domain_mbm_alloc(u32 num_rmid, struct rdt_hw_mon_domain *hw_dom) 408 + static int arch_domain_mbm_alloc(u32 num_rmid, struct rdt_hw_l3_mon_domain *hw_dom) 409 409 { 410 410 size_t tsize = sizeof(*hw_dom->arch_mbm_states[0]); 411 411 enum resctrl_event_id eventid; ··· 503 503 504 504 static void l3_mon_domain_setup(int cpu, int id, struct rdt_resource *r, struct list_head *add_pos) 505 505 { 506 - struct rdt_hw_mon_domain *hw_dom; 507 - struct rdt_mon_domain *d; 506 + struct rdt_hw_l3_mon_domain *hw_dom; 507 + struct rdt_l3_mon_domain *d; 508 508 struct cacheinfo *ci; 509 509 int err; 510 510 ··· 653 653 654 654 switch (r->rid) { 655 655 case RDT_RESOURCE_L3: { 656 - struct rdt_hw_mon_domain *hw_dom; 657 - struct rdt_mon_domain *d; 656 + struct rdt_hw_l3_mon_domain *hw_dom; 657 + struct rdt_l3_mon_domain *d; 658 658 659 659 if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3)) 660 660 return; 661 661 662 - d = container_of(hdr, struct rdt_mon_domain, hdr); 662 + d = container_of(hdr, struct rdt_l3_mon_domain, hdr); 663 663 hw_dom = resctrl_to_arch_mon_dom(d); 664 664 resctrl_offline_mon_domain(r, hdr); 665 665 list_del_rcu(&hdr->list);
+8 -8
arch/x86/kernel/cpu/resctrl/internal.h
··· 63 63 }; 64 64 65 65 /** 66 - * struct rdt_hw_mon_domain - Arch private attributes of a set of CPUs that share 67 - * a resource for a monitor function 68 - * @d_resctrl: Properties exposed to the resctrl file system 66 + * struct rdt_hw_l3_mon_domain - Arch private attributes of a set of CPUs sharing 67 + * RDT_RESOURCE_L3 monitoring 68 + * @d_resctrl: Properties exposed to the resctrl file system 69 69 * @arch_mbm_states: Per-event pointer to the MBM event's saved state. 70 70 * An MBM event's state is an array of struct arch_mbm_state 71 71 * indexed by RMID on x86. 72 72 * 73 73 * Members of this structure are accessed via helpers that provide abstraction. 74 74 */ 75 - struct rdt_hw_mon_domain { 76 - struct rdt_mon_domain d_resctrl; 75 + struct rdt_hw_l3_mon_domain { 76 + struct rdt_l3_mon_domain d_resctrl; 77 77 struct arch_mbm_state *arch_mbm_states[QOS_NUM_L3_MBM_EVENTS]; 78 78 }; 79 79 ··· 82 82 return container_of(r, struct rdt_hw_ctrl_domain, d_resctrl); 83 83 } 84 84 85 - static inline struct rdt_hw_mon_domain *resctrl_to_arch_mon_dom(struct rdt_mon_domain *r) 85 + static inline struct rdt_hw_l3_mon_domain *resctrl_to_arch_mon_dom(struct rdt_l3_mon_domain *r) 86 86 { 87 - return container_of(r, struct rdt_hw_mon_domain, d_resctrl); 87 + return container_of(r, struct rdt_hw_l3_mon_domain, d_resctrl); 88 88 } 89 89 90 90 /** ··· 140 140 141 141 extern struct rdt_hw_resource rdt_resources_all[]; 142 142 143 - void arch_mon_domain_online(struct rdt_resource *r, struct rdt_mon_domain *d); 143 + void arch_mon_domain_online(struct rdt_resource *r, struct rdt_l3_mon_domain *d); 144 144 145 145 /* CPUID.(EAX=10H, ECX=ResID=1).EAX */ 146 146 union cpuid_0x10_1_eax {
+18 -18
arch/x86/kernel/cpu/resctrl/monitor.c
··· 109 109 * 110 110 * In RMID sharing mode there are fewer "logical RMID" values available 111 111 * to accumulate data ("physical RMIDs" are divided evenly between SNC 112 - * nodes that share an L3 cache). Linux creates an rdt_mon_domain for 112 + * nodes that share an L3 cache). Linux creates an rdt_l3_mon_domain for 113 113 * each SNC node. 114 114 * 115 115 * The value loaded into IA32_PQR_ASSOC is the "logical RMID". ··· 157 157 return 0; 158 158 } 159 159 160 - static struct arch_mbm_state *get_arch_mbm_state(struct rdt_hw_mon_domain *hw_dom, 160 + static struct arch_mbm_state *get_arch_mbm_state(struct rdt_hw_l3_mon_domain *hw_dom, 161 161 u32 rmid, 162 162 enum resctrl_event_id eventid) 163 163 { ··· 171 171 return state ? &state[rmid] : NULL; 172 172 } 173 173 174 - void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_mon_domain *d, 174 + void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 175 175 u32 unused, u32 rmid, 176 176 enum resctrl_event_id eventid) 177 177 { 178 - struct rdt_hw_mon_domain *hw_dom = resctrl_to_arch_mon_dom(d); 178 + struct rdt_hw_l3_mon_domain *hw_dom = resctrl_to_arch_mon_dom(d); 179 179 int cpu = cpumask_any(&d->hdr.cpu_mask); 180 180 struct arch_mbm_state *am; 181 181 u32 prmid; ··· 194 194 * Assumes that hardware counters are also reset and thus that there is 195 195 * no need to record initial non-zero counts. 196 196 */ 197 - void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_mon_domain *d) 197 + void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_l3_mon_domain *d) 198 198 { 199 - struct rdt_hw_mon_domain *hw_dom = resctrl_to_arch_mon_dom(d); 199 + struct rdt_hw_l3_mon_domain *hw_dom = resctrl_to_arch_mon_dom(d); 200 200 enum resctrl_event_id eventid; 201 201 int idx; 202 202 ··· 217 217 return chunks >> shift; 218 218 } 219 219 220 - static u64 get_corrected_val(struct rdt_resource *r, struct rdt_mon_domain *d, 220 + static u64 get_corrected_val(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 221 221 u32 rmid, enum resctrl_event_id eventid, u64 msr_val) 222 222 { 223 - struct rdt_hw_mon_domain *hw_dom = resctrl_to_arch_mon_dom(d); 223 + struct rdt_hw_l3_mon_domain *hw_dom = resctrl_to_arch_mon_dom(d); 224 224 struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); 225 225 struct arch_mbm_state *am; 226 226 u64 chunks; ··· 242 242 u32 unused, u32 rmid, enum resctrl_event_id eventid, 243 243 u64 *val, void *ignored) 244 244 { 245 - struct rdt_hw_mon_domain *hw_dom; 245 + struct rdt_hw_l3_mon_domain *hw_dom; 246 + struct rdt_l3_mon_domain *d; 246 247 struct arch_mbm_state *am; 247 - struct rdt_mon_domain *d; 248 248 u64 msr_val; 249 249 u32 prmid; 250 250 int cpu; ··· 254 254 if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3)) 255 255 return -EINVAL; 256 256 257 - d = container_of(hdr, struct rdt_mon_domain, hdr); 257 + d = container_of(hdr, struct rdt_l3_mon_domain, hdr); 258 258 hw_dom = resctrl_to_arch_mon_dom(d); 259 259 cpu = cpumask_any(&hdr->cpu_mask); 260 260 prmid = logical_rmid_to_physical_rmid(cpu, rmid); ··· 308 308 return 0; 309 309 } 310 310 311 - void resctrl_arch_reset_cntr(struct rdt_resource *r, struct rdt_mon_domain *d, 311 + void resctrl_arch_reset_cntr(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 312 312 u32 unused, u32 rmid, int cntr_id, 313 313 enum resctrl_event_id eventid) 314 314 { 315 - struct rdt_hw_mon_domain *hw_dom = resctrl_to_arch_mon_dom(d); 315 + struct rdt_hw_l3_mon_domain *hw_dom = resctrl_to_arch_mon_dom(d); 316 316 struct arch_mbm_state *am; 317 317 318 318 am = get_arch_mbm_state(hw_dom, rmid, eventid); ··· 324 324 } 325 325 } 326 326 327 - int resctrl_arch_cntr_read(struct rdt_resource *r, struct rdt_mon_domain *d, 327 + int resctrl_arch_cntr_read(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 328 328 u32 unused, u32 rmid, int cntr_id, 329 329 enum resctrl_event_id eventid, u64 *val) 330 330 { ··· 354 354 * must adjust RMID counter numbers based on SNC node. See 355 355 * logical_rmid_to_physical_rmid() for code that does this. 356 356 */ 357 - void arch_mon_domain_online(struct rdt_resource *r, struct rdt_mon_domain *d) 357 + void arch_mon_domain_online(struct rdt_resource *r, struct rdt_l3_mon_domain *d) 358 358 { 359 359 if (snc_nodes_per_l3_cache > 1) 360 360 msr_clear_bit(MSR_RMID_SNC_CONFIG, 0); ··· 516 516 */ 517 517 static void _resctrl_abmc_enable(struct rdt_resource *r, bool enable) 518 518 { 519 - struct rdt_mon_domain *d; 519 + struct rdt_l3_mon_domain *d; 520 520 521 521 lockdep_assert_cpus_held(); 522 522 ··· 555 555 /* 556 556 * Send an IPI to the domain to assign the counter to RMID, event pair. 557 557 */ 558 - void resctrl_arch_config_cntr(struct rdt_resource *r, struct rdt_mon_domain *d, 558 + void resctrl_arch_config_cntr(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 559 559 enum resctrl_event_id evtid, u32 rmid, u32 closid, 560 560 u32 cntr_id, bool assign) 561 561 { 562 - struct rdt_hw_mon_domain *hw_dom = resctrl_to_arch_mon_dom(d); 562 + struct rdt_hw_l3_mon_domain *hw_dom = resctrl_to_arch_mon_dom(d); 563 563 union l3_qos_abmc_cfg abmc_cfg = { 0 }; 564 564 struct arch_mbm_state *am; 565 565
+1 -1
fs/resctrl/ctrlmondata.c
··· 600 600 struct kernfs_open_file *of = m->private; 601 601 enum resctrl_res_level resid; 602 602 enum resctrl_event_id evtid; 603 + struct rdt_l3_mon_domain *d; 603 604 struct rdt_domain_hdr *hdr; 604 605 struct rmid_read rr = {0}; 605 - struct rdt_mon_domain *d; 606 606 struct rdtgroup *rdtgrp; 607 607 int domid, cpu, ret = 0; 608 608 struct rdt_resource *r;
+4 -4
fs/resctrl/internal.h
··· 369 369 370 370 int resctrl_mon_resource_init(void); 371 371 372 - void mbm_setup_overflow_handler(struct rdt_mon_domain *dom, 372 + void mbm_setup_overflow_handler(struct rdt_l3_mon_domain *dom, 373 373 unsigned long delay_ms, 374 374 int exclude_cpu); 375 375 ··· 377 377 378 378 bool is_mba_sc(struct rdt_resource *r); 379 379 380 - void cqm_setup_limbo_handler(struct rdt_mon_domain *dom, unsigned long delay_ms, 380 + void cqm_setup_limbo_handler(struct rdt_l3_mon_domain *dom, unsigned long delay_ms, 381 381 int exclude_cpu); 382 382 383 383 void cqm_handle_limbo(struct work_struct *work); 384 384 385 - bool has_busy_rmid(struct rdt_mon_domain *d); 385 + bool has_busy_rmid(struct rdt_l3_mon_domain *d); 386 386 387 - void __check_limbo(struct rdt_mon_domain *d, bool force_free); 387 + void __check_limbo(struct rdt_l3_mon_domain *d, bool force_free); 388 388 389 389 void resctrl_file_fflags_init(const char *config, unsigned long fflags); 390 390
+35 -35
fs/resctrl/monitor.c
··· 130 130 * decrement the count. If the busy count gets to zero on an RMID, we 131 131 * free the RMID 132 132 */ 133 - void __check_limbo(struct rdt_mon_domain *d, bool force_free) 133 + void __check_limbo(struct rdt_l3_mon_domain *d, bool force_free) 134 134 { 135 135 struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3); 136 136 u32 idx_limit = resctrl_arch_system_num_rmid_idx(); ··· 188 188 resctrl_arch_mon_ctx_free(r, QOS_L3_OCCUP_EVENT_ID, arch_mon_ctx); 189 189 } 190 190 191 - bool has_busy_rmid(struct rdt_mon_domain *d) 191 + bool has_busy_rmid(struct rdt_l3_mon_domain *d) 192 192 { 193 193 u32 idx_limit = resctrl_arch_system_num_rmid_idx(); 194 194 ··· 289 289 static void add_rmid_to_limbo(struct rmid_entry *entry) 290 290 { 291 291 struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3); 292 - struct rdt_mon_domain *d; 292 + struct rdt_l3_mon_domain *d; 293 293 u32 idx; 294 294 295 295 lockdep_assert_held(&rdtgroup_mutex); ··· 342 342 list_add_tail(&entry->list, &rmid_free_lru); 343 343 } 344 344 345 - static struct mbm_state *get_mbm_state(struct rdt_mon_domain *d, u32 closid, 345 + static struct mbm_state *get_mbm_state(struct rdt_l3_mon_domain *d, u32 closid, 346 346 u32 rmid, enum resctrl_event_id evtid) 347 347 { 348 348 u32 idx = resctrl_arch_rmid_idx_encode(closid, rmid); ··· 362 362 * Return: 363 363 * Valid counter ID on success, or -ENOENT on failure. 364 364 */ 365 - static int mbm_cntr_get(struct rdt_resource *r, struct rdt_mon_domain *d, 365 + static int mbm_cntr_get(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 366 366 struct rdtgroup *rdtgrp, enum resctrl_event_id evtid) 367 367 { 368 368 int cntr_id; ··· 389 389 * Return: 390 390 * Valid counter ID on success, or -ENOSPC on failure. 391 391 */ 392 - static int mbm_cntr_alloc(struct rdt_resource *r, struct rdt_mon_domain *d, 392 + static int mbm_cntr_alloc(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 393 393 struct rdtgroup *rdtgrp, enum resctrl_event_id evtid) 394 394 { 395 395 int cntr_id; ··· 408 408 /* 409 409 * mbm_cntr_free() - Clear the counter ID configuration details in the domain @d. 410 410 */ 411 - static void mbm_cntr_free(struct rdt_mon_domain *d, int cntr_id) 411 + static void mbm_cntr_free(struct rdt_l3_mon_domain *d, int cntr_id) 412 412 { 413 413 memset(&d->cntr_cfg[cntr_id], 0, sizeof(*d->cntr_cfg)); 414 414 } ··· 418 418 int cpu = smp_processor_id(); 419 419 u32 closid = rdtgrp->closid; 420 420 u32 rmid = rdtgrp->mon.rmid; 421 - struct rdt_mon_domain *d; 421 + struct rdt_l3_mon_domain *d; 422 422 int cntr_id = -ENOENT; 423 423 struct mbm_state *m; 424 424 u64 tval = 0; ··· 427 427 rr->err = -EIO; 428 428 return -EINVAL; 429 429 } 430 - d = container_of(rr->hdr, struct rdt_mon_domain, hdr); 430 + d = container_of(rr->hdr, struct rdt_l3_mon_domain, hdr); 431 431 432 432 if (rr->is_mbm_cntr) { 433 433 cntr_id = mbm_cntr_get(rr->r, d, rdtgrp, rr->evtid); ··· 470 470 int cpu = smp_processor_id(); 471 471 u32 closid = rdtgrp->closid; 472 472 u32 rmid = rdtgrp->mon.rmid; 473 - struct rdt_mon_domain *d; 473 + struct rdt_l3_mon_domain *d; 474 474 u64 tval = 0; 475 475 int err, ret; 476 476 ··· 545 545 u64 cur_bw, bytes, cur_bytes; 546 546 u32 closid = rdtgrp->closid; 547 547 u32 rmid = rdtgrp->mon.rmid; 548 - struct rdt_mon_domain *d; 548 + struct rdt_l3_mon_domain *d; 549 549 struct mbm_state *m; 550 550 551 551 if (!domain_header_is_valid(rr->hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3)) 552 552 return; 553 - d = container_of(rr->hdr, struct rdt_mon_domain, hdr); 553 + d = container_of(rr->hdr, struct rdt_l3_mon_domain, hdr); 554 554 m = get_mbm_state(d, closid, rmid, rr->evtid); 555 555 if (WARN_ON_ONCE(!m)) 556 556 return; ··· 650 650 * throttle MSRs already have low percentage values. To avoid 651 651 * unnecessarily restricting such rdtgroups, we also increase the bandwidth. 652 652 */ 653 - static void update_mba_bw(struct rdtgroup *rgrp, struct rdt_mon_domain *dom_mbm) 653 + static void update_mba_bw(struct rdtgroup *rgrp, struct rdt_l3_mon_domain *dom_mbm) 654 654 { 655 655 u32 closid, rmid, cur_msr_val, new_msr_val; 656 656 struct mbm_state *pmbm_data, *cmbm_data; ··· 718 718 resctrl_arch_update_one(r_mba, dom_mba, closid, CDP_NONE, new_msr_val); 719 719 } 720 720 721 - static void mbm_update_one_event(struct rdt_resource *r, struct rdt_mon_domain *d, 721 + static void mbm_update_one_event(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 722 722 struct rdtgroup *rdtgrp, enum resctrl_event_id evtid) 723 723 { 724 724 struct rmid_read rr = {0}; ··· 750 750 resctrl_arch_mon_ctx_free(rr.r, rr.evtid, rr.arch_mon_ctx); 751 751 } 752 752 753 - static void mbm_update(struct rdt_resource *r, struct rdt_mon_domain *d, 753 + static void mbm_update(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 754 754 struct rdtgroup *rdtgrp) 755 755 { 756 756 /* ··· 771 771 void cqm_handle_limbo(struct work_struct *work) 772 772 { 773 773 unsigned long delay = msecs_to_jiffies(CQM_LIMBOCHECK_INTERVAL); 774 - struct rdt_mon_domain *d; 774 + struct rdt_l3_mon_domain *d; 775 775 776 776 cpus_read_lock(); 777 777 mutex_lock(&rdtgroup_mutex); 778 778 779 - d = container_of(work, struct rdt_mon_domain, cqm_limbo.work); 779 + d = container_of(work, struct rdt_l3_mon_domain, cqm_limbo.work); 780 780 781 781 __check_limbo(d, false); 782 782 ··· 799 799 * @exclude_cpu: Which CPU the handler should not run on, 800 800 * RESCTRL_PICK_ANY_CPU to pick any CPU. 801 801 */ 802 - void cqm_setup_limbo_handler(struct rdt_mon_domain *dom, unsigned long delay_ms, 802 + void cqm_setup_limbo_handler(struct rdt_l3_mon_domain *dom, unsigned long delay_ms, 803 803 int exclude_cpu) 804 804 { 805 805 unsigned long delay = msecs_to_jiffies(delay_ms); ··· 816 816 { 817 817 unsigned long delay = msecs_to_jiffies(MBM_OVERFLOW_INTERVAL); 818 818 struct rdtgroup *prgrp, *crgrp; 819 - struct rdt_mon_domain *d; 819 + struct rdt_l3_mon_domain *d; 820 820 struct list_head *head; 821 821 struct rdt_resource *r; 822 822 ··· 831 831 goto out_unlock; 832 832 833 833 r = resctrl_arch_get_resource(RDT_RESOURCE_L3); 834 - d = container_of(work, struct rdt_mon_domain, mbm_over.work); 834 + d = container_of(work, struct rdt_l3_mon_domain, mbm_over.work); 835 835 836 836 list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) { 837 837 mbm_update(r, d, prgrp); ··· 865 865 * @exclude_cpu: Which CPU the handler should not run on, 866 866 * RESCTRL_PICK_ANY_CPU to pick any CPU. 867 867 */ 868 - void mbm_setup_overflow_handler(struct rdt_mon_domain *dom, unsigned long delay_ms, 868 + void mbm_setup_overflow_handler(struct rdt_l3_mon_domain *dom, unsigned long delay_ms, 869 869 int exclude_cpu) 870 870 { 871 871 unsigned long delay = msecs_to_jiffies(delay_ms); ··· 1120 1120 * mbm_cntr_free_all() - Clear all the counter ID configuration details in the 1121 1121 * domain @d. Called when mbm_assign_mode is changed. 1122 1122 */ 1123 - static void mbm_cntr_free_all(struct rdt_resource *r, struct rdt_mon_domain *d) 1123 + static void mbm_cntr_free_all(struct rdt_resource *r, struct rdt_l3_mon_domain *d) 1124 1124 { 1125 1125 memset(d->cntr_cfg, 0, sizeof(*d->cntr_cfg) * r->mon.num_mbm_cntrs); 1126 1126 } ··· 1129 1129 * resctrl_reset_rmid_all() - Reset all non-architecture states for all the 1130 1130 * supported RMIDs. 1131 1131 */ 1132 - static void resctrl_reset_rmid_all(struct rdt_resource *r, struct rdt_mon_domain *d) 1132 + static void resctrl_reset_rmid_all(struct rdt_resource *r, struct rdt_l3_mon_domain *d) 1133 1133 { 1134 1134 u32 idx_limit = resctrl_arch_system_num_rmid_idx(); 1135 1135 enum resctrl_event_id evt; ··· 1150 1150 * Assign the counter if @assign is true else unassign the counter. Reset the 1151 1151 * associated non-architectural state. 1152 1152 */ 1153 - static void rdtgroup_assign_cntr(struct rdt_resource *r, struct rdt_mon_domain *d, 1153 + static void rdtgroup_assign_cntr(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 1154 1154 enum resctrl_event_id evtid, u32 rmid, u32 closid, 1155 1155 u32 cntr_id, bool assign) 1156 1156 { ··· 1170 1170 * Return: 1171 1171 * 0 on success, < 0 on failure. 1172 1172 */ 1173 - static int rdtgroup_alloc_assign_cntr(struct rdt_resource *r, struct rdt_mon_domain *d, 1173 + static int rdtgroup_alloc_assign_cntr(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 1174 1174 struct rdtgroup *rdtgrp, struct mon_evt *mevt) 1175 1175 { 1176 1176 int cntr_id; ··· 1205 1205 * Return: 1206 1206 * 0 on success, < 0 on failure. 1207 1207 */ 1208 - static int rdtgroup_assign_cntr_event(struct rdt_mon_domain *d, struct rdtgroup *rdtgrp, 1208 + static int rdtgroup_assign_cntr_event(struct rdt_l3_mon_domain *d, struct rdtgroup *rdtgrp, 1209 1209 struct mon_evt *mevt) 1210 1210 { 1211 1211 struct rdt_resource *r = resctrl_arch_get_resource(mevt->rid); ··· 1255 1255 * rdtgroup_free_unassign_cntr() - Unassign and reset the counter ID configuration 1256 1256 * for the event pointed to by @mevt within the domain @d and resctrl group @rdtgrp. 1257 1257 */ 1258 - static void rdtgroup_free_unassign_cntr(struct rdt_resource *r, struct rdt_mon_domain *d, 1258 + static void rdtgroup_free_unassign_cntr(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 1259 1259 struct rdtgroup *rdtgrp, struct mon_evt *mevt) 1260 1260 { 1261 1261 int cntr_id; ··· 1276 1276 * the event structure @mevt from the domain @d and the group @rdtgrp. Unassign 1277 1277 * the counters from all the domains if @d is NULL else unassign from @d. 1278 1278 */ 1279 - static void rdtgroup_unassign_cntr_event(struct rdt_mon_domain *d, struct rdtgroup *rdtgrp, 1279 + static void rdtgroup_unassign_cntr_event(struct rdt_l3_mon_domain *d, struct rdtgroup *rdtgrp, 1280 1280 struct mon_evt *mevt) 1281 1281 { 1282 1282 struct rdt_resource *r = resctrl_arch_get_resource(mevt->rid); ··· 1351 1351 static void rdtgroup_update_cntr_event(struct rdt_resource *r, struct rdtgroup *rdtgrp, 1352 1352 enum resctrl_event_id evtid) 1353 1353 { 1354 - struct rdt_mon_domain *d; 1354 + struct rdt_l3_mon_domain *d; 1355 1355 int cntr_id; 1356 1356 1357 1357 list_for_each_entry(d, &r->mon_domains, hdr.list) { ··· 1457 1457 size_t nbytes, loff_t off) 1458 1458 { 1459 1459 struct rdt_resource *r = rdt_kn_parent_priv(of->kn); 1460 - struct rdt_mon_domain *d; 1460 + struct rdt_l3_mon_domain *d; 1461 1461 int ret = 0; 1462 1462 bool enable; 1463 1463 ··· 1530 1530 struct seq_file *s, void *v) 1531 1531 { 1532 1532 struct rdt_resource *r = rdt_kn_parent_priv(of->kn); 1533 - struct rdt_mon_domain *dom; 1533 + struct rdt_l3_mon_domain *dom; 1534 1534 bool sep = false; 1535 1535 1536 1536 cpus_read_lock(); ··· 1554 1554 struct seq_file *s, void *v) 1555 1555 { 1556 1556 struct rdt_resource *r = rdt_kn_parent_priv(of->kn); 1557 - struct rdt_mon_domain *dom; 1557 + struct rdt_l3_mon_domain *dom; 1558 1558 bool sep = false; 1559 1559 u32 cntrs, i; 1560 1560 int ret = 0; ··· 1595 1595 int mbm_L3_assignments_show(struct kernfs_open_file *of, struct seq_file *s, void *v) 1596 1596 { 1597 1597 struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3); 1598 - struct rdt_mon_domain *d; 1598 + struct rdt_l3_mon_domain *d; 1599 1599 struct rdtgroup *rdtgrp; 1600 1600 struct mon_evt *mevt; 1601 1601 int ret = 0; ··· 1658 1658 return NULL; 1659 1659 } 1660 1660 1661 - static int rdtgroup_modify_assign_state(char *assign, struct rdt_mon_domain *d, 1661 + static int rdtgroup_modify_assign_state(char *assign, struct rdt_l3_mon_domain *d, 1662 1662 struct rdtgroup *rdtgrp, struct mon_evt *mevt) 1663 1663 { 1664 1664 int ret = 0; ··· 1684 1684 static int resctrl_parse_mbm_assignment(struct rdt_resource *r, struct rdtgroup *rdtgrp, 1685 1685 char *event, char *tok) 1686 1686 { 1687 - struct rdt_mon_domain *d; 1687 + struct rdt_l3_mon_domain *d; 1688 1688 unsigned long dom_id = 0; 1689 1689 char *dom_str, *id_str; 1690 1690 struct mon_evt *mevt;
+20 -20
fs/resctrl/rdtgroup.c
··· 1640 1640 static int mbm_config_show(struct seq_file *s, struct rdt_resource *r, u32 evtid) 1641 1641 { 1642 1642 struct resctrl_mon_config_info mon_info; 1643 - struct rdt_mon_domain *dom; 1643 + struct rdt_l3_mon_domain *dom; 1644 1644 bool sep = false; 1645 1645 1646 1646 cpus_read_lock(); ··· 1688 1688 } 1689 1689 1690 1690 static void mbm_config_write_domain(struct rdt_resource *r, 1691 - struct rdt_mon_domain *d, u32 evtid, u32 val) 1691 + struct rdt_l3_mon_domain *d, u32 evtid, u32 val) 1692 1692 { 1693 1693 struct resctrl_mon_config_info mon_info = {0}; 1694 1694 ··· 1729 1729 static int mon_config_write(struct rdt_resource *r, char *tok, u32 evtid) 1730 1730 { 1731 1731 char *dom_str = NULL, *id_str; 1732 + struct rdt_l3_mon_domain *d; 1732 1733 unsigned long dom_id, val; 1733 - struct rdt_mon_domain *d; 1734 1734 1735 1735 /* Walking r->domains, ensure it can't race with cpuhp */ 1736 1736 lockdep_assert_cpus_held(); ··· 2781 2781 { 2782 2782 struct rdt_fs_context *ctx = rdt_fc2context(fc); 2783 2783 unsigned long flags = RFTYPE_CTRL_BASE; 2784 - struct rdt_mon_domain *dom; 2784 + struct rdt_l3_mon_domain *dom; 2785 2785 struct rdt_resource *r; 2786 2786 int ret; 2787 2787 ··· 3232 3232 struct rdt_domain_hdr *hdr) 3233 3233 { 3234 3234 struct rdtgroup *prgrp, *crgrp; 3235 - struct rdt_mon_domain *d; 3235 + struct rdt_l3_mon_domain *d; 3236 3236 char subname[32]; 3237 3237 bool snc_mode; 3238 3238 char name[32]; ··· 3240 3240 if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3)) 3241 3241 return; 3242 3242 3243 - d = container_of(hdr, struct rdt_mon_domain, hdr); 3243 + d = container_of(hdr, struct rdt_l3_mon_domain, hdr); 3244 3244 snc_mode = r->mon_scope == RESCTRL_L3_NODE; 3245 3245 sprintf(name, "mon_%s_%02d", r->name, snc_mode ? d->ci_id : hdr->id); 3246 3246 if (snc_mode) ··· 3258 3258 struct rdt_resource *r, struct rdtgroup *prgrp, 3259 3259 bool do_sum) 3260 3260 { 3261 + struct rdt_l3_mon_domain *d; 3261 3262 struct rmid_read rr = {0}; 3262 - struct rdt_mon_domain *d; 3263 3263 struct mon_data *priv; 3264 3264 struct mon_evt *mevt; 3265 3265 int ret, domid; ··· 3267 3267 if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3)) 3268 3268 return -EINVAL; 3269 3269 3270 - d = container_of(hdr, struct rdt_mon_domain, hdr); 3270 + d = container_of(hdr, struct rdt_l3_mon_domain, hdr); 3271 3271 for_each_mon_event(mevt) { 3272 3272 if (mevt->rid != r->rid || !mevt->enabled) 3273 3273 continue; ··· 3292 3292 struct rdt_resource *r, struct rdtgroup *prgrp) 3293 3293 { 3294 3294 struct kernfs_node *kn, *ckn; 3295 - struct rdt_mon_domain *d; 3295 + struct rdt_l3_mon_domain *d; 3296 3296 char name[32]; 3297 3297 bool snc_mode; 3298 3298 int ret = 0; ··· 3302 3302 if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3)) 3303 3303 return -EINVAL; 3304 3304 3305 - d = container_of(hdr, struct rdt_mon_domain, hdr); 3305 + d = container_of(hdr, struct rdt_l3_mon_domain, hdr); 3306 3306 snc_mode = r->mon_scope == RESCTRL_L3_NODE; 3307 3307 sprintf(name, "mon_%s_%02d", r->name, snc_mode ? d->ci_id : d->hdr.id); 3308 3308 kn = kernfs_find_and_get(parent_kn, name); ··· 4246 4246 mutex_unlock(&rdtgroup_mutex); 4247 4247 } 4248 4248 4249 - static void domain_destroy_mon_state(struct rdt_mon_domain *d) 4249 + static void domain_destroy_mon_state(struct rdt_l3_mon_domain *d) 4250 4250 { 4251 4251 int idx; 4252 4252 ··· 4270 4270 4271 4271 void resctrl_offline_mon_domain(struct rdt_resource *r, struct rdt_domain_hdr *hdr) 4272 4272 { 4273 - struct rdt_mon_domain *d; 4273 + struct rdt_l3_mon_domain *d; 4274 4274 4275 4275 mutex_lock(&rdtgroup_mutex); 4276 4276 4277 4277 if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3)) 4278 4278 goto out_unlock; 4279 4279 4280 - d = container_of(hdr, struct rdt_mon_domain, hdr); 4280 + d = container_of(hdr, struct rdt_l3_mon_domain, hdr); 4281 4281 4282 4282 /* 4283 4283 * If resctrl is mounted, remove all the ··· 4319 4319 * 4320 4320 * Returns 0 for success, or -ENOMEM. 4321 4321 */ 4322 - static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_mon_domain *d) 4322 + static int domain_setup_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]); ··· 4377 4377 4378 4378 int resctrl_online_mon_domain(struct rdt_resource *r, struct rdt_domain_hdr *hdr) 4379 4379 { 4380 - struct rdt_mon_domain *d; 4380 + struct rdt_l3_mon_domain *d; 4381 4381 int err = -EINVAL; 4382 4382 4383 4383 mutex_lock(&rdtgroup_mutex); ··· 4385 4385 if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3)) 4386 4386 goto out_unlock; 4387 4387 4388 - d = container_of(hdr, struct rdt_mon_domain, hdr); 4388 + d = container_of(hdr, struct rdt_l3_mon_domain, hdr); 4389 4389 err = domain_setup_mon_state(r, d); 4390 4390 if (err) 4391 4391 goto out_unlock; ··· 4432 4432 } 4433 4433 } 4434 4434 4435 - static struct rdt_mon_domain *get_mon_domain_from_cpu(int cpu, 4436 - struct rdt_resource *r) 4435 + static struct rdt_l3_mon_domain *get_mon_domain_from_cpu(int cpu, 4436 + struct rdt_resource *r) 4437 4437 { 4438 - struct rdt_mon_domain *d; 4438 + struct rdt_l3_mon_domain *d; 4439 4439 4440 4440 lockdep_assert_cpus_held(); 4441 4441 ··· 4451 4451 void resctrl_offline_cpu(unsigned int cpu) 4452 4452 { 4453 4453 struct rdt_resource *l3 = resctrl_arch_get_resource(RDT_RESOURCE_L3); 4454 - struct rdt_mon_domain *d; 4454 + struct rdt_l3_mon_domain *d; 4455 4455 struct rdtgroup *rdtgrp; 4456 4456 4457 4457 mutex_lock(&rdtgroup_mutex);
+11 -11
include/linux/resctrl.h
··· 178 178 }; 179 179 180 180 /** 181 - * struct rdt_mon_domain - group of CPUs sharing a resctrl monitor resource 181 + * struct rdt_l3_mon_domain - group of CPUs sharing RDT_RESOURCE_L3 monitoring 182 182 * @hdr: common header for different domain types 183 183 * @ci_id: cache info id for this domain 184 184 * @rmid_busy_llc: bitmap of which limbo RMIDs are above threshold ··· 192 192 * @cntr_cfg: array of assignable counters' configuration (indexed 193 193 * by counter ID) 194 194 */ 195 - struct rdt_mon_domain { 195 + struct rdt_l3_mon_domain { 196 196 struct rdt_domain_hdr hdr; 197 197 unsigned int ci_id; 198 198 unsigned long *rmid_busy_llc; ··· 367 367 }; 368 368 369 369 struct resctrl_mon_config_info { 370 - struct rdt_resource *r; 371 - struct rdt_mon_domain *d; 372 - u32 evtid; 373 - u32 mon_config; 370 + struct rdt_resource *r; 371 + struct rdt_l3_mon_domain *d; 372 + u32 evtid; 373 + u32 mon_config; 374 374 }; 375 375 376 376 /** ··· 585 585 * 586 586 * This can be called from any CPU. 587 587 */ 588 - void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_mon_domain *d, 588 + void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 589 589 u32 closid, u32 rmid, 590 590 enum resctrl_event_id eventid); 591 591 ··· 598 598 * 599 599 * This can be called from any CPU. 600 600 */ 601 - void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_mon_domain *d); 601 + void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_l3_mon_domain *d); 602 602 603 603 /** 604 604 * resctrl_arch_reset_all_ctrls() - Reset the control for each CLOSID to its ··· 624 624 * 625 625 * This can be called from any CPU. 626 626 */ 627 - void resctrl_arch_config_cntr(struct rdt_resource *r, struct rdt_mon_domain *d, 627 + void resctrl_arch_config_cntr(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 628 628 enum resctrl_event_id evtid, u32 rmid, u32 closid, 629 629 u32 cntr_id, bool assign); 630 630 ··· 647 647 * Return: 648 648 * 0 on success, or -EIO, -EINVAL etc on error. 649 649 */ 650 - int resctrl_arch_cntr_read(struct rdt_resource *r, struct rdt_mon_domain *d, 650 + int resctrl_arch_cntr_read(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 651 651 u32 closid, u32 rmid, int cntr_id, 652 652 enum resctrl_event_id eventid, u64 *val); 653 653 ··· 662 662 * 663 663 * This can be called from any CPU. 664 664 */ 665 - void resctrl_arch_reset_cntr(struct rdt_resource *r, struct rdt_mon_domain *d, 665 + void resctrl_arch_reset_cntr(struct rdt_resource *r, struct rdt_l3_mon_domain *d, 666 666 u32 closid, u32 rmid, int cntr_id, 667 667 enum resctrl_event_id eventid); 668 668