qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "Xie, Huawei" <huawei.xie@intel.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] Revert "vhost: rename VHOST_RESET_OWNER to VHOST_RESET_DEVICE"
Date: Fri, 16 Oct 2015 16:04:09 +0800	[thread overview]
Message-ID: <20151016080409.GM3115@yliu-dev.sh.intel.com> (raw)
In-Reply-To: <20151016103429-mutt-send-email-mst@redhat.com>

On Fri, Oct 16, 2015 at 10:47:49AM +0300, Michael S. Tsirkin wrote:
> On Fri, Oct 16, 2015 at 03:32:56PM +0800, Yuanhan Liu wrote:
> > On Fri, Oct 16, 2015 at 10:21:40AM +0300, Michael S. Tsirkin wrote:
> > > On Fri, Oct 16, 2015 at 03:18:59PM +0800, Yuanhan Liu wrote:
> > > > This reverts commit d1f8b30ec8dde0318fd1b98d24a64926feae9625.
> > > > 
> > > > It turned out that it breaks stuff, so revert it:
> > > > 
> > > >     http://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg00949.html
> > > > 
> > > > CC: "Michael S. Tsirkin" <mst@redhat.com>
> > > > Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> > > > Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> > > 
> > > OK but that's not enough. We need to also
> > > - drop patch sending this on stop
> > 
> > I could do that. But may I know why we have to drop it on stop?
> 
> Because we need to get the state from remote after stop.
> RESET_OWNER discards that, so we can't resume the VM.

Got it, and thanks for the explanation.

> > If we don't send it on stop, when will we send it? The termination
> > of QEMU?
> 
> If mq is negotiated, we don't need it.  If mq isn't negotiated, maybe we
> should send it on reset/driver unload. It might be better than
> corrupting guest memory. And if we do, maybe we should keep
> the RESET_DEVICE name.

Maybe we should just ignore it now, before I (we) have clear clue
on how to handle it correctly.

> 
> > > - send VHOST_USER_SET_VRING_ENABLE on stop and start instead
> > 
> > That indeed looks more reasonable. And actually, Huawei asked whether
> > there is a message from QEMU to tell us that a vring is ready in
> > our weekly meeting this morning. And here it is :)
> > 
> > 	--yliu
> 
> Unfortunately that's only there if MQ is negotiated.

Yes.

> 
> If MQ is not negotiated, then I think you can get away with
> starting processing after you get the 1st kick.

We mark a vring is ready by checking the callfd and kickfd:
if both are valid (> 0), then it's ready.

	--yliu

> 
> 
> > > 
> > > > ---
> > > >  docs/specs/vhost-user.txt   | 4 ++--
> > > >  hw/net/vhost_net.c          | 2 +-
> > > >  hw/virtio/vhost-user.c      | 8 ++++----
> > > >  linux-headers/linux/vhost.h | 2 +-
> > > >  tests/vhost-user-test.c     | 2 +-
> > > >  5 files changed, 9 insertions(+), 9 deletions(-)
> > > > 
> > > > diff --git a/docs/specs/vhost-user.txt b/docs/specs/vhost-user.txt
> > > > index 4eadad1..4bcd17d 100644
> > > > --- a/docs/specs/vhost-user.txt
> > > > +++ b/docs/specs/vhost-user.txt
> > > > @@ -211,10 +211,10 @@ Message types
> > > >        as an owner of the session. This can be used on the Slave as a
> > > >        "session start" flag.
> > > >  
> > > > - * VHOST_USER_RESET_DEVICE
> > > > + * VHOST_USER_RESET_OWNER
> > > >  
> > > >        Id: 4
> > > > -      Equivalent ioctl: VHOST_RESET_DEVICE
> > > > +      Equivalent ioctl: VHOST_RESET_OWNER
> > > >        Master payload: N/A
> > > >  
> > > >        Issued when a new connection is about to be closed. The Master will no
> > > > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> > > > index 2bce891..804f5c9 100644
> > > > --- a/hw/net/vhost_net.c
> > > > +++ b/hw/net/vhost_net.c
> > > > @@ -296,7 +296,7 @@ static void vhost_net_stop_one(struct vhost_net *net,
> > > >      } else if (net->nc->info->type == NET_CLIENT_OPTIONS_KIND_VHOST_USER) {
> > > >          for (file.index = 0; file.index < net->dev.nvqs; ++file.index) {
> > > >              const VhostOps *vhost_ops = net->dev.vhost_ops;
> > > > -            int r = vhost_ops->vhost_call(&net->dev, VHOST_RESET_DEVICE,
> > > > +            int r = vhost_ops->vhost_call(&net->dev, VHOST_RESET_OWNER,
> > > >                                            NULL);
> > > >              assert(r >= 0);
> > > >          }
> > > > diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> > > > index b11c0d2..12a9104 100644
> > > > --- a/hw/virtio/vhost-user.c
> > > > +++ b/hw/virtio/vhost-user.c
> > > > @@ -34,7 +34,7 @@ typedef enum VhostUserRequest {
> > > >      VHOST_USER_GET_FEATURES = 1,
> > > >      VHOST_USER_SET_FEATURES = 2,
> > > >      VHOST_USER_SET_OWNER = 3,
> > > > -    VHOST_USER_RESET_DEVICE = 4,
> > > > +    VHOST_USER_RESET_OWNER = 4,
> > > >      VHOST_USER_SET_MEM_TABLE = 5,
> > > >      VHOST_USER_SET_LOG_BASE = 6,
> > > >      VHOST_USER_SET_LOG_FD = 7,
> > > > @@ -102,7 +102,7 @@ static unsigned long int ioctl_to_vhost_user_request[VHOST_USER_MAX] = {
> > > >      VHOST_GET_FEATURES,     /* VHOST_USER_GET_FEATURES */
> > > >      VHOST_SET_FEATURES,     /* VHOST_USER_SET_FEATURES */
> > > >      VHOST_SET_OWNER,        /* VHOST_USER_SET_OWNER */
> > > > -    VHOST_RESET_DEVICE,      /* VHOST_USER_RESET_DEVICE */
> > > > +    VHOST_RESET_OWNER,      /* VHOST_USER_RESET_OWNER */
> > > >      VHOST_SET_MEM_TABLE,    /* VHOST_USER_SET_MEM_TABLE */
> > > >      VHOST_SET_LOG_BASE,     /* VHOST_USER_SET_LOG_BASE */
> > > >      VHOST_SET_LOG_FD,       /* VHOST_USER_SET_LOG_FD */
> > > > @@ -192,7 +192,7 @@ static bool vhost_user_one_time_request(VhostUserRequest request)
> > > >  {
> > > >      switch (request) {
> > > >      case VHOST_USER_SET_OWNER:
> > > > -    case VHOST_USER_RESET_DEVICE:
> > > > +    case VHOST_USER_RESET_OWNER:
> > > >      case VHOST_USER_SET_MEM_TABLE:
> > > >      case VHOST_USER_GET_QUEUE_NUM:
> > > >          return true;
> > > > @@ -249,7 +249,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
> > > >          break;
> > > >  
> > > >      case VHOST_USER_SET_OWNER:
> > > > -    case VHOST_USER_RESET_DEVICE:
> > > > +    case VHOST_USER_RESET_OWNER:
> > > >          break;
> > > >  
> > > >      case VHOST_USER_SET_MEM_TABLE:
> > > > diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h
> > > > index 14a0160..ead86db 100644
> > > > --- a/linux-headers/linux/vhost.h
> > > > +++ b/linux-headers/linux/vhost.h
> > > > @@ -78,7 +78,7 @@ struct vhost_memory {
> > > >  #define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01)
> > > >  /* Give up ownership, and reset the device to default values.
> > > >   * Allows subsequent call to VHOST_OWNER_SET to succeed. */
> > > > -#define VHOST_RESET_DEVICE _IO(VHOST_VIRTIO, 0x02)
> > > > +#define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02)
> > > >  
> > > >  /* Set up/modify memory layout */
> > > >  #define VHOST_SET_MEM_TABLE	_IOW(VHOST_VIRTIO, 0x03, struct vhost_memory)
> > > > diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
> > > > index 56df5cc..f181391 100644
> > > > --- a/tests/vhost-user-test.c
> > > > +++ b/tests/vhost-user-test.c
> > > > @@ -53,7 +53,7 @@ typedef enum VhostUserRequest {
> > > >      VHOST_USER_GET_FEATURES = 1,
> > > >      VHOST_USER_SET_FEATURES = 2,
> > > >      VHOST_USER_SET_OWNER = 3,
> > > > -    VHOST_USER_RESET_DEVICE = 4,
> > > > +    VHOST_USER_RESET_OWNER = 4,
> > > >      VHOST_USER_SET_MEM_TABLE = 5,
> > > >      VHOST_USER_SET_LOG_BASE = 6,
> > > >      VHOST_USER_SET_LOG_FD = 7,
> > > > -- 
> > > > 1.9.0

  reply	other threads:[~2015-10-16  8:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16  7:18 [Qemu-devel] [PATCH 1/3] Revert "vhost: rename VHOST_RESET_OWNER to VHOST_RESET_DEVICE" Yuanhan Liu
2015-10-16  7:19 ` [Qemu-devel] [PATCH 2/3] doc: vhost-user: request naming fix Yuanhan Liu
2015-10-16  7:19 ` [Qemu-devel] [PATCH 3/3] vhost-user-test: add multiple queue test Yuanhan Liu
2015-10-16  7:20   ` Michael S. Tsirkin
2015-10-16  7:33     ` Yuanhan Liu
2015-10-16  7:21 ` [Qemu-devel] [PATCH 1/3] Revert "vhost: rename VHOST_RESET_OWNER to VHOST_RESET_DEVICE" Michael S. Tsirkin
2015-10-16  7:32   ` Yuanhan Liu
2015-10-16  7:47     ` Michael S. Tsirkin
2015-10-16  8:04       ` Yuanhan Liu [this message]
2015-10-16  8:15         ` Michael S. Tsirkin
2015-10-16  8:38           ` Yuanhan Liu
2015-10-21  8:55       ` Yuanhan Liu
2015-10-21  9:15         ` Michael S. Tsirkin
2015-10-21  9:21           ` Yuanhan Liu
2015-10-21 10:42             ` Michael S. Tsirkin

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=20151016080409.GM3115@yliu-dev.sh.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=huawei.xie@intel.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).