* [PATCH] x86/setup: do not include kexec_handover.h from asm/setup.h
@ 2026-07-01 15:15 Pratyush Yadav
2026-07-01 16:57 ` Borislav Petkov
0 siblings, 1 reply; 6+ messages in thread
From: Pratyush Yadav @ 2026-07-01 15:15 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Pasha Tatashin, Mike Rapoport, Pratyush Yadav
Cc: linux-kernel, x86, kexec
From: "Pratyush Yadav (Google)" <pratyush@kernel.org>
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
compliation failures.
Nothing in setup.h anything from KHO. Remove the header from setup.h,
and directly include it in setup.c and kaslr.c, which do use things from
KHO. It should also help reduce files recompiled when kexec_handover.h
changes.
Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
---
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.
arch/x86/boot/compressed/kaslr.c | 2 ++
arch/x86/include/asm/setup.h | 2 --
arch/x86/kernel/setup.c | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 8e4bf5365ac6..db4afe1df738 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -32,6 +32,8 @@
#include <asm/setup.h> /* For COMMAND_LINE_SIZE */
#undef _SETUP
+#include <linux/kexec_handover.h>
+
extern unsigned long get_cmd_line_ptr(void);
/* Simplified build-specific string for starting entropy. */
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 914eb32581c7..895d09faaf83 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -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>
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 46882ce79c3a..5ebb521e136d 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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>
--
2.55.0.rc0.799.gd6f94ed593-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] x86/setup: do not include kexec_handover.h from asm/setup.h
2026-07-01 15:15 [PATCH] x86/setup: do not include kexec_handover.h from asm/setup.h Pratyush Yadav
@ 2026-07-01 16:57 ` Borislav Petkov
2026-07-02 19:31 ` Mike Rapoport
0 siblings, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2026-07-01 16:57 UTC (permalink / raw)
To: Pratyush Yadav
Cc: Thomas Gleixner, Ingo Molnar, Dave Hansen, H. Peter Anvin,
Pasha Tatashin, Mike Rapoport, linux-kernel, x86, kexec
On Wed, Jul 01, 2026 at 05:15:33PM +0200, Pratyush Yadav wrote:
> From: "Pratyush Yadav (Google)" <pratyush@kernel.org>
>
> 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
> compliation failures.
This is exactly why we are trying hard to block people from using more linux/
namespace headers in the decompressor code. Please split it and put only the
bits that are needed by the decompressor into a header in
arch/x86/include/asm/shared/ and use that in the decompressor.
There are examples there.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86/setup: do not include kexec_handover.h from asm/setup.h
2026-07-01 16:57 ` Borislav Petkov
@ 2026-07-02 19:31 ` Mike Rapoport
2026-07-03 0:11 ` Borislav Petkov
0 siblings, 1 reply; 6+ messages in thread
From: Mike Rapoport @ 2026-07-02 19:31 UTC (permalink / raw)
To: Borislav Petkov
Cc: Pratyush Yadav, Thomas Gleixner, Ingo Molnar, Dave Hansen,
H. Peter Anvin, Pasha Tatashin, linux-kernel, x86, kexec
On Wed, Jul 01, 2026 at 09:57:14AM -0700, Borislav Petkov wrote:
> On Wed, Jul 01, 2026 at 05:15:33PM +0200, Pratyush Yadav wrote:
> > From: "Pratyush Yadav (Google)" <pratyush@kernel.org>
> >
> > 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
> > compliation failures.
>
> This is exactly why we are trying hard to block people from using more linux/
> namespace headers in the decompressor code. Please split it and put only the
> bits that are needed by the decompressor into a header in
> arch/x86/include/asm/shared/ and use that in the decompressor.
>
> There are examples there.
The examples there are really x86 specific.
KHO needs decompressor to recognise 'struct kho_scratch' that's defined in
include/linux/kexec_handover.h
I see there's a duplicated 'struct efi_unaccepted_memory' for decompressor
needs, should KHO do the same for 'struct kho_scratch'?
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86/setup: do not include kexec_handover.h from asm/setup.h
2026-07-02 19:31 ` Mike Rapoport
@ 2026-07-03 0:11 ` Borislav Petkov
2026-07-03 6:19 ` Mike Rapoport
0 siblings, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2026-07-03 0:11 UTC (permalink / raw)
To: Mike Rapoport
Cc: Pratyush Yadav, Thomas Gleixner, Ingo Molnar, Dave Hansen,
H. Peter Anvin, Pasha Tatashin, linux-kernel, x86, kexec
On Thu, Jul 02, 2026 at 10:31:11PM +0300, Mike Rapoport wrote:
> The examples there are really x86 specific.
> KHO needs decompressor to recognise 'struct kho_scratch' that's defined in
> include/linux/kexec_handover.h
That struct is huuuge :-P
struct kho_scratch {
phys_addr_t addr;
phys_addr_t size;
};
> I see there's a duplicated 'struct efi_unaccepted_memory' for decompressor
> needs, should KHO do the same for 'struct kho_scratch'?
You could. But it would go out of sync perhaps.
You could also try a
include/asm-generic/kho.h
and put only really generic, basic gunk there and include it everywhere.
HTH.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86/setup: do not include kexec_handover.h from asm/setup.h
2026-07-03 0:11 ` Borislav Petkov
@ 2026-07-03 6:19 ` Mike Rapoport
2026-07-03 15:11 ` Borislav Petkov
0 siblings, 1 reply; 6+ messages in thread
From: Mike Rapoport @ 2026-07-03 6:19 UTC (permalink / raw)
To: Borislav Petkov
Cc: Pratyush Yadav, Thomas Gleixner, Ingo Molnar, Dave Hansen,
H. Peter Anvin, Pasha Tatashin, linux-kernel, x86, kexec
On Thu, Jul 02, 2026 at 05:11:28PM -0700, Borislav Petkov wrote:
> On Thu, Jul 02, 2026 at 10:31:11PM +0300, Mike Rapoport wrote:
> > The examples there are really x86 specific.
> > KHO needs decompressor to recognise 'struct kho_scratch' that's defined in
> > include/linux/kexec_handover.h
>
> That struct is huuuge :-P
>
> struct kho_scratch {
> phys_addr_t addr;
> phys_addr_t size;
> };
The size does not matter ;-P
> > I see there's a duplicated 'struct efi_unaccepted_memory' for decompressor
> > needs, should KHO do the same for 'struct kho_scratch'?
>
> You could. But it would go out of sync perhaps.
>
> You could also try a
>
> include/asm-generic/kho.h
>
> and put only really generic, basic gunk there and include it everywhere.
asm-generic would be my preference too if that's fine to include in
decompressor.
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86/setup: do not include kexec_handover.h from asm/setup.h
2026-07-03 6:19 ` Mike Rapoport
@ 2026-07-03 15:11 ` Borislav Petkov
0 siblings, 0 replies; 6+ messages in thread
From: Borislav Petkov @ 2026-07-03 15:11 UTC (permalink / raw)
To: Mike Rapoport
Cc: Pratyush Yadav, Thomas Gleixner, Ingo Molnar, Dave Hansen,
H. Peter Anvin, Pasha Tatashin, linux-kernel, x86, kexec
On Fri, Jul 03, 2026 at 09:19:11AM +0300, Mike Rapoport wrote:
> The size does not matter ;-P
Yeah, that's what they all say :-P
> asm-generic would be my preference too if that's fine to include in
> decompressor.
Sure, the main idea is that if we add more linux/ namespace includes into the
decompressor, they end up pulling in the world and more and then you end up in
build and include hell. So we try to make sure only more or less
self-contained headers are included.
And there's a bunch of build magic in scripts/Makefile.asm-headers and this
# Support for using generic headers in asm-generic
asm-generic := -f $(srctree)/scripts/Makefile.asm-headers obj
in the main Makefile which lets you do things like that apparently:
$ git grep generic-y arch/x86/
arch/x86/include/asm/Kbuild:13:generic-y += early_ioremap.h
arch/x86/include/asm/Kbuild:14:generic-y += fprobe.h
arch/x86/include/asm/Kbuild:15:generic-y += mcs_spinlock.h
arch/x86/include/asm/Kbuild:16:generic-y += mmzone.h
arch/x86/include/asm/Kbuild:17:generic-y += ring_buffer.h
but you'd need to try it - I've only heard about it from the sidelines.
:-)
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-07-03 15:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 15:15 [PATCH] x86/setup: do not include kexec_handover.h from asm/setup.h Pratyush Yadav
2026-07-01 16:57 ` Borislav Petkov
2026-07-02 19:31 ` Mike Rapoport
2026-07-03 0:11 ` Borislav Petkov
2026-07-03 6:19 ` Mike Rapoport
2026-07-03 15:11 ` Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox