[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7cgugnvrv5CJPe_EP_M8pp8h+GsCCW3-RDmyrd+JDGYJrQ@mail.gmail.com>
Date: Fri, 10 Dec 2021 10:59:49 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
LKML <linux-kernel@...r.kernel.org>,
Stephane Eranian <eranian@...gle.com>,
Andi Kleen <ak@...ux.intel.com>,
Ian Rogers <irogers@...gle.com>,
Song Liu <songliubraving@...com>
Subject: Re: [PATCH v3] perf/core: Set event shadow time for inactive events too
On Fri, Dec 10, 2021 at 2:20 AM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Thu, Dec 09, 2021 at 01:51:42PM -0800, Namhyung Kim wrote:
> > On Thu, Dec 9, 2021 at 3:35 AM Peter Zijlstra <peterz@...radead.org> wrote:
> > >
> > > On Thu, Dec 09, 2021 at 12:26:32PM +0100, Peter Zijlstra wrote:
> > > > On Sun, Dec 05, 2021 at 02:48:43PM -0800, Namhyung Kim wrote:
> > > >
> > > > > Actually 18446744069443110306 is 0xffffffff01b345a2 so it seems to
> > > > > have a negative enabled time. In fact, bperf keeps values returned by
> > > > > bpf_perf_event_read_value() which calls perf_event_read_local(), and
> > > > > accumulates delta between two calls. When event->shadow_ctx_time is
> > > > > not set, it'd return invalid enabled time which is bigger than normal.
> > > >
> > > > *that*, how does it happen that shadow_time isn't set? It should be last
> > > > set when the event switches to INACTIVE, no? At which point the logic in
> > > > perf_event_read_local() should make @enabled move forward while @running
> > > > stays put.
> > > >
> > > > Let me go rummage around a bit... either I'm missing something obvious
> > > > or something's smelly.
> > >
> > > How's this then?
> >
> > Still the same :(
>
> You're doing that bpf-cgroup crud, right? Where exactly do you hook into
> to do the counter reads?
That's true but it doesn't use cgroup events actually. They are plain cpu
events and BPF is called from a separate 'cgroup-switches' event to
read out the counters.
>
> > Maybe because the event is enabled from the beginning.
> > Then it might miss set_state/update_time at all.
>
> Even then, it's set to INACTIVE and any state change thereafter needs to
> go through perf_event_set_state() and update the relevant timestamps.
Right, but the problem happens when you read the event *before*
any state change.
Thanks,
Namhyung
Powered by blists - more mailing lists