mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: <catalin.marinas@arm.com>, <will@kernel.org>,
	<mark.rutland@arm.com>, <chenhuacai@kernel.org>,
	<kernel@xen0n.name>, <maddy@linux.ibm.com>, <mpe@ellerman.id.au>,
	<npiggin@gmail.com>, <chleroy@kernel.org>,
	<ritesh.list@gmail.com>, <sshegde@linux.ibm.com>,
	<pjw@kernel.org>, <palmer@dabbelt.com>, <aou@eecs.berkeley.edu>,
	<alex@ghiti.fr>, <tglx@kernel.org>, <mingo@redhat.com>,
	<bp@alien8.de>, <dave.hansen@linux.intel.com>, <hpa@zytor.com>,
	<akpm@linux-foundation.org>, <baoquan.he@linux.dev>,
	<rppt@kernel.org>, <pasha.tatashin@soleen.com>,
	<pratyush@kernel.org>, <leitao@debian.org>, <yeoreum.yun@arm.com>,
	<mpilaniy@redhat.com>, <robh@kernel.org>, <coiby.xu@gmail.com>,
	<Yeking@Red54.com>, <prudo@redhat.com>, <brads@mainlining.org>,
	<sourabhjain@linux.ibm.com>, <mkchauras@gmail.com>,
	<blum@kernel.org>, <adityag@linux.ibm.com>,
	<qirui.001@bytedance.com>, <hui.wang@canonical.com>,
	<sohammetha01@gmail.com>, <guoren@kernel.org>,
	<gaohan@iscas.ac.cn>, <ionut.nechita@windriver.com>,
	<vishal.l.verma@intel.com>, <seanjc@google.com>,
	<ardb@kernel.org>, <richard.lyu@suse.com>, <arnd@arndb.de>,
	<tzimmermann@suse.de>, <rick.p.edgecombe@intel.com>,
	<kai.huang@intel.com>, <kas@kernel.org>, <piliu@redhat.com>,
	<thuth@redhat.com>, <shradhagupta@linux.microsoft.com>,
	<ebiggers@kernel.org>, <jbouron@amazon.com>, <me@linux.beauty>,
	<mclapinski@google.com>, <graf@amazon.com>,
	<tangyouling@kylinos.cn>, <x86@kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <loongarch@lists.linux.dev>,
	<linuxppc-dev@lists.ozlabs.org>,
	<linux-riscv@lists.infradead.org>, <kexec@lists.infradead.org>
Subject: Re: [PATCH v8 00/11] kexec: Rework segment loading and fix CMA retries
Date: Mon, 23 Nov 2026 15:10:53 +0800	[thread overview]
Message-ID: <584a0e7a-230e-4a95-9e09-a1d6499a6ea9@huawei.com> (raw)
In-Reply-To: <20261112133418.4044428-1-ruanjinjie@huawei.com>



在 2026/11/12 21:34, Jinjie Ruan 写道:
> ARM64, LoongArch, RISC-V, x86 and powerpc build the elf core header
> and place it together with the initrd and the DTB with almost identical
> code.
> 
> This series reworks that path into common helpers that the architectures
> reuse, and fixes the CMA page and elf core header leaks in the arm64
> and LoongArch placement retry loops.
> 
> The patch organization is as follows:
> 
> - Patch 1 moves the release of the elf core header into the generic
>   post-load cleanup, so that the architectures no longer free it
>   themselves.
> 
> - Patch 2 adds the common helpers
> 
> - Patches 3-7 convert arm64, LoongArch, RISC-V, X86 and Powerpc to
>   reuse the common helpers
> 
> - Patches 8-11 fix the CMA pages leaked by the retry loops and
>   the loop that makes no progress
> 
> Tested with kexec_file_load() on arm64, LoongArch, RISC-V, X86 and
> Powerpc under QEMU, including the CMA retry paths, loading a crash
> kernel and booting the second kernel, with the agent help.
> 
> This series is also available at:
> 	https://github.com/ruanjinjie-eng/linux/tree/kexec_rework_cma_bugfx_v9
> 
> Changes in v8:
> - Rework the common code as Mike suggested: the core provides building
>   blocks and the architectures uses them (Mike)
> - Build the elf core header once and only place it on the retries (Mike)
> - Keep the segment order and the arch placement policy unchanged (Mike)
> - Convert x86 and powerpc as well
> - Move the CMA fixes to the end of the series (Mike)

Hi Mike,

Does this refactoring now meet your expectations?

In my view, there is still an issue worth discussing: should we reserve
for the crash hotplug elf core header in the framework code
kexec_add_elf_core_header(), or only implement it in the x86
architecture code, and consider generalizing it after the ARM64
implementation is available?

Best regards,
Jinjie


> - Link to v7: https://lore.kernel.org/all/20261026075201.699550-1-ruanjinjie@huawei.com/
> 
> Previous Versions are as below:
> - v6: https://lore.kernel.org/all/20260921090450.807575-1-ruanjinjie@huawei.com/
> - v5: https://lore.kernel.org/all/20260918100442.3841135-1-ruanjinjie@huawei.com/
> - v4: https://lore.kernel.org/all/20260907125404.922123-1-ruanjinjie@huawei.com/
> - v3: https://lore.kernel.org/all/20260826092541.3905933-1-ruanjinjie@huawei.com/
> - v2: https://lore.kernel.org/all/20260729031235.2840255-1-ruanjinjie@huawei.com/
> - v1: https://lore.kernel.org/all/20260723131242.1537633-1-ruanjinjie@huawei.com/#t
> 
> Jinjie Ruan (11):
>   kexec: Free the elf core header in kimage_file_post_load_cleanup()
>   kexec: Add helpers to load the elf core header, initrd and FDT
>   arm64: kexec_file: Load the other segments with common helpers
>   LoongArch: kexec_file: Load the other segments with common helpers
>   riscv: kexec_file: Load the extra segments with common helpers
>   x86: kexec_file: Use the common segment helpers
>   powerpc: kexec_file: Use the common segment helpers
>   kexec: Extract kexec_free_segment_cma() from kimage_free_cma()
>   kexec: Add kexec_rollback_segments() helper
>   arm64: kexec_file: Fix CMA segment placement retries
>   LoongArch: kexec_file: Fix CMA segment placement retries
> 
>  arch/arm64/include/asm/kexec.h             |   4 +-
>  arch/arm64/kernel/kexec_image.c            |  15 ++-
>  arch/arm64/kernel/machine_kexec_file.c     |  87 ++++----------
>  arch/loongarch/include/asm/kexec.h         |   3 +-
>  arch/loongarch/kernel/kexec_efi.c          |  15 ++-
>  arch/loongarch/kernel/kexec_elf.c          |   3 +-
>  arch/loongarch/kernel/machine_kexec_file.c |  80 +++++--------
>  arch/powerpc/kexec/elf_64.c                |   9 +-
>  arch/powerpc/kexec/file_load_64.c          |  18 +--
>  arch/riscv/include/asm/kexec.h             |   4 +-
>  arch/riscv/kernel/kexec_elf.c              |   3 +-
>  arch/riscv/kernel/kexec_image.c            |   3 +-
>  arch/riscv/kernel/machine_kexec_file.c     |  83 ++++----------
>  arch/x86/kernel/crash.c                    |  25 +----
>  arch/x86/kernel/kexec-bzimage64.c          |   8 +-
>  arch/x86/kernel/machine_kexec_64.c         |   4 -
>  include/linux/kexec.h                      |  14 +++
>  kernel/kexec_core.c                        |  25 +++--
>  kernel/kexec_file.c                        | 125 +++++++++++++++++++++
>  19 files changed, 254 insertions(+), 274 deletions(-)
> 


      parent reply	other threads:[~2026-11-23  7:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 13:34 Jinjie Ruan
2026-11-12 13:34 ` [PATCH v8 01/11] kexec: Free the elf core header in kimage_file_post_load_cleanup() Jinjie Ruan
2026-11-12 13:34 ` [PATCH v8 02/11] kexec: Add helpers to load the elf core header, initrd and FDT Jinjie Ruan
2026-11-12 13:34 ` [PATCH v8 03/11] arm64: kexec_file: Load the other segments with common helpers Jinjie Ruan
2026-11-12 13:34 ` [PATCH v8 04/11] LoongArch: " Jinjie Ruan
2026-11-12 13:34 ` [PATCH v8 05/11] riscv: kexec_file: Load the extra " Jinjie Ruan
2026-11-12 13:34 ` [PATCH v8 06/11] x86: kexec_file: Use the common segment helpers Jinjie Ruan
2026-11-12 13:34 ` [PATCH v8 07/11] powerpc: " Jinjie Ruan
2026-11-12 13:34 ` [PATCH v8 08/11] kexec: Extract kexec_free_segment_cma() from kimage_free_cma() Jinjie Ruan
2026-11-12 13:34 ` [PATCH v8 09/11] kexec: Add kexec_rollback_segments() helper Jinjie Ruan
2026-11-12 13:34 ` [PATCH v8 10/11] arm64: kexec_file: Fix CMA segment placement retries Jinjie Ruan
2026-11-12 13:34 ` [PATCH v8 11/11] LoongArch: " Jinjie Ruan
2026-11-23  7:10 ` Jinjie Ruan [this message]

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=584a0e7a-230e-4a95-9e09-a1d6499a6ea9@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=Yeking@Red54.com \
    --cc=adityag@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=baoquan.he@linux.dev \
    --cc=blum@kernel.org \
    --cc=bp@alien8.de \
    --cc=brads@mainlining.org \
    --cc=catalin.marinas@arm.com \
    --cc=chenhuacai@kernel.org \
    --cc=chleroy@kernel.org \
    --cc=coiby.xu@gmail.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=ebiggers@kernel.org \
    --cc=gaohan@iscas.ac.cn \
    --cc=graf@amazon.com \
    --cc=guoren@kernel.org \
    --cc=hpa@zytor.com \
    --cc=hui.wang@canonical.com \
    --cc=ionut.nechita@windriver.com \
    --cc=jbouron@amazon.com \
    --cc=kai.huang@intel.com \
    --cc=kas@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=kexec@lists.infradead.org \
    --cc=leitao@debian.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=loongarch@lists.linux.dev \
    --cc=maddy@linux.ibm.com \
    --cc=mark.rutland@arm.com \
    --cc=mclapinski@google.com \
    --cc=me@linux.beauty \
    --cc=mingo@redhat.com \
    --cc=mkchauras@gmail.com \
    --cc=mpe@ellerman.id.au \
    --cc=mpilaniy@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=piliu@redhat.com \
    --cc=pjw@kernel.org \
    --cc=pratyush@kernel.org \
    --cc=prudo@redhat.com \
    --cc=qirui.001@bytedance.com \
    --cc=richard.lyu@suse.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=ritesh.list@gmail.com \
    --cc=robh@kernel.org \
    --cc=rppt@kernel.org \
    --cc=seanjc@google.com \
    --cc=shradhagupta@linux.microsoft.com \
    --cc=sohammetha01@gmail.com \
    --cc=sourabhjain@linux.ibm.com \
    --cc=sshegde@linux.ibm.com \
    --cc=tangyouling@kylinos.cn \
    --cc=tglx@kernel.org \
    --cc=thuth@redhat.com \
    --cc=tzimmermann@suse.de \
    --cc=vishal.l.verma@intel.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=yeoreum.yun@arm.com \
    /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

all inboxes | Powered by JetHome®