All of lore.kernel.org
 help / color / mirror / Atom feed
* Can't use kexec-tools for preserve-context kexec 'call'?
@ 2024-12-09 14:07 David Woodhouse
  2024-12-12  3:02 ` Baoquan He
  0 siblings, 1 reply; 3+ messages in thread
From: David Woodhouse @ 2024-12-09 14:07 UTC (permalink / raw)
  To: kexec

[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]

In https://git.kernel.org/torvalds/c/07fa619f2a40c there is a test
program which uses kexec to invoke a 4-instruction 'executable' which
merely writes a byte to a serial port and returns.

It just loads a single kexec segment containing those four
instructions.

Should I have been able to do that using kexec-tools? I couldn't work
out how.

And even once it's loaded, 'kexec -f -e' does manage to invoke it, but
then reports 'No such file or directory' after the reboot() system call
returns success. Strace shows:

reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC[  143.979879] Freezing user space processes
[  143.981493] Freezing user space processes completed (elapsed 0.000 seconds)
[  143.982148] OOM killer disabled.
[  143.999573] Disabling non-boot CPUs ...
[  144.017504] smpboot: CPU 1 is now offline
[  144.018298] crash hp: kexec_trylock() failed, kdump image may be inaccurate
B[  144.034246] Enabling non-boot CPUs ...
[  144.034666] crash hp: kexec_trylock() failed, kdump image may be inaccurate
[  144.035396] smpboot: Booting Node 0 Processor 1 APIC 0x1
[  144.037406] CPU1 is up
[  144.042020] virtio_blk virtio1: 2/0/0 default/read/poll queues
[  144.046702] OOM killer enabled.
[  144.047368] Restarting tasks ... done.
) = 0
write(2, "kexec failed: No such file or di"..., 40kexec failed: No such file or directory
) = 40
exit_group(-1)                          = ?
+++ exited with 255 +++






[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can't use kexec-tools for preserve-context kexec 'call'?
  2024-12-09 14:07 Can't use kexec-tools for preserve-context kexec 'call'? David Woodhouse
@ 2024-12-12  3:02 ` Baoquan He
  2024-12-12  9:41   ` David Woodhouse
  0 siblings, 1 reply; 3+ messages in thread
From: Baoquan He @ 2024-12-12  3:02 UTC (permalink / raw)
  To: David Woodhouse; +Cc: kexec

Hi David,

On 12/09/24 at 02:07pm, David Woodhouse wrote:
> In https://git.kernel.org/torvalds/c/07fa619f2a40c there is a test
> program which uses kexec to invoke a 4-instruction 'executable' which
> merely writes a byte to a serial port and returns.
> 
> It just loads a single kexec segment containing those four
> instructions.
> 
> Should I have been able to do that using kexec-tools? I couldn't work
> out how.
> 
> And even once it's loaded, 'kexec -f -e' does manage to invoke it, but
> then reports 'No such file or directory' after the reboot() system call
> returns success. Strace shows:

May I know why you are testing preserve-context feature recently? I
noticed you have raised an issue inside kernel and worked out a draft
patch, while you did't tell what use case or scenario preserve-context
is used in. Asking this because you could be the 1st one to test it and
report issues on preserve-context as far as I know these years.

If there's newly found scenario preserve-context is needed, that's a
good thing. Otherwise we may consider to put it in DEPRECATED list in
kernel config so that we can finally take it off from kernel in several
years, like this people won't meet it and need take time to study what
it is and why it doesn't work as it was declared. What do you think?

Thanks
Baoquan

> 
> reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC[  143.979879] Freezing user space processes
> [  143.981493] Freezing user space processes completed (elapsed 0.000 seconds)
> [  143.982148] OOM killer disabled.
> [  143.999573] Disabling non-boot CPUs ...
> [  144.017504] smpboot: CPU 1 is now offline
> [  144.018298] crash hp: kexec_trylock() failed, kdump image may be inaccurate
> B[  144.034246] Enabling non-boot CPUs ...
> [  144.034666] crash hp: kexec_trylock() failed, kdump image may be inaccurate
> [  144.035396] smpboot: Booting Node 0 Processor 1 APIC 0x1
> [  144.037406] CPU1 is up
> [  144.042020] virtio_blk virtio1: 2/0/0 default/read/poll queues
> [  144.046702] OOM killer enabled.
> [  144.047368] Restarting tasks ... done.
> ) = 0
> write(2, "kexec failed: No such file or di"..., 40kexec failed: No such file or directory
> ) = 40
> exit_group(-1)                          = ?
> +++ exited with 255 +++
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can't use kexec-tools for preserve-context kexec 'call'?
  2024-12-12  3:02 ` Baoquan He
@ 2024-12-12  9:41   ` David Woodhouse
  0 siblings, 0 replies; 3+ messages in thread
From: David Woodhouse @ 2024-12-12  9:41 UTC (permalink / raw)
  To: Baoquan He; +Cc: kexec

[-- Attachment #1: Type: text/plain, Size: 2045 bytes --]

On Thu, 2024-12-12 at 11:02 +0800, Baoquan He wrote:
> Hi David,
> 
> On 12/09/24 at 02:07pm, David Woodhouse wrote:
> > In https://git.kernel.org/torvalds/c/07fa619f2a40c there is a test
> > program which uses kexec to invoke a 4-instruction 'executable' which
> > merely writes a byte to a serial port and returns.
> > 
> > It just loads a single kexec segment containing those four
> > instructions.
> > 
> > Should I have been able to do that using kexec-tools? I couldn't work
> > out how.
> > 
> > And even once it's loaded, 'kexec -f -e' does manage to invoke it, but
> > then reports 'No such file or directory' after the reboot() system call
> > returns success. Strace shows:
> 
> May I know why you are testing preserve-context feature recently? I
> noticed you have raised an issue inside kernel and worked out a draft
> patch, while you did't tell what use case or scenario preserve-context
> is used in. Asking this because you could be the 1st one to test it and
> report issues on preserve-context as far as I know these years.

Right now, I'm testing it because I touched that code path in
relocate_kernel_64.S and thus of *course* I have to test it. How could
anyone touch this code and *not* test for regressions?

> If there's newly found scenario preserve-context is needed, that's a
> good thing. Otherwise we may consider to put it in DEPRECATED list in
> kernel config so that we can finally take it off from kernel in several
> years, like this people won't meet it and need take time to study what
> it is and why it doesn't work as it was declared. What do you think?

By coincidence, however, I do happen to know of a production scenario
in which preserve-context kexec is used a few million times a week.
(Which is lucky, because I was able to crib some of my test case from
that code base.)

The reload-GDT fix is also already in that code base, FWIW, and I have
already frowned at them for not upstreaming it immediately, which was a
violation of our development policy.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-12  9:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-09 14:07 Can't use kexec-tools for preserve-context kexec 'call'? David Woodhouse
2024-12-12  3:02 ` Baoquan He
2024-12-12  9:41   ` David Woodhouse

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.