mbox series

[0/5] kexec: fix the incorrect ifdeffery and dependency of CONFIG_KEXEC

Message ID 20231208073036.7884-1-bhe@redhat.com (mailing list archive)
Headers show
Series kexec: fix the incorrect ifdeffery and dependency of CONFIG_KEXEC | expand

Message

Baoquan He Dec. 8, 2023, 7:30 a.m. UTC
The select of KEXEC for CRASH_DUMP in kernel/Kconfig.kexec will be
dropped, then compiling errors will be triggered if below config
items are set:

===
CONFIG_CRASH_CORE=y
CONFIG_KEXEC_CORE=y
CONFIG_CRASH_DUMP=y
===

E.g on mips, below link error are seen:
--------------------------------------------------------------------
mipsel-linux-ld: kernel/kexec_core.o: in function `kimage_free':
kernel/kexec_core.c:(.text+0x2200): undefined reference to `machine_kexec_cleanup'
mipsel-linux-ld: kernel/kexec_core.o: in function `__crash_kexec':
kernel/kexec_core.c:(.text+0x2480): undefined reference to `machine_crash_shutdown'
mipsel-linux-ld: kernel/kexec_core.c:(.text+0x2488): undefined reference to `machine_kexec'
mipsel-linux-ld: kernel/kexec_core.o: in function `kernel_kexec':
kernel/kexec_core.c:(.text+0x29b8): undefined reference to `machine_shutdown'
mipsel-linux-ld: kernel/kexec_core.c:(.text+0x29c0): undefined reference to `machine_kexec'
--------------------------------------------------------------------

Here, change the incorrect dependency of building kexec_core related object
files, and the ifdeffery on architectures from CONFIG_KEXEC to
CONFIG_KEXEC_CORE.

Testing:
========
Passed on mips and loognarch with the LKP reproducer.

Baoquan He (5):
  loongarch, kexec: change dependency of object files
  m68k, kexec: fix the incorrect ifdeffery and build dependency of
    CONFIG_KEXEC
  mips, kexec: fix the incorrect ifdeffery and dependency of
    CONFIG_KEXEC
  sh, kexec: fix the incorrect ifdeffery and dependency of CONFIG_KEXEC
  x86, kexec: fix the wrong ifdeffery CONFIG_KEXEC

 arch/loongarch/kernel/Makefile  |  2 +-
 arch/m68k/include/asm/kexec.h   |  4 ++--
 arch/m68k/kernel/Makefile       |  2 +-
 arch/mips/cavium-octeon/smp.c   |  4 ++--
 arch/mips/include/asm/kexec.h   |  2 +-
 arch/mips/include/asm/smp-ops.h |  2 +-
 arch/mips/include/asm/smp.h     |  2 +-
 arch/mips/kernel/Makefile       |  2 +-
 arch/mips/kernel/smp-bmips.c    |  4 ++--
 arch/mips/kernel/smp-cps.c      | 10 +++++-----
 arch/mips/loongson64/reset.c    |  4 ++--
 arch/mips/loongson64/smp.c      |  2 +-
 arch/sh/include/asm/kexec.h     |  4 ++--
 arch/sh/kernel/Makefile         |  2 +-
 arch/sh/kernel/reboot.c         |  4 ++--
 arch/sh/kernel/setup.c          |  2 +-
 arch/x86/boot/compressed/acpi.c |  2 +-
 17 files changed, 27 insertions(+), 27 deletions(-)

Comments

Baoquan He Dec. 8, 2023, 7:42 a.m. UTC | #1
Forgot adding kexec to CC, add it now.

On 12/08/23 at 03:30pm, Baoquan He wrote:
> The select of KEXEC for CRASH_DUMP in kernel/Kconfig.kexec will be
> dropped, then compiling errors will be triggered if below config
> items are set:
> 
> ===
> CONFIG_CRASH_CORE=y
> CONFIG_KEXEC_CORE=y
> CONFIG_CRASH_DUMP=y
> ===
> 
> E.g on mips, below link error are seen:
> --------------------------------------------------------------------
> mipsel-linux-ld: kernel/kexec_core.o: in function `kimage_free':
> kernel/kexec_core.c:(.text+0x2200): undefined reference to `machine_kexec_cleanup'
> mipsel-linux-ld: kernel/kexec_core.o: in function `__crash_kexec':
> kernel/kexec_core.c:(.text+0x2480): undefined reference to `machine_crash_shutdown'
> mipsel-linux-ld: kernel/kexec_core.c:(.text+0x2488): undefined reference to `machine_kexec'
> mipsel-linux-ld: kernel/kexec_core.o: in function `kernel_kexec':
> kernel/kexec_core.c:(.text+0x29b8): undefined reference to `machine_shutdown'
> mipsel-linux-ld: kernel/kexec_core.c:(.text+0x29c0): undefined reference to `machine_kexec'
> --------------------------------------------------------------------
> 
> Here, change the incorrect dependency of building kexec_core related object
> files, and the ifdeffery on architectures from CONFIG_KEXEC to
> CONFIG_KEXEC_CORE.
> 
> Testing:
> ========
> Passed on mips and loognarch with the LKP reproducer.
> 
> Baoquan He (5):
>   loongarch, kexec: change dependency of object files
>   m68k, kexec: fix the incorrect ifdeffery and build dependency of
>     CONFIG_KEXEC
>   mips, kexec: fix the incorrect ifdeffery and dependency of
>     CONFIG_KEXEC
>   sh, kexec: fix the incorrect ifdeffery and dependency of CONFIG_KEXEC
>   x86, kexec: fix the wrong ifdeffery CONFIG_KEXEC
> 
>  arch/loongarch/kernel/Makefile  |  2 +-
>  arch/m68k/include/asm/kexec.h   |  4 ++--
>  arch/m68k/kernel/Makefile       |  2 +-
>  arch/mips/cavium-octeon/smp.c   |  4 ++--
>  arch/mips/include/asm/kexec.h   |  2 +-
>  arch/mips/include/asm/smp-ops.h |  2 +-
>  arch/mips/include/asm/smp.h     |  2 +-
>  arch/mips/kernel/Makefile       |  2 +-
>  arch/mips/kernel/smp-bmips.c    |  4 ++--
>  arch/mips/kernel/smp-cps.c      | 10 +++++-----
>  arch/mips/loongson64/reset.c    |  4 ++--
>  arch/mips/loongson64/smp.c      |  2 +-
>  arch/sh/include/asm/kexec.h     |  4 ++--
>  arch/sh/kernel/Makefile         |  2 +-
>  arch/sh/kernel/reboot.c         |  4 ++--
>  arch/sh/kernel/setup.c          |  2 +-
>  arch/x86/boot/compressed/acpi.c |  2 +-
>  17 files changed, 27 insertions(+), 27 deletions(-)
> 
> -- 
> 2.41.0
>
Geert Uytterhoeven Dec. 11, 2023, 8:25 a.m. UTC | #2
Hi Baoquan,

On Fri, Dec 8, 2023 at 8:43 AM Baoquan He <bhe@redhat.com> wrote:
> Forgot adding kexec to CC, add it now.
>
> On 12/08/23 at 03:30pm, Baoquan He wrote:
> > The select of KEXEC for CRASH_DUMP in kernel/Kconfig.kexec will be
> > dropped, then compiling errors will be triggered if below config
> > items are set:
> >
> > ===
> > CONFIG_CRASH_CORE=y
> > CONFIG_KEXEC_CORE=y
> > CONFIG_CRASH_DUMP=y
> > ===
> >
> > E.g on mips, below link error are seen:
> > --------------------------------------------------------------------
> > mipsel-linux-ld: kernel/kexec_core.o: in function `kimage_free':
> > kernel/kexec_core.c:(.text+0x2200): undefined reference to `machine_kexec_cleanup'
> > mipsel-linux-ld: kernel/kexec_core.o: in function `__crash_kexec':
> > kernel/kexec_core.c:(.text+0x2480): undefined reference to `machine_crash_shutdown'
> > mipsel-linux-ld: kernel/kexec_core.c:(.text+0x2488): undefined reference to `machine_kexec'
> > mipsel-linux-ld: kernel/kexec_core.o: in function `kernel_kexec':
> > kernel/kexec_core.c:(.text+0x29b8): undefined reference to `machine_shutdown'
> > mipsel-linux-ld: kernel/kexec_core.c:(.text+0x29c0): undefined reference to `machine_kexec'
> > --------------------------------------------------------------------
> >
> > Here, change the incorrect dependency of building kexec_core related object
> > files, and the ifdeffery on architectures from CONFIG_KEXEC to
> > CONFIG_KEXEC_CORE.
> >
> > Testing:
> > ========
> > Passed on mips and loognarch with the LKP reproducer.
> >
> > Baoquan He (5):
> >   loongarch, kexec: change dependency of object files
> >   m68k, kexec: fix the incorrect ifdeffery and build dependency of
> >     CONFIG_KEXEC
> >   mips, kexec: fix the incorrect ifdeffery and dependency of
> >     CONFIG_KEXEC
> >   sh, kexec: fix the incorrect ifdeffery and dependency of CONFIG_KEXEC
> >   x86, kexec: fix the wrong ifdeffery CONFIG_KEXEC

I understand this series is v3 of "[PATCH v2] kexec_core: change
dependency of object files"? As this series does not contain a
changelog, can you please summarize what was changed?
Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Baoquan He Dec. 11, 2023, 9:10 a.m. UTC | #3
On 12/11/23 at 09:25am, Geert Uytterhoeven wrote:
> Hi Baoquan,
> 
> On Fri, Dec 8, 2023 at 8:43 AM Baoquan He <bhe@redhat.com> wrote:
> > Forgot adding kexec to CC, add it now.
> >
> > On 12/08/23 at 03:30pm, Baoquan He wrote:
> > > The select of KEXEC for CRASH_DUMP in kernel/Kconfig.kexec will be
> > > dropped, then compiling errors will be triggered if below config
> > > items are set:
> > >
> > > ===
> > > CONFIG_CRASH_CORE=y
> > > CONFIG_KEXEC_CORE=y
> > > CONFIG_CRASH_DUMP=y
> > > ===
> > >
> > > E.g on mips, below link error are seen:
> > > --------------------------------------------------------------------
> > > mipsel-linux-ld: kernel/kexec_core.o: in function `kimage_free':
> > > kernel/kexec_core.c:(.text+0x2200): undefined reference to `machine_kexec_cleanup'
> > > mipsel-linux-ld: kernel/kexec_core.o: in function `__crash_kexec':
> > > kernel/kexec_core.c:(.text+0x2480): undefined reference to `machine_crash_shutdown'
> > > mipsel-linux-ld: kernel/kexec_core.c:(.text+0x2488): undefined reference to `machine_kexec'
> > > mipsel-linux-ld: kernel/kexec_core.o: in function `kernel_kexec':
> > > kernel/kexec_core.c:(.text+0x29b8): undefined reference to `machine_shutdown'
> > > mipsel-linux-ld: kernel/kexec_core.c:(.text+0x29c0): undefined reference to `machine_kexec'
> > > --------------------------------------------------------------------
> > >
> > > Here, change the incorrect dependency of building kexec_core related object
> > > files, and the ifdeffery on architectures from CONFIG_KEXEC to
> > > CONFIG_KEXEC_CORE.
> > >
> > > Testing:
> > > ========
> > > Passed on mips and loognarch with the LKP reproducer.
> > >
> > > Baoquan He (5):
> > >   loongarch, kexec: change dependency of object files
> > >   m68k, kexec: fix the incorrect ifdeffery and build dependency of
> > >     CONFIG_KEXEC
> > >   mips, kexec: fix the incorrect ifdeffery and dependency of
> > >     CONFIG_KEXEC
> > >   sh, kexec: fix the incorrect ifdeffery and dependency of CONFIG_KEXEC
> > >   x86, kexec: fix the wrong ifdeffery CONFIG_KEXEC
> 
> I understand this series is v3 of "[PATCH v2] kexec_core: change
> dependency of object files"? As this series does not contain a
> changelog, can you please summarize what was changed?
> Thanks!

Oh, sorry for the confusion.

You are right, I should have taken this as v3 and posted to avoid
confusion.

I add below change log for this series, not sure if it's clearer than
before. E.g for m68k, the <asm/kexec.h> is included in <linux/kexec.h>.
The old ifdeffery CONFIG_KEXEC will cause those definitions in
asm/kexec.h unseen if CONFIG_KEXEC is unset. See
KEXEC_SOURCE_MEMORY_LIMIT, it's needed in kernel/kexec_core.c.

Changelog:
------------
v2->v3:
- Change the incorrect ifdeffery CONFIG_KEXEC in arch. Since select of
  KEXEC for CRASH_DUMP in kernel/Kconfig.kexec is dropped, people can
  set below config items dependently of CONFIG_KEXEC. Then those
  KEXEC_CORE or CRASH_CORE related codes compiling will report error.

  ===
  CONFIG_CRASH_CORE=y
  CONFIG_KEXEC_CORE=y
  CONFIG_CRASH_DUMP=y
  ===
- Change the incorrect ifdeffery CONFIG_KEXEC in get_cmdline_acpi_rsdp()
  of x86 because kexec_file_load needs that too.

v1->v2:
- V1 only includes fix on loongarch. Add m68k, mips, sh fix in v2 too.