Skip to contentSkip to conversation

purgatory: do not enable vectorization automatically for purgatory compiling

PATCH Superseded Baoquan He 2 participants 4 messages Mar 29, 2022 – Mar 30, 2022

Subsystems (2)
lore
Share & tools
lore

Baoquan He

author
#0 lore raw

PATCH 1/1 purgatory: do not enable vectorization automatically for purgatory compiling

Redhat CKI reported kdump kernel will hang a while very early after crash triggered, then reset to firmware to reboot.

This failure can only be observed with kdump or kexec reboot via kexec_load system call. With kexec_file_load interface, both kdump and kexec reboot work very well. And further investigation shows that gcc version 11 doesn't have this issue, while gcc version 12 does.

After checking the release notes of the latest gcc, Dave found out it's because gcc 12 enables auto-vectorization for -O2 optimization level. Please see below link for more information:

https://www.phoronix.com/scan.php?page=news_item&px=GCC-12-Auto-Vec-O2

Adding -fno-tree-vectorize to Makefile of purgatory can fix the issue.

---
 purgatory/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
purgatory/Makefile +1 -1
index 49ce80a638b2..9e04a5b0ef93 100644
@@ -49,7 +49,7 @@ $(PURGATORY): CFLAGS+=$(PURGATORY_EXTRA_CFLAGS) \
 		      $($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
 		      -Os -fno-builtin -ffreestanding \
 		      -fno-zero-initialized-in-bss \
-		      -fno-PIC -fno-PIE -fno-stack-protector
+		      -fno-PIC -fno-PIE -fno-stack-protector -fno-tree-vectorize
 
 $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
 			-I$(srcdir)/purgatory/include \
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/1 purgatory: do not enable vectorization automatically for purgatory compiling

Redhat CKI reported kdump kernel will hang a while very early after crash triggered, then reset to firmware to reboot.

This failure can only be observed with kdump or kexec reboot via kexec_load system call. With kexec_file_load interface, both kdump and kexec reboot work very well. And further investigation shows that gcc version 11 doesn't have this issue, while gcc version 12 does.

After checking the release notes of the latest gcc, Dave found out it's because gcc 12 enables auto-vectorization for -O2 optimization level. Please see below link for more information:

https://www.phoronix.com/scan.php?page=news_item&px=GCC-12-Auto-Vec-O2

Adding -fno-tree-vectorize to Makefile of purgatory can fix the issue.

---
v1->v2:
Rebase code change on latest master branch since v1 code was made on my local branch based on an old release version of kexec-tools.

 purgatory/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
purgatory/Makefile +1 -1
index 2dd6c476889e..15adb120e54a 100644
@@ -49,7 +49,7 @@ $(PURGATORY): CFLAGS=$(PURGATORY_EXTRA_CFLAGS) \
 		      $($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
 		      -Os -fno-builtin -ffreestanding \
 		      -fno-zero-initialized-in-bss \
-		      -fno-PIC -fno-PIE -fno-stack-protector
+		      -fno-PIC -fno-PIE -fno-stack-protector -fno-tree-vectorize
 
 $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
 			-I$(srcdir)/purgatory/include \
Signature · 1 line
2.34.1
Applied
#2 lore raw

PATCH v2 1/1 purgatory: do not enable vectorization automatically for purgatory compiling

Quoted 12 lines · Baoquan He

Redhat CKI reported kdump kernel will hang a while very early after crash triggered, then reset to firmware to reboot.

This failure can only be observed with kdump or kexec reboot via kexec_load system call. With kexec_file_load interface, both kdump and kexec reboot work very well. And further investigation shows that gcc version 11 doesn't have this issue, while gcc version 12 does.

After checking the release notes of the latest gcc, Dave found out it's because gcc 12 enables auto-vectorization for -O2 optimization level. Please see below link for more information:

Quoted 5 lines

https://www.phoronix.com/scan.php?page=news_item&px=GCC-12-Auto-Vec-O2

Adding -fno-tree-vectorize to Makefile of purgatory can fix the issue.

Thanks, applied.

author
#3 lore raw

PATCH v2 1/1 purgatory: do not enable vectorization automatically for purgatory compiling

Quoted 13 lines · Simon Horman
Quoted 12 lines · Baoquan He

Redhat CKI reported kdump kernel will hang a while very early after crash triggered, then reset to firmware to reboot.

This failure can only be observed with kdump or kexec reboot via kexec_load system call. With kexec_file_load interface, both kdump and kexec reboot work very well. And further investigation shows that gcc version 11 doesn't have this issue, while gcc version 12 does.

After checking the release notes of the latest gcc, Dave found out it's because gcc 12 enables auto-vectorization for -O2 optimization level. Please see below link for more information:

Quoted 7 lines
Quoted 5 lines

https://www.phoronix.com/scan.php?page=news_item&px=GCC-12-Auto-Vec-O2

Adding -fno-tree-vectorize to Makefile of purgatory can fix the issue.

Thanks, applied.

Thanks, Simon.