vfio/migration: Correct device state from vmstate change for savevm case.
PATCH 1/1 vfio/migration: Correct device state from vmstate change for savevm case.
Set _SAVING flag for device state from vmstate change handler when it gets called from savevm.
Currently State transition savevm/suspend is seen as:
_RUNNING -> _STOP -> Stop-and-copy -> _STOP
State transition savevm/suspend should be:
_RUNNING -> Stop-and-copy -> _STOP
State transition from _RUNNING to _STOP occurs from vfio_vmstate_change() where when vmstate changes from running to !running, _RUNNING flag is reset but at the same time when vfio_vmstate_change() is called for RUN_STATE_SAVE_VM, _SAVING bit should be set.
Reported by: Yishai Hadas <[email protected]>
--- hw/vfio/migration.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
hw/vfio/migration.c +10 -1
@@ -725,7 +725,16 @@ static void vfio_vmstate_change(void *opaque, bool running, RunState state)* _RUNNING bit */ mask = ~VFIO_DEVICE_STATE_RUNNING ; - value =0 ; + +/* +* When VM state transition to stop for savevm command, device should +* start saving data. +*/ +if (state ==RUN_STATE_SAVE_VM ) { + value =VFIO_DEVICE_STATE_SAVING ; + }else { + value =0 ; + } } ret =vfio_migration_set_state (vbasedev, mask, value);
Signature · 1 line
2.7.0
CCing more Nvidia folks who are testing this patch.
Gentle Ping for review.
Thanks,
Kirti
Quoted 43 lines · Kirti Wankhede
Set
_SAVINGflag for device state from vmstate change handler when it gets called from savevm.Currently State transition savevm/suspend is seen as:
_RUNNING -> _STOP -> Stop-and-copy -> _STOPState transition savevm/suspend should be:
_RUNNING -> Stop-and-copy -> _STOPState transition from
_RUNNINGto_STOPoccurs fromvfio_vmstate_change()where when vmstate changes from running to !running,_RUNNINGflag is reset but at the same time whenvfio_vmstate_change()is called forRUN_STATE_SAVE_VM,_SAVINGbit should be set.Reported by: Yishai Hadas <[email protected]>
Signed-off-by Kirti Wankhede <[email protected]>--- hw/vfio/migration.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)hw/vfio/migration.c +10
-1@@ -725,7 +725,16 @@ static void vfio_vmstate_change(void *opaque, bool running, RunState state)* _RUNNING bit */ mask = ~VFIO_DEVICE_STATE_RUNNING ; - value =0 ; + +/* +* When VM state transition to stop for savevm command, device should +* start saving data. +*/ +if (state ==RUN_STATE_SAVE_VM ) { + value =VFIO_DEVICE_STATE_SAVING ; + }else { + value =0 ; + } } ret =vfio_migration_set_state (vbasedev, mask, value);