* [PATCH] Set cpu explicitly in kernel compiles
@ 2005-05-04 7:05 Paul Mackerras
2005-05-04 11:28 ` Dan Malek
` (3 more replies)
0 siblings, 4 replies; 39+ messages in thread
From: Paul Mackerras @ 2005-05-04 7:05 UTC (permalink / raw)
To: linuxppc-dev; +Cc: trini
What do people think of this patch? The motivation for it is that a
biarch gcc-4.0 will by default tune for POWER4, even for a 32-bit
compile, meaning that we end up with a lot of nops we don't need.
This also takes out -mstring.
With this, the text size reduces by about 120k for my normal config
when compiling with a biarch gcc-4.0. The text size also reduces
slightly when compiling with the Debian gcc-3.3.5 (32-bit only, not
biarch).
If there are no objections I'll send this to Andrew and Linus.
Paul.
diff -urN linux-2.6/arch/ppc/Makefile pmac-2.5/arch/ppc/Makefile
--- linux-2.6/arch/ppc/Makefile 2005-05-02 08:29:36.000000000 +1000
+++ pmac-2.5/arch/ppc/Makefile 2005-05-03 16:45:57.000000000 +1000
@@ -23,15 +23,14 @@
LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic
CPPFLAGS += -Iarch/$(ARCH)
AFLAGS += -Iarch/$(ARCH)
-CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \
- -ffixed-r2 -mmultiple
+CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe -ffixed-r2 -mmultiple
CPP = $(CC) -E $(CFLAGS)
CHECKFLAGS += -D__powerpc__
-ifndef CONFIG_E500
-CFLAGS += -mstring
-endif
+cpu-opt-$(CONFIG_6xx) += -mcpu=750 -mtune=7450
+
+CFLAGS += $(cpu-opt-y)
cpu-as-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
cpu-as-$(CONFIG_4xx) += -Wa,-m405
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-04 7:05 [PATCH] Set cpu explicitly in kernel compiles Paul Mackerras
@ 2005-05-04 11:28 ` Dan Malek
2005-05-04 15:34 ` Tom Rini
2005-05-04 21:36 ` Paul Mackerras
2005-05-04 13:45 ` Kumar Gala
` (2 subsequent siblings)
3 siblings, 2 replies; 39+ messages in thread
From: Dan Malek @ 2005-05-04 11:28 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, trini
On May 4, 2005, at 3:05 AM, Paul Mackerras wrote:
> +cpu-opt-$(CONFIG_6xx) += -mcpu=750 -mtune=7450
What about cores that aren't CONFIG_6xx (8xx, 4xx, e500, etc.)?
How about we create a CONFIG_GCC_CPUOPT and
CONFIG_AS_OPT, and just get these out of the configuration file?
-- Dan
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-04 7:05 [PATCH] Set cpu explicitly in kernel compiles Paul Mackerras
2005-05-04 11:28 ` Dan Malek
@ 2005-05-04 13:45 ` Kumar Gala
2005-05-04 15:28 ` Tom Rini
2005-07-03 17:29 ` Olaf Hering
2006-04-02 19:40 ` Olaf Hering
3 siblings, 1 reply; 39+ messages in thread
From: Kumar Gala @ 2005-05-04 13:45 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, trini
On May 4, 2005, at 2:05 AM, Paul Mackerras wrote:
> What do people think of this patch?=A0 The motivation for it is that a
> biarch gcc-4.0 will by default tune for POWER4, even for a 32-bit
> compile, meaning that we end up with a lot of nops we don't need.
> This also takes out -mstring.
>
> With this, the text size reduces by about 120k for my normal config
> when compiling with a biarch gcc-4.0.=A0 The text size also reduces
> slightly when compiling with the Debian gcc-3.3.5 (32-bit only, not
> biarch).
What is attributed to this large of a text size change. I've always=20
assumed the -mcpu and -mtune options really only effected code=20
scheduling. This seems really odd since there arent really that many=20
different instructions between the various PPC variants.
- kumar=
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-04 13:45 ` Kumar Gala
@ 2005-05-04 15:28 ` Tom Rini
0 siblings, 0 replies; 39+ messages in thread
From: Tom Rini @ 2005-05-04 15:28 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Wed, May 04, 2005 at 08:45:51AM -0500, Kumar Gala wrote:
>
> On May 4, 2005, at 2:05 AM, Paul Mackerras wrote:
>
> >What do people think of this patch?? The motivation for it is that a
> > biarch gcc-4.0 will by default tune for POWER4, even for a 32-bit
> > compile, meaning that we end up with a lot of nops we don't need.
> > This also takes out -mstring.
> >
> >With this, the text size reduces by about 120k for my normal config
> > when compiling with a biarch gcc-4.0.? The text size also reduces
> > slightly when compiling with the Debian gcc-3.3.5 (32-bit only, not
> > biarch).
>
> What is attributed to this large of a text size change. I've always
My guess is taking out the nops that we don't need on !POWER4.
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-04 11:28 ` Dan Malek
@ 2005-05-04 15:34 ` Tom Rini
2005-05-04 16:06 ` Chris Friesen
2005-05-04 21:36 ` Paul Mackerras
1 sibling, 1 reply; 39+ messages in thread
From: Tom Rini @ 2005-05-04 15:34 UTC (permalink / raw)
To: Dan Malek; +Cc: linuxppc-dev
On Wed, May 04, 2005 at 07:28:30AM -0400, Dan Malek wrote:
>
> On May 4, 2005, at 3:05 AM, Paul Mackerras wrote:
>
> >+cpu-opt-$(CONFIG_6xx) += -mcpu=750 -mtune=7450
>
> What about cores that aren't CONFIG_6xx (8xx, 4xx, e500, etc.)?
There's two choices. We can either go down the route x86 has of each
CPU family choice defaulting to a cpu-opt-..., or we could do roughly
what we do today and force the default cpu/tune to be whatever the
default is on gcc-3.3.x (which I assume is really gcc-3.x.x, but..).
Since there are folks working on optimizing toolchains on at least some
of the newer CPUs, I'd be inclined to say we should do something like
cpu-opt-y := ... gcc-3.3.x defaults ...
cpu-opt-$(CONFIG_6xx) := -mcpu=750 -mtune=7450
cpu-opt-$(CONFIG_8xx) := -mcpu=800 -mtune=800 # Or whatever it is..
CFLAGS += $(cpu-opt-y)
> How about we create a CONFIG_GCC_CPUOPT and
> CONFIG_AS_OPT, and just get these out of the configuration file?
Ick. It's possible, but unfun, to go from CONFIG_FOO="string" to
cflags.
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-04 15:34 ` Tom Rini
@ 2005-05-04 16:06 ` Chris Friesen
0 siblings, 0 replies; 39+ messages in thread
From: Chris Friesen @ 2005-05-04 16:06 UTC (permalink / raw)
To: Tom Rini; +Cc: linuxppc-dev
Tom Rini wrote:
> Since there are folks working on optimizing toolchains on at least some
> of the newer CPUs, I'd be inclined to say we should do something like
> cpu-opt-y := ... gcc-3.3.x defaults ...
> cpu-opt-$(CONFIG_6xx) := -mcpu=750 -mtune=7450
> cpu-opt-$(CONFIG_8xx) := -mcpu=800 -mtune=800 # Or whatever it is..
While you're at it, how about breaking out the 970 as separate from the
POWER4?
Chris
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-04 11:28 ` Dan Malek
2005-05-04 15:34 ` Tom Rini
@ 2005-05-04 21:36 ` Paul Mackerras
2005-05-04 23:21 ` Dan Malek
1 sibling, 1 reply; 39+ messages in thread
From: Paul Mackerras @ 2005-05-04 21:36 UTC (permalink / raw)
To: Dan Malek; +Cc: linuxppc-dev, trini
Dan Malek writes:
> What about cores that aren't CONFIG_6xx (8xx, 4xx, e500, etc.)?
Well, what about them? I didn't change anything for them (except to
remove the -mstring). What -mcpu or -mtune options do you want for them?
> How about we create a CONFIG_GCC_CPUOPT and
> CONFIG_AS_OPT, and just get these out of the configuration file?
No. We already have enough configuration questions that are
unanswerable by ordinary mortals.
Paul.
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-04 21:36 ` Paul Mackerras
@ 2005-05-04 23:21 ` Dan Malek
2005-05-05 4:00 ` Paul Mackerras
0 siblings, 1 reply; 39+ messages in thread
From: Dan Malek @ 2005-05-04 23:21 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, trini
On May 4, 2005, at 5:36 PM, Paul Mackerras wrote:
> Well, what about them? I didn't change anything for them (except to
> remove the -mstring). What -mcpu or -mtune options do you want for
> them?
The only reason I mentioned it is the "new" default behavior of the
compiler is appropriate for only a very small subset of the cores,
and your solution only addresses some of the ones affected.
In the past, the default behavior was fine for all but your
special case :-)
My concern wasn't specifically for which options I wanted, but
rather for the mechanism to set all of them now that it appears
we need to do that.
> No. We already have enough configuration questions that are
> unanswerable by ordinary mortals.
OK, but we still need some kind of indication from the configuration
process. It seems to me it would be easier (and more logical) to
have the default behavior work like it has in the past, and use the
special options for the POWER4, which we already know in
the configuration.
Thanks.
-- Dan
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-04 23:21 ` Dan Malek
@ 2005-05-05 4:00 ` Paul Mackerras
2005-05-05 4:12 ` Tom Rini
0 siblings, 1 reply; 39+ messages in thread
From: Paul Mackerras @ 2005-05-05 4:00 UTC (permalink / raw)
To: Dan Malek; +Cc: linuxppc-dev, trini
Dan Malek writes:
> The only reason I mentioned it is the "new" default behavior of the
> compiler is appropriate for only a very small subset of the cores,
Subset of which set of cores? Do you mean "small subset of 6xx cores"
or "small subset of PPC cores"? I didn't change anything for non-6xx
cores except to take out -mstring (if you really want that back, say
so :). If you mean "small subset of 6xx cores" then are you objecting
to the specific choice of "-mcpu=603 -mtune=7450", or what?
> My concern wasn't specifically for which options I wanted, but
> rather for the mechanism to set all of them now that it appears
> we need to do that.
We don't *need* to do it any more than we did before. It's easy to
set options for 4xx, 8xx, etc. - just say the word.
> OK, but we still need some kind of indication from the configuration
> process. It seems to me it would be easier (and more logical) to
> have the default behavior work like it has in the past, and use the
> special options for the POWER4, which we already know in
> the configuration.
The problem isn't for POWER4, the problem is biarch gcc4 optimizing
for POWER4 when we are compiling for 6xx.
Paul.
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 4:00 ` Paul Mackerras
@ 2005-05-05 4:12 ` Tom Rini
2005-05-05 4:44 ` Paul Mackerras
0 siblings, 1 reply; 39+ messages in thread
From: Tom Rini @ 2005-05-05 4:12 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
On Thu, May 05, 2005 at 02:00:35PM +1000, Paul Mackerras wrote:
> Dan Malek writes:
>
> > The only reason I mentioned it is the "new" default behavior of the
> > compiler is appropriate for only a very small subset of the cores,
>
> Subset of which set of cores? Do you mean "small subset of 6xx cores"
> or "small subset of PPC cores"? I didn't change anything for non-6xx
> cores except to take out -mstring (if you really want that back, say
> so :). If you mean "small subset of 6xx cores" then are you objecting
> to the specific choice of "-mcpu=603 -mtune=7450", or what?
>
> > My concern wasn't specifically for which options I wanted, but
> > rather for the mechanism to set all of them now that it appears
> > we need to do that.
>
> We don't *need* to do it any more than we did before. It's easy to
> set options for 4xx, 8xx, etc. - just say the word.
>
> > OK, but we still need some kind of indication from the configuration
> > process. It seems to me it would be easier (and more logical) to
> > have the default behavior work like it has in the past, and use the
> > special options for the POWER4, which we already know in
> > the configuration.
>
> The problem isn't for POWER4, the problem is biarch gcc4 optimizing
> for POWER4 when we are compiling for 6xx.
So here's where the confusion comes in. You're saying that even though
(except .S files) no ppc32 kernel config was passing in explicit
-mcpu=... or similar, only CONFIG_6xx is hurt by the gcc4 biarch thingy?
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 4:12 ` Tom Rini
@ 2005-05-05 4:44 ` Paul Mackerras
2005-05-05 4:47 ` Tom Rini
2005-05-05 12:12 ` Dan Malek
0 siblings, 2 replies; 39+ messages in thread
From: Paul Mackerras @ 2005-05-05 4:44 UTC (permalink / raw)
To: Tom Rini; +Cc: linuxppc-dev
Tom Rini writes:
> So here's where the confusion comes in. You're saying that even though
> (except .S files) no ppc32 kernel config was passing in explicit
> -mcpu=... or similar, only CONFIG_6xx is hurt by the gcc4 biarch thingy?
Indeed, we were never using -mcpu, and maybe we should be.
The problem only comes up if you configure gcc4 as biarch. I can't
imagine anyone building a biarch compiler for 4xx or 8xx. :)
Alan Modra tells me that gcc4 can support all the ppc families in the
one binary, and that you can specify what cpu to use as the assumed
default at configure time. If you specify --with-cpu=xxx at configure
time you get scheduling for that particular cpu.
So yes, only CONFIG_6xx is affected by biarch gcc4 assuming POWER4.
Other families would only be affected if you were using a generic
gcc4, which won't work at present anyway, since we don't add
-mcpu=xxx.
Paul.
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 4:44 ` Paul Mackerras
@ 2005-05-05 4:47 ` Tom Rini
2005-05-05 5:22 ` Paul Mackerras
2005-05-05 12:12 ` Dan Malek
1 sibling, 1 reply; 39+ messages in thread
From: Tom Rini @ 2005-05-05 4:47 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
On Thu, May 05, 2005 at 02:44:08PM +1000, Paul Mackerras wrote:
> Tom Rini writes:
>
> > So here's where the confusion comes in. You're saying that even though
> > (except .S files) no ppc32 kernel config was passing in explicit
> > -mcpu=... or similar, only CONFIG_6xx is hurt by the gcc4 biarch thingy?
>
> Indeed, we were never using -mcpu, and maybe we should be.
>
> The problem only comes up if you configure gcc4 as biarch. I can't
> imagine anyone building a biarch compiler for 4xx or 8xx. :)
I can, quite easily. Think someone like Dan doing dev from their nice
shiney G5.
> Alan Modra tells me that gcc4 can support all the ppc families in the
> one binary, and that you can specify what cpu to use as the assumed
> default at configure time. If you specify --with-cpu=xxx at configure
> time you get scheduling for that particular cpu.
>
> So yes, only CONFIG_6xx is affected by biarch gcc4 assuming POWER4.
> Other families would only be affected if you were using a generic
> gcc4, which won't work at present anyway, since we don't add
> -mcpu=xxx.
Why won't it work with generic gcc4 ? Will something more than a lot of
extra nops be added?
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 4:47 ` Tom Rini
@ 2005-05-05 5:22 ` Paul Mackerras
2005-05-05 12:24 ` Dan Malek
2005-05-06 14:44 ` Segher Boessenkool
0 siblings, 2 replies; 39+ messages in thread
From: Paul Mackerras @ 2005-05-05 5:22 UTC (permalink / raw)
To: Tom Rini; +Cc: linuxppc-dev
Tom Rini writes:
> Why won't it work with generic gcc4 ? Will something more than a lot of
> extra nops be added?
Well, say you are compiling for 405. You either need to have a gcc
that was configured with --with-cpu=405, or you need to have hacked
arch/ppc/Makefile to add -mcpu=405. In both cases the problem doesn't
arise. It only arises if you have a biarch gcc4 that was configured
without any --with-cpu=xxx option and is run without any -mcpu=xxx
option.
If you think we should have -mcpu=xxx on the command line for 4xx,
44x, 8xx, etc., then that's fine, but that is a separate problem from
what my patch was addressing (one which my patch might make it easier
to fix, though).
Paul.
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 4:44 ` Paul Mackerras
2005-05-05 4:47 ` Tom Rini
@ 2005-05-05 12:12 ` Dan Malek
1 sibling, 0 replies; 39+ messages in thread
From: Dan Malek @ 2005-05-05 12:12 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Tom Rini, linuxppc-dev
On May 5, 2005, at 12:44 AM, Paul Mackerras wrote:
> The problem only comes up if you configure gcc4 as biarch. I can't
> imagine anyone building a biarch compiler for 4xx or 8xx. :)
Why not? I've never built a "special" compiler for any development
work, and am very likely to use the default compiler installed on
my YDL system (which could likely be a G5) for building any
embedded PowerPC software.
> So yes, only CONFIG_6xx is affected by biarch gcc4 assuming POWER4.
> Other families would only be affected if you were using a generic
> gcc4, which won't work at present anyway, since we don't add
> -mcpu=xxx.
What do you mean by "won't work"? The compiler simply refuses
or builds for a POWER4 because we don't have the proper -mcpu
flags?
Thanks.
-- Dan
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 5:22 ` Paul Mackerras
@ 2005-05-05 12:24 ` Dan Malek
2005-05-05 14:00 ` Kumar Gala
2005-05-06 14:44 ` Segher Boessenkool
1 sibling, 1 reply; 39+ messages in thread
From: Dan Malek @ 2005-05-05 12:24 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Tom Rini, linuxppc-dev
On May 5, 2005, at 1:22 AM, Paul Mackerras wrote:
> If you think we should have -mcpu=xxx on the command line for 4xx,
> 44x, 8xx, etc., then that's fine, but that is a separate problem from
> what my patch was addressing (one which my patch might make it easier
> to fix, though).
I think that is exactly what we want, although I don't know how that is
separate from the patch you sent. My original comment was the patch
fixes the problem for only one of the cpu cores, not all of them. Which
then led into the subsequent suggestion of making the biarch work
like the past compilers, and we must specific the flags for POWER4
instead of the other way around. Without explicit -mcpu flags, the
existing compiler behavior is just fine ..... but, I guess I'd be
standing
in the way of progress to want this :-)
Thanks.
-- Dan
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 12:24 ` Dan Malek
@ 2005-05-05 14:00 ` Kumar Gala
2005-05-05 14:23 ` Tom Rini
0 siblings, 1 reply; 39+ messages in thread
From: Kumar Gala @ 2005-05-05 14:00 UTC (permalink / raw)
To: Dan Malek; +Cc: Tom Rini, linuxppc-dev
On May 5, 2005, at 7:24 AM, Dan Malek wrote:
>
>
> On May 5, 2005, at 1:22 AM, Paul Mackerras wrote:
> > If you think we should have -mcpu=3Dxxx on the command line for =
4xx,
> > 44x, 8xx, etc., then that's fine, but that is a separate problem=20
> from
> > what my patch was addressing (one which my patch might make it=20
> easier
> > to fix, though).
>
> I think that is exactly what we want, although I don't know how that =
is
> separate from the patch you sent.=A0 My original comment was the =
patch
> fixes the problem for only one of the cpu cores, not all of them.=A0=20=
> Which
> then led into the subsequent suggestion of making the biarch work
> like the past compilers, and we must specific the flags for POWER4
> instead of the other way around.=A0 Without explicit -mcpu flags, the
> existing compiler behavior is just fine .....=A0 but, I guess I'd be
> standing
> in the way of progress to want this :-)
I agree with Dan here. I think we should go ahead and extend the patch=20=
to set -mcpu and -mtune flags for the list of processors we have in=20
"Processor Type". If I'm building a kernel for e500 or 4xx I might as=20=
well get a kernel that is tuned a bit more for the subarch. =20
Additionally, there should be some expert override ability, so if I=20
really want to do -mcpu=3D7455 -mtune=3D7455 I can.
- kumar
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 14:00 ` Kumar Gala
@ 2005-05-05 14:23 ` Tom Rini
2005-05-05 15:12 ` Kumar Gala
0 siblings, 1 reply; 39+ messages in thread
From: Tom Rini @ 2005-05-05 14:23 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Thu, May 05, 2005 at 09:00:50AM -0500, Kumar Gala wrote:
>
> On May 5, 2005, at 7:24 AM, Dan Malek wrote:
>
> >
> >
> >On May 5, 2005, at 1:22 AM, Paul Mackerras wrote:
> > > If you think we should have -mcpu=xxx on the command line for 4xx,
> > > 44x, 8xx, etc., then that's fine, but that is a separate problem
> >from
> > > what my patch was addressing (one which my patch might make it
> >easier
> > > to fix, though).
> >
> >I think that is exactly what we want, although I don't know how that is
> > separate from the patch you sent.? My original comment was the patch
> > fixes the problem for only one of the cpu cores, not all of them.?
> >Which
> > then led into the subsequent suggestion of making the biarch work
> > like the past compilers, and we must specific the flags for POWER4
> > instead of the other way around.? Without explicit -mcpu flags, the
> > existing compiler behavior is just fine .....? but, I guess I'd be
> >standing
> > in the way of progress to want this :-)
>
> I agree with Dan here. I think we should go ahead and extend the patch
> to set -mcpu and -mtune flags for the list of processors we have in
> "Processor Type". If I'm building a kernel for e500 or 4xx I might as
> well get a kernel that is tuned a bit more for the subarch.
This is fine.
> Additionally, there should be some expert override ability, so if I
> really want to do -mcpu=7455 -mtune=7455 I can.
Gack, no! It's quite a pain to go from CONFIG_FOO="string" into useable
Makefile bits that the one we did have back in 2.4 is gone. That also
implies gcc finally knows something about these cores that might be
useful, which I don't think is the case, nor is it likely to be. But if
we did want it, we'd probably go the route x86 has.
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 14:23 ` Tom Rini
@ 2005-05-05 15:12 ` Kumar Gala
2005-05-05 15:27 ` Tom Rini
0 siblings, 1 reply; 39+ messages in thread
From: Kumar Gala @ 2005-05-05 15:12 UTC (permalink / raw)
To: Tom Rini; +Cc: linuxppc-dev
On May 5, 2005, at 9:23 AM, Tom Rini wrote:
> On Thu, May 05, 2005 at 09:00:50AM -0500, Kumar Gala wrote:
> >
> > On May 5, 2005, at 7:24 AM, Dan Malek wrote:
> >
> > >
> > >
> > >On May 5, 2005, at 1:22 AM, Paul Mackerras wrote:
> > > > If you think we should have -mcpu=3Dxxx on the command line for=20=
> 4xx,
> > > > 44x, 8xx, etc., then that's fine, but that is a separate =
problem
> > >from
> > > > what my patch was addressing (one which my patch might make it
> > >easier
> > > > to fix, though).
> > >
> > >I think that is exactly what we want, although I don't know how=20
> that is
> > > separate from the patch you sent.? My original comment was the=20
> patch
> > > fixes the problem for only one of the cpu cores, not all of =
them.?
> > >Which
> > > then led into the subsequent suggestion of making the biarch work
> > > like the past compilers, and we must specific the flags for =
POWER4
> > > instead of the other way around.? Without explicit -mcpu flags,=20=
> the
> > > existing compiler behavior is just fine .....? but, I guess I'd =
be
> > >standing
> > > in the way of progress to want this :-)
> >
> > I agree with Dan here.=A0 I think we should go ahead and extend the=20=
> patch
> > to set -mcpu and -mtune flags for the list of processors we have in
> > "Processor Type".=A0 If I'm building a kernel for e500 or 4xx I =
might=20
> as
> > well get a kernel that is tuned a bit more for the subarch.=A0
>
> This is fine.
>
> > Additionally, there should be some expert override ability, so if I
> > really want to do -mcpu=3D7455 -mtune=3D7455 I can.
>
> Gack, no!=A0 It's quite a pain to go from CONFIG_FOO=3D"string" into=20=
> useable
> Makefile bits that the one we did have back in 2.4 is gone.=A0 That =
also
> implies gcc finally knows something about these cores that might be
> useful, which I don't think is the case, nor is it likely to be.=A0 =
But=20
> if
> we did want it, we'd probably go the route x86 has.
I'm not saying it has to be done via a CONFIG option, all I'm saying is=20=
if I want to explicitly use GCC then I would hope we could somehow=20
disable it being override.
- kumar=
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 15:12 ` Kumar Gala
@ 2005-05-05 15:27 ` Tom Rini
2005-05-05 16:22 ` Kumar Gala
0 siblings, 1 reply; 39+ messages in thread
From: Tom Rini @ 2005-05-05 15:27 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Thu, May 05, 2005 at 10:12:42AM -0500, Kumar Gala wrote:
>
> On May 5, 2005, at 9:23 AM, Tom Rini wrote:
>
> >On Thu, May 05, 2005 at 09:00:50AM -0500, Kumar Gala wrote:
> > >
> >> On May 5, 2005, at 7:24 AM, Dan Malek wrote:
> > >
> >> >
> > > >
> > > >On May 5, 2005, at 1:22 AM, Paul Mackerras wrote:
> > > > > If you think we should have -mcpu=xxx on the command line for
> >4xx,
> > > > > 44x, 8xx, etc., then that's fine, but that is a separate problem
> >> >from
> > > > > what my patch was addressing (one which my patch might make it
> >> >easier
> > > > > to fix, though).
> > > >
> > > >I think that is exactly what we want, although I don't know how
> >that is
> > > > separate from the patch you sent.? My original comment was the
> >patch
> > > > fixes the problem for only one of the cpu cores, not all of them.?
> >> >Which
> > > > then led into the subsequent suggestion of making the biarch work
> > > > like the past compilers, and we must specific the flags for POWER4
> > > > instead of the other way around.? Without explicit -mcpu flags,
> >the
> > > > existing compiler behavior is just fine .....? but, I guess I'd be
> > > >standing
> > > > in the way of progress to want this :-)
> > >
> >> I agree with Dan here.? I think we should go ahead and extend the
> >patch
> >> to set -mcpu and -mtune flags for the list of processors we have in
> >> "Processor Type".? If I'm building a kernel for e500 or 4xx I might
> >as
> >> well get a kernel that is tuned a bit more for the subarch.?
> >
> > This is fine.
> >
> >> Additionally, there should be some expert override ability, so if I
> >> really want to do -mcpu=7455 -mtune=7455 I can.
> >
> >Gack, no!? It's quite a pain to go from CONFIG_FOO="string" into
> >useable
> > Makefile bits that the one we did have back in 2.4 is gone.? That also
> > implies gcc finally knows something about these cores that might be
> > useful, which I don't think is the case, nor is it likely to be.? But
> >if
> > we did want it, we'd probably go the route x86 has.
>
> I'm not saying it has to be done via a CONFIG option, all I'm saying is
> if I want to explicitly use GCC then I would hope we could somehow
> disable it being override.
If you're not doing it via CONFIG, that leaves manual (which is always
an option) or seeing if passing CFLAGS on the cmdline overrides things,
or adds to them.
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 15:27 ` Tom Rini
@ 2005-05-05 16:22 ` Kumar Gala
2005-05-05 16:29 ` Tom Rini
0 siblings, 1 reply; 39+ messages in thread
From: Kumar Gala @ 2005-05-05 16:22 UTC (permalink / raw)
To: Tom Rini; +Cc: linuxppc-dev
On May 5, 2005, at 10:27 AM, Tom Rini wrote:
> On Thu, May 05, 2005 at 10:12:42AM -0500, Kumar Gala wrote:
> >
> > On May 5, 2005, at 9:23 AM, Tom Rini wrote:
> >
> > >On Thu, May 05, 2005 at 09:00:50AM -0500, Kumar Gala wrote:
> > > >
> > >> On May 5, 2005, at 7:24 AM, Dan Malek wrote:
> > > >
> > >> >
> > > > >
> > > > >On May 5, 2005, at 1:22 AM, Paul Mackerras wrote:
> > > > > > If you think we should have -mcpu=xxx on the command line
> for
> > >4xx,
> > > > > > 44x, 8xx, etc., then that's fine, but that is a separate
> problem
> > >> >from
> > > > > > what my patch was addressing (one which my patch might make
> it
> > >> >easier
> > > > > > to fix, though).
> > > > >
> > > > >I think that is exactly what we want, although I don't know how
> > >that is
> > > > > separate from the patch you sent.? My original comment was the
> > >patch
> > > > > fixes the problem for only one of the cpu cores, not all of
> them.?
> > >> >Which
> > > > > then led into the subsequent suggestion of making the biarch
> work
> > > > > like the past compilers, and we must specific the flags for
> POWER4
> > > > > instead of the other way around.? Without explicit -mcpu
> flags,
> > >the
> > > > > existing compiler behavior is just fine .....? but, I guess
> I'd be
> > > > >standing
> > > > > in the way of progress to want this :-)
> > > >
> > >> I agree with Dan here.? I think we should go ahead and extend the
> > >patch
> > >> to set -mcpu and -mtune flags for the list of processors we have
> in
> > >> "Processor Type".? If I'm building a kernel for e500 or 4xx I
> might
> > >as
> > >> well get a kernel that is tuned a bit more for the subarch.?
> > >
> > > This is fine.
> > >
> > >> Additionally, there should be some expert override ability, so
> if I
> > >> really want to do -mcpu=7455 -mtune=7455 I can.
> > >
> > >Gack, no!? It's quite a pain to go from CONFIG_FOO="string" into
> > >useable
> > > Makefile bits that the one we did have back in 2.4 is gone.? That
> also
> > > implies gcc finally knows something about these cores that might
> be
> > > useful, which I don't think is the case, nor is it likely to be.?
> But
> > >if
> > > we did want it, we'd probably go the route x86 has.
> >
> > I'm not saying it has to be done via a CONFIG option, all I'm saying
> is
> > if I want to explicitly use GCC then I would hope we could somehow
> > disable it being override.
>
> If you're not doing it via CONFIG, that leaves manual (which is always
> an option) or seeing if passing CFLAGS on the cmdline overrides
> things,
> or adds to them.
Thats all I really want. Just for us to make sure if I want to do
-mcpu=7455 -mtune=7455 I'm able to and it actually does what I told it
to do. I'm not sure if GCC is consistent on how it handles args that
are duplicated. For example what will happen with the following:
gcc -mcpu=750 -mtune=7450 -mcpu=603 -mtune=603
Is this -mcpu=750 -mtune=7450 or -mcpu=603 -mtune=603
- kumar
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 16:22 ` Kumar Gala
@ 2005-05-05 16:29 ` Tom Rini
0 siblings, 0 replies; 39+ messages in thread
From: Tom Rini @ 2005-05-05 16:29 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Thu, May 05, 2005 at 11:22:38AM -0500, Kumar Gala wrote:
>
> On May 5, 2005, at 10:27 AM, Tom Rini wrote:
>
> >On Thu, May 05, 2005 at 10:12:42AM -0500, Kumar Gala wrote:
> > >
> >> On May 5, 2005, at 9:23 AM, Tom Rini wrote:
> > >
> >> >On Thu, May 05, 2005 at 09:00:50AM -0500, Kumar Gala wrote:
> > > > >
> > > >> On May 5, 2005, at 7:24 AM, Dan Malek wrote:
> > > > >
> > > >> >
> > > > > >
> > > > > >On May 5, 2005, at 1:22 AM, Paul Mackerras wrote:
> > > > > > > If you think we should have -mcpu=xxx on the command line
> >for
> >> >4xx,
> > > > > > > 44x, 8xx, etc., then that's fine, but that is a separate
> >problem
> > > >> >from
> > > > > > > what my patch was addressing (one which my patch might make
> >it
> > > >> >easier
> > > > > > > to fix, though).
> > > > > >
> > > > > >I think that is exactly what we want, although I don't know how
> >> >that is
> > > > > > separate from the patch you sent.? My original comment was the
> >> >patch
> > > > > > fixes the problem for only one of the cpu cores, not all of
> >them.?
> > > >> >Which
> > > > > > then led into the subsequent suggestion of making the biarch
> >work
> > > > > > like the past compilers, and we must specific the flags for
> >POWER4
> > > > > > instead of the other way around.? Without explicit -mcpu
> >flags,
> >> >the
> > > > > > existing compiler behavior is just fine .....? but, I guess
> >I'd be
> > > > > >standing
> > > > > > in the way of progress to want this :-)
> > > > >
> > > >> I agree with Dan here.? I think we should go ahead and extend the
> >> >patch
> > > >> to set -mcpu and -mtune flags for the list of processors we have
> >in
> > > >> "Processor Type".? If I'm building a kernel for e500 or 4xx I
> >might
> >> >as
> > > >> well get a kernel that is tuned a bit more for the subarch.?
> > > >
> > > > This is fine.
> >> >
> > > >> Additionally, there should be some expert override ability, so
> >if I
> > > >> really want to do -mcpu=7455 -mtune=7455 I can.
> > > >
> > > >Gack, no!? It's quite a pain to go from CONFIG_FOO="string" into
> >> >useable
> > > > Makefile bits that the one we did have back in 2.4 is gone.? That
> >also
> > > > implies gcc finally knows something about these cores that might
> >be
> > > > useful, which I don't think is the case, nor is it likely to be.?
> >But
> >> >if
> > > > we did want it, we'd probably go the route x86 has.
> > >
> >> I'm not saying it has to be done via a CONFIG option, all I'm saying
> >is
> >> if I want to explicitly use GCC then I would hope we could somehow
> >> disable it being override.
> >
> >If you're not doing it via CONFIG, that leaves manual (which is always
> > an option) or seeing if passing CFLAGS on the cmdline overrides
> >things,
> > or adds to them.
>
> Thats all I really want. Just for us to make sure if I want to do
> -mcpu=7455 -mtune=7455 I'm able to and it actually does what I told it
> to do. I'm not sure if GCC is consistent on how it handles args that
> are duplicated. For example what will happen with the following:
>
> gcc -mcpu=750 -mtune=7450 -mcpu=603 -mtune=603
>
> Is this -mcpu=750 -mtune=7450 or -mcpu=603 -mtune=603
Last one wins, modulo gcc bugs, is the rule I believe.
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-05 5:22 ` Paul Mackerras
2005-05-05 12:24 ` Dan Malek
@ 2005-05-06 14:44 ` Segher Boessenkool
2005-05-06 14:53 ` Tom Rini
1 sibling, 1 reply; 39+ messages in thread
From: Segher Boessenkool @ 2005-05-06 14:44 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Tom Rini, linuxppc-dev
> Well, say you are compiling for 405. You either need to have a gcc
> that was configured with --with-cpu=405, or you need to have hacked
> arch/ppc/Makefile to add -mcpu=405. In both cases the problem doesn't
> arise. It only arises if you have a biarch gcc4 that was configured
> without any --with-cpu=xxx option and is run without any -mcpu=xxx
> option.
It happens for any installation where the default chosen by the GCC
used is not the -mcpu=XXX flag you need used for your kernel. Which
is a much more general statement than the biarch one. Most people just
get lucky, because they compile code with a compiler that is defaulted
for their target, and userland and kernel use (about) the same options
on most targets. Not so in biarch land (bleeech).
> If you think we should have -mcpu=xxx on the command line for 4xx,
> 44x, 8xx, etc., then that's fine, but that is a separate problem from
> what my patch was addressing (one which my patch might make it easier
> to fix, though).
Please always use -mcpu=XXX (and perhaps -mtune=XXX), that's the only
"correct" way to fix this. Or _never_ do any -mcpu=, and let users
override it in the CC setting in the Makefile. But I like the first
option better.
Segher
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-06 14:44 ` Segher Boessenkool
@ 2005-05-06 14:53 ` Tom Rini
2005-05-06 15:28 ` Segher Boessenkool
2005-05-06 15:47 ` Kumar Gala
0 siblings, 2 replies; 39+ messages in thread
From: Tom Rini @ 2005-05-06 14:53 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev
On Fri, May 06, 2005 at 04:44:33PM +0200, Segher Boessenkool wrote:
> >Well, say you are compiling for 405. You either need to have a gcc
> >that was configured with --with-cpu=405, or you need to have hacked
> >arch/ppc/Makefile to add -mcpu=405. In both cases the problem doesn't
> >arise. It only arises if you have a biarch gcc4 that was configured
> >without any --with-cpu=xxx option and is run without any -mcpu=xxx
> >option.
>
> It happens for any installation where the default chosen by the GCC
> used is not the -mcpu=XXX flag you need used for your kernel. Which
> is a much more general statement than the biarch one. Most people just
> get lucky, because they compile code with a compiler that is defaulted
> for their target, and userland and kernel use (about) the same options
> on most targets. Not so in biarch land (bleeech).
Note that up until very recently (and just a bit before conflicting
opcodes were added), no -mcpu=XXX was required. For example, I compiled
a 44x kernel with a -mcpu=750 toolchain no problems shortly after Paul
posted this. The only exception to this rule I can possibly think of is
85xx. But even that would be the "very recently" thing I mentioned as
I know you can use an 82xx-set toolchain to build for 85xx.
Having said that..
> >If you think we should have -mcpu=xxx on the command line for 4xx,
> >44x, 8xx, etc., then that's fine, but that is a separate problem from
> >what my patch was addressing (one which my patch might make it easier
> >to fix, though).
>
> Please always use -mcpu=XXX (and perhaps -mtune=XXX), that's the only
> "correct" way to fix this. Or _never_ do any -mcpu=, and let users
> override it in the CC setting in the Makefile. But I like the first
> option better.
We should setup cpu-opt-$(CONFIG_every choice) to fix new gcc breakage
(and I guess we shouldn't have removed the do-nothing ones we had a few
years ago).
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-06 14:53 ` Tom Rini
@ 2005-05-06 15:28 ` Segher Boessenkool
2005-05-06 15:34 ` Tom Rini
2005-05-06 15:47 ` Kumar Gala
1 sibling, 1 reply; 39+ messages in thread
From: Segher Boessenkool @ 2005-05-06 15:28 UTC (permalink / raw)
To: Tom Rini; +Cc: linuxppc-dev
> Note that up until very recently (and just a bit before conflicting
> opcodes were added), no -mcpu=XXX was required.
True, but it's just lucky that it worked...
Segher
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-06 15:28 ` Segher Boessenkool
@ 2005-05-06 15:34 ` Tom Rini
0 siblings, 0 replies; 39+ messages in thread
From: Tom Rini @ 2005-05-06 15:34 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev
On Fri, May 06, 2005 at 05:28:57PM +0200, Segher Boessenkool wrote:
> >Note that up until very recently (and just a bit before conflicting
> >opcodes were added), no -mcpu=XXX was required.
>
> True, but it's just lucky that it worked...
It used to be design that it worked. But now I'm sounding like Dan,
which I find only slightly disconcerting :)
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-06 14:53 ` Tom Rini
2005-05-06 15:28 ` Segher Boessenkool
@ 2005-05-06 15:47 ` Kumar Gala
1 sibling, 0 replies; 39+ messages in thread
From: Kumar Gala @ 2005-05-06 15:47 UTC (permalink / raw)
To: Tom Rini; +Cc: linuxppc-dev
On May 6, 2005, at 9:53 AM, Tom Rini wrote:
> On Fri, May 06, 2005 at 04:44:33PM +0200, Segher Boessenkool wrote:
> > >Well, say you are compiling for 405.=A0 You either need to have a =
gcc
> > >that was configured with --with-cpu=3D405, or you need to have =
hacked
> > >arch/ppc/Makefile to add -mcpu=3D405.=A0 In both cases the problem=20=
> doesn't
> > >arise.=A0 It only arises if you have a biarch gcc4 that was=20
> configured
> > >without any --with-cpu=3Dxxx option and is run without any =
-mcpu=3Dxxx
> > >option.
> >
> > It happens for any installation where the default chosen by the GCC
> > used is not the -mcpu=3DXXX flag you need used for your kernel.=A0 =
Which
> > is a much more general statement than the biarch one.=A0 Most =
people=20
> just
> > get lucky, because they compile code with a compiler that is=20
> defaulted
> > for their target, and userland and kernel use (about) the same=20
> options
> > on most targets.=A0 Not so in biarch land (bleeech).
>
> Note that up until very recently (and just a bit before conflicting
> opcodes were added), no -mcpu=3DXXX was required.=A0 For example, I=20=
> compiled
> a 44x kernel with a -mcpu=3D750 toolchain no problems shortly after =
Paul
> posted this.=A0 The only exception to this rule I can possibly think =
of=20
> is
> 85xx.=A0 But even that would be the "very recently" thing I mentioned =
as
> I know you can use an 82xx-set toolchain to build for 85xx.
>
> Having said that..
I do the same thing as well and the only issue I have is that 85xx=20
doesn't support strings thus the conditional we currently have for=20
-mstring.
- kumar=
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-05-04 7:05 [PATCH] Set cpu explicitly in kernel compiles Paul Mackerras
2005-05-04 11:28 ` Dan Malek
2005-05-04 13:45 ` Kumar Gala
@ 2005-07-03 17:29 ` Olaf Hering
2005-07-03 18:32 ` Tom Rini
2006-04-02 19:40 ` Olaf Hering
3 siblings, 1 reply; 39+ messages in thread
From: Olaf Hering @ 2005-07-03 17:29 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, trini
On Wed, May 04, Paul Mackeras wrote:
> What do people think of this patch? The motivation for it is that a
> biarch gcc-4.0 will by default tune for POWER4, even for a 32-bit
> compile, meaning that we end up with a lot of nops we don't need.
> This also takes out -mstring.
>
> With this, the text size reduces by about 120k for my normal config
> when compiling with a biarch gcc-4.0. The text size also reduces
> slightly when compiling with the Debian gcc-3.3.5 (32-bit only, not
> biarch).
>
> If there are no objections I'll send this to Andrew and Linus.
What will be done about this patch? -mcpu=750 reduces .text by 70k.
text data bss dec hex filename
3397801 579544 519704 4497049 449e99 ../O-ppc-cpu601/vmlinux
3397502 579544 519704 4496750 449d6e ../O-ppc-cpu604/vmlinux
3397953 579544 519704 4497201 449f31 ../O-ppc-cpu750/vmlinux
3469857 579544 519704 4569105 45b811 ../O-ppc-default/vmlinux
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-07-03 17:29 ` Olaf Hering
@ 2005-07-03 18:32 ` Tom Rini
2005-07-05 18:14 ` Olaf Hering
0 siblings, 1 reply; 39+ messages in thread
From: Tom Rini @ 2005-07-03 18:32 UTC (permalink / raw)
To: Olaf Hering; +Cc: linuxppc-dev
On Sun, Jul 03, 2005 at 07:29:55PM +0200, Olaf Hering wrote:
> On Wed, May 04, Paul Mackeras wrote:
>
> > What do people think of this patch? The motivation for it is that a
> > biarch gcc-4.0 will by default tune for POWER4, even for a 32-bit
> > compile, meaning that we end up with a lot of nops we don't need.
> > This also takes out -mstring.
> >
> > With this, the text size reduces by about 120k for my normal config
> > when compiling with a biarch gcc-4.0. The text size also reduces
> > slightly when compiling with the Debian gcc-3.3.5 (32-bit only, not
> > biarch).
> >
> > If there are no objections I'll send this to Andrew and Linus.
>
> What will be done about this patch? -mcpu=750 reduces .text by 70k.
The fix for the real problem is now in. Perhaps, based off gcc's info
page, we should update (from what 2.6.12 looks like) to do:
cpu-as-y = -Wa,-mcpu=powerpc # Pure ppc32
cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
cpu-as-$(CONFIG_PPC_601) := -Wa,-mcpu=601 # Or whatever the 601 option is
cpu-as-$(CONFIG_PPC64BRIDGE) := -Wa,mcpu=powerpc64
< add 4xx/BookE here >
And see what we get. I really don't think we should fall into the i386
ugly trap of i386/i486/i586/i586tsc/... 20 other options ..., esp since
it looks like the main win is switching from 100% generic powerpc to
something more specific. And going with the generic name means if gcc
starts doing something different on 750 vs 7400 vs 604, we win.
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-07-03 18:32 ` Tom Rini
@ 2005-07-05 18:14 ` Olaf Hering
2005-07-05 19:47 ` Tom Rini
0 siblings, 1 reply; 39+ messages in thread
From: Olaf Hering @ 2005-07-05 18:14 UTC (permalink / raw)
To: Tom Rini; +Cc: linuxppc-dev
On Sun, Jul 03, Tom Rini wrote:
> cpu-as-y = -Wa,-mcpu=powerpc # Pure ppc32
That alone should fix it, adding -mcpu=$somecpu may generate bad code
for other cpu types, according to alanm.
> cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
> cpu-as-$(CONFIG_PPC_601) := -Wa,-mcpu=601 # Or whatever the 601 option is
601 doesnt need special cflags handling.
cpu-as-$(CONFIG_6xx) += -Wa,-mcpu=powerpc
may be enough, no idea if -Wa is required.
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-07-05 18:14 ` Olaf Hering
@ 2005-07-05 19:47 ` Tom Rini
2005-07-05 19:54 ` Olaf Hering
0 siblings, 1 reply; 39+ messages in thread
From: Tom Rini @ 2005-07-05 19:47 UTC (permalink / raw)
To: Olaf Hering; +Cc: linuxppc-dev
On Tue, Jul 05, 2005 at 08:14:48PM +0200, Olaf Hering wrote:
> On Sun, Jul 03, Tom Rini wrote:
>
> > cpu-as-y = -Wa,-mcpu=powerpc # Pure ppc32
>
> That alone should fix it, adding -mcpu=$somecpu may generate bad code
> for other cpu types, according to alanm.
Exactly.
> > cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
> > cpu-as-$(CONFIG_PPC_601) := -Wa,-mcpu=601 # Or whatever the 601 option is
>
> 601 doesnt need special cflags handling.
gcc info page says that -mcpu=powerpc won't work for 601.
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-07-05 19:47 ` Tom Rini
@ 2005-07-05 19:54 ` Olaf Hering
2005-07-05 19:58 ` Tom Rini
0 siblings, 1 reply; 39+ messages in thread
From: Olaf Hering @ 2005-07-05 19:54 UTC (permalink / raw)
To: Tom Rini; +Cc: linuxppc-dev
On Tue, Jul 05, Tom Rini wrote:
> gcc info page says that -mcpu=powerpc won't work for 601.
-mcpu=common may work for everyone, after a quick grep in
gcc/config/rs6000
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-07-05 19:54 ` Olaf Hering
@ 2005-07-05 19:58 ` Tom Rini
2005-07-05 20:17 ` Olaf Hering
2005-07-05 20:27 ` Olaf Hering
0 siblings, 2 replies; 39+ messages in thread
From: Tom Rini @ 2005-07-05 19:58 UTC (permalink / raw)
To: Olaf Hering; +Cc: linuxppc-dev
On Tue, Jul 05, 2005 at 09:54:41PM +0200, Olaf Hering wrote:
> On Tue, Jul 05, Tom Rini wrote:
>
> > gcc info page says that -mcpu=powerpc won't work for 601.
>
> -mcpu=common may work for everyone, after a quick grep in
> gcc/config/rs6000
It does, and that's the code bloat you're trying to get rid of :)
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-07-05 19:58 ` Tom Rini
@ 2005-07-05 20:17 ` Olaf Hering
2005-07-05 20:27 ` Olaf Hering
1 sibling, 0 replies; 39+ messages in thread
From: Olaf Hering @ 2005-07-05 20:17 UTC (permalink / raw)
To: Tom Rini; +Cc: linuxppc-dev
On Tue, Jul 05, Tom Rini wrote:
> On Tue, Jul 05, 2005 at 09:54:41PM +0200, Olaf Hering wrote:
> > On Tue, Jul 05, Tom Rini wrote:
> >
> > > gcc info page says that -mcpu=powerpc won't work for 601.
> >
> > -mcpu=common may work for everyone, after a quick grep in
> > gcc/config/rs6000
>
> It does, and that's the code bloat you're trying to get rid of :)
Yeah, leads to fun like that:
init/built-in.o: In function `calibrate_delay':
: undefined reference to `__quous'
need to grep harder.
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-07-05 19:58 ` Tom Rini
2005-07-05 20:17 ` Olaf Hering
@ 2005-07-05 20:27 ` Olaf Hering
2005-07-05 21:22 ` Tom Rini
1 sibling, 1 reply; 39+ messages in thread
From: Olaf Hering @ 2005-07-05 20:27 UTC (permalink / raw)
To: Tom Rini; +Cc: linuxppc-dev
On Tue, Jul 05, Tom Rini wrote:
> On Tue, Jul 05, 2005 at 09:54:41PM +0200, Olaf Hering wrote:
> > On Tue, Jul 05, Tom Rini wrote:
> >
> > > gcc info page says that -mcpu=powerpc won't work for 601.
> >
> > -mcpu=common may work for everyone, after a quick grep in
> > gcc/config/rs6000
>
> It does, and that's the code bloat you're trying to get rid of :)
3397494 579544 519704 4496742 449d66 ../O-ppc-cpucommon/vmlinux
3469857 579544 519704 4569105 45b811 ../O-ppc-default/vmlinux
-mcpu=powerpc reduces text size still more than -mcpu=750
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-07-05 20:27 ` Olaf Hering
@ 2005-07-05 21:22 ` Tom Rini
2005-07-06 6:38 ` Olaf Hering
0 siblings, 1 reply; 39+ messages in thread
From: Tom Rini @ 2005-07-05 21:22 UTC (permalink / raw)
To: Olaf Hering; +Cc: linuxppc-dev
On Tue, Jul 05, 2005 at 10:27:17PM +0200, Olaf Hering wrote:
> On Tue, Jul 05, Tom Rini wrote:
>
> > On Tue, Jul 05, 2005 at 09:54:41PM +0200, Olaf Hering wrote:
> > > On Tue, Jul 05, Tom Rini wrote:
> > >
> > > > gcc info page says that -mcpu=powerpc won't work for 601.
> > >
> > > -mcpu=common may work for everyone, after a quick grep in
> > > gcc/config/rs6000
> >
> > It does, and that's the code bloat you're trying to get rid of :)
>
> 3397494 579544 519704 4496742 449d66 ../O-ppc-cpucommon/vmlinux
> 3469857 579544 519704 4569105 45b811 ../O-ppc-default/vmlinux
That's very wierd. What is the default then? Thinking back to May, I
thought it was 'common', and that was why Paul wanted to change things.
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2005-07-05 21:22 ` Tom Rini
@ 2005-07-06 6:38 ` Olaf Hering
0 siblings, 0 replies; 39+ messages in thread
From: Olaf Hering @ 2005-07-06 6:38 UTC (permalink / raw)
To: Tom Rini; +Cc: linuxppc-dev
On Tue, Jul 05, Tom Rini wrote:
> That's very wierd. What is the default then? Thinking back to May, I
> thought it was 'common', and that was why Paul wanted to change things.
This is an odd biarch compiler, the one that Paul talked about:
Target: powerpc64-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,f95,java,ada --enable-checking
--with-gxx-include-dir=/usr/include/c++/4.0.1 --with-slibdir=/lib
--with-system-zlib --enable-shared --enable-__cxa_atexit
--without-system-libunwind --with-cpu=default32
--host=powerpc64-suse-linux
Thread model: posix
gcc version 4.0.1 20050701 (prerelease) (SUSE Linux)
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH] Set cpu explicitly in kernel compiles
2005-05-04 7:05 [PATCH] Set cpu explicitly in kernel compiles Paul Mackerras
` (2 preceding siblings ...)
2005-07-03 17:29 ` Olaf Hering
@ 2006-04-02 19:40 ` Olaf Hering
2006-04-06 4:37 ` Paul Mackerras
3 siblings, 1 reply; 39+ messages in thread
From: Olaf Hering @ 2006-04-02 19:40 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, trini
On Wed, 2005-05-04, Paul Mackeras wrote:
> What do people think of this patch? The motivation for it is that a
> biarch gcc-4.0 will by default tune for POWER4, even for a 32-bit
> compile, meaning that we end up with a lot of nops we don't need.
> This also takes out -mstring.
>
> With this, the text size reduces by about 120k for my normal config
> when compiling with a biarch gcc-4.0. The text size also reduces
> slightly when compiling with the Debian gcc-3.3.5 (32-bit only, not
> biarch).
Compile the 32bit kernel with -mcpu=powerpc. This reduces the imagesize
when a compiler is used that defaults to -mtune=power4. It inserts lots
of nops to please the 64bit cpu instruction scheduling. But all these nops
are not needed for 32bit kernels.
Example with SLES10 gcc 4.1.0 and arch/powerpc/configs/pmac32_defconfig:
vmlinux vmlinux.strip vmlinux.gz
-O2 4980515 4187528 1846829
-Os 4618801 3827084 1673333
-O2 -mcpu=powerpc 4738851 3945868 1816253
-Os -mcpu=powerpc 4532785 3741068 1664688
Signed-off-by: Olaf Hering <olh@suse.de>
---
arch/powerpc/Makefile | 1 +
1 file changed, 1 insertion(+)
Index: linux-2.6.16-olh/arch/powerpc/Makefile
===================================================================
--- linux-2.6.16-olh.orig/arch/powerpc/Makefile
+++ linux-2.6.16-olh/arch/powerpc/Makefile
@@ -107,6 +107,7 @@ endif
cpu-as-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
cpu-as-$(CONFIG_4xx) += -Wa,-m405
cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
+cpu-as-$(CONFIG_6xx) += -mcpu=powerpc
cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec
cpu-as-$(CONFIG_E500) += -Wa,-me500
cpu-as-$(CONFIG_E200) += -Wa,-me200
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2006-04-02 19:40 ` Olaf Hering
@ 2006-04-06 4:37 ` Paul Mackerras
2006-04-11 18:42 ` Olaf Hering
0 siblings, 1 reply; 39+ messages in thread
From: Paul Mackerras @ 2006-04-06 4:37 UTC (permalink / raw)
To: Olaf Hering; +Cc: linuxppc-dev, trini
Olaf Hering writes:
> --- linux-2.6.16-olh.orig/arch/powerpc/Makefile
> +++ linux-2.6.16-olh/arch/powerpc/Makefile
> @@ -107,6 +107,7 @@ endif
> cpu-as-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
> cpu-as-$(CONFIG_4xx) += -Wa,-m405
> cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
> +cpu-as-$(CONFIG_6xx) += -mcpu=powerpc
Is this really the right place for this? The cpu-as- thing is really
for assembler options.
Paul.
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH] Set cpu explicitly in kernel compiles
2006-04-06 4:37 ` Paul Mackerras
@ 2006-04-11 18:42 ` Olaf Hering
0 siblings, 0 replies; 39+ messages in thread
From: Olaf Hering @ 2006-04-11 18:42 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, trini
On Thu, Apr 06, Paul Mackeras wrote:
> Olaf Hering writes:
>
> > --- linux-2.6.16-olh.orig/arch/powerpc/Makefile
> > +++ linux-2.6.16-olh/arch/powerpc/Makefile
> > @@ -107,6 +107,7 @@ endif
> > cpu-as-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
> > cpu-as-$(CONFIG_4xx) += -Wa,-m405
> > cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
> > +cpu-as-$(CONFIG_6xx) += -mcpu=powerpc
>
> Is this really the right place for this? The cpu-as- thing is really
> for assembler options.
Compile the 32bit kernel with -mcpu=powerpc. This reduces the imagesize
when a compiler is used that defaults to -mtune=power4. It inserts lots
of nops to please the 64bit cpu instruction scheduling. But all these nops
are not needed for 32bit kernels.
Example with SLES10 gcc 4.1.0 and arch/powerpc/configs/pmac32_defconfig:
vmlinux vmlinux.strip vmlinux.gz
-O2 4980515 4187528 1846829
-Os 4618801 3827084 1673333
-O2 -mcpu=powerpc 4738851 3945868 1816253
-Os -mcpu=powerpc 4532785 3741068 1664688
Signed-off-by: Olaf Hering <olh@suse.de>
---
arch/powerpc/Makefile | 4 ++++
1 file changed, 4 insertions(+)
Index: linux-2.6.16-olh/arch/powerpc/Makefile
===================================================================
--- linux-2.6.16-olh.orig/arch/powerpc/Makefile
+++ linux-2.6.16-olh/arch/powerpc/Makefile
@@ -104,6 +104,10 @@ ifndef CONFIG_FSL_BOOKE
CFLAGS += -mstring
endif
+ifeq ($(CONFIG_6xx),y)
+CFLAGS += -mcpu=powerpc
+endif
+
cpu-as-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
cpu-as-$(CONFIG_4xx) += -Wa,-m405
cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
^ permalink raw reply [flat|nested] 39+ messages in thread
end of thread, other threads:[~2006-04-11 18:42 UTC | newest]
Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-04 7:05 [PATCH] Set cpu explicitly in kernel compiles Paul Mackerras
2005-05-04 11:28 ` Dan Malek
2005-05-04 15:34 ` Tom Rini
2005-05-04 16:06 ` Chris Friesen
2005-05-04 21:36 ` Paul Mackerras
2005-05-04 23:21 ` Dan Malek
2005-05-05 4:00 ` Paul Mackerras
2005-05-05 4:12 ` Tom Rini
2005-05-05 4:44 ` Paul Mackerras
2005-05-05 4:47 ` Tom Rini
2005-05-05 5:22 ` Paul Mackerras
2005-05-05 12:24 ` Dan Malek
2005-05-05 14:00 ` Kumar Gala
2005-05-05 14:23 ` Tom Rini
2005-05-05 15:12 ` Kumar Gala
2005-05-05 15:27 ` Tom Rini
2005-05-05 16:22 ` Kumar Gala
2005-05-05 16:29 ` Tom Rini
2005-05-06 14:44 ` Segher Boessenkool
2005-05-06 14:53 ` Tom Rini
2005-05-06 15:28 ` Segher Boessenkool
2005-05-06 15:34 ` Tom Rini
2005-05-06 15:47 ` Kumar Gala
2005-05-05 12:12 ` Dan Malek
2005-05-04 13:45 ` Kumar Gala
2005-05-04 15:28 ` Tom Rini
2005-07-03 17:29 ` Olaf Hering
2005-07-03 18:32 ` Tom Rini
2005-07-05 18:14 ` Olaf Hering
2005-07-05 19:47 ` Tom Rini
2005-07-05 19:54 ` Olaf Hering
2005-07-05 19:58 ` Tom Rini
2005-07-05 20:17 ` Olaf Hering
2005-07-05 20:27 ` Olaf Hering
2005-07-05 21:22 ` Tom Rini
2005-07-06 6:38 ` Olaf Hering
2006-04-02 19:40 ` Olaf Hering
2006-04-06 4:37 ` Paul Mackerras
2006-04-11 18:42 ` Olaf Hering
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).