Re: [tip:perf/core] perf/core: Check return value of the perf_event_read() IPI
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [tip:perf/core] perf/core: Check return value of the perf_event_read() IPI
- From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
- Date: Fri, 2 Sep 2016 10:33:38 +0200
- Cc: Jiri Olsa <jolsa@xxxxxxxxxx>, Vegard Nossum <vegard.nossum@xxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Vince Weaver <vincent.weaver@xxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, David Carrillo-Cisneros <davidcc@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Kan Liang <kan.liang@xxxxxxxxx>, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>, Paul Turner <pjt@xxxxxxxxxx>, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, LKML <linux-kernel@xxxxxxxxxxxxxxx>, Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>, "linux-tip-commits@xxxxxxxxxxxxxxx" <linux-tip-commits@xxxxxxxxxxxxxxx>
- In-reply-to: <CABPqkBSnOiqa51vvPG-QS=9vRaUDzdDZ8xSFVh=MJ9ROudvCUg@mail.gmail.com>
- References: <1471467307-61171-2-git-send-email-davidcc@google.com> <tip-71e7bc2bab77e64882c031c2af943c3256c1adb0@git.kernel.org> <CAOMGZ=HUNTxBOjNkP+HtD1q-yk0sOBUoMJeCu=0cKOrc8coezQ@mail.gmail.com> <20160822071737.GF4349@krava> <20160822082932.GA13171@krava> <20160822103823.GA2271@krava> <20160829100309.GS10121@twins.programming.kicks-ass.net> <20160829130213.GF10168@twins.programming.kicks-ass.net> <CABPqkBSnOiqa51vvPG-QS=9vRaUDzdDZ8xSFVh=MJ9ROudvCUg@mail.gmail.com>
- User-agent: Mutt/1.5.23.1 (2014-03-12)
On Tue, Aug 30, 2016 at 09:26:18AM -0700, Stephane Eranian wrote:
> I am trying to understand this better.
> There is a race between oncpu/active and the smp_call. By the time
> you actually do the smp_call the oncpu may be wrong and smp_call now
> returns an error given David's change.
> I suspect the race was always there.
Me too, I might even have done it on purpose and then forgot about it.
Now cured with a comment.
> It boils down to what is the guarantee of the API in terms of the
> "freshness" of the value returned on read(). I am guessing that if
> you thought you had to do the smp_call, it is because the event was
> still active and oncpu != -1.
> If it is no longer active, it happened very recently and, in that
> case, one can use the saved count in the perf_event struct as a valid
> value because it was necessarily updated when the event was scheduled
> out.
Almost, if its not active, its not counting. Therefore we don't care
about updates.
The other race, against sched_in(), is as you describe though, we can
observe ACTIVE && on_cpu==-1 or INACTIVE && on_cpu (due to lack of
ordering and serialization) but if we can observe that, the sched_in was
(very) recent and we still don't care because its the same as if the
read request happened slightly earlier etc..
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Index of Archives]
[Linux Stable Commits]
[Linux Stable Kernel]
[Linux Kernel]
[Linux USB Devel]
[Linux Video &Media]
[Linux Audio Users]
[Yosemite News]
[Linux SCSI]