From: Paolo Bonzini <pbonzini@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio-pci: fix memory MR cleanup for modern
Date: Mon, 27 Jul 2015 15:30:27 +0200 [thread overview]
Message-ID: <55B63273.5080509@redhat.com> (raw)
In-Reply-To: <1438003477-5769-1-git-send-email-mst@redhat.com>
On 27/07/2015 15:24, Michael S. Tsirkin wrote:
> +static void virtio_pci_modern_region_unmap(VirtIOPCIProxy *proxy,
> + VirtIOPCIRegion *region)
> +{
> + memory_region_del_subregion(&proxy->modern_bar,
> + ®ion->mr);
> +}
> +
> /* This is called by virtio-bus just after the device is plugged. */
> static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
> {
> @@ -1520,8 +1527,16 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
> static void virtio_pci_device_unplugged(DeviceState *d)
> {
> VirtIOPCIProxy *proxy = VIRTIO_PCI(d);
> + bool modern = !(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_MODERN);
>
> virtio_pci_stop_ioeventfd(proxy);
> +
> + if (modern) {
> + virtio_pci_modern_region_unmap(proxy, &proxy->common);
> + virtio_pci_modern_region_unmap(proxy, &proxy->isr);
> + virtio_pci_modern_region_unmap(proxy, &proxy->device);
> + virtio_pci_modern_region_unmap(proxy, &proxy->notify);
> + }
> }
Actually this is not necessary. memory_region_del_subregion is only
needed inasmuch as it prevents further guest access to the region, so
it's enough that the toplevel region (the modern_bar itself) is
unmapped. The PCI core does that automatically.
That said, it's polite to unmap everything, so if you want this patch:
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo
next prev parent reply other threads:[~2015-07-27 13:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-27 13:24 [Qemu-devel] [PATCH] virtio-pci: fix memory MR cleanup for modern Michael S. Tsirkin
2015-07-27 13:30 ` Paolo Bonzini [this message]
2015-07-27 14:21 ` Paolo Bonzini
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=55B63273.5080509@redhat.com \
--to=pbonzini@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.