> -----Original Message----- > From: Dr. David Alan Gilbert [mailto:dgilb...@redhat.com] > Sent: Tuesday, August 14, 2018 7:52 PM > To: Paolo Bonzini <pbonz...@redhat.com> > Cc: Zhoujian (jay) <jianjay.z...@huawei.com>; qemu-devel@nongnu.org; > quint...@redhat.com; wangxin (U) <wangxinxin.w...@huawei.com> > Subject: Re: [RFC PATCH] vl: fix migration when watchdog expires > > * Paolo Bonzini (pbonz...@redhat.com) wrote: > > On 14/08/2018 12:48, Jay Zhou wrote: > > > I got the following error when migrating a VM with watchdog > > > device: > > > > > > {"timestamp": {"seconds": 1533884471, "microseconds": 668099}, > > > "event": "WATCHDOG", "data": {"action": "reset"}} > > > {"timestamp": {"seconds": 1533884471, "microseconds": 677658}, > > > "event": "RESET", "data": {"guest": true}} > > > {"timestamp": {"seconds": 1533884471, "microseconds": 677874}, > > > "event": "STOP"} > > > qemu-system-x86_64: invalid runstate transition: 'prelaunch' -> > 'postmigrate' > > > Aborted > > > > > > The run state transition is RUN_STATE_FINISH_MIGRATE to > > > RUN_STATE_PRELAUNCH, then the migration thread aborted when it tries to > set RUN_STATE_POSTMIGRATE. > > > There is a race between the main loop thread and the migration thread I > think. > > > > In that case I think you shouldn't go to POSTMIGRATE at all, because > > the VM has been reset. > > Migration has the VM stopped; it's not expecting the state to change at that > point. > > > Alternatively, when the watchdog fires in RUN_STATE_FINISH_MIGRATE > > state, it might delay the action until after the "cont" command is > > invoked on the source, but I'm not sure what's the best way to achieve > > that... > > Jay: Which watchdog were you using?
Hi Dave, it is i6300esb, which uses QEMU_CLOCK_VIRTUAL. > > a) Should the watchdog expire when the VM is stopped; I think it shouldn't - > hw/acpi/tco.c uses a virtual timer as does i6300esb; so is the bug here that > the watchdog being used didn't use a virtual timer? > > b) If the watchdog expires just before the VM gets stopped, is there a race > which could hit this? Possibly. This is the case I met I think. Regards, Jay Zhou > > c) Could main_loop_should_exit guard all the 'request's by something that > checks whether the VM is stopped? > > Dave > > > > Paolo > -- > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK