From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Xueming(Steven) Li" <xuemingl@nvidia.com>
Cc: "zhangyuwei.9149@bytedance.com" <zhangyuwei.9149@bytedance.com>,
"qemu-stable@nongnu.org" <qemu-stable@nongnu.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"tiwei.bie@intel.com" <tiwei.bie@intel.com>,
"raphael.norwitz@nutanix.com" <raphael.norwitz@nutanix.com>
Subject: Re: [PATCH v3 2/2] vhost-user: remove VirtQ notifier restore
Date: Tue, 19 Oct 2021 03:24:56 -0400 [thread overview]
Message-ID: <20211019032437-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1e58a3d2b8cfd9b802e5e9422598a9217f306ee9.camel@nvidia.com>
On Tue, Oct 19, 2021 at 07:21:24AM +0000, Xueming(Steven) Li wrote:
> On Tue, 2021-10-19 at 02:37 -0400, Michael S. Tsirkin wrote:
> > On Fri, Oct 08, 2021 at 03:58:05PM +0800, Xueming Li wrote:
> > > When vhost-user vdpa client restart, VQ notifier resources become
> > > invalid, no need to keep mmap, vdpa client will set VQ notifier after
> > > reconnect.
> > >
> > > Removes VQ notifier restore and related flags.
> > >
> > > Fixes: 44866521bd6e ("vhost-user: support registering external host notifiers")
> > > Cc: tiwei.bie@intel.com
> > > Cc: qemu-stable@nongnu.org
> > > Cc: Yuwei Zhang <zhangyuwei.9149@bytedance.com>
> > > Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> >
> > Pls fix up bisect and repost.
> > Also, can you please clarify what does "no need" mean?
>
> mmap becomes invalid, need to unmap it.
confused even more. pls include explanation in commit log.
> > You include a Fixes tag but is there a bug? What behaviour
> > are you trying to fix? A resource leak?
> > Or are you just simplifying code?
> > If the later then no need for a Fixes tag.
>
> Yes, just simplifying code, will remove it.
>
> >
> >
> >
> >
> > > ---
> > > hw/virtio/vhost-user.c | 20 ++------------------
> > > include/hw/virtio/vhost-user.h | 1 -
> > > 2 files changed, 2 insertions(+), 19 deletions(-)
> > >
> > > diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> > > index b2e948bdc7..d127aa478a 100644
> > > --- a/hw/virtio/vhost-user.c
> > > +++ b/hw/virtio/vhost-user.c
> > > @@ -22,6 +22,7 @@
> > > #include "qemu/main-loop.h"
> > > #include "qemu/sockets.h"
> > > #include "sysemu/cryptodev.h"
> > > +#include "sysemu/cpus.h"
> > > #include "migration/migration.h"
> > > #include "migration/postcopy-ram.h"
> > > #include "trace.h"
> > > @@ -1143,19 +1144,6 @@ static int vhost_user_set_vring_num(struct vhost_dev *dev,
> > > return vhost_set_vring(dev, VHOST_USER_SET_VRING_NUM, ring);
> > > }
> > >
> > > -static void vhost_user_host_notifier_restore(struct vhost_dev *dev,
> > > - int queue_idx)
> > > -{
> > > - struct vhost_user *u = dev->opaque;
> > > - VhostUserHostNotifier *n = &u->user->notifier[queue_idx];
> > > - VirtIODevice *vdev = dev->vdev;
> > > -
> > > - if (n->addr && !n->set) {
> > > - virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true);
> > > - n->set = true;
> > > - }
> > > -}
> > > -
> > > static void vhost_user_host_notifier_remove(struct vhost_dev *dev,
> > > int queue_idx)
> > > {
> > > @@ -1163,7 +1151,7 @@ static void vhost_user_host_notifier_remove(struct vhost_dev *dev,
> > > VhostUserHostNotifier *n = &u->user->notifier[queue_idx];
> > > VirtIODevice *vdev = dev->vdev;
> > >
> > > - if (n->addr && n->set) {
> > > + if (n->addr) {
> > > virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, false);
> > > if (!qemu_in_vcpu_thread()) { /* Avoid vCPU dead lock. */
> > > /* Wait for VM threads accessing old flatview which contains notifier. */
> > > @@ -1171,15 +1159,12 @@ static void vhost_user_host_notifier_remove(struct vhost_dev *dev,
> > > }
> > > munmap(n->addr, qemu_real_host_page_size);
> > > n->addr = NULL;
> > > - n->set = false;
> > > }
> > > }
> > >
> > > static int vhost_user_set_vring_base(struct vhost_dev *dev,
> > > struct vhost_vring_state *ring)
> > > {
> > > - vhost_user_host_notifier_restore(dev, ring->index);
> > > -
> > > return vhost_set_vring(dev, VHOST_USER_SET_VRING_BASE, ring);
> > > }
> > >
> > > @@ -1539,7 +1524,6 @@ static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev,
> > > }
> > >
> > > n->addr = addr;
> > > - n->set = true;
> > >
> > > return 0;
> > > }
> > > diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h
> > > index a9abca3288..f6012b2078 100644
> > > --- a/include/hw/virtio/vhost-user.h
> > > +++ b/include/hw/virtio/vhost-user.h
> > > @@ -14,7 +14,6 @@
> > > typedef struct VhostUserHostNotifier {
> > > MemoryRegion mr;
> > > void *addr;
> > > - bool set;
> > > } VhostUserHostNotifier;
> > >
> > > typedef struct VhostUserState {
> > > --
> > > 2.33.0
> >
>
next prev parent reply other threads:[~2021-10-19 7:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-08 7:58 [PATCH v3 0/2] Improve vhost-user VQ notifier unmap Xueming Li
2021-10-08 7:58 ` [PATCH v3 1/2] vhost-user: fix VirtQ notifier cleanup Xueming Li
2021-10-19 6:15 ` Michael S. Tsirkin
2021-10-19 6:45 ` Xueming(Steven) Li
2021-10-19 6:57 ` Michael S. Tsirkin
2021-10-08 7:58 ` [PATCH v3 2/2] vhost-user: remove VirtQ notifier restore Xueming Li
2021-10-19 6:37 ` Michael S. Tsirkin
2021-10-19 7:21 ` Xueming(Steven) Li
2021-10-19 7:24 ` Michael S. Tsirkin [this message]
2021-10-19 8:00 ` Xueming(Steven) Li
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=20211019032437-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=raphael.norwitz@nutanix.com \
--cc=tiwei.bie@intel.com \
--cc=xuemingl@nvidia.com \
--cc=zhangyuwei.9149@bytedance.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).