linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org, x86@kernel.org,
	Baoquan He <bhe@redhat.com>,
	arnd@arndb.de, ignat@cloudflare.com, kexec@lists.infradead.org,
	viro@zeniv.linux.org.uk, eric_devolder@yahoo.com,
	linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org,
	linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
	hbathini@linux.ibm.com, ebiederm@xmission.com
Subject: [PATCH 0/5] crash: clean up kdump related config items
Date: Fri,  5 Jan 2024 18:33:00 +0800	[thread overview]
Message-ID: <20240105103305.557273-1-bhe@redhat.com> (raw)

Motivation:
=============
Previously, LKP reported a building error. When investigating, it can't
be resolved reasonablly with the present messy kdump config items.

https://lore.kernel.org/oe-kbuild-all/202312182200.Ka7MzifQ-lkp@intel.com/


The kdump (crash dumping) related config items could causes confusions:

Firstly,
---
CRASH_CORE enables codes including
 - crashkernel reservation parsing;
 - elfcorehdr updating;
 - vmcoreinfo saving;
 - crash hotplug handling;

Now fadump of powerpc, kcore dynamic debugging and kdump all selects
CRASH_CORE, while fadump 
 - fadump needs crashkernel parsing, vmcoreinfo and accessing
   global variable 'elfcorehdr_addr';
 - kcore needs saved vmcoreinfo;
 - kdump needs all of the current kernel/crash_core.c.

So only enabling PROC_CORE or FA_DUMP will enable CRASH_CORE will
confuse people that we enable the core code of kdump. Actually it's not.

Secondly,
---
It's not reasonable to allow KEXEC_CORE select CRASH_CORE.

Because KEXEC_CORE enables codes which allocate control pages, copy
kexec/kdump segments, and prepare for switching. These codes are
shared by both kexec_load and kexec_file_load, and by both kexec reboot
and kdump. We could want kexec reboot, but disable kdump. In that case,
CRASH_CORE should not be selected.

Thirdly,
---
It's not reasonable to allow CRASH_DUMP select KEXEC_CORE.

That could make KEXEC_CORE, CRASH_DUMP are enabled independently from
KEXEC or KEXEC_FILE. However, w/o KEXEC or KEXEC_FILE, the KEXEC_CORE
code built in doesn't make any sense because no kernel loading or
switching will happen to utilize the KEXEC_CORE code.

Changes:
===========
1, split CRASH_CORE codes into three parts:
    1. move the elfcorehdr upating code and crash hotplug handling code
       into kernel/kexec_core.c. Both KEXEC and KEXEC_FILE will use them.
    2. split crashkernel reservation code out into kernel/crash_reserve.c,
       add CRASH_RESERVE to control its enabling;
    3. rename the left kernel/crash_core.c to kernel/vmcore_info.c since
       only vmcoreinfo is saved in the file, and add VMCORE_INFO to
       control its enabling;
2, rename the current kernel/crash_dump.c to kernel/elfcorehdr.c because
it only defines elfcorehdr_addr and function parse_elfcorehdr() in the
file. And build it in when VMCORE_INFO is enabled.

Achievement:
===========
With above changes, I can rearrange the config items as below (the right
item depends on or is selected by the left item):

    PROC_KCORE -----------> VMCORE_INFO
    
               |----------> VMCORE_INFO
    FA_DUMP----|
               |----------> CRASH_RESERVE
    
                                                    ---->VMCORE_INFO
                                                   /
                                                   |---->CRASH_RESERVE
    KEXEC      --|                                /|
                 |--> KEXEC_CORE--> CRASH_DUMP-->/-|---->PROC_VMCORE
    KEXEC_FILE --|                               \ |
                                                   \---->CRASH_HOTPLUG
    
    KEXEC      --|
                 |--> KEXEC_CORE (for kexec reboot only)
    KEXEC_FILE --|

Baoquan He (5):
  kexec_core: move kdump related codes from crash_core.c to kexec_core.c
  kexec: split crashkernel reservation code out from crash_core.c
  crash: rename crash_core to vmcore_info
  crash: remove dependency of FA_DUMP on CRASH_DUMP
  crash: clean up CRASH_DUMP

 arch/arm64/Kconfig                            |    2 +-
 .../asm/{crash_core.h => crash_reserve.h}     |    4 +-
 arch/arm64/kernel/Makefile                    |    2 +-
 .../kernel/{crash_core.c => vmcore_info.c}    |    2 +-
 arch/powerpc/Kconfig                          |    4 +-
 arch/powerpc/kernel/setup-common.c            |    2 +-
 arch/powerpc/mm/nohash/kaslr_booke.c          |    4 +-
 arch/powerpc/platforms/powernv/opal-core.c    |    2 +-
 arch/riscv/Kconfig                            |    2 +-
 .../asm/{crash_core.h => crash_reserve.h}     |    4 +-
 arch/riscv/kernel/Makefile                    |    2 +-
 .../kernel/{crash_core.c => vmcore_info.c}    |    2 +-
 arch/x86/Kconfig                              |    2 +-
 .../asm/{crash_core.h => crash_reserve.h}     |    6 +-
 arch/x86/kernel/Makefile                      |    2 +-
 .../{crash_core_32.c => vmcore_info_32.c}     |    2 +-
 .../{crash_core_64.c => vmcore_info_64.c}     |    2 +-
 drivers/firmware/qemu_fw_cfg.c                |   14 +-
 fs/proc/Kconfig                               |    2 +-
 fs/proc/kcore.c                               |    2 +-
 include/linux/buildid.h                       |    2 +-
 include/linux/crash_reserve.h                 |   48 +
 include/linux/kexec.h                         |   27 +-
 include/linux/{crash_core.h => vmcore_info.h} |   78 +-
 kernel/Kconfig.kexec                          |   12 +-
 kernel/Makefile                               |    4 +-
 kernel/crash_core.c                           | 1065 -----------------
 kernel/crash_reserve.c                        |  453 +++++++
 kernel/{crash_dump.c => elfcorehdr.c}         |    0
 kernel/kexec_core.c                           |  408 +++++++
 kernel/kexec_internal.h                       |    2 +
 kernel/ksysfs.c                               |    6 +-
 kernel/printk/printk.c                        |    4 +-
 kernel/vmcore_info.c                          |  233 ++++
 lib/buildid.c                                 |    2 +-
 35 files changed, 1222 insertions(+), 1186 deletions(-)
 rename arch/arm64/include/asm/{crash_core.h => crash_reserve.h} (81%)
 rename arch/arm64/kernel/{crash_core.c => vmcore_info.c} (97%)
 rename arch/riscv/include/asm/{crash_core.h => crash_reserve.h} (78%)
 rename arch/riscv/kernel/{crash_core.c => vmcore_info.c} (96%)
 rename arch/x86/include/asm/{crash_core.h => crash_reserve.h} (92%)
 rename arch/x86/kernel/{crash_core_32.c => vmcore_info_32.c} (90%)
 rename arch/x86/kernel/{crash_core_64.c => vmcore_info_64.c} (94%)
 create mode 100644 include/linux/crash_reserve.h
 rename include/linux/{crash_core.h => vmcore_info.h} (59%)
 delete mode 100644 kernel/crash_core.c
 create mode 100644 kernel/crash_reserve.c
 rename kernel/{crash_dump.c => elfcorehdr.c} (100%)
 create mode 100644 kernel/vmcore_info.c

-- 
2.41.0


             reply	other threads:[~2024-01-05 10:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-05 10:33 Baoquan He [this message]
2024-01-05 10:33 ` [PATCH 1/5] kexec_core: move kdump related codes from crash_core.c to kexec_core.c Baoquan He
2024-01-06 10:59   ` kernel test robot
2024-01-07 13:58     ` Baoquan He
2024-01-06 14:58   ` kernel test robot
2024-01-07  8:52     ` Baoquan He
2024-01-05 10:33 ` [PATCH 2/5] kexec: split crashkernel reservation code out from crash_core.c Baoquan He
2024-01-05 10:33 ` [PATCH 3/5] crash: rename crash_core to vmcore_info Baoquan He
2024-01-05 10:33 ` [PATCH 4/5] crash: remove dependency of FA_DUMP on CRASH_DUMP Baoquan He
2024-01-05 10:33 ` [PATCH 5/5] crash: clean up CRASH_DUMP Baoquan He
2024-01-07 13:19   ` kernel test robot
2024-01-09  3:49     ` Baoquan He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240105103305.557273-1-bhe@redhat.com \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=ebiederm@xmission.com \
    --cc=eric_devolder@yahoo.com \
    --cc=hbathini@linux.ibm.com \
    --cc=ignat@cloudflare.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).