netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Xu <wexu@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: mst@redhat.com, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	jfreimann@redhat.com, tiwei.bie@intel.com
Subject: Re: [RFC V4 PATCH 7/8] vhost: packed ring support
Date: Wed, 23 May 2018 15:17:27 +0800	[thread overview]
Message-ID: <20180523071727.GA13373@wei-ubt> (raw)
In-Reply-To: <e12d4055-6ae6-4d00-ae8b-1acd88633f48@redhat.com>

On Wed, May 23, 2018 at 09:39:28AM +0800, Jason Wang wrote:
> 
> 
> On 2018年05月23日 00:54, Wei Xu wrote:
> >On Wed, May 16, 2018 at 08:32:20PM +0800, Jason Wang wrote:
> >>Signed-off-by: Jason Wang <jasowang@redhat.com>
> >>---
> >>  drivers/vhost/net.c   |   3 +-
> >>  drivers/vhost/vhost.c | 539 ++++++++++++++++++++++++++++++++++++++++++++++----
> >>  drivers/vhost/vhost.h |   8 +-
> >>  3 files changed, 513 insertions(+), 37 deletions(-)
> >>
> >>diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> >>index 8304c30..f2a0f5b 100644
> >>--- a/drivers/vhost/vhost.c
> >>+++ b/drivers/vhost/vhost.c
> >>@@ -1358,6 +1382,8 @@ long vhost_vring_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *arg
> >>  			break;
> >>  		}
> >>  		vq->last_avail_idx = s.num;
> >>+		if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED))
> >>+			vq->avail_wrap_counter = s.num >> 31;
> >>  		/* Forget the cached index value. */
> >>  		vq->avail_idx = vq->last_avail_idx;
> >>  		break;
> >>@@ -1366,6 +1392,8 @@ long vhost_vring_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *arg
> >>  		s.num = vq->last_avail_idx;
> >>  		if (copy_to_user(argp, &s, sizeof s))
> >>  			r = -EFAULT;
> >>+		if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED))
> >>+			s.num |= vq->avail_wrap_counter << 31;
> >>  		break;
> >>  	case VHOST_SET_VRING_ADDR:
> >>  		if (copy_from_user(&a, argp, sizeof a)) {
> >'last_used_idx' also needs to be saved/restored here.
> >
> >I have figured out the root cause of broken device after reloading
> >'virtio-net' module, all indices have been reset for a reloading but
> >'last_used_idx' is not properly reset in this case. This confuses
> >handle_rx()/tx().
> >
> >Wei
> >
> 
> Good catch, so we probably need a new ioctl to sync between qemu and vhost.
> 
> Something like VHOST_SET/GET_USED_BASE.

Sure, or can we expand 'vhost_vring_state' to keep them done in a bunch?

> 
> Thanks
> 

  reply	other threads:[~2018-05-23  7:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 12:32 [RFC V4 PATCH 0/8] Packed ring layout for vhost Jason Wang
2018-05-16 12:32 ` [RFC V4 PATCH 1/8] vhost: move get_rx_bufs to vhost.c Jason Wang
2018-05-16 12:32 ` [RFC V4 PATCH 2/8] vhost: hide used ring layout from device Jason Wang
2018-05-16 12:32 ` [RFC V4 PATCH 3/8] vhost: do not use vring_used_elem Jason Wang
2018-05-16 12:32 ` [RFC V4 PATCH 4/8] vhost_net: do not explicitly manipulate vhost_used_elem Jason Wang
2018-05-16 12:32 ` [RFC V4 PATCH 5/8] vhost: vhost_put_user() can accept metadata type Jason Wang
2018-05-16 12:32 ` [RFC V4 PATCH 6/8] virtio: introduce packed ring defines Jason Wang
2018-05-16 12:32 ` [RFC V4 PATCH 7/8] vhost: packed ring support Jason Wang
2018-05-22 16:54   ` Wei Xu
2018-05-23  1:39     ` Jason Wang
2018-05-23  7:17       ` Wei Xu [this message]
2018-05-23  8:57         ` Jason Wang
2018-05-16 12:32 ` [RFC V4 PATCH 8/8] vhost: event suppression for packed ring Jason Wang
2018-05-25  2:28   ` Jason Wang
2018-05-20 16:25 ` [RFC V4 PATCH 0/8] Packed ring layout for vhost Wei Xu
2018-05-21  2:33   ` Jason Wang
2018-05-21 12:25     ` Wei Xu

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=20180523071727.GA13373@wei-ubt \
    --to=wexu@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=jfreimann@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=tiwei.bie@intel.com \
    --cc=virtualization@lists.linux-foundation.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).