Re: [PATCH v1 3/9] x86/resctrl: Add resctrl_mbm_flush_cpu() to collect CPUs' MBM events

From: Peter Newman
Date: Thu Jun 01 2023 - 10:46:08 EST


Hi Reinette,

On Thu, May 11, 2023 at 11:37 PM Reinette Chatre
<reinette.chatre@xxxxxxxxx> wrote:
> On 4/21/2023 7:17 AM, Peter Newman wrote:
> > + /* Count bandwidth after the first successful counter read. */
> > + if (counter->initialized) {
> > + /* Assume that mbm_update() will prevent double-overflows. */
> > + if (val != counter->prev_bytes)
> > + atomic64_add(val - counter->prev_bytes,
> > + &m->soft_rmid_bytes);
> > + } else {
> > + counter->initialized = true;
> > + }
> > +
> > + counter->prev_bytes = val;
>
> I notice a lot of similarities between the above and the software controller,
> see mbm_bw_count().

I see the "a=now(); a-b; b=a;" and the not handling overflow parts
being similar, but the use of the initialized flag seems quite
different from delta_comp.

Also mbm_state is on the arch-independent side and the new code is
going to the arch-dependent side, so it wouldn't be convenient to try
to use the mbm_bw structures for this.

>From this, I don't think trying to reuse this is worth it unless you
have other suggestions.

-Peter