mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Stephane Eranian <eranian@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	"mingo@elte.hu" <mingo@elte.hu>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	"ak@linux.intel.com" <ak@linux.intel.com>,
	David Ahern <dsahern@gmail.com>
Subject: Re: [BUG] perf: cannot read counts in per-process mode in 3.17-rcX
Date: Mon, 8 Sep 2014 14:49:45 +0200	[thread overview]
Message-ID: <20140908124945.GD17728@krava.brq.redhat.com> (raw)
In-Reply-To: <CABPqkBRREcix0TtLLUgiq8uabUqG=m2un79WKLqPXF=LccSQbw@mail.gmail.com>

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


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

  reply	other threads:[~2014-09-08 12:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08 12:35 Stephane Eranian
2014-09-08 12:49 ` Jiri Olsa [this message]
2014-09-08 13:21   ` Stephane Eranian
2014-09-08 14:31     ` [PATCH] perf: Do not check PERF_EVENT_STATE_EXIT on syscall read path Jiri Olsa
2014-09-08 15:22       ` Peter Zijlstra
2014-09-10 13:49         ` Stephane Eranian
2014-09-15 10:29           ` Stephane Eranian
2014-09-16 10:58       ` [tip:perf/core] " tip-bot for Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140908124945.GD17728@krava.brq.redhat.com \
    --to=jolsa@redhat.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®