All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: lkp@lists.01.org
Subject: Re: [PATCHv3] perf powerpc: Don't call perf_event_disable from atomic context
Date: Wed, 26 Oct 2016 17:24:55 +0200	[thread overview]
Message-ID: <20161026152454.GA1186@krava> (raw)
In-Reply-To: <20161026151249.GC3117@twins.programming.kicks-ass.net>

[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]

On Wed, Oct 26, 2016 at 05:12:49PM +0200, Peter Zijlstra wrote:
> On Wed, Oct 26, 2016 at 11:48:24AM +0200, Jiri Olsa wrote:
> 
> > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > index c6e47e97b33f..04477983945e 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -1960,6 +1960,13 @@ void perf_event_disable(struct perf_event *event)
> >  }
> >  EXPORT_SYMBOL_GPL(perf_event_disable);
> >  
> > +void perf_event_disable_inatomic(struct perf_event *event, int kill)
> > +{
> > +	event->pending_kill    = kill;
> > +	event->pending_disable = 1;
> > +	irq_work_queue(&event->pending);
> > +}
> > +
> >  static void perf_set_shadow_time(struct perf_event *event,
> >  				 struct perf_event_context *ctx,
> >  				 u64 tstamp)
> > @@ -7074,9 +7081,7 @@ static int __perf_event_overflow(struct perf_event *event,
> >  	event->pending_kill = POLL_IN;
> >  	if (events && atomic_dec_and_test(&event->event_limit)) {
> >  		ret = 1;
> > -		event->pending_kill = POLL_HUP;
> > -		event->pending_disable = 1;
> > -		irq_work_queue(&event->pending);
> > +		perf_event_disable_inatomic(event, POLL_HUP);
> >  	}
> 
> So the pending_kill stuff is independent of the disable here. No need to
> combine the two. I've change the patch as per the below.
> 
> That is, pending_kill is part of pending_wakeup, not of pending_disable.
> Here we simply use both, its just that on disable we need a different
> kind of wakeup (HANGUP instead of IN).
> 
> See how after ->overflow_handler() we send a wakeup if there's a
> registered signal.

ok, seems good

thanks,
jirka

WARNING: multiple messages have this Message-ID (diff)
From: Jiri Olsa <jolsa@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Huang, Ying" <ying.huang@intel.com>,
	kernel test robot <xiaolong.ye@intel.com>,
	Michael Neuling <mikey@neuling.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	lkp@01.org, lkml <linux-kernel@vger.kernel.org>,
	Jan Stancek <jstancek@redhat.com>,
	Paul Mackerras <paulus@samba.org>, Jiri Olsa <jolsa@kernel.org>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCHv3] perf powerpc: Don't call perf_event_disable from atomic context
Date: Wed, 26 Oct 2016 17:24:55 +0200	[thread overview]
Message-ID: <20161026152454.GA1186@krava> (raw)
In-Reply-To: <20161026151249.GC3117@twins.programming.kicks-ass.net>

On Wed, Oct 26, 2016 at 05:12:49PM +0200, Peter Zijlstra wrote:
> On Wed, Oct 26, 2016 at 11:48:24AM +0200, Jiri Olsa wrote:
> 
> > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > index c6e47e97b33f..04477983945e 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -1960,6 +1960,13 @@ void perf_event_disable(struct perf_event *event)
> >  }
> >  EXPORT_SYMBOL_GPL(perf_event_disable);
> >  
> > +void perf_event_disable_inatomic(struct perf_event *event, int kill)
> > +{
> > +	event->pending_kill    = kill;
> > +	event->pending_disable = 1;
> > +	irq_work_queue(&event->pending);
> > +}
> > +
> >  static void perf_set_shadow_time(struct perf_event *event,
> >  				 struct perf_event_context *ctx,
> >  				 u64 tstamp)
> > @@ -7074,9 +7081,7 @@ static int __perf_event_overflow(struct perf_event *event,
> >  	event->pending_kill = POLL_IN;
> >  	if (events && atomic_dec_and_test(&event->event_limit)) {
> >  		ret = 1;
> > -		event->pending_kill = POLL_HUP;
> > -		event->pending_disable = 1;
> > -		irq_work_queue(&event->pending);
> > +		perf_event_disable_inatomic(event, POLL_HUP);
> >  	}
> 
> So the pending_kill stuff is independent of the disable here. No need to
> combine the two. I've change the patch as per the below.
> 
> That is, pending_kill is part of pending_wakeup, not of pending_disable.
> Here we simply use both, its just that on disable we need a different
> kind of wakeup (HANGUP instead of IN).
> 
> See how after ->overflow_handler() we send a wakeup if there's a
> registered signal.

ok, seems good

thanks,
jirka

  reply	other threads:[~2016-10-26 15:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 13:55 [PATCH] perf powerpc: Don't call perf_event_disable from atomic context Jiri Olsa
2016-09-23 16:37 ` Peter Zijlstra
2016-10-03 13:29   ` Jiri Olsa
2016-10-03 13:47     ` Peter Zijlstra
2016-10-04  4:29       ` Michael Ellerman
2016-10-04  7:06         ` Peter Zijlstra
2016-10-10 13:19           ` Will Deacon
2016-10-05  8:09         ` Jiri Olsa
2016-10-05 19:53           ` Jiri Olsa
2016-10-06  7:24             ` Peter Zijlstra
2016-10-06 12:33               ` [PATCHv2] " Jiri Olsa
2016-10-24 12:26                 ` Peter Zijlstra
2016-10-24 15:49                   ` Jiri Olsa
2016-10-25  6:40                 ` [perf powerpc] 18d1796d0b: [No primary change] kernel test robot
2016-10-25  6:40                   ` [lkp] " kernel test robot
2016-10-25  9:06                   ` Peter Zijlstra
2016-10-25  9:06                     ` [lkp] " Peter Zijlstra
2016-10-26  2:09                     ` Huang, Ying
2016-10-26  2:09                       ` [LKP] [lkp] " Huang, Ying
2016-10-26  9:48                       ` [PATCHv3] perf powerpc: Don't call perf_event_disable from atomic context Jiri Olsa
2016-10-26  9:48                         ` Jiri Olsa
2016-10-26 15:12                         ` Peter Zijlstra
2016-10-26 15:12                           ` Peter Zijlstra
2016-10-26 15:24                           ` Jiri Olsa [this message]
2016-10-26 15:24                             ` Jiri Olsa
2016-10-28 10:10                         ` [tip:perf/urgent] perf/powerpc: Don't call perf_event_disable() " tip-bot for Jiri Olsa
2016-10-04  4:08 ` [PATCH] perf powerpc: Don't call perf_event_disable " Michael Ellerman
2016-10-05  8:08   ` Jiri Olsa
2016-10-05  8:21   ` Jan Stancek

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=20161026152454.GA1186@krava \
    --to=jolsa@redhat.com \
    --cc=lkp@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.