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: <CABPqkBRPWh+=CfXBYaYW=P6FJke3KB-7y-U1ky8JAKjDY3JaEg@mail.gmail.com>
Date:	Mon, 8 Sep 2014 15:21:12 +0200
From:	Stephane Eranian <eranian@...gle.com>
To:	Jiri Olsa <jolsa@...hat.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	"mingo@...e.hu" <mingo@...e.hu>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Namhyung Kim <namhyung@...nel.org>,
	"ak@...ux.intel.com" <ak@...ux.intel.com>,
	David Ahern <dsahern@...il.com>
Subject: Re: [BUG] perf: cannot read counts in per-process mode in 3.17-rcX

On Mon, Sep 8, 2014 at 2:49 PM, Jiri Olsa <jolsa@...hat.com> wrote:
>
> On Mon, Sep 08, 2014 at 02:35:06PM +0200, Stephane Eranian wrote:
> > Hi,
> >
> > It seems something is seriously broken with perf_events in
> > 3.17-rcX. I have tried rc3, rc4. No way to get any counts
> > out using perf stat in per-process mode. I am trying on Intel
> > and the PMU is correctly detected:
> >
> > $ perf stat -e cycles ls
> >       <not counted> cycles
> >
> > It is not a permission problem. It is a read problem!
> > $ strace perf stat -e cycles ls
> >
> > perf_event_open(0x27d7e20, 2261, -1, -1, 0x8 /* PERF_FLAG_??? */) = 3
> > write(6, "\0", 1)                       = 1
> > close(6)                                = 0
> > wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 2261
> > --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2261,
> > si_status=0, si_utime=0, si_stime=0} ---
> > rt_sigreturn()                          = 2261
> > read(3, "", 24)                         = 0
> >  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> ouch thats me.. sry :-\
>
> the PERF_EVENT_STATE_EXIT check should not go to the
> read path.. could you please test attached patch?
>
> jirka
>
Works for me again now. Thanks for the quick fix. Please push it upstream.

Acked-by: Stephane Eranian <eranian@...gle.com>
>
>
> ---
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index d8cb4d2..6d1c9ce 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -3600,8 +3600,7 @@ perf_read_hw(struct perf_event *event, char __user *buf, size_t count)
>          * error state (i.e. because it was pinned but it couldn't be
>          * scheduled on to the CPU at some point).
>          */
> -       if ((event->state == PERF_EVENT_STATE_ERROR) ||
> -           (event->state == PERF_EVENT_STATE_EXIT))
> +       if (event->state == PERF_EVENT_STATE_ERROR)
>                 return 0;
>
>         if (count < event->read_size)
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ