[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e12d4055-6ae6-4d00-ae8b-1acd88633f48@redhat.com>
Date: Wed, 23 May 2018 09:39:28 +0800
From: Jason Wang <jasowang@...hat.com>
To: Wei Xu <wexu@...hat.com>
Cc: mst@...hat.com, kvm@...r.kernel.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, jfreimann@...hat.com,
tiwei.bie@...el.com
Subject: Re: [RFC V4 PATCH 7/8] vhost: packed ring support
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@...hat.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.
Thanks
Powered by blists - more mailing lists