vmcoreinfo: make hwerr_data visible for debugging
PATCH v2 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. Also document it, so, it doesn't get removed in the future as suggested by akpm.
---
Changes in v2:
- Add a comment to explain why the array is global (akpm)
- Link to v1: https://patch.msgid.link/[email protected]
--- kernel/vmcore_info.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/vmcore_info.c +5 -1
@@ -36,7 +36,11 @@ struct hwerr_info {time64_t timestamp; }; -static struct hwerr_info hwerr_data[HWERR_RECOV_MAX ]; +/* +* The hwerr_data[] array is declared with global scope so that it remains +* accessible to vmcoreinfo even when Link Time Optimization (LTO) is enabled. +*/ +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]>
Quoted 10 lines · Breno Leitao
If the kernel is compiled with LTO,
hwerr_datasymbol 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_dataso that the information is still preserved when the kernel is built with LTO. Makinghwerr_dataa global symbol ensures its debug info survives the LTO link process and appears in kallsyms. Also document it, so, it doesn't get removed in the future as suggested by akpm.
Quoted 8 lines
Signed-off-by Breno Leitao <[email protected]>---
Changes in v2:
- Add a comment to explain why the array is global (akpm)
- Link to v1: https://patch.msgid.link/[email protected]--- kernel/vmcore_info.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
LGTM,
BTW, is it worth a 'Fixes' tag?
Quoted 27 lines
kernel/vmcore_info.c +5
-2@@ -36,7 +36,11 @@ struct hwerr_info {time64_t timestamp; }; -static struct hwerr_info hwerr_data[HWERR_RECOV_MAX ]; +/* +* The hwerr_data[] array is declared with global scope so that it remains +* accessible to vmcoreinfo even when Link Time Optimization (LTO) is enabled. +*/ +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-01592f705a77Best regards,
Signature · 1 line
Breno Leitao <[email protected]>
Hello Baoquan,
Quoted 20 lines · Baoquan He
Quoted 10 lines · Breno Leitao
If the kernel is compiled with LTO,
hwerr_datasymbol 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_dataso that the information is still preserved when the kernel is built with LTO. Makinghwerr_dataa global symbol ensures its debug info survives the LTO link process and appears in kallsyms. Also document it, so, it doesn't get removed in the future as suggested by akpm.Quoted 8 lines
Signed-off-by Breno Leitao <[email protected]>---
Changes in v2:
- Add a comment to explain why the array is global (akpm)
- Link to v1: https://patch.msgid.link/[email protected]--- kernel/vmcore_info.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Quoted 5 lines
LGTM,
Acked-by Baoquan He <[email protected]>BTW, is it worth a 'Fixes' tag?
I am not sure, but, if we prefer to, this is the correct tag:
Thanks for the review,
--breno
Quoted 25 lines · On Fri, 23 Jan 2026 01:24:17 -0800 Breno Leitao <[email protected]> wrote:
Hello Baoquan,
Quoted 22 lines · Baoquan He
Quoted 10 lines · Breno Leitao
If the kernel is compiled with LTO,
hwerr_datasymbol 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_dataso that the information is still preserved when the kernel is built with LTO. Makinghwerr_dataa global symbol ensures its debug info survives the LTO link process and appears in kallsyms. Also document it, so, it doesn't get removed in the future as suggested by akpm.Quoted 8 lines
Signed-off-by Breno Leitao <[email protected]>---
Changes in v2:
- Add a comment to explain why the array is global (akpm)
- Link to v1: https://patch.msgid.link/[email protected]--- kernel/vmcore_info.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)LGTM,
Quoted 7 lines
Quoted 3 lines
Acked-by Baoquan He <[email protected]>BTW, is it worth a 'Fixes' tag?
I am not sure, but, if we prefer to, this is the correct tag:
Fixes 3fa805c37dd4d ("vmcoreinfo: track and log recoverable hardware errors")
3fa805c37dd4d was added in 6.19-rc1, so this patch is a fixup against this rc series. So yes, it should go into 6.19-rcX also.
I hadn't noticed the timing here so thanks both for pointing it out.
Quoted 29 lines · Andrew Morton
Quoted 27 lines · On Fri, 23 Jan 2026 01:24:17 -0800 Breno Leitao <[email protected]> wrote:
Hello Baoquan,
Quoted 24 lines · Baoquan He
Quoted 10 lines · Breno Leitao
If the kernel is compiled with LTO,
hwerr_datasymbol 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_dataso that the information is still preserved when the kernel is built with LTO. Makinghwerr_dataa global symbol ensures its debug info survives the LTO link process and appears in kallsyms. Also document it, so, it doesn't get removed in the future as suggested by akpm.Quoted 8 lines
Signed-off-by Breno Leitao <[email protected]>---
Changes in v2:
- Add a comment to explain why the array is global (akpm)
- Link to v1: https://patch.msgid.link/[email protected]--- kernel/vmcore_info.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)LGTM,
Acked-by Baoquan He <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
BTW, is it worth a 'Fixes' tag?
I am not sure, but, if we prefer to, this is the correct tag:
Fixes 3fa805c37dd4d ("vmcoreinfo: track and log recoverable hardware errors")
3fa805c37dd4dwas added in 6.19-rc1, so this patch is a fixup against this rc series. So yes, it should go into 6.19-rcX also.
Ah, then no need. thanks.