hyperv: fix build if KEXEC not enabled
Subsystems (2)
PATCH 1/1 hyperv: fix build if KEXEC not enabled
Fixes regression 4.3 mergw window in my config where hyperv is enable but CONFIG_KEXEC not enabled.
arch/x86/kernel/cpu/mshyperv.c:112: undefined reference to `native_machine_crash_shutdown'
Introduced by:
commit b4370df2b1f5158de028e167974263c5757b34a6
Author: Vitaly Kuznetsov <[email protected]>
Date: Sat Aug 1 16:08:09 2015 -0700
Drivers: hv: vmbus: add special crash handler
arch/x86/kernel/cpu/mshyperv.c +2 -0
@@ -109,7 +109,9 @@ static void hv_machine_crash_shutdown(st {if (hv_crash_handler)hv_crash_handler (regs); +#ifdef CONFIG_KEXEC native_machine_crash_shutdown (regs); +#endif }
Quoted 19 lines · Stephen Hemminger
Fixes regression 4.3 mergw window in my config where hyperv is enable but
CONFIG_KEXECnot enabled.
arch/x86/kernel/cpu/mshyperv.c:112: undefined reference to `native_machine_crash_shutdown'Introduced by:
commitb4370df2b1f5158de028e167974263c5757b34a6
Author: Vitaly Kuznetsov <[email protected]>
Date: Sat Aug 1 16:08:09 2015 -0700Drivers: hv: vmbus: add special crash handler
Signed-off-by Stephen Hemminger <[email protected]>
arch/x86/kernel/cpu/mshyperv.c static void hv_machine_crash_shutdown(st · line 114
Quoted 6 lines
arch/x86/kernel/cpu/mshyperv.c +2
-0@@ -109,7 +109,9 @@ static void hv_machine_crash_shutdown(st {if (hv_crash_handler)hv_crash_handler (regs); +#ifdef CONFIG_KEXEC native_machine_crash_shutdown (regs); +#endif
I think there's another related bug as well:
machine_ops.crash_shutdown = hv_machine_crash_shutdown;
that should be #ifdef CONFIG_KEXEC as well AFAICS.
These bugs came upstream via the driver tree:
b4370df2b1f5 ("Drivers: hv: vmbus: add special crash handler") 2517281d63a2 ("Drivers: hv: vmbus: add special kexec handler")
Thanks,
Ingo
Quoted 30 lines · Ingo Molnar
Quoted 19 lines · Stephen Hemminger
Fixes regression 4.3 mergw window in my config where hyperv is enable but
CONFIG_KEXECnot enabled.
arch/x86/kernel/cpu/mshyperv.c:112: undefined reference to `native_machine_crash_shutdown'Introduced by:
commitb4370df2b1f5158de028e167974263c5757b34a6
Author: Vitaly Kuznetsov <[email protected]>
Date: Sat Aug 1 16:08:09 2015 -0700Drivers: hv: vmbus: add special crash handler
Signed-off-by Stephen Hemminger <[email protected]>arch/x86/kernel/cpu/mshyperv.c static void hv_machine_crash_shutdown(st · line 114
Quoted 6 lines
arch/x86/kernel/cpu/mshyperv.c +2
-0@@ -109,7 +109,9 @@ static void hv_machine_crash_shutdown(st {if (hv_crash_handler)hv_crash_handler (regs); +#ifdef CONFIG_KEXEC native_machine_crash_shutdown (regs); +#endif I think there's another related bug as well:
Quoted 4 lines
machine_ops.crash_shutdown = hv_machine_crash_shutdown;that should be #ifdef
CONFIG_KEXECas well AFAICS.
Why? crash_shutdown is defined in machine_ops unconditionally, I don't see why we _need_ #ifdef here (and btw Greg insisted on removing them).
Quoted 8 lines
These bugs came upstream via the driver tree:
b4370df2b1f5("Drivers: hv: vmbus: add special crash handler")2517281d63a2("Drivers: hv: vmbus: add special kexec handler")Thanks,
Ingo
Signature · 1 line
Vitaly
Quoted 32 lines · Vitaly Kuznetsov
Quoted 30 lines · Ingo Molnar
Quoted 19 lines · Stephen Hemminger
Fixes regression 4.3 mergw window in my config where hyperv is enable but
CONFIG_KEXECnot enabled.
arch/x86/kernel/cpu/mshyperv.c:112: undefined reference to `native_machine_crash_shutdown'Introduced by:
commitb4370df2b1f5158de028e167974263c5757b34a6
Author: Vitaly Kuznetsov <[email protected]>
Date: Sat Aug 1 16:08:09 2015 -0700Drivers: hv: vmbus: add special crash handler
Signed-off-by Stephen Hemminger <[email protected]>arch/x86/kernel/cpu/mshyperv.c static void hv_machine_crash_shutdown(st · line 114
Quoted 6 lines
arch/x86/kernel/cpu/mshyperv.c +2
-0@@ -109,7 +109,9 @@ static void hv_machine_crash_shutdown(st {if (hv_crash_handler)hv_crash_handler (regs); +#ifdef CONFIG_KEXEC native_machine_crash_shutdown (regs); +#endif I think there's another related bug as well:
Quoted 6 lines
Quoted 4 lines
machine_ops.crash_shutdown = hv_machine_crash_shutdown;that should be #ifdef
CONFIG_KEXECas well AFAICS.Why? [...]
Because you are bloating the kernel.
That's because machine_ops.crash_shutdown() does nothing outside of kexec and that's the existing pattern in the native and KVM code. (Xen does it inconsistently as well.)
So you bloat the kernel at minimum, and also confuse the reader what it's all about.
Quoted 2 lines
[...]
crash_shutdownis defined inmachine_opsunconditionally, I don't see why we _need_ #ifdef here (and btw Greg insisted on removing them).
So arguably the kexec interface should be cleaned up as well, into something like:
kexec_crash_handler_set(hv_machine_crash_shutdown);
... which would compile to no code at all in the !KEXEC case, and then we could also make ::crash_shutdown #ifdef KEXEC.
At least one #ifdef is unavoidable unless we make KCONFIG an always-enabled facility - or merge it more intelligently with the regular reboot/shutdown code.
I.e. I don't think there should be kexec specific 'handlers' per se - there should be reboot/shutdown handlers that will also serve kexec just fine.
But until that's fixed we've got to make the best of the existing kexec design.
Thanks,
Ingo
Quoted 55 lines · Ingo Molnar
Quoted 32 lines · Vitaly Kuznetsov
Quoted 30 lines · Ingo Molnar
Quoted 19 lines · Stephen Hemminger
Fixes regression 4.3 mergw window in my config where hyperv is enable but
CONFIG_KEXECnot enabled.
arch/x86/kernel/cpu/mshyperv.c:112: undefined reference to `native_machine_crash_shutdown'Introduced by:
commitb4370df2b1f5158de028e167974263c5757b34a6
Author: Vitaly Kuznetsov <[email protected]>
Date: Sat Aug 1 16:08:09 2015 -0700Drivers: hv: vmbus: add special crash handler
Signed-off-by Stephen Hemminger <[email protected]>arch/x86/kernel/cpu/mshyperv.c static void hv_machine_crash_shutdown(st · line 114
Quoted 6 lines
arch/x86/kernel/cpu/mshyperv.c +2
-0@@ -109,7 +109,9 @@ static void hv_machine_crash_shutdown(st {if (hv_crash_handler)hv_crash_handler (regs); +#ifdef CONFIG_KEXEC native_machine_crash_shutdown (regs); +#endif I think there's another related bug as well:
Quoted 6 lines
Quoted 4 lines
machine_ops.crash_shutdown = hv_machine_crash_shutdown;that should be #ifdef
CONFIG_KEXECas well AFAICS.Why? [...]
Because you are bloating the kernel.
That's because
machine_ops.crash_shutdown()does nothing outside of kexec and that's the existing pattern in the native and KVM code. (Xen does it inconsistently as well.)So you bloat the kernel at minimum, and also confuse the reader what it's all about.
Quoted 2 lines
[...]
crash_shutdownis defined inmachine_opsunconditionally, I don't see why we _need_ #ifdef here (and btw Greg insisted on removing them).So arguably the kexec interface should be cleaned up as well, into something like:
Quoted 8 lines
kexec_crash_handler_set(hv_machine_crash_shutdown);... which would compile to no code at all in the !KEXEC case, and then we could also make ::crash_shutdown #ifdef KEXEC.
At least one #ifdef is unavoidable unless we make KCONFIG an always-enabled facility - or merge it more intelligently with the regular reboot/shutdown code.
Greg,
I don't personally have a strong opinion here but I'm leaning towards Ingo's suggestion. That would mean I have to break your 'no #ifdefs in C files' rule (ok, I can move everything to mshyperv.h to respect it but that would feel like a fraud). Please let me know if you prefer such fix to the previously posted one (https://lkml.org/lkml/2015/8/11/417).
Thanks,
Quoted 9 lines
I.e. I don't think there should be kexec specific 'handlers' per se - there should be reboot/shutdown handlers that will also serve kexec just fine.
But until that's fixed we've got to make the best of the existing kexec design.
Thanks,
Ingo
Signature · 1 line
Vitaly
Quoted 17 lines · Stephen Hemminger
Fixes regression 4.3 mergw window in my config where hyperv is enable but
CONFIG_KEXECnot enabled.
arch/x86/kernel/cpu/mshyperv.c:112: undefined reference to `native_machine_crash_shutdown'Introduced by:
commitb4370df2b1f5158de028e167974263c5757b34a6
Author: Vitaly Kuznetsov <[email protected]>
Date: Sat Aug 1 16:08:09 2015 -0700Drivers: hv: vmbus: add special crash handler
Signed-off-by Stephen Hemminger <[email protected]>
arch/x86/kernel/cpu/mshyperv.c static void hv_machine_crash_shutdown(st · line 115
Quoted 7 lines
arch/x86/kernel/cpu/mshyperv.c +2
-0@@ -109,7 +109,9 @@ static void hv_machine_crash_shutdown(st {if (hv_crash_handler)hv_crash_handler (regs); +#ifdef CONFIG_KEXEC native_machine_crash_shutdown (regs); +#endif }
Greg in particular was against #ifdefs in C code and I sent the following patch to fix the issue:
https://lkml.org/lkml/2015/8/11/417
Signature · 1 line
Vitaly
Quoted 30 lines · Vitaly Kuznetsov
Quoted 17 lines · Stephen Hemminger
Fixes regression 4.3 mergw window in my config where hyperv is enable but
CONFIG_KEXECnot enabled.
arch/x86/kernel/cpu/mshyperv.c:112: undefined reference to `native_machine_crash_shutdown'Introduced by:
commitb4370df2b1f5158de028e167974263c5757b34a6
Author: Vitaly Kuznetsov <[email protected]>
Date: Sat Aug 1 16:08:09 2015 -0700Drivers: hv: vmbus: add special crash handler
Signed-off-by Stephen Hemminger <[email protected]>arch/x86/kernel/cpu/mshyperv.c static void hv_machine_crash_shutdown(st · line 115
Quoted 7 lines
arch/x86/kernel/cpu/mshyperv.c +2
-0@@ -109,7 +109,9 @@ static void hv_machine_crash_shutdown(st {if (hv_crash_handler)hv_crash_handler (regs); +#ifdef CONFIG_KEXEC native_machine_crash_shutdown (regs); +#endif }Greg in particular was against #ifdefs in C code and I sent the following patch to fix the issue:
Quoted 1 line
Note that this is still somewhat buggy, the whole hv_machine_crash_shutdown() should be conditional - like in kvmclock.c.
Thanks,
Ingo