x86/setup: do not include kexec_handover.h from asm/setup.h
Subsystems (4)
Pratyush Yadav
maintainerPATCH v3 1/1 x86/setup: do not include kexec_handover.h from asm/setup.h
From: "Pratyush Yadav (Google)" <[email protected]>
x86 asm/setup.h includes linux/kexec_handover.h. This is because it is used by setup.c and kaslr.c. But this inclusion is problematic. The header is included in many places, so it results in the KHO header being propagated there. Also, the setup header is used by realmode code. If KHO header includes things like mm.h, it causes a big dump of compilation failures.
Nothing in setup.h uses anything from KHO. Remove the header from setup.h, and directly include it in setup.c. which does use things from KHO. Since kaslr.c is a part of the decompressor, avoid including linux headers there directly. Instead, split out struct kho_scratch, which is the only thing the kaslr.c uses, and move it to include/asm-generic/kexec_handover.h.
This should also help reduce files recompiled when kexec_handover.h changes.
---
Notes:
Thomas/Ingo/Borislav/Dave, is it okay if we take this patch through the live update tree? I have a patch series for KHO that depends on this, but it is 20 odd patches and I don't want to spam the x86 list with them. So I am sending this change out separately. It is an improvement on its own anyway since it reduces recompilation on kexec_handover.h changes.
All the changed files see relatively low patch traffic so chances of conflicts should minimal I think. And if there are any, I imagine they will be relatively simple to resolve.
Changes in v3:
- Fix changelog nitpicks.
- Add kexec_handover.h to generic-y and use asm/kexec_handover.h in kaslr.c
Changes in v2:
- Do not include linux/kexec_handover.h in kaslr.c. Instead, split out struct kho_scratch, which is the only thing kaslr uses. Move it to its own header in include/asm-generic/kexec_handover.h
MAINTAINERS | 1 + arch/x86/boot/compressed/kaslr.c | 2 ++ arch/x86/include/asm/Kbuild | 1 + arch/x86/include/asm/setup.h | 2 -- arch/x86/kernel/setup.c | 1 + include/asm-generic/kexec_handover.h | 12 ++++++++++++ include/linux/kexec_handover.h | 6 +----- 7 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 include/asm-generic/kexec_handover.h
MAINTAINERS +1 -0
@@ -14334,6 +14334,7 @@ S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux.git F: Documentation/admin-guide/mm/kho.rst F: Documentation/core-api/kho/* +F: include/asm-generic/kexec_handover.h F: include/linux/kexec_handover.h F: include/linux/kho/ F: include/linux/kho_block.h
arch/x86/boot/compressed/kaslr.c +2 -0
@@ -32,6 +32,8 @@#include <asm/setup.h> /* For COMMAND_LINE_SIZE */ #undef _SETUP +#include <asm/kexec_handover.h> +extern unsigned long get_cmd_line_ptr (void );/* Simplified build-specific string for starting entropy. */
arch/x86/include/asm/Kbuild +1 -0
@@ -15,3 +15,4 @@ generic-y += fprobe.h generic-y += mcs_spinlock.h generic-y += mmzone.h generic-y += ring_buffer.h +generic-y += kexec_handover.h
arch/x86/include/asm/setup.h +0 -2
@@ -69,8 +69,6 @@ extern void x86_ce4100_early_setup(void);static inline void x86_ce4100_early_setup (void ) { }#endif -#include <linux/kexec_handover.h> -#ifndef _SETUP#include <asm/espfix.h>
arch/x86/kernel/setup.c +1 -0
@@ -16,6 +16,7 @@#include <linux/init_ohci1394_dma.h> #include <linux/initrd.h> #include <linux/iscsi_ibft.h> +#include <linux/kexec_handover.h> #include <linux/memblock.h> #include <linux/panic_notifier.h> #include <linux/pci.h>
include/asm-generic/kexec_handover.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_GENERIC_KEXEC_HANDOVER_H +#define __ASM_GENERIC_KEXEC_HANDOVER_H + +#include <linux/types.h> + +struct kho_scratch { +phys_addr_t addr; +phys_addr_t size; +}; + +#endif /* __ASM_GENERIC_KEXEC_HANDOVER_H */
include/linux/kexec_handover.h +1 -5
@@ -5,11 +5,7 @@#include <linux/err.h> #include <linux/errno.h> #include <linux/types.h> - -struct kho_scratch { -phys_addr_t addr; -phys_addr_t size; -}; +#include <asm-generic/kexec_handover.h> struct kho_vmalloc ;
Signature · 1 line
2.55.0.rc2.803.g1fd1e6609c-goog
Quoted 44 lines · Pratyush Yadav
From: "Pratyush Yadav (Google)" <[email protected]>
x86
asm/setup.hincludeslinux/kexec_handover.h. This is because it is used bysetup.candkaslr.c. But this inclusion is problematic. The header is included in many places, so it results in the KHO header being propagated there. Also, the setup header is used by realmode code. If KHO header includes things likemm.h, it causes a big dump of compilation failures.Nothing in
setup.huses anything from KHO. Remove the header fromsetup.h, and directly include it insetup.c. which does use things from KHO. Sincekaslr.cis a part of the decompressor, avoid including linux headers there directly. Instead, split out structkho_scratch, which is the only thing thekaslr.cuses, and move it toinclude/asm-generic/kexec_handover.h.This should also help reduce files recompiled when
kexec_handover.hchanges.Signed-off-by Pratyush Yadav (Google) <[email protected]>---
Notes:
Thomas/Ingo/Borislav/Dave, is it okay if we take this patch through the live update tree? I have a patch series for KHO that depends on this, but it is 20 odd patches and I don't want to spam the x86 list with them. So I am sending this change out separately. It is an improvement on its own anyway since it reduces recompilation onkexec_handover.hchanges.All the changed files see relatively low patch traffic so chances of conflicts should minimal I think. And if there are any, I imagine they will be relatively simple to resolve.
Changes in v3:
- Fix changelog nitpicks.
- Addkexec_handover.hto generic-y and useasm/kexec_handover.hinkaslr.cChanges in v2:
- Do not includelinux/kexec_handover.hinkaslr.c. Instead, split out structkho_scratch, which is the only thing kaslr uses. Move it to its own header ininclude/asm-generic/kexec_handover.h
Quoted 9 lines
MAINTAINERS | 1 + arch/x86/boot/compressed/kaslr.c | 2 ++ arch/x86/include/asm/Kbuild | 1 + arch/x86/include/asm/setup.h | 2 -- arch/x86/kernel/setup.c | 1 + include/asm-generic/kexec_handover.h | 12 ++++++++++++ include/linux/kexec_handover.h | 6 +----- 7 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 include/asm-generic/kexec_handover.h
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 1 line · Pratyush Yadav
x86/setup: do not include
kexec_handover.hfromasm/setup.h
Applied to kho-scratch branch of liveupdate/linux.git tree, thanks!
[1/1] x86/setup: do not include kexec_handover.h from asm/setup.h
commit: 08412b8c707fdbccb7bf2116f0554fe09113cd53
tree: https://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux
branch: kho-scratch
--
Sincerely yours,
Mike.