Skip to content

Commit 481d363

Browse files
aeglbp3tk0v
authored andcommitted
x86/resctrl: Modify update_mba_bw() to use per CTRL_MON group event
update_mba_bw() hard codes use of the memory bandwidth local event which prevents more flexible options from being deployed. Change this function to use the event specified in the rdtgroup that is being processed. Mount time checks for the "mba_MBps" option ensure that local memory bandwidth is enabled. So drop the redundant is_mbm_local_enabled() check. Signed-off-by: Tony Luck <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Tested-by: Babu Moger <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3b49c37 commit 481d363

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -752,20 +752,20 @@ static void update_mba_bw(struct rdtgroup *rgrp, struct rdt_mon_domain *dom_mbm)
752752
u32 closid, rmid, cur_msr_val, new_msr_val;
753753
struct mbm_state *pmbm_data, *cmbm_data;
754754
struct rdt_ctrl_domain *dom_mba;
755+
enum resctrl_event_id evt_id;
755756
struct rdt_resource *r_mba;
756-
u32 cur_bw, user_bw, idx;
757757
struct list_head *head;
758758
struct rdtgroup *entry;
759-
760-
if (!is_mbm_local_enabled())
761-
return;
759+
u32 cur_bw, user_bw;
762760

763761
r_mba = &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl;
762+
evt_id = rgrp->mba_mbps_event;
764763

765764
closid = rgrp->closid;
766765
rmid = rgrp->mon.rmid;
767-
idx = resctrl_arch_rmid_idx_encode(closid, rmid);
768-
pmbm_data = &dom_mbm->mbm_local[idx];
766+
pmbm_data = get_mbm_state(dom_mbm, closid, rmid, evt_id);
767+
if (WARN_ON_ONCE(!pmbm_data))
768+
return;
769769

770770
dom_mba = get_ctrl_domain_from_cpu(smp_processor_id(), r_mba);
771771
if (!dom_mba) {
@@ -784,7 +784,9 @@ static void update_mba_bw(struct rdtgroup *rgrp, struct rdt_mon_domain *dom_mbm)
784784
*/
785785
head = &rgrp->mon.crdtgrp_list;
786786
list_for_each_entry(entry, head, mon.crdtgrp_list) {
787-
cmbm_data = &dom_mbm->mbm_local[entry->mon.rmid];
787+
cmbm_data = get_mbm_state(dom_mbm, entry->closid, entry->mon.rmid, evt_id);
788+
if (WARN_ON_ONCE(!cmbm_data))
789+
return;
788790
cur_bw += cmbm_data->prev_bw;
789791
}
790792

0 commit comments

Comments
 (0)