From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= Subject: [PATCH v4 0/7] vhost: Reset batched descriptors on SET_VRING_BASE call Date: Wed, 1 Apr 2020 20:31:11 +0200 Message-ID: <20200401183118.8334-1-eperezma@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Sender: kvm-owner@vger.kernel.org To: "Michael S. Tsirkin" Cc: "virtualization@lists.linux-foundation.org" , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Linux Next Mailing List , Stephen Rothwell , kvm list , Halil Pasic , "linux-kernel@vger.kernel.org" , Cornelia Huck , Christian Borntraeger List-Id: virtualization@lists.linuxfoundation.org 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. This series ammend this, resetting them every time backend changes, 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, only on test code. Another useful thing would be to check if mutex is properly get in vq private_data accessors. Not sure if mutex debug code allow that, similar to C++ unique lock::owns_lock. Not acquiring in the function because caller code holds the mutex in order to perform more actions. v4: * Rebase with vhost_iotlb changes. v3: * Rename accesors functions. * Make scsi and test use the accesors too. v2: * Squashed commits. * Create vq private_data accesors (mst). This serie is meant to be applied on top of 38dd2ba72ece18ec8398c8ddd13cfb02870b0309 in git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git. Eugenio P=C3=A9rez (4): tools/virtio: Add --batch option tools/virtio: Add --batch=3Drandom option tools/virtio: Add --reset=3Drandom tools/virtio: Make --reset reset ring idx Michael S. Tsirkin (3): vhost: option to fetch descriptors through an independent struct vhost: use batched version by default vhost: batching fetches drivers/vhost/test.c | 59 +++++++- drivers/vhost/test.h | 1 + drivers/vhost/vhost.c | 271 +++++++++++++++++++++++------------ drivers/vhost/vhost.h | 17 ++- drivers/virtio/virtio_ring.c | 29 ++++ tools/virtio/linux/virtio.h | 2 + tools/virtio/virtio_test.c | 123 ++++++++++++++-- 7 files changed, 395 insertions(+), 107 deletions(-) --=20 2.18.1