From: Li Zefan <lizf@cn.fujitsu.com>
To: Anton Blanchard <anton@samba.org>, subrata@linux.vnet.ibm.com
Cc: ltp-list@lists.sourceforge.net,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [LTP] [PATCH] powerpc: Fix hcall tracepoint recursion
Date: Fri, 22 Oct 2010 15:22:32 +0800 [thread overview]
Message-ID: <4CC13BB8.7090003@cn.fujitsu.com> (raw)
In-Reply-To: <20101021215212.4a982c85@kryten>
Anton Blanchard wrote:
> Hi,
>
>> This is a dead loop:
>>
>> trace_hcall_entry() -> trace_clock_global() -> trace_hcall_entry() ..
>>
>> And this is a PPC specific bug. Hope some ppc guys will fix it?
>> Or we kill trace_clock_global() if no one actually uses it..
>
> Nasty! How does the patch below look? I had to disable irqs otherwise
> we would sometimes drop valid events (if we take an interrupt anywhere
> in the region where depth is elevated, then the entire interrupt will
> be blocked from calling hcall tracepoints.
>
Thanks!
Subrata, could you test the patch below?
> Anton
> --
>
> Subject: [PATCH] powerpc: Fix hcall tracepoint recursion
>
> Spinlocks on shared processor partitions use H_YIELD to notify the
> hypervisor we are waiting on another virtual CPU. Unfortunately this means
> the hcall tracepoints can recurse.
>
> The patch below adds a percpu depth and checks it on both the entry and
> exit hcall tracepoints.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>
> Index: powerpc.git/arch/powerpc/platforms/pseries/lpar.c
> ===================================================================
> --- powerpc.git.orig/arch/powerpc/platforms/pseries/lpar.c 2010-10-21 17:32:00.980003644 +1100
> +++ powerpc.git/arch/powerpc/platforms/pseries/lpar.c 2010-10-21 17:34:54.942681273 +1100
> @@ -701,6 +701,13 @@ EXPORT_SYMBOL(arch_free_page);
> /* NB: reg/unreg are called while guarded with the tracepoints_mutex */
> extern long hcall_tracepoint_refcount;
>
> +/*
> + * Since the tracing code might execute hcalls we need to guard against
> + * recursion. One example of this are spinlocks calling H_YIELD on
> + * shared processor partitions.
> + */
> +static DEFINE_PER_CPU(unsigned int, hcall_trace_depth);
> +
> void hcall_tracepoint_regfunc(void)
> {
> hcall_tracepoint_refcount++;
> @@ -713,12 +720,42 @@ void hcall_tracepoint_unregfunc(void)
>
> void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
> {
> + unsigned long flags;
> + unsigned int *depth;
> +
> + local_irq_save(flags);
> +
> + depth = &__get_cpu_var(hcall_trace_depth);
> +
> + if (*depth)
> + goto out;
> +
> + (*depth)++;
> trace_hcall_entry(opcode, args);
> + (*depth)--;
> +
> +out:
> + local_irq_restore(flags);
> }
>
> void __trace_hcall_exit(long opcode, unsigned long retval,
> unsigned long *retbuf)
> {
> + unsigned long flags;
> + unsigned int *depth;
> +
> + local_irq_save(flags);
> +
> + depth = &__get_cpu_var(hcall_trace_depth);
> +
> + if (*depth)
> + goto out;
> +
> + (*depth)++;
> trace_hcall_exit(opcode, retval, retbuf);
> + (*depth)--;
> +
> +out:
> + local_irq_restore(flags);
> }
> #endif
>
>
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
WARNING: multiple messages have this Message-ID (diff)
From: Li Zefan <lizf@cn.fujitsu.com>
To: Anton Blanchard <anton@samba.org>, subrata@linux.vnet.ibm.com
Cc: ltp-list@lists.sourceforge.net,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc: Fix hcall tracepoint recursion
Date: Fri, 22 Oct 2010 15:22:32 +0800 [thread overview]
Message-ID: <4CC13BB8.7090003@cn.fujitsu.com> (raw)
In-Reply-To: <20101021215212.4a982c85@kryten>
Anton Blanchard wrote:
> Hi,
>
>> This is a dead loop:
>>
>> trace_hcall_entry() -> trace_clock_global() -> trace_hcall_entry() ..
>>
>> And this is a PPC specific bug. Hope some ppc guys will fix it?
>> Or we kill trace_clock_global() if no one actually uses it..
>
> Nasty! How does the patch below look? I had to disable irqs otherwise
> we would sometimes drop valid events (if we take an interrupt anywhere
> in the region where depth is elevated, then the entire interrupt will
> be blocked from calling hcall tracepoints.
>
Thanks!
Subrata, could you test the patch below?
> Anton
> --
>
> Subject: [PATCH] powerpc: Fix hcall tracepoint recursion
>
> Spinlocks on shared processor partitions use H_YIELD to notify the
> hypervisor we are waiting on another virtual CPU. Unfortunately this means
> the hcall tracepoints can recurse.
>
> The patch below adds a percpu depth and checks it on both the entry and
> exit hcall tracepoints.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>
> Index: powerpc.git/arch/powerpc/platforms/pseries/lpar.c
> ===================================================================
> --- powerpc.git.orig/arch/powerpc/platforms/pseries/lpar.c 2010-10-21 17:32:00.980003644 +1100
> +++ powerpc.git/arch/powerpc/platforms/pseries/lpar.c 2010-10-21 17:34:54.942681273 +1100
> @@ -701,6 +701,13 @@ EXPORT_SYMBOL(arch_free_page);
> /* NB: reg/unreg are called while guarded with the tracepoints_mutex */
> extern long hcall_tracepoint_refcount;
>
> +/*
> + * Since the tracing code might execute hcalls we need to guard against
> + * recursion. One example of this are spinlocks calling H_YIELD on
> + * shared processor partitions.
> + */
> +static DEFINE_PER_CPU(unsigned int, hcall_trace_depth);
> +
> void hcall_tracepoint_regfunc(void)
> {
> hcall_tracepoint_refcount++;
> @@ -713,12 +720,42 @@ void hcall_tracepoint_unregfunc(void)
>
> void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
> {
> + unsigned long flags;
> + unsigned int *depth;
> +
> + local_irq_save(flags);
> +
> + depth = &__get_cpu_var(hcall_trace_depth);
> +
> + if (*depth)
> + goto out;
> +
> + (*depth)++;
> trace_hcall_entry(opcode, args);
> + (*depth)--;
> +
> +out:
> + local_irq_restore(flags);
> }
>
> void __trace_hcall_exit(long opcode, unsigned long retval,
> unsigned long *retbuf)
> {
> + unsigned long flags;
> + unsigned int *depth;
> +
> + local_irq_save(flags);
> +
> + depth = &__get_cpu_var(hcall_trace_depth);
> +
> + if (*depth)
> + goto out;
> +
> + (*depth)++;
> trace_hcall_exit(opcode, retval, retbuf);
> + (*depth)--;
> +
> +out:
> + local_irq_restore(flags);
> }
> #endif
>
>
WARNING: multiple messages have this Message-ID (diff)
From: Li Zefan <lizf@cn.fujitsu.com>
To: Anton Blanchard <anton@samba.org>, subrata@linux.vnet.ibm.com
Cc: ltp-list@lists.sourceforge.net,
Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Paul Mackerras <paulus@samba.org>,
LKML <linux-kernel@vger.kernel.org>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc: Fix hcall tracepoint recursion
Date: Fri, 22 Oct 2010 15:22:32 +0800 [thread overview]
Message-ID: <4CC13BB8.7090003@cn.fujitsu.com> (raw)
In-Reply-To: <20101021215212.4a982c85@kryten>
Anton Blanchard wrote:
> Hi,
>
>> This is a dead loop:
>>
>> trace_hcall_entry() -> trace_clock_global() -> trace_hcall_entry() ..
>>
>> And this is a PPC specific bug. Hope some ppc guys will fix it?
>> Or we kill trace_clock_global() if no one actually uses it..
>
> Nasty! How does the patch below look? I had to disable irqs otherwise
> we would sometimes drop valid events (if we take an interrupt anywhere
> in the region where depth is elevated, then the entire interrupt will
> be blocked from calling hcall tracepoints.
>
Thanks!
Subrata, could you test the patch below?
> Anton
> --
>
> Subject: [PATCH] powerpc: Fix hcall tracepoint recursion
>
> Spinlocks on shared processor partitions use H_YIELD to notify the
> hypervisor we are waiting on another virtual CPU. Unfortunately this means
> the hcall tracepoints can recurse.
>
> The patch below adds a percpu depth and checks it on both the entry and
> exit hcall tracepoints.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>
> Index: powerpc.git/arch/powerpc/platforms/pseries/lpar.c
> ===================================================================
> --- powerpc.git.orig/arch/powerpc/platforms/pseries/lpar.c 2010-10-21 17:32:00.980003644 +1100
> +++ powerpc.git/arch/powerpc/platforms/pseries/lpar.c 2010-10-21 17:34:54.942681273 +1100
> @@ -701,6 +701,13 @@ EXPORT_SYMBOL(arch_free_page);
> /* NB: reg/unreg are called while guarded with the tracepoints_mutex */
> extern long hcall_tracepoint_refcount;
>
> +/*
> + * Since the tracing code might execute hcalls we need to guard against
> + * recursion. One example of this are spinlocks calling H_YIELD on
> + * shared processor partitions.
> + */
> +static DEFINE_PER_CPU(unsigned int, hcall_trace_depth);
> +
> void hcall_tracepoint_regfunc(void)
> {
> hcall_tracepoint_refcount++;
> @@ -713,12 +720,42 @@ void hcall_tracepoint_unregfunc(void)
>
> void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
> {
> + unsigned long flags;
> + unsigned int *depth;
> +
> + local_irq_save(flags);
> +
> + depth = &__get_cpu_var(hcall_trace_depth);
> +
> + if (*depth)
> + goto out;
> +
> + (*depth)++;
> trace_hcall_entry(opcode, args);
> + (*depth)--;
> +
> +out:
> + local_irq_restore(flags);
> }
>
> void __trace_hcall_exit(long opcode, unsigned long retval,
> unsigned long *retbuf)
> {
> + unsigned long flags;
> + unsigned int *depth;
> +
> + local_irq_save(flags);
> +
> + depth = &__get_cpu_var(hcall_trace_depth);
> +
> + if (*depth)
> + goto out;
> +
> + (*depth)++;
> trace_hcall_exit(opcode, retval, retbuf);
> + (*depth)--;
> +
> +out:
> + local_irq_restore(flags);
> }
> #endif
>
>
next prev parent reply other threads:[~2010-10-22 7:21 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-07 2:50 [LTP] [PATCH v2] Add ftrace-stress-test to LTP Li Zefan
2010-09-28 16:05 ` Subrata Modak
2010-10-04 7:13 ` Subrata Modak
2010-10-13 7:21 ` Subrata Modak
2010-10-13 7:29 ` Li Zefan
2010-10-13 7:35 ` Li Zefan
2010-10-13 11:29 ` Li Zefan
2010-10-13 18:37 ` Subrata Modak
2010-10-13 19:01 ` Subrata Modak
2010-10-18 3:19 ` [LTP] BUG: dead loop in PowerPC hcall tracepoint (Was: [PATCH v2] Add ftrace-stress-test to LTP) Li Zefan
2010-10-18 3:19 ` BUG: dead loop in PowerPC hcall tracepoint (Was: [LTP] " Li Zefan
2010-10-18 3:19 ` Li Zefan
2010-10-18 10:05 ` [LTP] BUG: dead loop in PowerPC hcall tracepoint (Was: " Benjamin Herrenschmidt
2010-10-18 10:05 ` BUG: dead loop in PowerPC hcall tracepoint (Was: [LTP] " Benjamin Herrenschmidt
2010-10-18 10:05 ` Benjamin Herrenschmidt
2010-10-18 14:25 ` [LTP] BUG: dead loop in PowerPC hcall tracepoint (Was: " Steven Rostedt
2010-10-18 14:25 ` BUG: dead loop in PowerPC hcall tracepoint (Was: [LTP] " Steven Rostedt
2010-10-18 14:25 ` Steven Rostedt
2010-10-19 0:49 ` [LTP] BUG: dead loop in PowerPC hcall tracepoint (Was: " Li Zefan
2010-10-19 0:49 ` BUG: dead loop in PowerPC hcall tracepoint (Was: [LTP] " Li Zefan
2010-10-19 0:49 ` Li Zefan
2010-10-21 10:52 ` [LTP] [PATCH] powerpc: Fix hcall tracepoint recursion Anton Blanchard
2010-10-21 10:52 ` Anton Blanchard
2010-10-21 10:52 ` Anton Blanchard
2010-10-22 7:22 ` Li Zefan [this message]
2010-10-22 7:22 ` Li Zefan
2010-10-22 7:22 ` Li Zefan
2010-10-22 7:25 ` [LTP] " Subrata Modak
2010-10-22 7:25 ` Subrata Modak
2010-10-22 7:25 ` Subrata Modak
[not found] ` <20101101201256.66dc6dd7@kryten>
2010-11-02 18:46 ` [LTP] " Subrata Modak
2010-11-11 7:57 ` Subrata Modak
2010-11-11 7:57 ` Subrata Modak
2010-11-11 7:57 ` Subrata Modak
2010-10-22 14:14 ` [LTP] " Steven Rostedt
2010-10-22 14:14 ` Steven Rostedt
2010-10-22 14:14 ` Steven Rostedt
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=4CC13BB8.7090003@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=anton@samba.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ltp-list@lists.sourceforge.net \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=subrata@linux.vnet.ibm.com \
/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.