From: "Cédric Le Goater" <clg@kaod.org>
To: Yang Zhong <yang.zhong@linux.intel.com>,
Alex Williamson <alex.williamson@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: <qemu-devel@nongnu.org>
Subject: Re: About the instance_finalize callback in VFIO PCI
Date: Tue, 21 Mar 2023 18:30:14 +0100 [thread overview]
Message-ID: <1d364b78-3dbb-87cb-daff-e92f40444ab7@kaod.org> (raw)
In-Reply-To: <ZBgn90bjw9iRaTrw@yangzhon>
On 3/20/23 10:31, Yang Zhong wrote:
> Hello Alex and Paolo,
>
> There is one instance_finalize callback definition in hw/vfio/pci.c, but
> i find this callback(vfio_instance_finalize()) never be called during the
> VM shutdown with close VM or "init 0" command in guest.
>
> The Qemu related command:
> ......
> -device vfio-pci,host=d9:00.0
> ......
well, the finalize op is correctly called for hot unplugged devices, using
device_add.
> static const TypeInfo vfio_pci_dev_info = {
> .name = TYPE_VFIO_PCI,
> .parent = TYPE_PCI_DEVICE,
> .instance_size = sizeof(VFIOPCIDevice),
> .class_init = vfio_pci_dev_class_init,
> .instance_init = vfio_instance_init,
> .instance_finalize = vfio_instance_finalize,
> .interfaces = (InterfaceInfo[]) {
> { INTERFACE_PCIE_DEVICE },
> { INTERFACE_CONVENTIONAL_PCI_DEVICE },
> { }
> },
> };
>
> If my test method is wrong, would you please tell me how to trigger to
> this callback when VM shutdown? thanks
I would have thought that user_creatable_cleanup would have taken care
of it. But it's not. This needs some digging.
C.
> By the way, i also debugged other instance_finalize callback functions,
> if my understanding is right, all instance_finalize callback should be
> called from object_unref(object) from qemu_cleanup(void) in
> ./softmmu/runstate.c. But there is no VFIO related object_unref() call in
> this cleanup function, So the instance_finalize callback in vfio pci
> should be useless? thanks!
>
> Regards,
> Yang
>
>
next prev parent reply other threads:[~2023-03-21 17:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 9:31 About the instance_finalize callback in VFIO PCI Yang Zhong
2023-03-21 17:30 ` Cédric Le Goater [this message]
2023-03-21 20:44 ` Paolo Bonzini
2023-03-22 12:39 ` Yang Zhong
2023-03-22 12:28 ` Yang Zhong
2023-03-22 12:56 ` Cédric Le Goater
2023-03-22 13:10 ` Yang Zhong
2023-03-22 18:22 ` Alex Williamson
2023-03-23 5:58 ` Yang Zhong
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=1d364b78-3dbb-87cb-daff-e92f40444ab7@kaod.org \
--to=clg@kaod.org \
--cc=alex.williamson@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yang.zhong@linux.intel.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).