lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160902083338.GK10138@twins.programming.kicks-ass.net>
Date:   Fri, 2 Sep 2016 10:33:38 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Stephane Eranian <eranian@...gle.com>
Cc:     Jiri Olsa <jolsa@...hat.com>,
        Vegard Nossum <vegard.nossum@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Vince Weaver <vincent.weaver@...ne.edu>,
        Ingo Molnar <mingo@...nel.org>,
        David Carrillo-Cisneros <davidcc@...gle.com>,
        "H. Peter Anvin" <hpa@...or.com>, Kan Liang <kan.liang@...el.com>,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        Paul Turner <pjt@...gle.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        "linux-tip-commits@...r.kernel.org" 
        <linux-tip-commits@...r.kernel.org>
Subject: Re: [tip:perf/core] perf/core: Check return value of the
 perf_event_read() IPI

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..


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ