From: Peter Xu <peterx@redhat.com>
To: Eugenio Perez Martin <eperezma@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>,
qemu-level <qemu-devel@nongnu.org>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH] virtio: Add corresponding memory_listener_unregister to unrealize
Date: Mon, 25 Jan 2021 12:18:04 -0500 [thread overview]
Message-ID: <20210125171804.GL260413@xz-x1> (raw)
In-Reply-To: <CAJaqyWdYQH8O-WvLm4raWtWbhwz6BiC3ucGyi584BWALyy+UUA@mail.gmail.com>
On Mon, Jan 25, 2021 at 05:55:35PM +0100, Eugenio Perez Martin wrote:
> On Mon, Jan 25, 2021 at 4:15 AM Jason Wang <jasowang@redhat.com> wrote:
> >
> >
> > On 2021/1/23 上午4:08, Eugenio Pérez wrote:
> > > Cannot destroy address spaces of IOMMU-aware virtio devices without it,
> > > since they can contain memory listeners.
> >
> >
> > It's better to explain why the one in finalize doesn't work here.
> >
>
> Hi Jason! Good point. The other call is at virtio_device_instance_finalize.
>
> Function virtio_device_instance_finalize is called after
> address_space_destroy if we follow steps of buglink.
>
> Address_space_destroy is called by
> pci_qdev_unrealize/do_pci_unregister_device, after call to
> virtio_device_unrealize. After that call,
> virtio_device_instance_finalize is called through object_deinit,
> freeing the bus.
>
> Also, memory_listener_unregister can be called again because it checks
> for listener->address_space != NULL at start, and sets it to NULL at
> end.
>
> In regular shutdown, nothing of this is called, so maybe we could
> safely delete the call to memory_listener_unregister at
> virtio_device_instance_finalize?
I didn't notice this; if so we'd better remove that call if it's destined to be
a noop after all.
>
> If not, should I send again the patch with a new commit message?
Maybe attach the full backtrace too along with above? The assertion itself
could be a very good explanation of what's happened.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2021-01-25 17:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-22 20:08 [PATCH] virtio: Add corresponding memory_listener_unregister to unrealize Eugenio Pérez
2021-01-22 20:17 ` Peter Xu
2021-01-25 3:15 ` Jason Wang
2021-01-25 16:55 ` Eugenio Perez Martin
2021-01-25 17:18 ` Peter Xu [this message]
2021-01-25 19:22 ` Eugenio Perez Martin
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=20210125171804.GL260413@xz-x1 \
--to=peterx@redhat.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.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).