qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Shenming Lu <lushenming@huawei.com>
To: Alex Williamson <alex.williamson@redhat.com>,
	Kirti Wankhede <kwankhede@nvidia.com>,
	Cornelia Huck <cohuck@redhat.com>, <qemu-devel@nongnu.org>,
	<qemu-arm@nongnu.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Neo Jia <cjia@nvidia.com>,
	mst@redhat.com, Marc Zyngier <maz@kernel.org>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	Eric Auger <eric.auger@redhat.com>,
	yuzenghui@huawei.com, wanghaibin.wang@huawei.com,
	lushenming@huawei.com
Subject: [PATCH v3 2/3] vfio: Set the priority of the VFIO VM state change handler explicitly
Date: Tue, 23 Feb 2021 10:22:24 +0800	[thread overview]
Message-ID: <20210223022225.50-3-lushenming@huawei.com> (raw)
In-Reply-To: <20210223022225.50-1-lushenming@huawei.com>

In the VFIO VM state change handler when stopping the VM, the _RUNNING
bit in device_state is cleared which makes the VFIO device stop, including
no longer generating interrupts. Then we can save the pending states of
all interrupts in the GIC VM state change handler (on ARM).

So we have to set the priority of the VFIO VM state change handler
explicitly (like virtio devices) to ensure it is called before the
GIC's in saving.

Signed-off-by: Shenming Lu <lushenming@huawei.com>
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
---
 hw/vfio/migration.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index f5bf67f642..b74982e3e6 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -862,7 +862,8 @@ static int vfio_migration_init(VFIODevice *vbasedev,
     register_savevm_live(id, VMSTATE_INSTANCE_ID_ANY, 1, &savevm_vfio_handlers,
                          vbasedev);
 
-    migration->vm_state = qemu_add_vm_change_state_handler(vfio_vmstate_change,
+    migration->vm_state = qdev_add_vm_change_state_handler(vbasedev->dev,
+                                                           vfio_vmstate_change,
                                                            vbasedev);
     migration->migration_state.notify = vfio_migration_state_notifier;
     add_migration_state_change_notifier(&migration->migration_state);
-- 
2.19.1



  parent reply	other threads:[~2021-02-23  2:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23  2:22 [PATCH v3 0/3] vfio: Some fixes and optimizations for VFIO migration Shenming Lu
2021-02-23  2:22 ` [PATCH v3 1/3] vfio: Move the saving of the config space to the right place in " Shenming Lu
2021-03-01  5:57   ` Kirti Wankhede
2021-02-23  2:22 ` Shenming Lu [this message]
2021-02-23  2:22 ` [PATCH v3 3/3] vfio: Avoid disabling and enabling vectors repeatedly " Shenming Lu
2021-03-02 21:26   ` Alex Williamson
2021-03-09  7:25     ` Shenming Lu
2021-03-09 18:12       ` Alex Williamson
2021-03-02  5:58 ` [PATCH v3 0/3] vfio: Some fixes and optimizations for " Shenming Lu

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=20210223022225.50-3-lushenming@huawei.com \
    --to=lushenming@huawei.com \
    --cc=alex.williamson@redhat.com \
    --cc=cjia@nvidia.com \
    --cc=cohuck@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=kwankhede@nvidia.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=maz@kernel.org \
    --cc=mst@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wanghaibin.wang@huawei.com \
    --cc=yuzenghui@huawei.com \
    /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).