The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: George Guo <dongtai.guo@linux.dev>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: maobibo@loongson.cn, loongarch@lists.linux.dev,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	George Guo <guodongtai@kylinos.cn>
Subject: Re: [PATCH v4 0/2] LoongArch: kexec: avoid clobbering the QEMU FDT
Date: Thu,  9 Jul 2026 20:48:30 +0800	[thread overview]
Message-ID: <20260709124830.15417-1-dongtai.guo@linux.dev> (raw)
In-Reply-To: <CAAhV-H7S9_hPDFoCtzgfY9TeH_koN9NfKq9mo8y9BmLA5-7how@mail.gmail.com>

Hi Huacai,

Thanks for the correction, and I am sorry for the way I handled this.

> Who told you the trampoline is dead code? All non-boot CPUs are
> running in the trampoline, you can use maxcpus=1 to go to the new
> kernel, and do something, and then hotplug the non-boot CPUs at any
> time.

You are right, and I was wrong to call the trampoline dead once the new
kernel starts.  The non-boot CPUs spin in kexec_smp_wait inside the
trampoline buffer and only leave it when the new kernel brings them
online, so with maxcpus=1 they stay there until a later CPU hotplug.
The buffer has to stay valid the whole time.

That breaks my patch 1.  control_code_page is allocated by the kexec
core and is not reserved in the new kernel, so the new kernel can reuse
that page while the non-boot CPUs are still spinning in it, and small
memory makes that more likely.  The fixed KEXEC_CONTROL_CODE at 0x100000
avoided this because the first 2MB is memblock_reserve()d in both
kernels; its only problem was that it overlaps QEMU's machine FDT at
0x100000.  So my Q2 answer in the cover letter was also wrong, and "as
arm64/riscv do" does not apply here.

So the trampoline still needs to live in the cross-kexec reserved first
2MB, just not on top of the FDT.  The FDT declares fdt_totalsize 1MB and
covers [0x100000, 0x200000), so the room left is below 0x100000.

Do you have a different fix in mind? I would like to agree on the
direction with you before I send anything.

> BTW,  you have never replied to my comments, all you have done is
> submit new versions again and again.

That is fair, and it was my mistake.  I should have replied to your
review in the thread and discussed it before sending a new version,
instead of putting my answers in a cover letter.  I will reply to
comments first from now on.

I will hold the series until we settle the trampoline approach.

Thanks,
George

  reply	other threads:[~2026-07-09 12:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 15:59 [PATCH v4 0/2] LoongArch: kexec: avoid clobbering the QEMU FDT George Guo
2026-07-01 15:59 ` [PATCH v4 1/2] LoongArch: kexec: use core control page for relocation trampoline to avoid QEMU FDT conflict George Guo
2026-07-01 15:59 ` [PATCH v4 2/2] LoongArch: kexec: load the command line in its own segment George Guo
2026-07-09  9:11 ` [PATCH v4 0/2] LoongArch: kexec: avoid clobbering the QEMU FDT Huacai Chen
2026-07-09 12:48   ` George Guo [this message]
2026-07-10 14:12     ` Huacai Chen

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=20260709124830.15417-1-dongtai.guo@linux.dev \
    --to=dongtai.guo@linux.dev \
    --cc=chenhuacai@kernel.org \
    --cc=guodongtai@kylinos.cn \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=maobibo@loongson.cn \
    /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