Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-20 Thread Kamalesh Babulal
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 <[EMAIL PROTECTED]>
>
> ---
>
> 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.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-20 Thread Kamalesh Babulal
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 [EMAIL PROTECTED]

 ---

 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.

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-19 Thread Randy Dunlap
On Wed, 19 Sep 2007 19:15:00 +0530 (IST) Satyam Sharma wrote:

> 
> In fact, it turns out OSDL's cross-compiler toolchains were built with
> crosstool itself. Should also add that those OSDL compilers are too old
> (gcc version 3.4.x-3.5.x mostly -- my build was totally spammed with those
> "+m" in asm constraints related warnings), so I'll try and build a few
> more recent ones (at least for the more popular platforms) over the
> weekend too.

Hi,
Please let us know if/when you have newer cross-compiler tarballs
available.

Thanks.
---
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-19 Thread Satyam Sharma


> On Mon, 17 Sep 2007 18:37:49 -0700
> Randy Dunlap <[EMAIL PROTECTED]> wrote:
> 
> > On Tue, 18 Sep 2007 05:13:40 +0530 (IST) Satyam Sharma wrote:
> > 
> > > Untested (not even compile-tested) patch.
> > > Could someone point me to ppc32/64 cross-compilers for i386?
> > 
> > OSDL had some, but those are gone now.
> > I downloaded all of them and still use them, although it would
> > be good to have some more recent versions of them.
> > 
> > I put the power* compiler tarballs here:
> > 
> > http://userweb.kernel.org/~rdunlap/cross-compilers/

Thanks -- BTW I made some simple changes to the tree structure in there
and added a few distcc [*] related scriptlets. The resulting tar ball:

http://www.cse.iitk.ac.in/users/ssatyam/powerpc64-unknown-linux-gnu.tar.bz2

can be made to work with Andrew's nice "xb" script with the following
trivial patch:


--- cross-compilers/read-me.txt~powerpc64   2007-09-19 14:39:01.0 
+0530
+++ cross-compilers/read-me.txt 2007-09-19 14:44:29.0 +0530
@@ -3,7 +3,7 @@ i386 cross-compilation binaries for seve
 on RH FC5 and RH FC6 i386 and x86_64.
 
 - untar the tarball in /
-- setenv ARCH sparc64 (or alpha, arm, i386, ia64, m68k, mips, s390, sparc)
+- setenv ARCH sparc64 (or alpha, arm, i386, ia64, m68k, mips, powerpc64, s390, 
sh4, sparc, x86_64)
 - xb mrproper
 - xb allmodconfig
 - xb
--- cross-compilers/xb~powerpc642007-09-19 14:40:09.0 +0530
+++ cross-compilers/xb  2007-09-19 14:52:46.0 +0530
@@ -31,6 +31,7 @@ I=vmlinux
 [ $ARCH = m68k ] &&CT=gcc-4.1.0-glibc-2.3.6
 [ $ARCH = mips ] &&CT=gcc-3.4.5-glibc-2.3.6
 [ $ARCH = powerpc ] && CT=gcc-4.1.0-glibc-2.3.6 && XARCH=powerpc-405-linux-gnu
+[ $ARCH = powerpc64 ] &&   CT=gcc-3.4.0-glibc-2.3.2 && export ARCH=powerpc
 [ $ARCH = s390 ] &&CT=gcc-4.1.0-glibc-2.3.6
 [ $ARCH = sh ] &&  CT=gcc-3.4.5-glibc-2.3.6 && XARCH=sh4-unknown-linux-gnu
 [ $ARCH = sparc ] &&   CT=gcc-4.1.0-glibc-2.3.6


On Mon, 17 Sep 2007, Josh Boyer wrote:
> 
> Crosstool is widely used.  It'll build several combinations of
> gcc/binutils/glibc for you.  
> 
> http://www.kegel.com/crosstool/

In fact, it turns out OSDL's cross-compiler toolchains were built with
crosstool itself. Should also add that those OSDL compilers are too old
(gcc version 3.4.x-3.5.x mostly -- my build was totally spammed with those
"+m" in asm constraints related warnings), so I'll try and build a few
more recent ones (at least for the more popular platforms) over the
weekend too.


Satyam


[*] But I'm a bit skeptical if the distcc stuff in "xb" works as intended.
Has anybody used that successfully? Will test it over the weekend ...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-19 Thread Satyam Sharma


 On Mon, 17 Sep 2007 18:37:49 -0700
 Randy Dunlap [EMAIL PROTECTED] wrote:
 
  On Tue, 18 Sep 2007 05:13:40 +0530 (IST) Satyam Sharma wrote:
  
   Untested (not even compile-tested) patch.
   Could someone point me to ppc32/64 cross-compilers for i386?
  
  OSDL had some, but those are gone now.
  I downloaded all of them and still use them, although it would
  be good to have some more recent versions of them.
  
  I put the power* compiler tarballs here:
  
  http://userweb.kernel.org/~rdunlap/cross-compilers/

Thanks -- BTW I made some simple changes to the tree structure in there
and added a few distcc [*] related scriptlets. The resulting tar ball:

http://www.cse.iitk.ac.in/users/ssatyam/powerpc64-unknown-linux-gnu.tar.bz2

can be made to work with Andrew's nice xb script with the following
trivial patch:


--- cross-compilers/read-me.txt~powerpc64   2007-09-19 14:39:01.0 
+0530
+++ cross-compilers/read-me.txt 2007-09-19 14:44:29.0 +0530
@@ -3,7 +3,7 @@ i386 cross-compilation binaries for seve
 on RH FC5 and RH FC6 i386 and x86_64.
 
 - untar the tarball in /
-- setenv ARCH sparc64 (or alpha, arm, i386, ia64, m68k, mips, s390, sparc)
+- setenv ARCH sparc64 (or alpha, arm, i386, ia64, m68k, mips, powerpc64, s390, 
sh4, sparc, x86_64)
 - xb mrproper
 - xb allmodconfig
 - xb
--- cross-compilers/xb~powerpc642007-09-19 14:40:09.0 +0530
+++ cross-compilers/xb  2007-09-19 14:52:46.0 +0530
@@ -31,6 +31,7 @@ I=vmlinux
 [ $ARCH = m68k ] CT=gcc-4.1.0-glibc-2.3.6
 [ $ARCH = mips ] CT=gcc-3.4.5-glibc-2.3.6
 [ $ARCH = powerpc ]  CT=gcc-4.1.0-glibc-2.3.6  XARCH=powerpc-405-linux-gnu
+[ $ARCH = powerpc64 ]CT=gcc-3.4.0-glibc-2.3.2  export ARCH=powerpc
 [ $ARCH = s390 ] CT=gcc-4.1.0-glibc-2.3.6
 [ $ARCH = sh ]   CT=gcc-3.4.5-glibc-2.3.6  XARCH=sh4-unknown-linux-gnu
 [ $ARCH = sparc ]CT=gcc-4.1.0-glibc-2.3.6


On Mon, 17 Sep 2007, Josh Boyer wrote:
 
 Crosstool is widely used.  It'll build several combinations of
 gcc/binutils/glibc for you.  
 
 http://www.kegel.com/crosstool/

In fact, it turns out OSDL's cross-compiler toolchains were built with
crosstool itself. Should also add that those OSDL compilers are too old
(gcc version 3.4.x-3.5.x mostly -- my build was totally spammed with those
+m in asm constraints related warnings), so I'll try and build a few
more recent ones (at least for the more popular platforms) over the
weekend too.


Satyam


[*] But I'm a bit skeptical if the distcc stuff in xb works as intended.
Has anybody used that successfully? Will test it over the weekend ...
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-19 Thread Randy Dunlap
On Wed, 19 Sep 2007 19:15:00 +0530 (IST) Satyam Sharma wrote:

 
 In fact, it turns out OSDL's cross-compiler toolchains were built with
 crosstool itself. Should also add that those OSDL compilers are too old
 (gcc version 3.4.x-3.5.x mostly -- my build was totally spammed with those
 +m in asm constraints related warnings), so I'll try and build a few
 more recent ones (at least for the more popular platforms) over the
 weekend too.

Hi,
Please let us know if/when you have newer cross-compiler tarballs
available.

Thanks.
---
~Randy
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-17 Thread Josh Boyer
On Mon, 17 Sep 2007 18:37:49 -0700
Randy Dunlap <[EMAIL PROTECTED]> wrote:

> On Tue, 18 Sep 2007 05:13:40 +0530 (IST) Satyam Sharma wrote:
> 
> > Untested (not even compile-tested) patch.
> > Could someone point me to ppc32/64 cross-compilers for i386?
> 
> OSDL had some, but those are gone now.
> I downloaded all of them and still use them, although it would
> be good to have some more recent versions of them.
> 
> I put the power* compiler tarballs here:
> 
> http://userweb.kernel.org/~rdunlap/cross-compilers/

Crosstool is widely used.  It'll build several combinations of
gcc/binutils/glibc for you.  

http://www.kegel.com/crosstool/

There's also the ELDK from Denx:  

http://www.denx.de/en/view/Software/WebHome#Embedded_Linux_Development_Kit

josh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-17 Thread Randy Dunlap
On Tue, 18 Sep 2007 05:13:40 +0530 (IST) Satyam Sharma wrote:

> Untested (not even compile-tested) patch.
> Could someone point me to ppc32/64 cross-compilers for i386?

OSDL had some, but those are gone now.
I downloaded all of them and still use them, although it would
be good to have some more recent versions of them.

I put the power* compiler tarballs here:

http://userweb.kernel.org/~rdunlap/cross-compilers/

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-17 Thread Satyam Sharma


On Tue, 18 Sep 2007, 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.

BTW arch/ppc/ has same issue, but that's gonna be removed by next year
anyways, so I think there's no point making a patch for that (?)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-17 Thread Satyam Sharma

> [ 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 <[EMAIL PROTECTED]>

---

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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-17 Thread Satyam Sharma

 [ 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 [EMAIL PROTECTED]

---

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);
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-17 Thread Satyam Sharma


On Tue, 18 Sep 2007, 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.

BTW arch/ppc/ has same issue, but that's gonna be removed by next year
anyways, so I think there's no point making a patch for that (?)
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-17 Thread Randy Dunlap
On Tue, 18 Sep 2007 05:13:40 +0530 (IST) Satyam Sharma wrote:

 Untested (not even compile-tested) patch.
 Could someone point me to ppc32/64 cross-compilers for i386?

OSDL had some, but those are gone now.
I downloaded all of them and still use them, although it would
be good to have some more recent versions of them.

I put the power* compiler tarballs here:

http://userweb.kernel.org/~rdunlap/cross-compilers/

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

2007-09-17 Thread Josh Boyer
On Mon, 17 Sep 2007 18:37:49 -0700
Randy Dunlap [EMAIL PROTECTED] wrote:

 On Tue, 18 Sep 2007 05:13:40 +0530 (IST) Satyam Sharma wrote:
 
  Untested (not even compile-tested) patch.
  Could someone point me to ppc32/64 cross-compilers for i386?
 
 OSDL had some, but those are gone now.
 I downloaded all of them and still use them, although it would
 be good to have some more recent versions of them.
 
 I put the power* compiler tarballs here:
 
 http://userweb.kernel.org/~rdunlap/cross-compilers/

Crosstool is widely used.  It'll build several combinations of
gcc/binutils/glibc for you.  

http://www.kegel.com/crosstool/

There's also the ELDK from Denx:  

http://www.denx.de/en/view/Software/WebHome#Embedded_Linux_Development_Kit

josh
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/