mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: "Jason Gunthorpe" <jgg@nvidia.com>,
	"Abhishek Shinde" <abhshinde@nvidia.com>
Cc: "Mark Rutland" <mark.rutland@arm.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"Jeremy Linton" <jeremy.linton@arm.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Simon Horman" <horms@kernel.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>,
	"Philipp Rudo" <prudo@redhat.com>,
	"Viktor Malik" <vmalik@redhat.com>,
	"Jan Hendrik Farr" <kernel@jfarr.cc>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	kexec@lists.infradead.org, bpf@vger.kernel.org,
	systemd-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCHv7 00/13] kexec: Use BPF lskel to enable kexec to load PE format boot image
Date: Fri, 16 Oct 2026 17:56:13 +0200	[thread overview]
Message-ID: <5236ef55-28b4-4331-8c7d-a6d112aa185f@app.fastmail.com> (raw)
In-Reply-To: <20261016144121.GA439341@nvidia.com>


On Fri, 16 Oct 2026, at 16:41, Jason Gunthorpe wrote:
> On Wed, Oct 14, 2026 at 06:39:14AM +0200, Ard Biesheuvel wrote:
>
>> > I've asked some folks here to take a look and try to test this with
>> > real DRTM capable HW. It seems very promising that it will work to me,
>> > and I surmize this is also close to boot a UKI?
>> 
>> It already works for UKIs as well.
>> 
>> The next step is to run it deprivileged - I think the arm64 stub code
>> is already very close to being runnable in that manner.
>
> Abhishek was able to test it on some Grace hardware, and investigate
> the DRTM. He was able to show it works, using some FW debugging to the
> serial port and the post-kexec dmesg:
>
>  <kexec>
>    INFO:    DRTM service handler: version
>    INFO:    DRTM service handler: get error
>    INFO:    ++ DRTM service handler: TPM features
>    INFO:    ++ DRTM service handler: Min. mem. requirement features
>    INFO:    ++ DRTM service handler: DMA protection features
>    INFO:    ++ DRTM service handler: Boot PE ID features
>    INFO:    DRTM service handler: dynamic launch
>
>    [..]
>
>    [  10.655030] DRTM: launch completed
>
> So this solution is absolutely viable for DRTM kexec. Great!
>

Excellent news!

> He had a couple of issues, I will try to summarize them as I
> understood them.
>
> 1) ARM DRTM requires that the executing CPU be the boot CPU when
>    launching the kernel. My patches enforced this in the EFI stub
>    assuming that the EFI stub will be the same CPU as after exit boot
>    services. Since the kthread has no CPU assignment it picks
>    something random and fails these checks:
>
>    [ 3219.695710] kexec_efi: EFI stub: ERROR: DRTM: boot PE 0x20000 
> does not match current PE 0x430000
>    [ 3219.695726] kexec_efi: EFI stub: WARNING: DRTM: preparation 
> failed, continuing without DRTM
>    [ 3219.732742] kexec_efi: EFI image suspended at ExitBootServices(), 
> system table @ 0x1001bff00090
>
>    The kthread this runs in picks a random CPU so it doesn't
>    work. Abhishek was able to put a kthread_bind() in to always use
>    the boot CPU
>

Interesting. I'm not sure this is a reliable workaround, though, given
that the return from ExitBootServices() occurs as a result of another
syscall(), and the kthread is long gone by then.

I think the reliable approach here is taking down all the other cores
before doing the kexec.

> 2) Most of our systems use 64K page size, so the restriction in the
>    series is not great. Abhishek used a 4k predecessor kernel and
>    confirmed he could boot a 64k successor
>

I've dropped that requirement already - the TTBR0 side can just switch
to 4k pages.

> 3) Some compile glitches:
>
>    1. arch/arm64/kernel/kexec_efi.c:175:35: error: 'PTE_ADDR_HIGH'
>    undeclared (first use in this function); did you mean 'PTE_ADDR_LOW'?
>

That is only #define'd when CONFIG_ARM64_PA_BITS_52 is set. I don't think
we should be using that directly, though - I'll investigate.

>    2. KEXEC_EFI_STUB declares depends on ARM64_4K_PAGES but nothing about
>    PA_BITS, so a 4K + 48-bit-PA config does not compile.
>

Same problem, I suppose?

>    3. With rustc 1.85.0, which is what scripts/min-tool-version.sh asks
>    for on arm64, the link fails:
>
>      ld: arch/arm64/kernel/kexec_efi_glue.o: undefined reference to
>      `__rust_no_alloc_shim_is_unstable'
>
>      ld: rust/alloc.o: undefined reference to 
> `__rust_alloc_error_handler_should_panic'
>
>    He used rustc 1.96.0 instead and it builds fine.
>

I think this is related to the use of the 'alloc' API, which my efiloader
crate uses but does not exist in the same way in the kernel. I'll look into
this as well.

In other news, I've added some other features to the prototype: x86_64
support, support for UKIs including sidecars etc (the kexec image loader
now accepts a cpio archive which can be presented as the ESP) and some
other improvements. This is highly in flux so let's compare notes often
so things do not diverge unnecessarily.



  reply	other threads:[~2026-10-16 15:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-22  1:43 Pingfan Liu
2026-03-22  1:43 ` [PATCHv7 01/13] bpf: Introduce kfuncs to parser buffer content Pingfan Liu
2026-03-22  2:14   ` bot+bpf-ci
2026-03-22  1:43 ` [PATCHv7 02/13] kexec_file: Use bpf-prog to decompose image Pingfan Liu
2026-03-22  2:14   ` bot+bpf-ci
2026-03-22  1:43 ` [PATCHv7 03/13] lib/decompress: Keep decompressor when CONFIG_KEEP_DECOMPRESSOR Pingfan Liu
2026-03-22  2:26   ` bot+bpf-ci
2026-03-22  1:43 ` [PATCHv7 04/13] kexec_file: Implement decompress method for parser Pingfan Liu
2026-03-22  2:26   ` bot+bpf-ci
2026-03-22  1:43 ` [PATCHv7 05/13] kexec_file: Implement copy " Pingfan Liu
2026-03-22  1:43 ` [PATCHv7 06/13] kexec_file: Chain the stages into a pipeline Pingfan Liu
2026-03-22  2:14   ` bot+bpf-ci
2026-03-22  1:43 ` [PATCHv7 07/13] kexec_file: Introduce a bpf-prog lskel to run a format parser Pingfan Liu
2026-03-22  1:43 ` [PATCHv7 08/13] kexec_file: Factor out routine to find a symbol in ELF Pingfan Liu
2026-03-22  2:14   ` bot+bpf-ci
2026-03-23  7:07   ` kernel test robot
2026-03-23 10:19   ` kernel test robot
2026-03-22  1:43 ` [PATCHv7 09/13] kexec_file: Integrate bpf light skeleton to load image with bpf-prog Pingfan Liu
2026-03-22  2:14   ` bot+bpf-ci
2026-03-22  1:43 ` [PATCHv7 10/13] arm64/kexec: Select KEXEC_BPF to support UEFI-style kernel image Pingfan Liu
2026-03-22  1:44 ` [PATCHv7 11/13] tools/kexec: Introduce a bpf-prog to handle zboot image Pingfan Liu
2026-03-22  2:26   ` bot+bpf-ci
2026-03-22  1:44 ` [PATCHv7 12/13] tools/kexec: Introduce a bpf-prog to handle UKI image Pingfan Liu
2026-03-22  1:44 ` [PATCHv7 13/13] tools/kexec: Introduce a tool to build zboot envelop Pingfan Liu
2026-03-23 19:02 ` [PATCHv7 00/13] kexec: Use BPF lskel to enable kexec to load PE format boot image Andrew Morton
2026-03-24  7:09   ` Pingfan Liu
2026-10-11 20:13 ` Jason Gunthorpe
2026-10-13 19:19   ` Ard Biesheuvel
2026-10-14  0:02     ` Jason Gunthorpe
2026-10-14  4:39       ` Ard Biesheuvel
2026-10-16 14:41         ` Jason Gunthorpe
2026-10-16 15:56           ` Ard Biesheuvel [this message]
2026-10-16 16:29             ` Jason Gunthorpe

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=5236ef55-28b4-4331-8c7d-a6d112aa185f@app.fastmail.com \
    --to=ardb@kernel.org \
    --cc=abhshinde@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=horms@kernel.org \
    --cc=jeremy.linton@arm.com \
    --cc=jgg@nvidia.com \
    --cc=john.fastabend@gmail.com \
    --cc=kernel@jfarr.cc \
    --cc=kexec@lists.infradead.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=martin.lau@linux.dev \
    --cc=prudo@redhat.com \
    --cc=song@kernel.org \
    --cc=systemd-devel@lists.freedesktop.org \
    --cc=vkuznets@redhat.com \
    --cc=vmalik@redhat.com \
    --cc=will@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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®