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.

fs/resctrl: Pass struct rdtgroup instead of individual members

Reading monitoring data for a monitoring group requires both the RMID and
CLOSID. The RMID and CLOSID are members of struct rdtgroup but passed
separately to several functions involved in retrieving event data.

When "mbm_event" counter assignment mode is enabled, a counter ID is required
to read event data. The counter ID is obtained through mbm_cntr_get(), which
expects a struct rdtgroup pointer.

Provide a pointer to the struct rdtgroup as parameter to functions involved in
retrieving event data to simplify access to RMID, CLOSID, and counter ID.

Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Link: https://lore.kernel.org/cover.1757108044.git.babu.moger@amd.com

authored by

Babu Moger and committed by
Borislav Petkov (AMD)
bc53eea6 aab2c508

+18 -15
+18 -15
fs/resctrl/monitor.c
··· 413 413 memset(&d->cntr_cfg[cntr_id], 0, sizeof(*d->cntr_cfg)); 414 414 } 415 415 416 - static int __mon_event_count(u32 closid, u32 rmid, struct rmid_read *rr) 416 + static int __mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr) 417 417 { 418 418 int cpu = smp_processor_id(); 419 + u32 closid = rdtgrp->closid; 420 + u32 rmid = rdtgrp->mon.rmid; 419 421 struct rdt_mon_domain *d; 420 422 struct mbm_state *m; 421 423 int err, ret; ··· 477 475 /* 478 476 * mbm_bw_count() - Update bw count from values previously read by 479 477 * __mon_event_count(). 480 - * @closid: The closid used to identify the cached mbm_state. 481 - * @rmid: The rmid used to identify the cached mbm_state. 478 + * @rdtgrp: resctrl group associated with the CLOSID and RMID to identify 479 + * the cached mbm_state. 482 480 * @rr: The struct rmid_read populated by __mon_event_count(). 483 481 * 484 482 * Supporting function to calculate the memory bandwidth ··· 486 484 * __mon_event_count() is compared with the chunks value from the previous 487 485 * invocation. This must be called once per second to maintain values in MBps. 488 486 */ 489 - static void mbm_bw_count(u32 closid, u32 rmid, struct rmid_read *rr) 487 + static void mbm_bw_count(struct rdtgroup *rdtgrp, struct rmid_read *rr) 490 488 { 491 489 u64 cur_bw, bytes, cur_bytes; 490 + u32 closid = rdtgrp->closid; 491 + u32 rmid = rdtgrp->mon.rmid; 492 492 struct mbm_state *m; 493 493 494 494 m = get_mbm_state(rr->d, closid, rmid, rr->evtid); ··· 519 515 520 516 rdtgrp = rr->rgrp; 521 517 522 - ret = __mon_event_count(rdtgrp->closid, rdtgrp->mon.rmid, rr); 518 + ret = __mon_event_count(rdtgrp, rr); 523 519 524 520 /* 525 521 * For Ctrl groups read data from child monitor groups and ··· 530 526 531 527 if (rdtgrp->type == RDTCTRL_GROUP) { 532 528 list_for_each_entry(entry, head, mon.crdtgrp_list) { 533 - if (__mon_event_count(entry->closid, entry->mon.rmid, 534 - rr) == 0) 529 + if (__mon_event_count(entry, rr) == 0) 535 530 ret = 0; 536 531 } 537 532 } ··· 661 658 } 662 659 663 660 static void mbm_update_one_event(struct rdt_resource *r, struct rdt_mon_domain *d, 664 - u32 closid, u32 rmid, enum resctrl_event_id evtid) 661 + struct rdtgroup *rdtgrp, enum resctrl_event_id evtid) 665 662 { 666 663 struct rmid_read rr = {0}; 667 664 ··· 675 672 return; 676 673 } 677 674 678 - __mon_event_count(closid, rmid, &rr); 675 + __mon_event_count(rdtgrp, &rr); 679 676 680 677 /* 681 678 * If the software controller is enabled, compute the 682 679 * bandwidth for this event id. 683 680 */ 684 681 if (is_mba_sc(NULL)) 685 - mbm_bw_count(closid, rmid, &rr); 682 + mbm_bw_count(rdtgrp, &rr); 686 683 687 684 resctrl_arch_mon_ctx_free(rr.r, rr.evtid, rr.arch_mon_ctx); 688 685 } 689 686 690 687 static void mbm_update(struct rdt_resource *r, struct rdt_mon_domain *d, 691 - u32 closid, u32 rmid) 688 + struct rdtgroup *rdtgrp) 692 689 { 693 690 /* 694 691 * This is protected from concurrent reads from user as both 695 692 * the user and overflow handler hold the global mutex. 696 693 */ 697 694 if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID)) 698 - mbm_update_one_event(r, d, closid, rmid, QOS_L3_MBM_TOTAL_EVENT_ID); 695 + mbm_update_one_event(r, d, rdtgrp, QOS_L3_MBM_TOTAL_EVENT_ID); 699 696 700 697 if (resctrl_is_mon_event_enabled(QOS_L3_MBM_LOCAL_EVENT_ID)) 701 - mbm_update_one_event(r, d, closid, rmid, QOS_L3_MBM_LOCAL_EVENT_ID); 698 + mbm_update_one_event(r, d, rdtgrp, QOS_L3_MBM_LOCAL_EVENT_ID); 702 699 } 703 700 704 701 /* ··· 771 768 d = container_of(work, struct rdt_mon_domain, mbm_over.work); 772 769 773 770 list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) { 774 - mbm_update(r, d, prgrp->closid, prgrp->mon.rmid); 771 + mbm_update(r, d, prgrp); 775 772 776 773 head = &prgrp->mon.crdtgrp_list; 777 774 list_for_each_entry(crgrp, head, mon.crdtgrp_list) 778 - mbm_update(r, d, crgrp->closid, crgrp->mon.rmid); 775 + mbm_update(r, d, crgrp); 779 776 780 777 if (is_mba_sc(NULL)) 781 778 update_mba_bw(prgrp, d);