public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Jiri Olsa <jolsa@kernel.org>,
	linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH 2/3] perf: Do not allow optimized switch for non-cloned events
Date: Tue, 24 Jun 2014 12:53:01 +0200	[thread overview]
Message-ID: <20140624105301.GB7554@krava.redhat.com> (raw)
In-Reply-To: <20140624103936.GK19860@laptop.programming.kicks-ass.net>

On Tue, Jun 24, 2014 at 12:39:36PM +0200, Peter Zijlstra wrote:
> On Tue, Jun 24, 2014 at 10:20:25AM +0200, Jiri Olsa wrote:
> > From: Jiri Olsa <jolsa@redhat.com>
> > 
> > The context check in perf_event_context_sched_out allows
> > non-cloned context to be part of the optimized schedule
> > out switch.
> > 
> > This could move non-cloned context into another workload
> > child. Once this child exits, the context is closed and
> > leaves all original (parent) events in closed state.
> > 
> > Any other new cloned event will have closed state and not
> > measure anything. And probably causing other odd bugs.
> > 
> > Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> > Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> > Cc: David Ahern <dsahern@gmail.com>
> > Cc: Frederic Weisbecker <fweisbec@gmail.com>
> > Cc: Ingo Molnar <mingo@kernel.org>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  kernel/events/core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > index d968008..4e3618e 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -2319,7 +2319,7 @@ static void perf_event_context_sched_out(struct task_struct *task, int ctxn,
> >  	next_parent = rcu_dereference(next_ctx->parent_ctx);
> >  
> >  	/* If neither context have a parent context; they cannot be clones. */
> > -	if (!parent && !next_parent)
> > +	if (!parent || !next_parent)
> >  		goto unlock;
> >  
> >  	if (next_parent == ctx || next_ctx == parent || next_parent == parent) {
> 
> Ohh, nice, good catch!

should I queue it with your ack?

jirka

  reply	other threads:[~2014-06-24 10:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24  8:20 [PATCH 1/3] perf: Make perf_event_init_context function static Jiri Olsa
2014-06-24  8:20 ` [PATCH 2/3] perf: Do not allow optimized switch for non-cloned events Jiri Olsa
2014-06-24 10:39   ` Peter Zijlstra
2014-06-24 10:53     ` Jiri Olsa [this message]
2014-06-24 12:46       ` Peter Zijlstra
2014-07-02  6:39   ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2014-06-24  8:20 ` [PATCH 3/3] perf tests: Add test to hit wrong event sched out Jiri Olsa
2014-07-05 10:46 ` [tip:perf/core] perf: Make perf_event_init_context() function static 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=20140624105301.GB7554@krava.redhat.com \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=dsahern@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.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