Message ID | 20211022051911.108383-8-michael.christie@oracle.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | vhost: multiple worker support | expand |
On Fri, Oct 22, 2021 at 12:19:06AM -0500, Mike Christie wrote: >Convert from vhost dev based helpers to vq ones. > >Signed-off-by: Mike Christie <michael.christie@oracle.com> >--- > drivers/vhost/vsock.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > >diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c >index 938aefbc75ec..c50c60d0955e 100644 >--- a/drivers/vhost/vsock.c >+++ b/drivers/vhost/vsock.c >@@ -300,7 +300,7 @@ vhost_transport_send_pkt(struct virtio_vsock_pkt *pkt) > list_add_tail(&pkt->list, &vsock->send_pkt_list); > spin_unlock_bh(&vsock->send_pkt_list_lock); > >- vhost_work_queue(&vsock->dev, &vsock->send_pkt_work); >+ vhost_vq_work_queue(&vsock->vqs[VSOCK_VQ_TX], &vsock->send_pkt_work); I think we should use VSOCK_VQ_RX. I know, the nomenclature is weird, but it's from the guest's point of view, so the host when sending packets uses the VSOCK_VQ_RX, see vhost_transport_send_pkt_work(). > > rcu_read_unlock(); > return len; >@@ -612,7 +612,7 @@ static int vhost_vsock_start(struct vhost_vsock *vsock) > /* Some packets may have been queued before the device was started, > * let's kick the send worker to send them. > */ >- vhost_work_queue(&vsock->dev, &vsock->send_pkt_work); >+ vhost_vq_work_queue(&vsock->vqs[VSOCK_VQ_TX], >&vsock->send_pkt_work); Ditto. Thanks, Stefano
On 10/25/21 4:08 AM, Stefano Garzarella wrote: > On Fri, Oct 22, 2021 at 12:19:06AM -0500, Mike Christie wrote: >> Convert from vhost dev based helpers to vq ones. >> >> Signed-off-by: Mike Christie <michael.christie@oracle.com> >> --- >> drivers/vhost/vsock.c | 8 +++++--- >> 1 file changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c >> index 938aefbc75ec..c50c60d0955e 100644 >> --- a/drivers/vhost/vsock.c >> +++ b/drivers/vhost/vsock.c >> @@ -300,7 +300,7 @@ vhost_transport_send_pkt(struct virtio_vsock_pkt *pkt) >> list_add_tail(&pkt->list, &vsock->send_pkt_list); >> spin_unlock_bh(&vsock->send_pkt_list_lock); >> >> - vhost_work_queue(&vsock->dev, &vsock->send_pkt_work); >> + vhost_vq_work_queue(&vsock->vqs[VSOCK_VQ_TX], &vsock->send_pkt_work); > > I think we should use VSOCK_VQ_RX. I know, the nomenclature is weird, but it's from the guest's point of view, so the host when sending packets uses the VSOCK_VQ_RX, see vhost_transport_send_pkt_work(). > > >> >> rcu_read_unlock(); >> return len; >> @@ -612,7 +612,7 @@ static int vhost_vsock_start(struct vhost_vsock *vsock) >> /* Some packets may have been queued before the device was started, >> * let's kick the send worker to send them. >> */ >> - vhost_work_queue(&vsock->dev, &vsock->send_pkt_work); >> + vhost_vq_work_queue(&vsock->vqs[VSOCK_VQ_TX], &vsock->send_pkt_work); > > Ditto. > You're right. I'll fix. Thanks.
diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 938aefbc75ec..c50c60d0955e 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -300,7 +300,7 @@ vhost_transport_send_pkt(struct virtio_vsock_pkt *pkt) list_add_tail(&pkt->list, &vsock->send_pkt_list); spin_unlock_bh(&vsock->send_pkt_list_lock); - vhost_work_queue(&vsock->dev, &vsock->send_pkt_work); + vhost_vq_work_queue(&vsock->vqs[VSOCK_VQ_TX], &vsock->send_pkt_work); rcu_read_unlock(); return len; @@ -612,7 +612,7 @@ static int vhost_vsock_start(struct vhost_vsock *vsock) /* Some packets may have been queued before the device was started, * let's kick the send worker to send them. */ - vhost_work_queue(&vsock->dev, &vsock->send_pkt_work); + vhost_vq_work_queue(&vsock->vqs[VSOCK_VQ_TX], &vsock->send_pkt_work); mutex_unlock(&vsock->dev.mutex); return 0; @@ -712,7 +712,9 @@ static void vhost_vsock_flush(struct vhost_vsock *vsock) for (i = 0; i < ARRAY_SIZE(vsock->vqs); i++) if (vsock->vqs[i].handle_kick) vhost_poll_flush(&vsock->vqs[i].poll); - vhost_work_dev_flush(&vsock->dev); + + vhost_vq_work_flush(&vsock->vqs[VSOCK_VQ_TX]); + vhost_vq_work_flush(&vsock->vqs[VSOCK_VQ_RX]); } static void vhost_vsock_reset_orphans(struct sock *sk)
Convert from vhost dev based helpers to vq ones. Signed-off-by: Mike Christie <michael.christie@oracle.com> --- drivers/vhost/vsock.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)