Skip to contentSkip to conversation

kexec: don't use kexec_file_load on XEN

PATCH In review Jiri Bohac 2 participants 2 messages Jan 16, 2024 – Jan 25, 2024

Subsystems (2)
lore
Share & tools
lore

Jiri Bohac

author
#0 lore raw

PATCH 1/1 kexec: don't use kexec_file_load on XEN

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).

Fixes 29fe5067ed07 ("kexec: make -a the default")
---
 kexec/kexec.8 | 1 +
 kexec/kexec.c | 4 ++++
 2 files changed, 5 insertions(+)
kexec/kexec.8 +1 -0
index b969cea..9e995fe 100644
@@ -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.
kexec/kexec.c +4 -0
index 08edfca..9d0ec46 100644
@@ -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");
Signature · 8 lines
Jiri Bohac <[email protected]>
SUSE Labs, Prague, Czechia


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw
Quoted 14 lines · Jiri Bohac

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.

Quoted 5 lines

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

Fixes 29fe5067ed07 ("kexec: make -a the default")

Thanks Jiri,

and sorry for the delay.
Applied to main.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec