[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170904120843.oazlv73phoxoinlj@hirez.programming.kicks-ass.net>
Date: Mon, 4 Sep 2017 14:08:43 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc: Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Andi Kleen <ak@...ux.intel.com>,
Kan Liang <kan.liang@...el.com>,
Dmitri Prokhorov <Dmitry.Prohorov@...el.com>,
Valery Cherepennikov <valery.cherepennikov@...el.com>,
Mark Rutland <mark.rutland@....com>,
Stephane Eranian <eranian@...gle.com>,
David Carrillo-Cisneros <davidcc@...gle.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Vince Weaver <vince@...ter.net>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [RFC][PATCH] perf: Rewrite enabled/running timekeeping
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? On ctx switch we should stop iteration for a PMU
once we fail to schedule 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.
Powered by blists - more mailing lists