Messages in this thread | | | Date | Wed, 25 Oct 2023 12:38:50 -0700 | From | Tony Luck <> | Subject | Re: [PATCH] x86/resctrl: mba_MBps: Fall back to total b/w if local b/w unavailable |
| |
On Wed, Oct 25, 2023 at 02:46:53PM +0200, Peter Newman wrote: > Hi Tony, > > On Tue, Oct 24, 2023 at 8:16 PM Tony Luck <tony.luck@intel.com> wrote: > > --- a/arch/x86/kernel/cpu/resctrl/monitor.c > > +++ b/arch/x86/kernel/cpu/resctrl/monitor.c > > @@ -418,6 +418,14 @@ static int __mon_event_count(u32 rmid, struct rmid_read *rr) > > return 0; > > } > > > > +static struct mbm_state *get_mbm_data(struct rdt_domain *dom_mbm, int rmid) > > +{ > > + if (is_mbm_local_enabled()) > > + return &dom_mbm->mbm_local[rmid]; > > + > > + return &dom_mbm->mbm_total[rmid]; > > +} > > That looks very similar to the get_mbm_state() function I added to > this same file recently: > > https://lore.kernel.org/all/20221220164132.443083-2-peternewman%40google.com > > I think the name you picked is misleadingly general. "local if > available, otherwise total" seems to be a choice specific to the mbps > controller. I think these functions should be reconciled a little > better. >
Peter (and Babu, who made the same point about get_mbm_state().
Do you want to see your function extended to do the "pick an MBM event?"
I could add a s/w defined "event" to the enum resctrl_event_id and extend get_mbm_state() like this:
static struct mbm_state *get_mbm_state(struct rdt_domain *d, u32 rmid, enum resctrl_event_id evtid) { switch (evtid) { case QOS_L3_MBM_TOTAL_EVENT_ID: return &d->mbm_total[rmid]; case QOS_L3_MBM_LOCAL_EVENT_ID: return &d->mbm_local[rmid]; + case QOS_L3_MBM_LOCAL_OR_TOTAL_EVENT_ID: + if (is_mbm_local_enabled()) + return &d->mbm_local[rmid]; + if (is_mbm_total_enabled()) + return &d->mbm_total[rmid]; + fallthrough; default: return NULL; } }
Is this the direction you are thinking of?
Callers then look like:
static void mbm_bw_count(u32 rmid, struct rmid_read *rr) { struct mbm_state *m = get_mbm_state(rr->d, rmid, QOS_L3_MBM_LOCAL_OR_TOTAL_EVENT_ID); u64 cur_bw, bytes, cur_bytes;
similar for the other three places where this is needed.
Any suggestions on how "QOS_L3_MBM_LOCAL_OR_TOTAL_EVENT_ID" could be abbreviated, or just have some different, but descriptive, name?
-Tony
| |