Patchwork powerpc: enforce a non-spe kernel build even on broken compilers

login
register
mail settings
Submitter Sebastian Siewior
Date Oct. 15, 2008, 2:43 p.m.
Message ID <20081015144359.GA30649@Chamillionaire.breakpoint.cc>
Download mbox | patch
Permalink /patch/4602/
State Superseded
Delegated to: Kumar Gala
Headers show

Comments

Sebastian Siewior - Oct. 15, 2008, 2:43 p.m.
* Kumar Gala | 2008-10-15 08:25:54 [-0500]:

>
> On Oct 15, 2008, at 3:59 AM, Sebastian Andrzej Siewior wrote:
>
>> * Sebastian Andrzej Siewior | 2008-10-15 00:49:46 [+0200]:
>>
>>>> is the -mabi=no-spe really needed?
>>> It seems to work the other way around (without -mabi=no-spe but with
>>> -mabi=no-spe) alteast I did not find anything in do_syslog() or while
>>> browsing through the dissasm. I do a boot check tomorrow.
>>
>> Okay. I recompiled with -mspe=no and was able to boot without trouble.
>> It didn't work with -mabi=no-spe.
>
> I'm confused.. what did you change from your patch?

This is the patch it right now:
Kumar Gala - Oct. 15, 2008, 4:31 p.m.
On Oct 15, 2008, at 9:43 AM, Sebastian Andrzej Siewior wrote:

> * Kumar Gala | 2008-10-15 08:25:54 [-0500]:
>
>>
>> On Oct 15, 2008, at 3:59 AM, Sebastian Andrzej Siewior wrote:
>>
>>> * Sebastian Andrzej Siewior | 2008-10-15 00:49:46 [+0200]:
>>>
>>>>> is the -mabi=no-spe really needed?
>>>> It seems to work the other way around (without -mabi=no-spe but  
>>>> with
>>>> -mabi=no-spe) alteast I did not find anything in do_syslog() or  
>>>> while
>>>> browsing through the dissasm. I do a boot check tomorrow.
>>>
>>> Okay. I recompiled with -mspe=no and was able to boot without  
>>> trouble.
>>> It didn't work with -mabi=no-spe.
>>
>> I'm confused.. what did you change from your patch?
>
> This is the patch it right now:
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -103,6 +103,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
>
> # No SPE instruction when building kernel
> KBUILD_CFLAGS += $(call cc-option,-mno-spe)
> +KBUILD_CFLAGS += $(call cc-option,-mspe=no)
>
> # Enable unit-at-a-time mode when possible. It shrinks the
> # kernel considerably.
> -- 
>
> With this patch it compiles and boots fine.
> The option -mabi=no-spe is not required.

ok.  can post a clean patch w/just this change.

- k
Nate Case - Oct. 17, 2008, 2:02 p.m.
On Wed, 2008-10-15 at 16:43 +0200, Sebastian Andrzej Siewior wrote:
> With this patch it compiles and boots fine.
> The option -mabi=no-spe is not required.

Please don't accept this patch yet.  My past testing showed that
"-mabi=no-spe" was required for my toolchain.  I'll go back and double
check though.

- Nate Case <ncase@xes-inc.com>
Sebastian Siewior - Oct. 17, 2008, 3:01 p.m.
* Nate Case | 2008-10-17 09:02:11 [-0500]:

>On Wed, 2008-10-15 at 16:43 +0200, Sebastian Andrzej Siewior wrote:
>> With this patch it compiles and boots fine.
>> The option -mabi=no-spe is not required.
>
>Please don't accept this patch yet.  My past testing showed that
>"-mabi=no-spe" was required for my toolchain.  I'll go back and double
>check though.
Okay. Here my compiler details:

| powerpc-linux-gnuspe-gcc -v 
| Using built-in specs.
| Target: powerpc-linux-gnuspe
| Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-9'
| --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
| --enable-languages=c,c++,obj-c++ --prefix=/usr --enable-shared
| --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
| --enable-threads=posix --enable-nls
| --with-gxx-include-dir=/usr/powerpc-linux-gnuspe/include/c++/4.3.1
| --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
| --disable-multilib --disable-multilib --with-cpu=8540
| --enable-e500_double --with-long-double-128 --enable-checking=release
| --program-prefix=powerpc-linux-gnuspe-
| --includedir=/usr/powerpc-linux-gnuspe/include --build=i486-linux-gnu
| --host=i486-linux-gnu --target=powerpc-linux-gnuspe
| Thread model: posix
| gcc version 4.3.1 (Debian 4.3.1-9) 
 
ths told me that we need all three options in this order because of how
they interact with gcc's internal flags.

>- Nate Case <ncase@xes-inc.com>

Sebastian
Nate Case - Oct. 24, 2008, 11:51 p.m.
On Fri, 2008-10-17 at 09:02 -0500, Nate Case wrote:
> > With this patch it compiles and boots fine.
> > The option -mabi=no-spe is not required.
> 
> Please don't accept this patch yet.  My past testing showed that
> "-mabi=no-spe" was required for my toolchain.  I'll go back and double
> check though.

OK, I went back and re-tested.

Kernel: 2.6.27
CPU: MPC8572
Toolchain:
    Cross-compiler built using crosstool-ng
    gcc 4.3.1, default target CFLAGS include '-mabi=spe -mspe'
    binutils 2.18.90 snapshot (built with --enable-spe=yes)

Kbuild flags                    Result
------------                    ------
-mno-spe (*)                    FAILED
-mno-spe -mabi=no-spe           FAILED
-mno-spe -mspe=no               OK
-mspe=no                        OK

(*) 2.6.27 default

In the failure case, the kernel would repeatedly dump out "SPE used in
kernel (task=xxxxxxxx, pc=xxxxxxxx)".

I think I was fooled before because I added _both_ "-mspe=no" and
"-mabi=no-spe" to my KBUILD_CFLAGS and saw the problem go away.  Since I
trusted the documentation that -mspe=no and -mno-spe were the same, I
assumed that -mabi=no-spe was the key.

So, I've changed my mind.  I now agree with Sebastian that
"-mabi=no-spe" is not required.  "-mno-spe -mspe=no" is probably the
safe way to go.
Kumar Gala - Oct. 24, 2008, 11:55 p.m.
On Oct 24, 2008, at 6:51 PM, Nate Case wrote:

> On Fri, 2008-10-17 at 09:02 -0500, Nate Case wrote:
>>> With this patch it compiles and boots fine.
>>> The option -mabi=no-spe is not required.
>>
>> Please don't accept this patch yet.  My past testing showed that
>> "-mabi=no-spe" was required for my toolchain.  I'll go back and  
>> double
>> check though.
>
> OK, I went back and re-tested.
>
> Kernel: 2.6.27
> CPU: MPC8572
> Toolchain:
>    Cross-compiler built using crosstool-ng
>    gcc 4.3.1, default target CFLAGS include '-mabi=spe -mspe'
>    binutils 2.18.90 snapshot (built with --enable-spe=yes)
>
> Kbuild flags                    Result
> ------------                    ------
> -mno-spe (*)                    FAILED
> -mno-spe -mabi=no-spe           FAILED
> -mno-spe -mspe=no               OK
> -mspe=no                        OK
>
> (*) 2.6.27 default
>
> In the failure case, the kernel would repeatedly dump out "SPE used in
> kernel (task=xxxxxxxx, pc=xxxxxxxx)".
>
> I think I was fooled before because I added _both_ "-mspe=no" and
> "-mabi=no-spe" to my KBUILD_CFLAGS and saw the problem go away.   
> Since I
> trusted the documentation that -mspe=no and -mno-spe were the same, I
> assumed that -mabi=no-spe was the key.
>
> So, I've changed my mind.  I now agree with Sebastian that
> "-mabi=no-spe" is not required.  "-mno-spe -mspe=no" is probably the
> safe way to go.
>
> -- 
> Nate Case <ncase@xes-inc.com>

thanks for testing this all out.

I'll submit a patch to remove the -mabi=.*spe.* foo.

- k

Patch

--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -103,6 +103,7 @@  KBUILD_CFLAGS += $(call cc-option,-mno-altivec)

 # No SPE instruction when building kernel
 KBUILD_CFLAGS += $(call cc-option,-mno-spe)
+KBUILD_CFLAGS += $(call cc-option,-mspe=no)

 # Enable unit-at-a-time mode when possible. It shrinks the
 # kernel considerably.