Hi Peter, On 6/1/2023 7:45 AM, Peter Newman wrote: > 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. At this time I am staring at mbm_state->prev_bw_bytes and mbm_soft_counter->prev_bytes and concerned about how much confusion this would generate. Considering the pending changes to data structures I hope this would be clear then. Reinette