All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: prasad@linux.vnet.ibm.com
Cc: Paul Mackerras <paulus@samba.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>,
	"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Subject: Re: [Patch][perf] Invoke __perf_event_disable without an IPI
Date: Mon, 11 Jun 2012 13:13:33 +0200	[thread overview]
Message-ID: <1339413213.30462.11.camel@twins> (raw)
In-Reply-To: <20120611060242.GA2538@in.ibm.com>

On Mon, 2012-06-11 at 11:32 +0530, K.Prasad wrote:

> While debugging a warning message on PowerPC while using hardware
> breakpoints, it was discovered that when perf_event_disable is invoked
> through hw_breakpoint_handler function with interrupts disabled, a
> subsequent IPI in the code path would trigger a WARN_ON_ONCE message in
> smp_call_function_single function.
> 
> This patch avoids the use of an IPI to invoke __perf_event_disable when
> it is safe to do so i.e. when the process associated with the perf-event
> would run on the current CPU and interrupts are disabled on the system.
> Since interrupts are always disabled before hw_breakpoint_handler in
> PowerPC, the warning message will no longer be seen.
> 
> Reported-by: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
> Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com>
> ---
>  kernel/events/core.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index fd126f8..0e2c1eb 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -1302,6 +1302,7 @@ static int __perf_event_disable(void *info)
>   */
>  void perf_event_disable(struct perf_event *event)
>  {
> +	int ret;
>  	struct perf_event_context *ctx = event->ctx;
>  	struct task_struct *task = ctx->task;
>  
> @@ -1314,6 +1315,17 @@ void perf_event_disable(struct perf_event *event)
>  	}
>  
>  retry:
> +	/*
> +	 * perf_event_disable may be called when interrupts are disabled.
> +	 * For e.g. hw_breakpoint_handler exception in PowerPC. Hence using
> +	 * IPIs to invoke __perf_event_disable is not always suitable. When
> +	 * possible invoke __perf_event_disable directly.
> +	 */
> +	if ((task_cpu(task) == smp_processor_id()) && irqs_disabled()) {

Urgh.. 

So what's the callchain for the ppc->hw_bp->perf that triggers this?


> +		ret = __perf_event_disable(event);
> +		if (!ret)
> +			return;
> +	}
>  	if (!task_function_call(task, __perf_event_disable, event))
>  		return;
>  
> 


  reply	other threads:[~2012-06-11 11:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-11  6:02 K.Prasad
2012-06-11 11:13 ` Peter Zijlstra [this message]
2012-06-12  6:06   ` K.Prasad
2012-06-12  9:12     ` Peter Zijlstra
2012-07-06  9:52       ` [PATCH v2] Hardware breakpoints: Invoke __perf_event_disable() if interrupts are already disabled Naveen N. Rao
2012-07-06 10:18         ` Naveen N. Rao
2012-07-18 10:30           ` [PATCH v2 RESEND] " Naveen N. Rao
2012-07-18 11:57             ` Frederic Weisbecker
2012-07-19 11:16               ` Naveen N. Rao
2012-07-25 11:32                 ` Naveen N. Rao
2012-07-31 13:41                   ` Frederic Weisbecker
2012-08-02  8:16                     ` [PATCH v3] " Naveen N. Rao
2012-08-15 17:37                       ` Naveen N. Rao
2012-08-15 18:42                         ` Frederic Weisbecker
2012-08-16  8:16                           ` Peter Zijlstra
2012-08-29  2:45                             ` Naveen N. Rao
2012-09-04 18:53                       ` [tip:perf/urgent] perf/hwpb: " tip-bot for K.Prasad

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=1339413213.30462.11.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=emachado@linux.vnet.ibm.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=paulus@samba.org \
    --cc=prasad@linux.vnet.ibm.com \
    --subject='Re: [Patch][perf] Invoke __perf_event_disable without an IPI' \
    /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

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.