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


Groups > linux.kernel > #1726131

Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping

From Alexey Budankov <alexey.budankov@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping
Date 2017-09-04 17:00 +0200
Message-ID <um110-6Md-11@gated-at.bofh.it> (permalink)
References (4 earlier) <uhohA-7x1-27@gated-at.bofh.it> <uhzG3-6Mv-29@gated-at.bofh.it> <ukBii-8so-29@gated-at.bofh.it> <ulX73-4pk-5@gated-at.bofh.it> <ulYmu-5lg-9@gated-at.bofh.it>
Organization Intel Corp.

Show all headers | View raw


On 04.09.2017 15:08, Peter Zijlstra wrote:
> On Mon, Sep 04, 2017 at 01:46:45PM +0300, Alexey Budankov wrote:
>>> So the below completely rewrites timekeeping (and probably breaks
>>> world) but does away with the need to touch events that don't get
>>> scheduled.
>>
>> We still need and do iterate thru all events at some points e.g. on context switches.
> 
> Why do we _need_ to?

We do so in the current implementation with several tstamp_* fields.

> On ctx switch we should stop iteration for a PMU once we fail toschedule an event, same as for rotation> 
>>> The basic idea is really simple, we have a single timestamp and
>>> depending on the state we update enabled/running. This obviously only
>>> requires updates when we change state and when we need up-to-date
>>> timestamps (read).
>>
>> I would prefer to have this rework in a FSM similar to that below, 
>> so state transition and the corresponding tstamp, total_time_enabled 
>> and total_time_running manipulation logic would be consolidated in 
>> one place and adjacent lines of code.
>>
>> From the table below event->state FSM is not as simple as it may seem 
>> on the first sight so in order to avoid regressions after rework we 
>> better keep that in mind and explicitly implement allowed and disallowed
>> state transitions.
> 
> Maybe if we introduce something like CONFIG_PERF_DEBUG, but I fear that
> for normal operation that's all fairly horrible overhead.
> 
>>     A	  	I	    O	       E	   X	      D     U
>>
>> A   Te+,Tr+     Te+,Tr+     Te+,Tr+    Te+,Tr+     Te+,Tr+    Te+,Tr+    ---
>>     ts 	        ts          ts         ts          ts         ts
>>
>> I   Te+,ts      Te+,ts      Te+,ts     Te+,ts      Te+,ts     Te+,ts     ---
>>
>> O   Te=0,Tr=0,  Te=0,Tr=0,  Te=0,Tr=0  Te=0,Tr=0   Te=0,Tr=0  Te=0,Tr=0  ---
>>     ts          ts          ts         ts          ts         ts
>>
>> E   Te=0,Tr=0,  Te=0,Tr=0,  Te=0,Tr=0  Te=0,Tr=0   Te=0,Tr=0  Te=0,Tr=0  ---
>>     ts          ts          ts         ts          ts         ts
>>
>> X   ---         ---         ---        ---         ---        ---        ---
>>
>> D   ---         ---         ---        ---         ---        ---        ---
>>
>> U   ---         Te=0,Tr=0   Te=0,Tr=0  ---         ---        ---        ---
>>                 ts          ts          
>>
>> LEGEND:
>>
>> U - allocation, A - ACTIVE, I - INACTIVE, O - OFF, 
>> E - ERROR, X - EXIT, D - DEAD,
> 
> Not sure we care about the different <0 values, they're all effectively
> OFF.

We still need to care about proper initial state of timings when moving above >=0 state.

> 
> 
> 

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


Thread

[RFC][PATCH] perf: Rewrite enabled/running timekeeping Peter Zijlstra <peterz@infradead.org> - 2017-08-31 19:20 +0200
  Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Alexey Budankov <alexey.budankov@linux.intel.com> - 2017-09-01 12:50 +0200
    Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Peter Zijlstra <peterz@infradead.org> - 2017-09-01 14:40 +0200
  Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Alexey Budankov <alexey.budankov@linux.intel.com> - 2017-09-01 13:20 +0200
    Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Peter Zijlstra <peterz@infradead.org> - 2017-09-01 14:50 +0200
  Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Vince Weaver <vince@deater.net> - 2017-09-01 23:30 +0200
  Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Alexey Budankov <alexey.budankov@linux.intel.com> - 2017-09-04 12:50 +0200
    Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Peter Zijlstra <peterz@infradead.org> - 2017-09-04 14:10 +0200
      Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Alexey Budankov <alexey.budankov@linux.intel.com> - 2017-09-04 17:00 +0200
        Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Peter Zijlstra <peterz@infradead.org> - 2017-09-04 17:50 +0200
          Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Peter Zijlstra <peterz@infradead.org> - 2017-09-04 18:00 +0200
          Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Peter Zijlstra <peterz@infradead.org> - 2017-09-05 13:30 +0200
          Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Alexey Budankov <alexey.budankov@linux.intel.com> - 2017-09-05 14:10 +0200
            Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Peter Zijlstra <peterz@infradead.org> - 2017-09-05 15:00 +0200
            Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Peter Zijlstra <peterz@infradead.org> - 2017-09-05 18:10 +0200
              Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Alexey Budankov <alexey.budankov@linux.intel.com> - 2017-09-06 15:50 +0200
              Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Alexey Budankov <alexey.budankov@linux.intel.com> - 2017-09-08 10:50 +0200
  Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping Peter Zijlstra <peterz@infradead.org> - 2017-09-05 11:50 +0200

csiph-web