Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Bohac <jbohac@suse.cz>
To: kexec@lists.infradead.org
Subject: [PATCH] kexec: don't use kexec_file_load on XEN
Date: Tue, 16 Jan 2024 18:14:31 +0100	[thread overview]
Message-ID: <Zaa5dwoUi4WnrCMA@dwarf.suse.cz> (raw)

Since commit 29fe5067ed07 ("kexec: make -a the default")
kexec tries the kexec_file_load syscall first and only falls back to kexec_load on
selected error codes.

This effectively breaks kexec on XEN, unless -c is pecified to force the kexec_load
syscall.

The XEN-specific functions (xen_kexec_load / xen_kexec_unload) are only called
from my_load / k_unload, i.e. the kexec_load code path.

With -p (panic kernel) kexec_file_load on XEN fails with -EADDRNOTAVAIL (crash
kernel reservation is ignored by the kernel on XEN), which is not in the list
of return codes that cause the fallback to kexec_file.

Without -p kexec_file_load actualy leads to a kernel oops on v6.4.0
(needs to be dubugged separately).

Signed-off-by: Jiri Bohac <jbohac@suse.cz>
Fixes: 29fe5067ed07 ("kexec: make -a the default")
---
 kexec/kexec.8 | 1 +
 kexec/kexec.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/kexec/kexec.8 b/kexec/kexec.8
index b969cea..9e995fe 100644
--- a/kexec/kexec.8
+++ b/kexec/kexec.8
@@ -162,6 +162,7 @@ Specify that the new kernel is of this
 .TP
 .BI \-s\ (\-\-kexec-file-syscall)
 Specify that the new KEXEC_FILE_LOAD syscall should be used exclusively.
+Ignored on XEN.
 .TP
 .BI \-c\ (\-\-kexec-syscall)
 Specify that the old KEXEC_LOAD syscall should be used exclusively.
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 08edfca..9d0ec46 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1685,6 +1685,10 @@ int main(int argc, char *argv[])
 			}
 		}
 	}
+	if (xen_present()) {
+		do_kexec_file_syscall = 0;
+		do_kexec_fallback = 0;
+	}
 	if (do_kexec_file_syscall) {
 		if (do_load_jump_back_helper && !do_kexec_fallback)
 			die("--load-jump-back-helper not supported with kexec_file_load\n");
-- 
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, Prague, Czechia


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

             reply	other threads:[~2024-01-16 17:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 17:14 Jiri Bohac [this message]
2024-01-25 17:02 ` [PATCH] kexec: don't use kexec_file_load on XEN Simon Horman

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=Zaa5dwoUi4WnrCMA@dwarf.suse.cz \
    --to=jbohac@suse.cz \
    --cc=kexec@lists.infradead.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