s390/ipl: fix ipl with -no-reboot
PATCH v2 1/1 s390/ipl: fix ipl with -no-reboot
kexec/kdump as well as the bootloader use a subcode of diagnose 308 that is supposed to reset the subsystem but not comprise a full "reboot". With the latest refactoring this is now broken when -no-reboot is used. This for example break virt-install from iso images.
We need to mark these "soft" reboots as ok for rebooting.
--- hw/s390x/ipl.c | 8 +++++++- include/sysemu/sysemu.h | 3 +++ vl.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-)
hw/s390x/ipl.c +7 -1
@@ -535,7 +535,13 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) ipl->iplb_valid =s390_gen_initial_iplb (ipl); } } -qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); +if (reset_type ==S390_RESET_MODIFIED_CLEAR || + reset_type ==S390_RESET_LOAD_NORMAL ) { +/* ignore -no-reboot */ +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET_FORCE ); + }else { +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); + }/* as this is triggered by a CPU, make sure to exit the loop */ if (tcg_enabled ()) {cpu_loop_exit (cs);
include/sysemu/sysemu.h +3 -0
@@ -44,6 +44,9 @@ typedef enum ShutdownCause {turns that into a shutdown */ SHUTDOWN_CAUSE_GUEST_PANIC ,/* Guest panicked, and command line turns that into a shutdown */ +SHUTDOWN_CAUSE_GUEST_RESET_FORCE ,/* Guest reset that should ignore +--no-reboot. This is useful for reset +like actions as s390 kexec/kdump */ SHUTDOWN_CAUSE__MAX , } ShutdownCause;
vl.c +1 -1
@@ -1674,7 +1674,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)void qemu_system_reset_request (ShutdownCause reason) { -if (no_reboot) { +if (no_reboot && reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) { shutdown_requested = reason; }else { reset_requested = reason;
Signature · 1 line
2.17.0
Quoted 5 lines · Christian Borntraeger
kexec/kdump as well as the bootloader use a subcode of diagnose 308 that is supposed to reset the subsystem but not comprise a full "reboot". With the latest refactoring this is now broken when -no-reboot is used. This for example break virt-install from iso images.
Its even worse. With this patch I can IPL with --no-reboot, but virt-install still creates an xml like
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
With you patch a "soft reset" still seems to trigger an qapi event so that libvirt kills the guest due to that...
Quoted 58 lines
We need to mark these "soft" reboots as ok for rebooting.
Fixes a30fb811cbe9 (s390x: refactor reset/reipl handling)Signed-off-by Christian Borntraeger <[email protected]>--- hw/s390x/ipl.c | 8 +++++++- include/sysemu/sysemu.h | 3 +++ vl.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-)hw/s390x/ipl.c +7
-1@@ -535,7 +535,13 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) ipl->iplb_valid =s390_gen_initial_iplb (ipl); } } -qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); +if (reset_type ==S390_RESET_MODIFIED_CLEAR || + reset_type ==S390_RESET_LOAD_NORMAL ) { +/* ignore -no-reboot */ +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET_FORCE ); + }else { +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); + }/* as this is triggered by a CPU, make sure to exit the loop */ if (tcg_enabled ()) {cpu_loop_exit (cs);include/sysemu/sysemu.h +3
-0@@ -44,6 +44,9 @@ typedef enum ShutdownCause {turns that into a shutdown */ SHUTDOWN_CAUSE_GUEST_PANIC ,/* Guest panicked, and command line turns that into a shutdown */ +SHUTDOWN_CAUSE_GUEST_RESET_FORCE ,/* Guest reset that should ignore +--no-reboot. This is useful for reset +like actions as s390 kexec/kdump */ SHUTDOWN_CAUSE__MAX , } ShutdownCause;vl.c +1
-1@@ -1674,7 +1674,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)void qemu_system_reset_request (ShutdownCause reason) { -if (no_reboot) { +if (no_reboot && reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) { shutdown_requested = reason; }else { reset_requested = reason;
Quoted 12 lines · Christian Borntraeger
Quoted 5 lines · Christian Borntraeger
kexec/kdump as well as the bootloader use a subcode of diagnose 308 that is supposed to reset the subsystem but not comprise a full "reboot". With the latest refactoring this is now broken when -no-reboot is used. This for example break virt-install from iso images.
Its even worse. With this patch I can IPL with --no-reboot, but virt-install still creates an xml like
Quoted 6 lines
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>With you patch a "soft reset" still seems to trigger an qapi event so that libvirt kills the guest due to that...
So this on top....
vl.c +1 -1
@@ -1628,7 +1628,7 @@ void qemu_system_reset(ShutdownCause reason) }else {qemu_devices_reset (); } -if (reason) { +if (reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) {qapi_event_send_reset (shutdown_caused_by_guest (reason), &error_abort); }
Quoted 12 lines · Christian Borntraeger
Quoted 5 lines · Christian Borntraeger
kexec/kdump as well as the bootloader use a subcode of diagnose 308 that is supposed to reset the subsystem but not comprise a full "reboot". With the latest refactoring this is now broken when -no-reboot is used. This for example break virt-install from iso images.
Its even worse. With this patch I can IPL with --no-reboot, but virt-install still creates an xml like
Quoted 6 lines
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>With you patch a "soft reset" still seems to trigger an qapi event so that libvirt kills the guest due to that...
Either
Quoted 51 lines
Quoted 51 lines
We need to mark these "soft" reboots as ok for rebooting.
Fixes a30fb811cbe9 (s390x: refactor reset/reipl handling)Signed-off-by Christian Borntraeger <[email protected]>--- hw/s390x/ipl.c | 8 +++++++- include/sysemu/sysemu.h | 3 +++ vl.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-)hw/s390x/ipl.c +7
-1@@ -535,7 +535,13 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) ipl->iplb_valid =s390_gen_initial_iplb (ipl); } } -qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); +if (reset_type ==S390_RESET_MODIFIED_CLEAR || + reset_type ==S390_RESET_LOAD_NORMAL ) { +/* ignore -no-reboot */ +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET_FORCE ); + }else { +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); + }/* as this is triggered by a CPU, make sure to exit the loop */ if (tcg_enabled ()) {cpu_loop_exit (cs);include/sysemu/sysemu.h +3
-0@@ -44,6 +44,9 @@ typedef enum ShutdownCause {turns that into a shutdown */ SHUTDOWN_CAUSE_GUEST_PANIC ,/* Guest panicked, and command line turns that into a shutdown */ +SHUTDOWN_CAUSE_GUEST_RESET_FORCE ,/* Guest reset that should ignore +--no-reboot. This is useful for reset +like actions as s390 kexec/kdump */ SHUTDOWN_CAUSE__MAX , } ShutdownCause;vl.c +0
-0@@ -1674,7 +1674,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)
Quoted 9 lines
vl.c void qemu_system_guest_panicked(GuestPanicInformation *info) · line 1680
Quoted 8 lines
vl.c +1
-1void qemu_system_reset_request (ShutdownCause reason) { -if (no_reboot) { +if (no_reboot && reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) { shutdown_requested = reason; }else { reset_requested = reason;
Maybe
SHUTDOWN_CAUSE_GUEST_RESET_FORCE -> SHUTDOWN_CAUSE_GUEST_RESET_INTERNAL
vl.c +1 -1
@@ -1628,7 +1628,7 @@ void qemu_system_reset(ShutdownCause reason) }else {qemu_devices_reset (); } -if (reason) { +if (reason !=SHUTDOWN_CAUSE_GUEST_RESET_INTERNAL ) {qapi_event_send_reset (shutdown_caused_by_guest (reason), &error_abort); }
Or revert ;)
Signature · 3 lines
Thanks, David / dhildenb