From: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
To: Satyam Sharma <satyam@infradead.org>
Cc: linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath
Date: Thu, 20 Sep 2007 13:55:04 +0530 [thread overview]
Message-ID: <46F22E60.2090403@linux.vnet.ibm.com> (raw)
In-Reply-To: <alpine.LFD.0.999.0709180511070.8863@enigma.security.iitk.ac.in>
Satyam Sharma wrote:
>> ------------[ cut here ]------------
>> Badness at arch/powerpc/kernel/smp.c:202
>>
>
> comes when smp_call_function_map() has been called with irqs disabled,
> which is illegal. However, there is a special case, the panic() codepath,
> when we do not want to warn about this -- warning at that time is pointless
> anyway, and only serves to scroll away the *real* cause of the panic and
> distracts from the real bug.
>
> * So let's extract the WARN_ON() from smp_call_function_map() into all its
> callers -- smp_call_function() and smp_call_function_single()
>
> * Also, introduce another caller of smp_call_function_map(), namely
> __smp_call_function() (and make smp_call_function() a wrapper over this)
> which does *not* warn about disabled irqs
>
> * Use this __smp_call_function() from the panic codepath's smp_send_stop()
>
> We also end having to move code of smp_send_stop() below the definition
> of __smp_call_function().
>
> Signed-off-by: Satyam Sharma <satyam@infradead.org>
>
> ---
>
> Untested (not even compile-tested) patch.
> Could someone point me to ppc32/64 cross-compilers for i386?
>
> arch/powerpc/kernel/smp.c | 27 ++++++++++++++++++---------
> 1 files changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index 1ea4316..b24dcba 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -152,11 +152,6 @@ static void stop_this_cpu(void *dummy)
> ;
> }
>
> -void smp_send_stop(void)
> -{
> - smp_call_function(stop_this_cpu, NULL, 1, 0);
> -}
> -
> /*
> * Structure and data for smp_call_function(). This is designed to minimise
> * static memory requirements. It also looks cleaner.
> @@ -198,9 +193,6 @@ int smp_call_function_map(void (*func) (void *info), void *info, int nonatomic,
> int cpu;
> u64 timeout;
>
> - /* Can deadlock when called with interrupts disabled */
> - WARN_ON(irqs_disabled());
> -
> if (unlikely(smp_ops == NULL))
> return ret;
>
> @@ -270,10 +262,19 @@ int smp_call_function_map(void (*func) (void *info), void *info, int nonatomic,
> return ret;
> }
>
> +static int __smp_call_function(void (*func)(void *info), void *info,
> + int nonatomic, int wait)
> +{
> + return smp_call_function_map(func,info,nonatomic,wait,cpu_online_map);
> +}
> +
> int smp_call_function(void (*func) (void *info), void *info, int nonatomic,
> int wait)
> {
> - return smp_call_function_map(func,info,nonatomic,wait,cpu_online_map);
> + /* Can deadlock when called with interrupts disabled */
> + WARN_ON(irqs_disabled());
> +
> + return __smp_call_function(func, info, nonatomic, wait);
> }
> EXPORT_SYMBOL(smp_call_function);
>
> @@ -283,6 +284,9 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info, int
> cpumask_t map = CPU_MASK_NONE;
> int ret = 0;
>
> + /* Can deadlock when called with interrupts disabled */
> + WARN_ON(irqs_disabled());
> +
> if (!cpu_online(cpu))
> return -EINVAL;
>
> @@ -299,6 +303,11 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info, int
> }
> EXPORT_SYMBOL(smp_call_function_single);
>
> +void smp_send_stop(void)
> +{
> + __smp_call_function(stop_this_cpu, NULL, 1, 0);
> +}
> +
> void smp_call_function_interrupt(void)
> {
> void (*func) (void *info);
>
Hi,
This patch solves the badness oops we get on the powerpc.
--
Thanks & Regards,
Kamalesh Babulal,
Linux Technology Center,
IBM, ISTL.
WARNING: multiple messages have this Message-ID (diff)
From: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
To: Satyam Sharma <satyam@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>,
linuxppc-dev@ozlabs.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath
Date: Thu, 20 Sep 2007 13:55:04 +0530 [thread overview]
Message-ID: <46F22E60.2090403@linux.vnet.ibm.com> (raw)
In-Reply-To: <alpine.LFD.0.999.0709180511070.8863@enigma.security.iitk.ac.in>
Satyam Sharma wrote:
>> ------------[ cut here ]------------
>> Badness at arch/powerpc/kernel/smp.c:202
>>
>
> comes when smp_call_function_map() has been called with irqs disabled,
> which is illegal. However, there is a special case, the panic() codepath,
> when we do not want to warn about this -- warning at that time is pointless
> anyway, and only serves to scroll away the *real* cause of the panic and
> distracts from the real bug.
>
> * So let's extract the WARN_ON() from smp_call_function_map() into all its
> callers -- smp_call_function() and smp_call_function_single()
>
> * Also, introduce another caller of smp_call_function_map(), namely
> __smp_call_function() (and make smp_call_function() a wrapper over this)
> which does *not* warn about disabled irqs
>
> * Use this __smp_call_function() from the panic codepath's smp_send_stop()
>
> We also end having to move code of smp_send_stop() below the definition
> of __smp_call_function().
>
> Signed-off-by: Satyam Sharma <satyam@infradead.org>
>
> ---
>
> Untested (not even compile-tested) patch.
> Could someone point me to ppc32/64 cross-compilers for i386?
>
> arch/powerpc/kernel/smp.c | 27 ++++++++++++++++++---------
> 1 files changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index 1ea4316..b24dcba 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -152,11 +152,6 @@ static void stop_this_cpu(void *dummy)
> ;
> }
>
> -void smp_send_stop(void)
> -{
> - smp_call_function(stop_this_cpu, NULL, 1, 0);
> -}
> -
> /*
> * Structure and data for smp_call_function(). This is designed to minimise
> * static memory requirements. It also looks cleaner.
> @@ -198,9 +193,6 @@ int smp_call_function_map(void (*func) (void *info), void *info, int nonatomic,
> int cpu;
> u64 timeout;
>
> - /* Can deadlock when called with interrupts disabled */
> - WARN_ON(irqs_disabled());
> -
> if (unlikely(smp_ops == NULL))
> return ret;
>
> @@ -270,10 +262,19 @@ int smp_call_function_map(void (*func) (void *info), void *info, int nonatomic,
> return ret;
> }
>
> +static int __smp_call_function(void (*func)(void *info), void *info,
> + int nonatomic, int wait)
> +{
> + return smp_call_function_map(func,info,nonatomic,wait,cpu_online_map);
> +}
> +
> int smp_call_function(void (*func) (void *info), void *info, int nonatomic,
> int wait)
> {
> - return smp_call_function_map(func,info,nonatomic,wait,cpu_online_map);
> + /* Can deadlock when called with interrupts disabled */
> + WARN_ON(irqs_disabled());
> +
> + return __smp_call_function(func, info, nonatomic, wait);
> }
> EXPORT_SYMBOL(smp_call_function);
>
> @@ -283,6 +284,9 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info, int
> cpumask_t map = CPU_MASK_NONE;
> int ret = 0;
>
> + /* Can deadlock when called with interrupts disabled */
> + WARN_ON(irqs_disabled());
> +
> if (!cpu_online(cpu))
> return -EINVAL;
>
> @@ -299,6 +303,11 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info, int
> }
> EXPORT_SYMBOL(smp_call_function_single);
>
> +void smp_send_stop(void)
> +{
> + __smp_call_function(stop_this_cpu, NULL, 1, 0);
> +}
> +
> void smp_call_function_interrupt(void)
> {
> void (*func) (void *info);
>
Hi,
This patch solves the badness oops we get on the powerpc.
--
Thanks & Regards,
Kamalesh Babulal,
Linux Technology Center,
IBM, ISTL.
next prev parent reply other threads:[~2007-09-20 8:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-14 10:05 [BUG][2.6.23-rc6] Badness at arch/powerpc/kernel/smp.c:202 Kamalesh Babulal
2007-09-14 10:37 ` Satyam Sharma
2007-09-14 10:37 ` Satyam Sharma
2007-09-14 11:03 ` Andy Whitcroft
2007-09-14 11:03 ` Andy Whitcroft
2007-09-17 23:43 ` [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath Satyam Sharma
2007-09-17 23:43 ` Satyam Sharma
2007-09-18 0:08 ` Satyam Sharma
2007-09-18 0:08 ` Satyam Sharma
2007-09-18 1:37 ` Randy Dunlap
2007-09-18 1:37 ` Randy Dunlap
2007-09-18 1:46 ` Josh Boyer
2007-09-18 1:46 ` Josh Boyer
2007-09-19 13:45 ` Satyam Sharma
2007-09-19 13:45 ` Satyam Sharma
2007-09-19 15:29 ` Randy Dunlap
2007-09-19 15:29 ` Randy Dunlap
2007-09-20 8:25 ` Kamalesh Babulal [this message]
2007-09-20 8:25 ` Kamalesh Babulal
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=46F22E60.2090403@linux.vnet.ibm.com \
--to=kamalesh@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
--cc=satyam@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 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.