[PATCH v2 1/1] VSOCK: remove more space available check filling TX vq

Subsystems: networking [general], the rest, virtio and vhost vsock driver, virtio core, vm sockets (af_vsock)

STALE3654d REVIEWED: 4 (4M)

1 review trailer (1 from subsystem maintainers).

5 messages, 4 authors, 2016-08-15 · open the first message on its own page

[PATCH v2 1/1] VSOCK: remove more space available check filling TX vq

From: <hidden>
Date: 2016-08-10 18:25:04

From: Gerard Garcia <redacted>

Remove unnecessary use of enable/disable callback notifications
and the incorrect more space available check.

The virtio_transport_tx_work handles when the TX virtqueue
has more buffers available.

Signed-off-by: Gerard Garcia <redacted>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
---

v2:
 * Comment style.

 net/vmw_vsock/virtio_transport.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
index 699dfab..936d7ee 100644
--- a/net/vmw_vsock/virtio_transport.c
+++ b/net/vmw_vsock/virtio_transport.c
@@ -87,9 +87,6 @@ virtio_transport_send_pkt_work(struct work_struct *work)
 
 	vq = vsock->vqs[VSOCK_VQ_TX];
 
-	/* Avoid unnecessary interrupts while we're processing the ring */
-	virtqueue_disable_cb(vq);
-
 	for (;;) {
 		struct virtio_vsock_pkt *pkt;
 		struct scatterlist hdr, buf, *sgs[2];
@@ -99,7 +96,6 @@ virtio_transport_send_pkt_work(struct work_struct *work)
 		spin_lock_bh(&vsock->send_pkt_list_lock);
 		if (list_empty(&vsock->send_pkt_list)) {
 			spin_unlock_bh(&vsock->send_pkt_list_lock);
-			virtqueue_enable_cb(vq);
 			break;
 		}
 
@@ -118,13 +114,13 @@ virtio_transport_send_pkt_work(struct work_struct *work)
 		}
 
 		ret = virtqueue_add_sgs(vq, sgs, out_sg, in_sg, pkt, GFP_KERNEL);
+		/* Usually this means that there is no more space available in
+		 * the vq
+		 */
 		if (ret < 0) {
 			spin_lock_bh(&vsock->send_pkt_list_lock);
 			list_add(&pkt->list, &vsock->send_pkt_list);
 			spin_unlock_bh(&vsock->send_pkt_list_lock);
-
-			if (!virtqueue_enable_cb(vq) && ret == -ENOSPC)
-				continue; /* retry now that we have more space */
 			break;
 		}
 
-- 
2.9.1

Re: [PATCH v2 1/1] VSOCK: remove more space available check filling TX vq

From: David Miller <davem@davemloft.net>
Date: 2016-08-13 00:31:16

From: ggarcia@abra.uab.cat
Date: Wed, 10 Aug 2016 17:24:34 +0200
From: Gerard Garcia <redacted>

Remove unnecessary use of enable/disable callback notifications
and the incorrect more space available check.

The virtio_transport_tx_work handles when the TX virtqueue
has more buffers available.

Signed-off-by: Gerard Garcia <redacted>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
This does not apply cleanly to the current net GIT tree.

Re: [PATCH v2 1/1] VSOCK: remove more space available check filling TXvq

From: Gerard Garcia <hidden>
Date: 2016-08-13 09:55:53

On 08/13/2016 02:31 AM, David Miller wrote:
From: ggarcia@abra.uab.cat
Date: Wed, 10 Aug 2016 17:24:34 +0200
quoted
From: Gerard Garcia <redacted>

Remove unnecessary use of enable/disable callback notifications
and the incorrect more space available check.

The virtio_transport_tx_work handles when the TX virtqueue
has more buffers available.

Signed-off-by: Gerard Garcia <redacted>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
This does not apply cleanly to the current net GIT tree.
I'm sorry, I should have said that it applies over the mst vhost tree.

Re: [PATCH v2 1/1] VSOCK: remove more space available check filling TX vq

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2016-08-14 23:16:55

On Wed, Aug 10, 2016 at 05:24:34PM +0200, ggarcia@abra.uab.cat wrote:
From: Gerard Garcia <redacted>

Remove unnecessary use of enable/disable callback notifications
and the incorrect more space available check.

The virtio_transport_tx_work handles when the TX virtqueue
has more buffers available.

Signed-off-by: Gerard Garcia <redacted>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Generally enable/disable is a worthwhile optimization,
but if Stefan wants to keep code simple for now,
I don't have a problem with that.
quoted hunk
---

v2:
 * Comment style.

 net/vmw_vsock/virtio_transport.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
index 699dfab..936d7ee 100644
--- a/net/vmw_vsock/virtio_transport.c
+++ b/net/vmw_vsock/virtio_transport.c
@@ -87,9 +87,6 @@ virtio_transport_send_pkt_work(struct work_struct *work)
 
 	vq = vsock->vqs[VSOCK_VQ_TX];
 
-	/* Avoid unnecessary interrupts while we're processing the ring */
-	virtqueue_disable_cb(vq);
-
 	for (;;) {
 		struct virtio_vsock_pkt *pkt;
 		struct scatterlist hdr, buf, *sgs[2];
@@ -99,7 +96,6 @@ virtio_transport_send_pkt_work(struct work_struct *work)
 		spin_lock_bh(&vsock->send_pkt_list_lock);
 		if (list_empty(&vsock->send_pkt_list)) {
 			spin_unlock_bh(&vsock->send_pkt_list_lock);
-			virtqueue_enable_cb(vq);
 			break;
 		}
 
@@ -118,13 +114,13 @@ virtio_transport_send_pkt_work(struct work_struct *work)
 		}
 
 		ret = virtqueue_add_sgs(vq, sgs, out_sg, in_sg, pkt, GFP_KERNEL);
+		/* Usually this means that there is no more space available in
+		 * the vq
+		 */
 		if (ret < 0) {
 			spin_lock_bh(&vsock->send_pkt_list_lock);
 			list_add(&pkt->list, &vsock->send_pkt_list);
 			spin_unlock_bh(&vsock->send_pkt_list_lock);
-
-			if (!virtqueue_enable_cb(vq) && ret == -ENOSPC)
-				continue; /* retry now that we have more space */
 			break;
 		}
 
-- 
2.9.1

Re: [PATCH v2 1/1] VSOCK: remove more space available check filling TX vq

From: Stefan Hajnoczi <stefanha@redhat.com>
Date: 2016-08-15 14:29:24

On Mon, Aug 15, 2016 at 02:16:51AM +0300, Michael S. Tsirkin wrote:
On Wed, Aug 10, 2016 at 05:24:34PM +0200, ggarcia@abra.uab.cat wrote:
quoted
From: Gerard Garcia <redacted>

Remove unnecessary use of enable/disable callback notifications
and the incorrect more space available check.

The virtio_transport_tx_work handles when the TX virtqueue
has more buffers available.

Signed-off-by: Gerard Garcia <redacted>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Generally enable/disable is a worthwhile optimization,
but if Stefan wants to keep code simple for now,
I don't have a problem with that.
Enabling/disabling callbacks is inappropriate in this function because
its job is *submitting* buffers rather than *reclaiming* completed
buffers.  Oops, I'm not sure how this mistake crept in :).

The callback suppression should only be done around the loop that
reclaims buffers.  Doing it in the wrong place leads to hangs if
interrupts are lost.

Stefan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help