Skip to contentSkip to conversation

xserver_xorg-server: use -O2 build optimization level

PATCH New Gustavo Zacarias 3 participants 6 messages May 6, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xserver_xorg-server: use -O2 build optimization level

The xorg server is somewhat sensitive to certain gcc versions combined with -Os, particularly for ARM and MIPS, typically in the form of the following symptom/error:

(EE) Segmentation fault at address 0x0
(EE)
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting

Force -O2 to work around this problem - for a target rootfs that uses X11 the tradeoff is minimal since a sample/test image for qemu vexpress with X11 + xinit + xterm + twm + xclock + gtk2 with demos is 60+ MB.

And it's less complicated than trying to find all of the bad combinations.

---
 package/x11r7/xserver_xorg-server/xserver_xorg-server.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/x11r7/xserver_xorg-server/xserver_xorg-server.mk +1 -1
index 617bcbc..9de6d91 100644
@@ -62,7 +62,7 @@ XSERVER_XORG_SERVER_CONF_OPTS = \
 	--disable-xephyr \
 	--disable-dmx \
 	--with-builder-addr=buildroot at buildroot.org \
-	CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/pixman-1" \
+	CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/pixman-1 -O2" \
 	--with-fontrootdir=/usr/share/fonts/X11/ \
 	--$(if $(BR2_PACKAGE_XSERVER_XORG_SERVER_XVFB),en,dis)able-xvfb
 
Signature · 1 line
2.7.3
#1 lore raw

PATCH 1/1 xserver_xorg-server: use -O2 build optimization level

Hello Gustavo,

Quoted 26 lines · Gustavo Zacarias

The xorg server is somewhat sensitive to certain gcc versions combined with -Os, particularly for ARM and MIPS, typically in the form of the following symptom/error:

(EE) Segmentation fault at address 0x0
(EE)
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting

Force -O2 to work around this problem - for a target rootfs that uses X11 the tradeoff is minimal since a sample/test image for qemu vexpress with X11 + xinit + xterm + twm + xclock + gtk2 with demos is 60+ MB.

And it's less complicated than trying to find all of the bad combinations.

---
 package/x11r7/xserver_xorg-server/xserver_xorg-server.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/x11r7/xserver_xorg-server/xserver_xorg-server.mk +0 -0
index 617bcbc..9de6d91 100644

package/x11r7/xserver_xorg-server/xserver_xorg-server.mk XSERVER_XORG_SERVER_CONF_OPTS = \ · line 68

Quoted 8 lines
package/x11r7/xserver_xorg-server/xserver_xorg-server.mk +1 -1
@@ -62,7 +62,7 @@ XSERVER_XORG_SERVER_CONF_OPTS = \
 	--disable-xephyr \
 	--disable-dmx \
 	--with-builder-addr=buildroot at buildroot.org \
-	CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/pixman-1" \
+	CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/pixman-1 -O2" \
 	--with-fontrootdir=/usr/share/fonts/X11/ \
 	--$(if $(BR2_PACKAGE_XSERVER_XORG_SERVER_XVFB),en,dis)able-xvfb
 

Thanks for the patch, will surely improve the 'out of the box' usability of buildroot, but I would prefer a 'blacklist' of known failing combinations and simply disable xserver (with comment why) in this case(s), the only know to me is RPi1:

BR2_ARCH="arm"
BR2_GCC_TARGET_CPU="arm1176jzf-s"
BR2_OPTIMIZE_S=y

The perfect solution would be a fix for gcc (and/or xserver)...

Regards,
Peter

#2 lore raw

PATCH 1/1 xserver_xorg-server: use -O2 build optimization level

Quoted 43 lines · Peter Seiderer

Hello Gustavo,

Quoted 26 lines · Gustavo Zacarias

The xorg server is somewhat sensitive to certain gcc versions combined with -Os, particularly for ARM and MIPS, typically in the form of the following symptom/error:

(EE) Segmentation fault at address 0x0
(EE)
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting

Force -O2 to work around this problem - for a target rootfs that uses X11 the tradeoff is minimal since a sample/test image for qemu vexpress with X11 + xinit + xterm + twm + xclock + gtk2 with demos is 60+ MB.

And it's less complicated than trying to find all of the bad combinations.

---
 package/x11r7/xserver_xorg-server/xserver_xorg-server.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/x11r7/xserver_xorg-server/xserver_xorg-server.mk +0 -0
index 617bcbc..9de6d91 100644

package/x11r7/xserver_xorg-server/xserver_xorg-server.mk XSERVER_XORG_SERVER_CONF_OPTS = \ · line 68

Quoted 8 lines
package/x11r7/xserver_xorg-server/xserver_xorg-server.mk +1 -1
@@ -62,7 +62,7 @@ XSERVER_XORG_SERVER_CONF_OPTS = \
 	--disable-xephyr \
 	--disable-dmx \
 	--with-builder-addr=buildroot at buildroot.org \
-	CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/pixman-1" \
+	CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/pixman-1 -O2" \
 	--with-fontrootdir=/usr/share/fonts/X11/ \
 	--$(if $(BR2_PACKAGE_XSERVER_XORG_SERVER_XVFB),en,dis)able-xvfb
 

Thanks for the patch, will surely improve the 'out of the box' usability of buildroot, but I would prefer a 'blacklist' of known failing combinations and simply disable xserver (with comment why) in this case(s), the only know to me is RPi1:

Quoted 4 lines

BR2_ARCH="arm"
BR2_GCC_TARGET_CPU="arm1176jzf-s"
BR2_OPTIMIZE_S=y

The original post [1] was about RPi2, so two known failing combinations ;-)

Curious if its the same failure location as for RPi1 (see [2]), anyone with RPi2 hardware who could try to run with debug info enabled (and/or the reduced test case from the bug report)?

Regards,
Peter

[1] http://lists.busybox.net/pipermail/buildroot/2016-May/160491.html
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63346

Quoted 8 lines

The perfect solution would be a fix for gcc (and/or xserver)...

Regards,
Peter
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

PATCH 1/1 xserver_xorg-server: use -O2 build optimization level

In reply to Peter Seiderer
Quoted 4 lines · Peter Seiderer

Thanks for the patch, will surely improve the 'out of the box' usability of buildroot, but I would prefer a 'blacklist' of known failing combinations and simply disable xserver (with comment why) in this case(s), the only know to me is RPi1:

Quoted 8 lines
   BR2_ARCH="arm"
   BR2_GCC_TARGET_CPU="arm1176jzf-s"
   BR2_OPTIMIZE_S=y

The perfect solution would be a fix for gcc (and/or xserver)...

Regards,
Peter

Hi Peter.
Isn't that a bit harsh?
I'm not 100% comfortable with this solution either, however blacklisting xorg will be messy to put it lightly.
Also finding the failing combinations will not be simple - it seems ARM in general is affected on several toolchain combinations, as is MIPS as well (both tested in Qemu) - so it goes beyond some particular platforms. Another alternative could be finding the exact gcc option that's causing it diffing the output of --help=optimizers and trying enabling/disabling one by one until it's fixed or fails since this would probably help pinpoint the precise optimizations that's causing it (which would in turn help in making a minimal test case to help upstream). Regards.

#4 lore raw

PATCH 1/1 xserver_xorg-server: use -O2 build optimization level

Hello Gustavo,

Quoted 10 lines · Gustavo Zacarias
Quoted 8 lines · Peter Seiderer

Thanks for the patch, will surely improve the 'out of the box' usability of buildroot, but I would prefer a 'blacklist' of known failing combinations and simply disable xserver (with comment why) in this case(s), the only know to me is RPi1:

   BR2_ARCH="arm"
   BR2_GCC_TARGET_CPU="arm1176jzf-s"
   BR2_OPTIMIZE_S=y
Quoted 7 lines
Quoted 4 lines

The perfect solution would be a fix for gcc (and/or xserver)...

Regards,
Peter

Hi Peter.
Isn't that a bit harsh?

Ups, sorry, apologize for my wrong/misleading wording, was not meant so...

Quoted 2 lines

I'm not 100% comfortable with this solution either, however blacklisting xorg will be messy to put it lightly.

Yes, did not catch it that more than one combination is affected (thought it was only RPi1....until sending the first e-mail, and only afterward registered the original post was about RPi2...

Quoted 3 lines

Also finding the failing combinations will not be simple - it seems ARM in general is affected on several toolchain combinations, as is MIPS as well (both tested in Qemu) - so it goes beyond some particular platforms.

Mind to share your configs and test commands (specially the MIPS one)?

Quoted 6 lines

Another alternative could be finding the exact gcc option that's causing it diffing the output of --help=optimizers and trying enabling/disabling one by one until it's fixed or fails since this would probably help pinpoint the precise optimizations that's causing it (which would in turn help in making a minimal test case to help upstream). Regards.

Thanks for the suggestion, will try it with a test case...

Regards,
Peter

#5 lore raw

PATCH 1/1 xserver_xorg-server: use -O2 build optimization level

In reply to Gustavo Zacarias

Hello,

Quoted 13 lines · Gustavo Zacarias

The xorg server is somewhat sensitive to certain gcc versions combined with -Os, particularly for ARM and MIPS, typically in the form of the following symptom/error:

(EE) Segmentation fault at address 0x0
(EE)
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting

Force -O2 to work around this problem - for a target rootfs that uses X11 the tradeoff is minimal since a sample/test image for qemu vexpress with X11 + xinit + xterm + twm + xclock + gtk2 with demos is 60+ MB.

Quoted 7 lines

And it's less complicated than trying to find all of the bad combinations.

---
 package/x11r7/xserver_xorg-server/xserver_xorg-server.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

I've added a comment in the .mk file that explains why we are forcing -O2, and a reference to the Bugzilla bug that this is fixing. Applied with those changes. Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com