On Fri, 2024-12-13 at 20:16 +0000, David Woodhouse wrote: > > > As discussed with Dave over IRC, the current implementation isn't > > actually that bad. It might use PMSG_THAW instead of PMSG_RESTORE in > > kernel_kexec(), but other than this it reflects the code flow around > > the jump from the restore kernel to the image one during resume from > > hibernation. > > > > This means that hibernation and kexec jump could be unified somewhat. > > Fair enough. I'm happy to do whatever cleanups or consolidation make > sense, if we have a consensus. > > There remains the question of why the blk-mq thing explodes on the > way down for both kjump and, apparently, even the plain kexec case. In case it's of any use, here's a test case I put together recently for kexec stress testing. http://david.woodhou.se/kexec.initramfs It's just an initrd I boot in qemu with '-initrd kexec.initramfs' and it builds a copy of itself, then kexecs back into the same kernel with the same initrd. You'll need to drop your own bzImage into it. It was designed to run without a block device, but to trigger the blk-mq thing or the one at https://lore.kernel.org/linux-scsi/F991D40F7D096653+20241203211857.0291ab1b@john-PC/ we'd probably need to actually mount something and maybe do some disk I/O. (Which means the fact that the initrd can rebuild itself with cpio is no longer quite so useful, as it could have just loaded the initrd for the next kernel from the file system. But I already did that part, so whatever.) $ cat init #!/bin/sh find . > files.txt mount -tproc none /proc cat /proc/sys/kernel/watchdog_thresh echo 20 > /proc/sys/kernel/watchdog_thresh mount -tramfs none /tmp NEXTCOUNT=$(($LOOPCOUNT+1)) CMDLINE=$(cat /proc/cmdline) NEWCMDLINE="${CMDLINE/LOOPCOUNT=$LOOPCOUNT/} LOOPCOUNT=$NEXTCOUNT" echo KEXEC LOOP $LOOPCOUNT echo $NEWCMDLINE cpio --quiet -H newc -o < files.txt | gzip -n9 > /tmp/initramfs.gz kexec -f /bzImage --initrd /tmp/initramfs.gz --append "$NEWCMDLINE" $ cp ~/git/linux/arch/x86/boot/bzImage . $ find . | cpio --quiet -H newc -o | gzip -n9 > ../kexec.initramfs $ ls -d `find .` . ./bin/mount ./lib64/ld-linux-x86-64.so.2 ./bin ./bin/sh ./lib64/libc.so.6 ./bin/busybox ./bin/sleep ./lib64/liblzma.so.5 ./bin/cat ./dev ./lib64/liblzma.so.5.4.4 ./bin/cpio ./dev/console ./lib64/libz.so.1 ./bin/echo ./dev/null ./lib64/libz.so.1.2.13 ./bin/find ./dev/ttyS5 ./loadret ./bin/gzip ./init ./loadret.c ./bin/kexec ./init.preserve-context ./proc ./bin/mknod ./lib64 ./tmp
Attachment:
smime.p7s
Description: S/MIME cryptographic signature