On 10/17/2016 02:50 PM, Paolo Bonzini wrote: >> Some testcase will trigger a guest panic state. For testing purposes >> it can be useful to exit QEMU anyway. > > I wonder if this should be done by default *unless* -no-shutdown is > provided. This would require some planning (and delay this to 2.9, > in all likelihood), but it probably would be pretty nice for general > usage.
Yes, might also an option. There are basically two cases a: guest panic b: qemu panic (e.g. if KVM_RUN return EFAULT) I think for b, the current behaviour might be better. In any case I want a tuneable and either -no-panic or the new -no-shutdown would allow that. > > Paolo > >> Signed-off-by: Christian Borntraeger <borntrae...@de.ibm.com> >> --- >> qemu-options.hx | 9 +++++++++ >> vl.c | 6 ++++++ >> 2 files changed, 15 insertions(+) >> >> diff --git a/qemu-options.hx b/qemu-options.hx >> index 01f01df..ee6d3d0 100644 >> --- a/qemu-options.hx >> +++ b/qemu-options.hx >> @@ -3301,6 +3301,15 @@ This allows for instance switching to monitor to >> commit changes to the >> disk image. >> ETEXI >> >> +DEF("no-panic", 0, QEMU_OPTION_no_panic, \ >> + "-no-panic exit QEMU also in guest panic state\n", QEMU_ARCH_ALL) >> +STEXI >> +@item -no-panic >> +@findex -no-panic >> +Exit QEMU on guest panic instead of keeping it alive. This allows for >> +instance running tests that are known to panic at the end. >> +ETEXI >> + >> DEF("loadvm", HAS_ARG, QEMU_OPTION_loadvm, \ >> "-loadvm [tag|id]\n" \ >> " start right away with a saved state (loadvm in >> monitor)\n", >> diff --git a/vl.c b/vl.c >> index f3abd99..57e1d91 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -164,6 +164,7 @@ int no_hpet = 0; >> int fd_bootchk = 1; >> static int no_reboot; >> int no_shutdown = 0; >> +int no_panic = 0; >> int cursor_hide = 1; >> int graphic_rotate = 0; >> const char *watchdog; >> @@ -1774,6 +1775,8 @@ void qemu_system_reset(bool report) >> >> void qemu_system_guest_panicked(void) >> { >> + if (no_panic) >> + return qemu_system_shutdown_request(); >> if (current_cpu) { >> current_cpu->crash_occurred = true; >> } >> @@ -3780,6 +3783,9 @@ int main(int argc, char **argv, char **envp) >> case QEMU_OPTION_no_shutdown: >> no_shutdown = 1; >> break; >> + case QEMU_OPTION_no_panic: >> + no_panic = 1; >> + break; >> case QEMU_OPTION_show_cursor: >> cursor_hide = 0; >> break; >> -- >> 2.5.5 >> >> >