Re: [PATCH 0/6] vhost: Reset batched descriptors on SET_VRING_BASE call

From: Christian Borntraeger
Date: Mon Mar 30 2020 - 03:14:07 EST



On 29.03.20 13:33, Eugenio PÃrez wrote:
> Vhost did not reset properly the batched descriptors on SET_VRING_BASE event. Because of that, is possible to return an invalid descriptor to the guest.

I guess this could explain my problems that I have seen during reset?

>
> This series ammend this, and creates a test to assert correct behavior. To do that, they need to expose a new function in virtio_ring, virtqueue_reset_free_head. Not sure if this can be avoided.
>
> Also, change from https://lkml.org/lkml/2020/3/27/108 is not included, that avoids to update a variable in a loop where it can be updated once.
>
> This is meant to be applied on top of eccb852f1fe6bede630e2e4f1a121a81e34354ab in git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git, and some commits should be squashed with that series.
>
> Eugenio PÃrez (6):
> tools/virtio: Add --batch option
> tools/virtio: Add --batch=random option
> tools/virtio: Add --reset=random
> tools/virtio: Make --reset reset ring idx
> vhost: Delete virtqueue batch_descs member
> fixup! vhost: batching fetches
>
> drivers/vhost/test.c | 57 ++++++++++++++++
> drivers/vhost/test.h | 1 +
> drivers/vhost/vhost.c | 12 +++-
> drivers/vhost/vhost.h | 1 -
> drivers/virtio/virtio_ring.c | 18 +++++
> include/linux/virtio.h | 2 +
> tools/virtio/linux/virtio.h | 2 +
> tools/virtio/virtio_test.c | 123 +++++++++++++++++++++++++++++++----
> 8 files changed, 201 insertions(+), 15 deletions(-)
>