diff options
author | Tony Luck <tony.luck@intel.com> | 2023-11-06 16:24:37 -0800 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2023-11-06 17:18:30 -0800 |
commit | bbeae6eae640449d79c255501237d4679537b22c (patch) | |
tree | 1e285abac8e42da516fb17188f56cdbef4ceaf08 | |
parent | c197317fb370298846e918dc2906d849e87bb80d (diff) | |
download | linux-resctrl2_patches_v6.6-rc6.tar.gz |
resctrl2: Fix issues when recylcing RMIDsresctrl2_patches_v6.6-rc6
Need to make sure first read of MBM local or total counters of a newly
allocated RMID saves the QM_CTR value so that subsequent reads will
calculate the delta correctly.
Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r-- | fs/resctrl2/arch/x86/rdt_monitor.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/resctrl2/arch/x86/rdt_monitor.c b/fs/resctrl2/arch/x86/rdt_monitor.c index 3e667051e24d7..4402059bffe96 100644 --- a/fs/resctrl2/arch/x86/rdt_monitor.c +++ b/fs/resctrl2/arch/x86/rdt_monitor.c @@ -88,30 +88,28 @@ static u64 wrap(u64 old, u64 new) static u64 adjust(struct mydomain *m, u64 rmid, u64 event, u64 chunks) { struct mbm_event_state *s; - u64 rawchunks = chunks; switch (event) { case EV_LLC: - break; + return chunks; case EV_TOT: s = &m->rmids[rmid].state[0]; - rawchunks = get_corrected_mbm_count(rmid, s->chunks + wrap(s->prev_msr, chunks)); break; case EV_LOC: s = &m->rmids[rmid].state[1]; - rawchunks = get_corrected_mbm_count(rmid, s->chunks + wrap(s->prev_msr, chunks)); - break; - case EV_TOTRATE: - s = &m->rmids[rmid].state[0]; - rawchunks = get_corrected_mbm_count(rmid, s->rate); - break; - case EV_LOCRATE: - s = &m->rmids[rmid].state[0]; - rawchunks = get_corrected_mbm_count(rmid, s->rate); break; + default: // TODO: TOT_RATE and LOC_RATE + return 0; + } + + if (!s->init) { + s->chunks = 0; + s->prev_msr = chunks; + s->init = true; + return 0; } - return rawchunks; + return get_corrected_mbm_count(rmid, s->chunks + wrap(s->prev_msr, chunks)); } struct rrmid_info { @@ -211,8 +209,8 @@ static void update_rmids(void *info) wrmsrl(MSR_IA32_QM_EVTSEL, (snc_adjust_rmid(rmid) << 32) | event); rdmsrl(MSR_IA32_QM_CTR, msr); now = jiffies; - addchunks = wrap(s->prev_msr, msr); if (s->init) { + addchunks = wrap(s->prev_msr, msr); s->chunks += addchunks; s->rate = addchunks * HZ; do_div(s->rate, (now - s->prev_jiffies)); |