qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: qemu-devel@nongnu.org
Cc: alex.williamson@redhat.com, Kunkun Jiang <jiangkunkun@huawei.com>,
	Qixin Gan <ganqixin@huawei.com>
Subject: [PULL 2/3] vfio: Fix unregister SaveVMHandler in vfio_migration_finalize
Date: Fri, 18 Jun 2021 09:34:59 -0600	[thread overview]
Message-ID: <162403049979.1793226.9917806596521410205.stgit@omen> (raw)
In-Reply-To: <162403041204.1793226.16018359908572247606.stgit@omen>

From: Kunkun Jiang <jiangkunkun@huawei.com>

In the vfio_migration_init(), the SaveVMHandler is registered for
VFIO device. But it lacks the operation of 'unregister'. It will
lead to 'Segmentation fault (core dumped)' in
qemu_savevm_state_setup(), if performing live migration after a
VFIO device is hot deleted.

Fixes: 7c2f5f75f94 (vfio: Register SaveVMHandlers for VFIO device)
Reported-by: Qixin Gan <ganqixin@huawei.com>
Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
Message-Id: <20210527123101.289-1-jiangkunkun@huawei.com>
Reviewed by: Kirti Wankhede <kwankhede@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 hw/vfio/migration.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 201642d75e6b..ef397ebe6c09 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -892,6 +892,7 @@ void vfio_migration_finalize(VFIODevice *vbasedev)
 
         remove_migration_state_change_notifier(&migration->migration_state);
         qemu_del_vm_change_state_handler(migration->vm_state);
+        unregister_savevm(VMSTATE_IF(vbasedev->dev), "vfio", vbasedev);
         vfio_migration_exit(vbasedev);
     }
 




  parent reply	other threads:[~2021-06-18 15:36 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 ` Alex Williamson [this message]
2021-06-18 15:35 ` [PULL 3/3] vfio/migration: Correct device state from vmstate change for savevm case Alex Williamson
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=162403049979.1793226.9917806596521410205.stgit@omen \
    --to=alex.williamson@redhat.com \
    --cc=ganqixin@huawei.com \
    --cc=jiangkunkun@huawei.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).