Skip to contentSkip to conversation

vmcoreinfo: make hwerr_data visible for debugging

PATCH Superseded Breno Leitao 2 participants 3 messages Jan 21 – Jan 22

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vmcoreinfo: make hwerr_data visible for debugging

If the kernel is compiled with LTO, hwerr_data symbol might be lost, and vmcoreinfo doesn't have it dumped. This is currently seen in some production kernels with LTO enabled.

Remove the static qualifier from hwerr_data so that the information is still preserved when the kernel is built with LTO. Making hwerr_data a global symbol ensures its debug info survives the LTO link process and appears in kallsyms.

---
 kernel/vmcore_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/vmcore_info.c +1 -1
index 22b3205dd4dc5..1f42818f77cef 100644
@@ -36,7 +36,7 @@ struct hwerr_info {
 	time64_t timestamp;
 };
 
-static struct hwerr_info hwerr_data[HWERR_RECOV_MAX];
+struct hwerr_info hwerr_data[HWERR_RECOV_MAX];
 
 Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
 			  void *data, size_t data_len)

---
base-commit: 053966c344dbd346e71305f530e91ea77916189f
change-id: 20260121-fix_vmcoreinfo-01592f705a77

Best regards,

Signature · 1 line
Breno Leitao <[email protected]>
#1 lore raw
Quoted 13 lines · On Wed, 21 Jan 2026 03:05:44 -0800 Breno Leitao <[email protected]> wrote:

If the kernel is compiled with LTO, hwerr_data symbol might be lost, and vmcoreinfo doesn't have it dumped. This is currently seen in some production kernels with LTO enabled.

Remove the static qualifier from hwerr_data so that the information is still preserved when the kernel is built with LTO. Making hwerr_data a global symbol ensures its debug info survives the LTO link process and appears in kallsyms.

kernel/vmcore_info.c struct hwerr_info { · line 42

Quoted 8 lines
kernel/vmcore_info.c +1 -1
@@ -36,7 +36,7 @@ struct hwerr_info {
 	time64_t timestamp;
 };
 
-static struct hwerr_info hwerr_data[HWERR_RECOV_MAX];
+struct hwerr_info hwerr_data[HWERR_RECOV_MAX];
 
 Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
 			  void *data, size_t data_len)

A non-static symbol which has no external references will be made static again by those who like to send in little fixups. A comment will help prevent that. How's this?

kernel/vmcore_info.c renamed from kernel/vmcore_info.c~vmcoreinfo-make-hwerr_data-visible-for-debugging-fix +1 -0
@@ -36,6 +36,7 @@ struct hwerr_info {
 	time64_t timestamp;
 };
 
+/* hwerr_data[] has global scope to make it available in vmcoreinfo under LTO */
 struct hwerr_info hwerr_data[HWERR_RECOV_MAX];
 
 Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,

_

#2 lore raw

Hello Andrew,

Quoted 20 lines · Andrew Morton
Quoted 18 lines · On Wed, 21 Jan 2026 03:05:44 -0800 Breno Leitao <[email protected]> wrote:

If the kernel is compiled with LTO, hwerr_data symbol might be lost, and vmcoreinfo doesn't have it dumped. This is currently seen in some production kernels with LTO enabled.

Remove the static qualifier from hwerr_data so that the information is still preserved when the kernel is built with LTO. Making hwerr_data a global symbol ensures its debug info survives the LTO link process and appears in kallsyms.

kernel/vmcore_info.c +1 -1
@@ -36,7 +36,7 @@ struct hwerr_info {
 	time64_t timestamp;
 };
 
-static struct hwerr_info hwerr_data[HWERR_RECOV_MAX];
+struct hwerr_info hwerr_data[HWERR_RECOV_MAX];
 
Quoted 7 lines

kernel/vmcore_info.c struct hwerr_info { · line 42

Quoted 3 lines
kernel/vmcore_info.c +0 -0
 Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
 			  void *data, size_t data_len)

A non-static symbol which has no external references will be made static again by those who like to send in little fixups. A comment will help prevent that. How's this?

very good point, I will update.

Thanks
--breno