lkml.org 
[lkml]   [2016]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/4] perf/x86/mbm: Store bytes counted for mbm during recycle
On Mon, Apr 25, 2016 at 02:12:09PM -0700, Vikas Shivappa wrote:


> >start:
> > prev_count = read_hw_counter();
>
> I am assuming this means we keep the prev_count when event is initialized.
> This is done in the mbm_init which calls update_sample with first parameter
> set to true..

No, when pmu::start() is called.

> >read:
> > do {
> > prev = prev_count;
> > cur_val = read_hw_counter();
> > delta = cur_val - prev;
> > } while (local_cmpxchg(&prev_count, prev, cur_val) != prev);
> > count += delta;

And this you do on pmu::{stop,read}()

> the update_sample does the work to compute the delta and add the delta to
> total_bytes.. it has all the code except for the while loop.

No, no, no, you add rc_count and st_count and generally make a huge mess
of things. The above needs none of that.

Because the above only cares about deltas against the hw counter (as per
prev_count). Therefore count can be an absolute value that carries all
your history as per rc_count, and you don't need st_count because per
prev_count you don't care about the absolute value of the hw counter.


\
 
 \ /
  Last update: 2016-05-03 10:01    [W:0.064 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site