[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150805162152.GC25159@twins.programming.kicks-ass.net>
Date: Wed, 5 Aug 2015 18:21:52 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Alexei Starovoitov <ast@...mgrid.com>
Cc: Kaixu Xia <xiakaixu@...wei.com>, davem@...emloft.net,
acme@...nel.org, mingo@...hat.com, masami.hiramatsu.pt@...achi.com,
jolsa@...nel.org, daniel@...earbox.net, wangnan0@...wei.com,
linux-kernel@...r.kernel.org, pi3orama@....com, hekuang@...wei.com,
netdev@...r.kernel.org
Subject: Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read()
that get the selected hardware PMU conuter
On Wed, Aug 05, 2015 at 09:08:32AM -0700, Alexei Starovoitov wrote:
> On 8/5/15 6:53 AM, Peter Zijlstra wrote:
> >+ /*
> >+ * If the event is currently on this CPU, its either a per-task event,
> >+ * or local to this CPU. Furthermore it means its ACTIVE (otherwise
> >+ * oncpu == -1).
> >+ */
> >+ if (event->oncpu == smp_processor_id())
> >+ event->pmu->read(event);
> >+
> >+ val = local64_read(&event->count);
> >+ local_irq_restore(flags);
> >+
>
> nice! cleaner and faster.
> so raw_spin_lock(&ctx->lock) is not needed, because
> update_*(event) methods are not called, right?
Indeed, and by ensuring the event is indeed local (by force of WARN_ON)
disabling IRQs will avoid counter scheduling and result in a stable
event state.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists