Skip to contentSkip to conversation

systemd: fix strange behaviour on qemumips64

PATCH In review Chen Qi 3 participants 5 messages Oct 23, 2017 – Oct 26, 2017

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

cover systemd: fix strange behaviour on qemumips64

The following changes since commit 65d23bd7986615fdfb0f1717b615534a2a14ab80:

README.qemu: qemuppc64 is not supported (2017-10-16 23:54:31 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/bug12266
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/bug12266

Chen Qi (1):
systemd: fix strange behaviour on qemumips64

 meta/recipes-core/systemd/systemd_234.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/1 systemd: fix strange behaviour on qemumips64

On qemumips64, systemctl status <unit>' would have the output of systemctl show <unit>'. This is incorrect.

However, it's not the code logic that cause such problem. It's the compilation flags.

Looking back the history, we had problem with systemd on qemumips64 which is also related to compilation flags. We solved that by using tweaking FULL_OPTIMIZATION for mips64 to have "-fno-tree-switch-conversion -fno-tree-tail-merge".

Now systemd has been upgraded to 234, and we don't have the above problem any more. However, a new problem appears, and that is the output of `systemctl status <unit>'.

Hence, we set '-O0' flag for mips64 when building systemd to avoid potential strange problems.

[YOCTO #12266]

---
 meta/recipes-core/systemd/systemd_234.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/systemd/systemd_234.bb +2 -2
index 36fd3f8..b294604 100644
@@ -158,8 +158,8 @@ CFLAGS .= "${@bb.utils.contains('PACKAGECONFIG', 'valgrind', ' -DVALGRIND=1', ''
 # disable problematic GCC 5.2 optimizations [YOCTO #8291]
 FULL_OPTIMIZATION_append_arm = " -fno-schedule-insns -fno-schedule-insns2"
 
-# Avoid login failure on qemumips64 when pam is enabled
-FULL_OPTIMIZATION_append_mips64 = " -fno-tree-switch-conversion -fno-tree-tail-merge"
+# Disable optimization on qemumips64 to avoid strange behaviour
+FULL_OPTIMIZATION_append_mips64 = " -O0"
 
 COMPILER_NM ?= "${HOST_PREFIX}gcc-nm"
 COMPILER_AR ?= "${HOST_PREFIX}gcc-ar"
Signature · 1 line
1.9.1
#2 lore raw

Can we trust the mips64 compiler at all? Is there a specific optimisation that systemd is turning on that is causing this breakage? Have you reported this to the gcc bugzilla?

Ross

Quoted 54 lines · Chen Qi

On qemumips64, systemctl status <unit>' would have the output of systemctl show <unit>'. This is incorrect.

However, it's not the code logic that cause such problem. It's the compilation flags.

Looking back the history, we had problem with systemd on qemumips64 which is also related to compilation flags. We solved that by using tweaking FULL_OPTIMIZATION for mips64 to have "-fno-tree-switch-conversion -fno-tree-tail-merge".

Now systemd has been upgraded to 234, and we don't have the above problem any more. However, a new problem appears, and that is the output of `systemctl
status <unit>'.

Hence, we set '-O0' flag for mips64 when building systemd to avoid potential
strange problems.

[YOCTO #12266]

---
 meta/recipes-core/systemd/systemd_234.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/systemd/systemd_234.bb +0 -0
index 36fd3f8..b294604 100644
@@ -158,8 +158,8 @@ CFLAGS .= "${@bb.utils.contains('PACKAGECONFIG',

'valgrind', ' -DVALGRIND=1', ''

 # disable problematic GCC 5.2 optimizations [YOCTO #8291]
 FULL_OPTIMIZATION_append_arm = " -fno-schedule-insns -fno-schedule-insns2"
meta/recipes-core/systemd/systemd_234.bb +2 -4
-# Avoid login failure on qemumips64 when pam is enabled
-FULL_OPTIMIZATION_append_mips64 = " -fno-tree-switch-conversion
-fno-tree-tail-merge"
+# Disable optimization on qemumips64 to avoid strange behaviour
+FULL_OPTIMIZATION_append_mips64 = " -O0"
 
 COMPILER_NM ?= "${HOST_PREFIX}gcc-nm"
 COMPILER_AR ?= "${HOST_PREFIX}gcc-ar"
--

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw
Quoted 46 lines · Ross

Can we trust the mips64 compiler at all? Is there a specific optimisation that systemd is turning on that is causing this breakage? Have you reported this to the gcc bugzilla?

Ross

Quoted 39 lines · Chen Qi

On qemumips64, systemctl status <unit>' would have the output of systemctl show <unit>'. This is incorrect.

However, it's not the code logic that cause such problem. It's the compilation flags.

Looking back the history, we had problem with systemd on qemumips64 which is also related to compilation flags. We solved that by using tweaking FULL_OPTIMIZATION for mips64 to have "-fno-tree-switch-conversion -fno-tree-tail-merge".

Now systemd has been upgraded to 234, and we don't have the above problem any more. However, a new problem appears, and that is the output of `systemctl
status <unit>'.

Hence, we set '-O0' flag for mips64 when building systemd to avoid potential
strange problems.

[YOCTO #12266]

---
 meta/recipes-core/systemd/systemd_234.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/systemd/systemd_234.bb +0 -0
index 36fd3f8..b294604 100644
@@ -158,8 +158,8 @@ CFLAGS .= "${@bb.utils.contains('PACKAGECONFIG',

'valgrind', ' -DVALGRIND=1', ''

 # disable problematic GCC 5.2 optimizations [YOCTO #8291]
 FULL_OPTIMIZATION_append_arm = " -fno-schedule-insns
-fno-schedule-insns2"
Quoted 6 lines

meta/recipes-core/systemd/systemd_234.bb CFLAGS .= "${@bb.utils.contains('PACKAGECONFIG', 'valgrind', ' -DVALGRIND=1', '' · line 162

Quoted 6 lines
meta/recipes-core/systemd/systemd_234.bb +2 -3
-# Avoid login failure on qemumips64 when pam is enabled
-FULL_OPTIMIZATION_append_mips64 = " -fno-tree-switch-conversion
-fno-tree-tail-merge"
+# Disable optimization on qemumips64 to avoid strange behaviour
+FULL_OPTIMIZATION_append_mips64 = " -O0"

I think we need a narrowed-down case may be a opt pass which is causing the problem. reduce the opt level to -O0 will pessimise the code and impact the performance.

Firstly, try to use normal -O2 and remove disabling tree-switch-conversion and tail call disable.

Quoted 19 lines
Quoted 10 lines

COMPILER_NM ?= "${HOST_PREFIX}gcc-nm"
COMPILER_AR ?= "${HOST_PREFIX}gcc-ar"
--
1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

author
#4 lore raw
Quoted 56 lines · Khem Raj
Quoted 45 lines · Ross

Can we trust the mips64 compiler at all? Is there a specific optimisation that systemd is turning on that is causing this breakage? Have you reported this to the gcc bugzilla?

Ross

Quoted 38 lines · Chen Qi

On qemumips64, systemctl status <unit>' would have the output of systemctl show <unit>'. This is incorrect.

However, it's not the code logic that cause such problem. It's the compilation flags.

Looking back the history, we had problem with systemd on qemumips64 which is also related to compilation flags. We solved that by using tweaking FULL_OPTIMIZATION for mips64 to have "-fno-tree-switch-conversion -fno-tree-tail-merge".

Now systemd has been upgraded to 234, and we don't have the above problem any more. However, a new problem appears, and that is the output of `systemctl
status <unit>'.

Hence, we set '-O0' flag for mips64 when building systemd to avoid potential
strange problems.

[YOCTO #12266]

---
  meta/recipes-core/systemd/systemd_234.bb | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/systemd/systemd_234.bb +0 -0
index 36fd3f8..b294604 100644
@@ -158,8 +158,8 @@ CFLAGS .= "${@bb.utils.contains('PACKAGECONFIG',

'valgrind', ' -DVALGRIND=1', ''

  # disable problematic GCC 5.2 optimizations [YOCTO #8291]
  FULL_OPTIMIZATION_append_arm = " -fno-schedule-insns
-fno-schedule-insns2"
Quoted 6 lines

meta/recipes-core/systemd/systemd_234.bb CFLAGS .= "${@bb.utils.contains('PACKAGECONFIG', 'valgrind', ' -DVALGRIND=1', '' · line 162

Quoted 6 lines
meta/recipes-core/systemd/systemd_234.bb +2 -3
-# Avoid login failure on qemumips64 when pam is enabled
-FULL_OPTIMIZATION_append_mips64 = " -fno-tree-switch-conversion
-fno-tree-tail-merge"
+# Disable optimization on qemumips64 to avoid strange behaviour
+FULL_OPTIMIZATION_append_mips64 = " -O0"

I think we need a narrowed-down case may be a opt pass which is causing the problem. reduce the opt level to -O0 will pessimise the code and impact the performance.

Quoted 2 lines

Firstly, try to use normal -O2 and remove disabling tree-switch-conversion and tail call disable.

Hi Ross & Khem,

I did some more tests today. Below is the result.

I wanted to narrow down the option, but things went strange.

With '-O0', we don't have this problem.
With '-O1', the problem could be reproduced.
The strangest thing is that when using '-O0' and other optimizations that O1 enables compared to O0, the problem cannot be reproduced. In theory, as '-O1' = '-O0' + <other optimizations>, the problem should be reproduced when using '-O0' + <other optimizations'. But in fact, it's not reproduced. I'm referring to https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html.

Regarding gcc flags turned on by systemd, I can confirm that when using '-O1' and '-O0', the options are the same.

Best Regards,
Chen Qi

Quoted 18 lines
Quoted 18 lines
Quoted 10 lines

COMPILER_NM ?= "${HOST_PREFIX}gcc-nm"
COMPILER_AR ?= "${HOST_PREFIX}gcc-ar"
--
1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core