Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1386928

Re: [PATCH 3/4] perf/x86/mbm: Fix mbm counting when RMIDs are reused

From Vikas Shivappa <vikas.shivappa@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/4] perf/x86/mbm: Fix mbm counting when RMIDs are reused
Date 2016-04-25 23:50 +0200
Message-ID <rrWye-4kQ-9@gated-at.bofh.it> (permalink)
References <rqTCp-2k1-3@gated-at.bofh.it> <rqTCp-2k1-1@gated-at.bofh.it> <rrKQq-3ck-19@gated-at.bofh.it> <rrRRU-GH-3@gated-at.bofh.it> <rrUZu-3iQ-67@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On Mon, 25 Apr 2016, Peter Zijlstra wrote:

> On Mon, Apr 25, 2016 at 09:44:53AM -0700, Vikas Shivappa wrote:
>>
>>
>> On Mon, 25 Apr 2016, Peter Zijlstra wrote:
>>
>>> On Fri, Apr 22, 2016 at 05:27:20PM -0700, Vikas Shivappa wrote:
>>>> When multiple instances of perf reuse RMID, then we need to start
>>>> counting for each instance rather than reporting the current RMID count.
>>>> This patch adds a st_count(start count) per event to track the same.
>>>
>>> what?
>>>
>>
>> Will fix the comit log :
>>
>> When multiple instances of perf reuse RMID for the same PID, then we need to
>> start counting from zero for each new event, rather than reporting the
>> current RMID. This patch adds a st_count(start count) per event to track the
>> same.
>>
>> For ex:
>> 1.RMID1's total_bytes is 100MB for event1(PID1)
>> 2.another perf instance starts measuring the same PID1 with event2. We reuse
>> RMID1 as the PID1 is already counted.
>> 3.event2 stores st_count as 100MB.
>> 4.After some time, when user wants to count event2 and say RMID1's current
>> total_bytes 110MB, we report 110MB - 100MB = 10MB
>
> This is naturally handled by the scheme I outlined in the other patch.

Something similar although there is one per rmid and one per event..

u64 read_sample(rmid...) // for each rmid
{
...

start:
   'per rmid' prev = read_hw_counter();

count:
   cur_count = read_hw_counter();
   delta = cur_count - prev;
   prev = cur_count;
   total_bytes += delta;

   return total_bytes;
}

when we lose the rmid -

xchng(event, rmid=-1)
{
..

'per event' rc_count = read_sample(event->rmid) - per event start count;
'per event' start_count = 0;

}


for each event -

start:
   if rmid is reused
    'per event' prev = read_sample(rmid);
   else
    prev = 0;

count: // we use count instead of read
   count = read_sample(rmid) + rc_count - prev;


>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3/4] perf/x86/mbm: Fix mbm counting when RMIDs are reused Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2016-04-23 02:30 +0200
  Re: [PATCH 3/4] perf/x86/mbm: Fix mbm counting when RMIDs are reused Peter Zijlstra <peterz@infradead.org> - 2016-04-25 11:20 +0200
    Re: [PATCH 3/4] perf/x86/mbm: Fix mbm counting when RMIDs are  reused Vikas Shivappa <vikas.shivappa@intel.com> - 2016-04-25 18:50 +0200
      Re: [PATCH 3/4] perf/x86/mbm: Fix mbm counting when RMIDs are reused Peter Zijlstra <peterz@infradead.org> - 2016-04-25 22:10 +0200
        Re: [PATCH 3/4] perf/x86/mbm: Fix mbm counting when RMIDs are  reused Vikas Shivappa <vikas.shivappa@intel.com> - 2016-04-25 23:50 +0200
          Re: [PATCH 3/4] perf/x86/mbm: Fix mbm counting when RMIDs are  reused Vikas Shivappa <vikas.shivappa@intel.com> - 2016-04-25 23:50 +0200

csiph-web