From: Alex Williamson <alex.williamson@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kirti Wankhede <kwankhede@nvidia.com>, alex.williamson@redhat.com
Subject: [PULL 3/3] vfio/migration: Correct device state from vmstate change for savevm case
Date: Fri, 18 Jun 2021 09:35:05 -0600 [thread overview]
Message-ID: <162403050520.1793226.14555349399059942330.stgit@omen> (raw)
In-Reply-To: <162403041204.1793226.16018359908572247606.stgit@omen>
From: Kirti Wankhede <kwankhede@nvidia.com>
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 <yishaih@nvidia.com>
Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
Message-Id: <1623177441-27496-1-git-send-email-kwankhede@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
hw/vfio/migration.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index ef397ebe6c09..82f654afb64a 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -724,7 +724,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);
next prev parent reply other threads:[~2021-06-18 15:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 15:34 [PULL 0/3] VFIO update 2021-06-18 Alex Williamson
2021-06-18 15:34 ` [PULL 1/3] docs/devel: Add VFIO device migration documentation Alex Williamson
2021-06-18 15:34 ` [PULL 2/3] vfio: Fix unregister SaveVMHandler in vfio_migration_finalize Alex Williamson
2021-06-18 15:35 ` Alex Williamson [this message]
2021-06-20 20:19 ` [PULL 0/3] VFIO update 2021-06-18 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=162403050520.1793226.14555349399059942330.stgit@omen \
--to=alex.williamson@redhat.com \
--cc=kwankhede@nvidia.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).