x86,nmi: Section header fixes
cover x86,nmi: Section header fixes
An earlier attempt at a fix for the problem described in the second patch was committed to Ingo's tree. Later a smaller/cleaner patch was posted. This series just reverts the original patch and then applies the second patch.
The second patch looks a lot cleaner this way instead of just provding the delta patch on top.
Ingo, let me know if this is not what you want.
Cheers,
Don
Don Zickus (1):
Revert "x86/nmi: Fix section mismatch warnings on 32-bit"
Li Zhong (1):
x86,nmi: Fix section mismatch warnings on 32-bit
arch/x86/include/asm/nmi.h | 20 +++----------------- arch/x86/kernel/nmi_selftest.c | 7 ++++--- 2 files changed, 7 insertions(+), 20 deletions(-)
Signature · 1 line
1.7.7.6
PATCH 1/2 Revert "x86/nmi: Fix section mismatch warnings on 32-bit"
This reverts commit eeaaa96a3a2134a174100afd129bb0891d05f4b2.
There is a cleaner/simpler way to achieve this.
--- arch/x86/include/asm/nmi.h | 14 -------------- arch/x86/kernel/nmi_selftest.c | 4 ++-- 2 files changed, 2 insertions(+), 16 deletions(-)
arch/x86/include/asm/nmi.h +0 -14
@@ -54,20 +54,6 @@ struct nmiaction { __register_nmi_handler((t), &fn##_na); \ }) -/* -* For special handlers that register/unregister in the -* init section only. This should be considered rare. -*/ -#define register_nmi_handler_initonly (t, fn, fg, n) \ -({ \ - static struct nmiaction fn##_na __initdata = { \ - .handler = (fn), \ - .name = (n), \ - .flags = (fg), \ - }; \ - __register_nmi_handler((t), &fn##_na); \ -}) -int __register_nmi_handler (unsigned int ,struct nmiaction *);void unregister_nmi_handler (unsigned int ,const char *);
arch/x86/kernel/nmi_selftest.c +2 -2
@@ -42,7 +42,7 @@ static int __init nmi_unk_cb(unsigned int val, struct pt_regs *regs)static void __init init_nmi_testsuite (void ) {/* trap all the unknown NMIs we may generate */ -register_nmi_handler_initonly (NMI_UNKNOWN , nmi_unk_cb,0 ,"nmi_selftest_unk" ); +register_nmi_handler (NMI_UNKNOWN , nmi_unk_cb,0 ,"nmi_selftest_unk" ); }static void __init cleanup_nmi_testsuite (void )
@@ -64,7 +64,7 @@ static void __init test_nmi_ipi(struct cpumask *mask) {unsigned long timeout; -if (register_nmi_handler_initonly (NMI_LOCAL , test_nmi_ipi_callback, +if (register_nmi_handler (NMI_LOCAL , test_nmi_ipi_callback,NMI_FLAG_FIRST ,"nmi_selftest" )) { nmi_fail =FAILURE ;return ;
Signature · 1 line
1.7.7.6
PATCH 2/2 x86,nmi: Fix section mismatch warnings on 32-bit
In reply to Don ZickusFrom: Li Zhong <[email protected]>
It was reported that compiling for 32-bit caused a bunch of section mismatch warnings:
VDSOSYM arch/x86/vdso/vdso32-syms.lds
LD arch/x86/vdso/built-in.o
LD arch/x86/built-in.o
WARNING: arch/x86/built-in.o(.data+0x5af0): Section mismatch in reference from the variable test_nmi_ipi_callback_na.10451 to the function .init.text:test_nmi_ipi_callback() The variable test_nmi_ipi_callback_na.10451 references
the function __init test_nmi_ipi_callback()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
WARNING: arch/x86/built-in.o(.data+0x5b04): Section mismatch in reference from the variable nmi_unk_cb_na.10399 to the function .init.text:nmi_unk_cb()
The variable nmi_unk_cb_na.10399 references
the function __init nmi_unk_cb()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
Both of these are attributed to the internal representation of the nmiaction struct created during register_nmi_handler. The reason for this is that those structs are not defined in the init section whereas the rest of the code in nmi_selftest.c is.
This is resolved by passing in another parameter that sets the structure as initdata or not.
[ Big thanks to Jan Beulich for decoding this for me as I didn't have a clue what was going on. ]
--- arch/x86/include/asm/nmi.h | 6 +++--- arch/x86/kernel/nmi_selftest.c | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-)
arch/x86/include/asm/nmi.h +3 -3
@@ -44,14 +44,14 @@ struct nmiaction {const char *name; }; -#define register_nmi_handler (t, fn, fg, n) \ +#define register_nmi_handler(t, fn, fg, n, init...) \ ({ \ - static struct nmiaction fn##_na = { \ + static struct nmiaction init fn##_na = { \ .handler = (fn), \ .name = (n), \ .flags = (fg), \ }; \ - __register_nmi_handler((t), &fn##_na); \ + __register_nmi_handler((t), &fn##_na); \ })int __register_nmi_handler (unsigned int ,struct nmiaction *);
arch/x86/kernel/nmi_selftest.c +3 -2
@@ -42,7 +42,8 @@ static int __init nmi_unk_cb(unsigned int val, struct pt_regs *regs)static void __init init_nmi_testsuite (void ) {/* trap all the unknown NMIs we may generate */ -register_nmi_handler (NMI_UNKNOWN , nmi_unk_cb,0 ,"nmi_selftest_unk" ); + register_nmi_handler(NMI_UNKNOWN, nmi_unk_cb, 0, "nmi_selftest_unk", +__initdata ); }static void __init cleanup_nmi_testsuite (void )
@@ -65,7 +66,7 @@ static void __init test_nmi_ipi(struct cpumask *mask)unsigned long timeout;if (register_nmi_handler (NMI_LOCAL , test_nmi_ipi_callback, -NMI_FLAG_FIRST ,"nmi_selftest" )) { + NMI_FLAG_FIRST, "nmi_selftest", __initdata)) { nmi_fail =FAILURE ;return ; }
Signature · 1 line
1.7.7.6
Quoted 8 lines · Don Zickus
An earlier attempt at a fix for the problem described in the second patch was committed to Ingo's tree. Later a smaller/cleaner patch was posted. This series just reverts the original patch and then applies the second patch.
The second patch looks a lot cleaner this way instead of just provding the delta patch on top.
Ingo, let me know if this is not what you want.
Wouldnt this be nicer as a delta enhancement, instead of a revert+fix-done-differently?
That way we'd should that the original one was good as well, it's just that this one is easier to maintain.
Thanks,
Ingo
Quoted 10 lines · Ingo Molnar
Quoted 7 lines · Don Zickus
An earlier attempt at a fix for the problem described in the second patch was committed to Ingo's tree. Later a smaller/cleaner patch was posted. This series just reverts the original patch and then applies the second patch.
The second patch looks a lot cleaner this way instead of just provding the delta patch on top.
Quoted 7 lines
Quoted 1 line
Ingo, let me know if this is not what you want.
Wouldnt this be nicer as a delta enhancement, instead of a revert+fix-done-differently?
That way we'd should that the original one was good as well, it's just that this one is easier to maintain.
Ok. I originally had a delta diff, but it looked ugly and hard to understand the new changes. That is why I did it this way. I'll send the delta enhancement and let you decide.
Cheers,
Don