Skip to content

Commit 93c7d43

Browse files
saiarcot895qiluo-msft
authored andcommitted
[warm-reboot] Use kexec_file_load instead of kexec_load when available (sonic-net#2608)
On some dev VMs, warm reboot on a VS image fails. Specifically, after kexec is called and the new kernel starts, the new kernel tries to load the initramfs, but fails to do so for whatever reason. There may be messages about gzip decompression failing and that it's corrupted. After some experimentation, it was found that when first loading the new kernel and initramfs into memory, using the `kexec_file_load` syscall (`-s` flag in kexec) worked fine, whereas using the default `kexec_load` syscall resulted in a failure. It's unknown why `kexec_file_load` worked fine when `kexec_load` didn't; there shouldn't be any difference for non-secure boot kernels, as far as I can tell. What was seen, however, was that when taking a KVM dump in the failure case, the memory that stored the initramfs had differences compared to what was on disk. It's unknown what caused these differences. As a workaround (and as a bit of a feature enhancement), use the `-a` flag with kexec, which tells it to use `kexec_file_load` if available, and `kexec_load` if it's not available or otherwise fails. armhf doesn't support `kexec_file_load`, whereas arm64 gained support for `kexec_file_load` in the 5.19 kernel (we're currently on 5.10). `amd64` has supported `kexec_file_load` since 3.17. This also makes it possible to do kexec on secure boot systems, where the kernel image must be loaded via `kexec_file_load`. Signed-off-by: Saikrishna Arcot <[email protected]> Signed-off-by: Saikrishna Arcot <[email protected]>
1 parent 8627944 commit 93c7d43

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/fast-reboot

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ function load_aboot_secureboot_kernel() {
411411
412412
function load_kernel() {
413413
# Load kernel into the memory
414-
/sbin/kexec -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$BOOT_OPTIONS"
414+
/sbin/kexec -a -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$BOOT_OPTIONS"
415415
}
416416
417417
function unload_kernel()

0 commit comments

Comments
 (0)