All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] powerpc/boot: Build wrapper with optimisations
@ 2018-10-10  2:45 Joel Stanley
  2018-10-10  2:45 ` [PATCH 1/2] powerpc/boot: Disable vector instructions Joel Stanley
  2018-10-10  2:45 ` [PATCH 2/2] powerpc/boot: Build boot wrapper with optimisations Joel Stanley
  0 siblings, 2 replies; 8+ messages in thread
From: Joel Stanley @ 2018-10-10  2:45 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Oliver O'Halloran

We currently build the wrapper with Os. This builds it with O2 instead,
reducing boot time when decompressing a compressed kernel. See patch
2 for details.

I've given this a spin with CONFIG_KERNEL_XZ on P9 and P8 as the
petitboot kernel.

Joel Stanley (2):
  powerpc/boot: Disable vector instructions
  powerpc/boot: Build boot wrapper with optimisations

 arch/powerpc/boot/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] powerpc/boot: Disable vector instructions
  2018-10-10  2:45 [PATCH 0/2] powerpc/boot: Build wrapper with optimisations Joel Stanley
@ 2018-10-10  2:45 ` Joel Stanley
  2018-10-10 12:11   ` Michael Ellerman
  2018-10-15  4:01   ` [1/2] " Michael Ellerman
  2018-10-10  2:45 ` [PATCH 2/2] powerpc/boot: Build boot wrapper with optimisations Joel Stanley
  1 sibling, 2 replies; 8+ messages in thread
From: Joel Stanley @ 2018-10-10  2:45 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Oliver O'Halloran

This will avoid auto-vectorisation when building with higher
optimisation levels.

We don't know if the machine can support VSX and even if it's present
it's probably not going to be enabled at this point in boot.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 arch/powerpc/boot/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 0fb96c26136f..739ef8d43b91 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -32,8 +32,8 @@ else
 endif
 
 BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-		 -fno-strict-aliasing -Os -msoft-float -pipe \
-		 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
+		 -fno-strict-aliasing -Os -msoft-float -mno-altivec -mno-vsx \
+		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
 		 -D$(compress-y)
 
 ifdef CONFIG_PPC64_BOOT_WRAPPER
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] powerpc/boot: Build boot wrapper with optimisations
  2018-10-10  2:45 [PATCH 0/2] powerpc/boot: Build wrapper with optimisations Joel Stanley
  2018-10-10  2:45 ` [PATCH 1/2] powerpc/boot: Disable vector instructions Joel Stanley
@ 2018-10-10  2:45 ` Joel Stanley
  1 sibling, 0 replies; 8+ messages in thread
From: Joel Stanley @ 2018-10-10  2:45 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Oliver O'Halloran

The boot wrapper is currently built with -Os. By building with O2 we
can meaningfully reduce the time decompressing the kernel.

I tested by comparing 10 runs of each option in Qemu and on hardware.
The kernel is compressed with KERNEL_XZ built with GCC 8.2.0-7ubuntu1.
The values are counts of the timebase.

Qemu TCG powernv Power8:

              Os            O2            O3
 median       10221123889   6201518438    6568186825
 stddev        1361267211    429090641     657930076
 improvement                    39.33%        35.74%

Palmetto Power8:

              Os            O2            O3
 median           50279         50599          35790
 stddev       992144533     627130655      623721078
 improvement                   36.79%         37.13%

Romulus Power9:

              Os            O2            O3
 median       670312391     454733720      448881398
 stddev          157569        107276         108760
 improvement                   32.16%         33.03%

TCG was quite noisy, with every few runs producing an outlier. Even so,
O2 is faster than O3. On hardware the numbers were less noisy and O3 is
slightly faster than O2.

The wrapper size increases when moving from Os. Comparing zImage.epapr
to the existing Os build using bloat-o-meter:

  Before=43401, After=56837 (13KB), chg +30.96%
  Before=43401, After=64305 (20KB), chg +48.16%

I chose O2 for a balance between Qemu and hardware speed up.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 arch/powerpc/boot/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 739ef8d43b91..c6c5a1a6627d 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -32,7 +32,7 @@ else
 endif
 
 BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-		 -fno-strict-aliasing -Os -msoft-float -mno-altivec -mno-vsx \
+		 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
 		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
 		 -D$(compress-y)
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc/boot: Disable vector instructions
  2018-10-10  2:45 ` [PATCH 1/2] powerpc/boot: Disable vector instructions Joel Stanley
@ 2018-10-10 12:11   ` Michael Ellerman
  2018-10-10 21:52     ` Joel Stanley
  2018-10-15  4:01   ` [1/2] " Michael Ellerman
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Ellerman @ 2018-10-10 12:11 UTC (permalink / raw)
  To: Joel Stanley, linuxppc-dev; +Cc: Oliver O'Halloran

Joel Stanley <joel@jms.id.au> writes:

> This will avoid auto-vectorisation when building with higher
> optimisation levels.
>
> We don't know if the machine can support VSX and even if it's present
> it's probably not going to be enabled at this point in boot.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  arch/powerpc/boot/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index 0fb96c26136f..739ef8d43b91 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -32,8 +32,8 @@ else
>  endif
>  
>  BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
> -		 -fno-strict-aliasing -Os -msoft-float -pipe \
> -		 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
> +		 -fno-strict-aliasing -Os -msoft-float -mno-altivec -mno-vsx \

That's going to break if the compiler doesn't understand -mno-vsx isn't it?

I'm not sure if "support" a compiler that old though.

cheers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc/boot: Disable vector instructions
  2018-10-10 12:11   ` Michael Ellerman
@ 2018-10-10 21:52     ` Joel Stanley
  2018-10-10 22:05       ` Segher Boessenkool
  0 siblings, 1 reply; 8+ messages in thread
From: Joel Stanley @ 2018-10-10 21:52 UTC (permalink / raw)
  To: Michael Ellerman, Segher Boessenkool; +Cc: Oliver O'Halloran, linuxppc-dev

On Wed, 10 Oct 2018 at 22:41, Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> Joel Stanley <joel@jms.id.au> writes:
>
> > This will avoid auto-vectorisation when building with higher
> > optimisation levels.
> >
> > We don't know if the machine can support VSX and even if it's present
> > it's probably not going to be enabled at this point in boot.
> >
> > Signed-off-by: Joel Stanley <joel@jms.id.au>
> > ---
> >  arch/powerpc/boot/Makefile | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> > index 0fb96c26136f..739ef8d43b91 100644
> > --- a/arch/powerpc/boot/Makefile
> > +++ b/arch/powerpc/boot/Makefile
> > @@ -32,8 +32,8 @@ else
> >  endif
> >
> >  BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
> > -              -fno-strict-aliasing -Os -msoft-float -pipe \
> > -              -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
> > +              -fno-strict-aliasing -Os -msoft-float -mno-altivec -mno-vsx \
>
> That's going to break if the compiler doesn't understand -mno-vsx isn't it?
>
> I'm not sure if "support" a compiler that old though.

Segher, the kernel mandates 4.6 as the minimum. Do we need to worry
about the compiler not supporting  -mno-altivec -mno-vsx?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc/boot: Disable vector instructions
  2018-10-10 21:52     ` Joel Stanley
@ 2018-10-10 22:05       ` Segher Boessenkool
  2018-10-10 23:59         ` Michael Ellerman
  0 siblings, 1 reply; 8+ messages in thread
From: Segher Boessenkool @ 2018-10-10 22:05 UTC (permalink / raw)
  To: Joel Stanley; +Cc: Oliver O'Halloran, linuxppc-dev

On Thu, Oct 11, 2018 at 08:22:54AM +1030, Joel Stanley wrote:
> On Wed, 10 Oct 2018 at 22:41, Michael Ellerman <mpe@ellerman.id.au> wrote:
> > Joel Stanley <joel@jms.id.au> writes:
> > >  BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
> > > -              -fno-strict-aliasing -Os -msoft-float -pipe \
> > > -              -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
> > > +              -fno-strict-aliasing -Os -msoft-float -mno-altivec -mno-vsx \
> >
> > That's going to break if the compiler doesn't understand -mno-vsx isn't it?
> >
> > I'm not sure if "support" a compiler that old though.
> 
> Segher, the kernel mandates 4.6 as the minimum. Do we need to worry
> about the compiler not supporting  -mno-altivec -mno-vsx?

-mvsx is gcc 4.5 and later.
https://www.gnu.org/software/gcc/gcc-4.5/changes.html

-maltivec is...  Hrm, not so easy to find...  gcc 3.1 and later it seems.
https://www.gnu.org/software/gcc/gcc-3.1/changes.html

You should be fine.


Segher

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc/boot: Disable vector instructions
  2018-10-10 22:05       ` Segher Boessenkool
@ 2018-10-10 23:59         ` Michael Ellerman
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2018-10-10 23:59 UTC (permalink / raw)
  To: Segher Boessenkool, Joel Stanley; +Cc: Oliver O'Halloran, linuxppc-dev

Segher Boessenkool <segher@kernel.crashing.org> writes:
> On Thu, Oct 11, 2018 at 08:22:54AM +1030, Joel Stanley wrote:
>> On Wed, 10 Oct 2018 at 22:41, Michael Ellerman <mpe@ellerman.id.au> wrote:
>> > Joel Stanley <joel@jms.id.au> writes:
>> > >  BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
>> > > -              -fno-strict-aliasing -Os -msoft-float -pipe \
>> > > -              -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
>> > > +              -fno-strict-aliasing -Os -msoft-float -mno-altivec -mno-vsx \
>> >
>> > That's going to break if the compiler doesn't understand -mno-vsx isn't it?
>> >
>> > I'm not sure if "support" a compiler that old though.
>> 
>> Segher, the kernel mandates 4.6 as the minimum. Do we need to worry
>> about the compiler not supporting  -mno-altivec -mno-vsx?
>
> -mvsx is gcc 4.5 and later.
> https://www.gnu.org/software/gcc/gcc-4.5/changes.html
>
> -maltivec is...  Hrm, not so easy to find...  gcc 3.1 and later it seems.
> https://www.gnu.org/software/gcc/gcc-3.1/changes.html

Thanks.

cheers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [1/2] powerpc/boot: Disable vector instructions
  2018-10-10  2:45 ` [PATCH 1/2] powerpc/boot: Disable vector instructions Joel Stanley
  2018-10-10 12:11   ` Michael Ellerman
@ 2018-10-15  4:01   ` Michael Ellerman
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2018-10-15  4:01 UTC (permalink / raw)
  To: Joel Stanley, linuxppc-dev; +Cc: Oliver O'Halloran

On Wed, 2018-10-10 at 02:45:22 UTC, Joel Stanley wrote:
> This will avoid auto-vectorisation when building with higher
> optimisation levels.
> 
> We don't know if the machine can support VSX and even if it's present
> it's probably not going to be enabled at this point in boot.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/e8e132e6885962582784b6fa16a80d

cheers

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-10-15  4:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10  2:45 [PATCH 0/2] powerpc/boot: Build wrapper with optimisations Joel Stanley
2018-10-10  2:45 ` [PATCH 1/2] powerpc/boot: Disable vector instructions Joel Stanley
2018-10-10 12:11   ` Michael Ellerman
2018-10-10 21:52     ` Joel Stanley
2018-10-10 22:05       ` Segher Boessenkool
2018-10-10 23:59         ` Michael Ellerman
2018-10-15  4:01   ` [1/2] " Michael Ellerman
2018-10-10  2:45 ` [PATCH 2/2] powerpc/boot: Build boot wrapper with optimisations Joel Stanley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.