virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/4] vsock: cancel connect packets when failing to connect
@ 2016-12-12 12:21 Peng Tao
  2016-12-12 12:21 ` [PATCH v4 1/4] vsock: track pkt owner vsock Peng Tao
  2016-12-13  9:50 ` [PATCH v4 0/4] vsock: cancel connect packets when failing to connect Stefan Hajnoczi
  0 siblings, 2 replies; 10+ messages in thread
From: Peng Tao @ 2016-12-12 12:21 UTC (permalink / raw)
  To: netdev; +Cc: virtualization, Stefan Hajnoczi, David Miller, Jorgen Hansen, kvm

Currently, if a connect call fails on a signal or timeout (e.g., guest is still
in the process of starting up), we'll just return to caller and leave the connect
packet queued and they are sent even though the connection is considered a failure,
which can confuse applications with unwanted false connect attempt.

The patchset enables vsock (both host and guest) to cancel queued packets when
a connect attempt is considered to fail.

v4 changelog:
  - drop two unnecessary void * cast
  - update new callback commnet
v3 changelog:
  - define cancel_pkt callback in struct vsock_transport rather than struct virtio_transport
  - rename virtio_vsock_pkt->vsk to virtio_vsock_pkt->cancel_token
v2 changelog:
  - fix queued_replies counting and resume tx/rx when necessary

Cheers,
Tao

Peng Tao (4):
  vsock: track pkt owner vsock
  vhost-vsock: add pkt cancel capability
  vsock: add pkt cancel capability
  vsock: cancel packets when failing to connect

 drivers/vhost/vsock.c                   | 41 ++++++++++++++++++++++++++++++++
 include/linux/virtio_vsock.h            |  2 ++
 include/net/af_vsock.h                  |  3 +++
 net/vmw_vsock/af_vsock.c                | 14 +++++++++++
 net/vmw_vsock/virtio_transport.c        | 42 +++++++++++++++++++++++++++++++++
 net/vmw_vsock/virtio_transport_common.c |  7 ++++++
 6 files changed, 109 insertions(+)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4 1/4] vsock: track pkt owner vsock
  2016-12-12 12:21 [PATCH v4 0/4] vsock: cancel connect packets when failing to connect Peng Tao
@ 2016-12-12 12:21 ` Peng Tao
  2016-12-12 12:21   ` [PATCH v4 2/4] vhost-vsock: add pkt cancel capability Peng Tao
  2016-12-13  9:50 ` [PATCH v4 0/4] vsock: cancel connect packets when failing to connect Stefan Hajnoczi
  1 sibling, 1 reply; 10+ messages in thread
From: Peng Tao @ 2016-12-12 12:21 UTC (permalink / raw)
  To: netdev; +Cc: virtualization, Stefan Hajnoczi, David Miller, Jorgen Hansen, kvm

So that we can cancel a queued pkt later if necessary.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
 include/linux/virtio_vsock.h            | 2 ++
 net/vmw_vsock/virtio_transport_common.c | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
index 9638bfe..193ad3a 100644
--- a/include/linux/virtio_vsock.h
+++ b/include/linux/virtio_vsock.h
@@ -48,6 +48,7 @@ struct virtio_vsock_pkt {
 	struct virtio_vsock_hdr	hdr;
 	struct work_struct work;
 	struct list_head list;
+	void *cancel_token; /* only used for cancellation */
 	void *buf;
 	u32 len;
 	u32 off;
@@ -56,6 +57,7 @@ struct virtio_vsock_pkt {
 
 struct virtio_vsock_pkt_info {
 	u32 remote_cid, remote_port;
+	struct vsock_sock *vsk;
 	struct msghdr *msg;
 	u32 pkt_len;
 	u16 type;
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index a53b3a1..ef94eb8 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -57,6 +57,7 @@ virtio_transport_alloc_pkt(struct virtio_vsock_pkt_info *info,
 	pkt->len		= len;
 	pkt->hdr.len		= cpu_to_le32(len);
 	pkt->reply		= info->reply;
+	pkt->cancel_token	= info->vsk;
 
 	if (info->msg && len > 0) {
 		pkt->buf = kmalloc(len, GFP_KERNEL);
@@ -180,6 +181,7 @@ static int virtio_transport_send_credit_update(struct vsock_sock *vsk,
 	struct virtio_vsock_pkt_info info = {
 		.op = VIRTIO_VSOCK_OP_CREDIT_UPDATE,
 		.type = type,
+		.vsk = vsk,
 	};
 
 	return virtio_transport_send_pkt_info(vsk, &info);
@@ -519,6 +521,7 @@ int virtio_transport_connect(struct vsock_sock *vsk)
 	struct virtio_vsock_pkt_info info = {
 		.op = VIRTIO_VSOCK_OP_REQUEST,
 		.type = VIRTIO_VSOCK_TYPE_STREAM,
+		.vsk = vsk,
 	};
 
 	return virtio_transport_send_pkt_info(vsk, &info);
@@ -534,6 +537,7 @@ int virtio_transport_shutdown(struct vsock_sock *vsk, int mode)
 			  VIRTIO_VSOCK_SHUTDOWN_RCV : 0) |
 			 (mode & SEND_SHUTDOWN ?
 			  VIRTIO_VSOCK_SHUTDOWN_SEND : 0),
+		.vsk = vsk,
 	};
 
 	return virtio_transport_send_pkt_info(vsk, &info);
@@ -560,6 +564,7 @@ virtio_transport_stream_enqueue(struct vsock_sock *vsk,
 		.type = VIRTIO_VSOCK_TYPE_STREAM,
 		.msg = msg,
 		.pkt_len = len,
+		.vsk = vsk,
 	};
 
 	return virtio_transport_send_pkt_info(vsk, &info);
@@ -581,6 +586,7 @@ static int virtio_transport_reset(struct vsock_sock *vsk,
 		.op = VIRTIO_VSOCK_OP_RST,
 		.type = VIRTIO_VSOCK_TYPE_STREAM,
 		.reply = !!pkt,
+		.vsk = vsk,
 	};
 
 	/* Send RST only if the original pkt is not a RST pkt */
@@ -826,6 +832,7 @@ virtio_transport_send_response(struct vsock_sock *vsk,
 		.remote_cid = le32_to_cpu(pkt->hdr.src_cid),
 		.remote_port = le32_to_cpu(pkt->hdr.src_port),
 		.reply = true,
+		.vsk = vsk,
 	};
 
 	return virtio_transport_send_pkt_info(vsk, &info);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 2/4] vhost-vsock: add pkt cancel capability
  2016-12-12 12:21 ` [PATCH v4 1/4] vsock: track pkt owner vsock Peng Tao
@ 2016-12-12 12:21   ` Peng Tao
  2016-12-12 12:21     ` [PATCH v4 3/4] vsock: " Peng Tao
                       ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Peng Tao @ 2016-12-12 12:21 UTC (permalink / raw)
  To: netdev; +Cc: virtualization, Stefan Hajnoczi, David Miller, Jorgen Hansen, kvm

To allow canceling all packets of a connection.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
 drivers/vhost/vsock.c  | 41 +++++++++++++++++++++++++++++++++++++++++
 include/net/af_vsock.h |  3 +++
 2 files changed, 44 insertions(+)

diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
index a504e2e0..fef8808 100644
--- a/drivers/vhost/vsock.c
+++ b/drivers/vhost/vsock.c
@@ -218,6 +218,46 @@ vhost_transport_send_pkt(struct virtio_vsock_pkt *pkt)
 	return len;
 }
 
+static int
+vhost_transport_cancel_pkt(struct vsock_sock *vsk)
+{
+	struct vhost_vsock *vsock;
+	struct virtio_vsock_pkt *pkt, *n;
+	int cnt = 0;
+	LIST_HEAD(freeme);
+
+	/* Find the vhost_vsock according to guest context id  */
+	vsock = vhost_vsock_get(vsk->remote_addr.svm_cid);
+	if (!vsock)
+		return -ENODEV;
+
+	spin_lock_bh(&vsock->send_pkt_list_lock);
+	list_for_each_entry_safe(pkt, n, &vsock->send_pkt_list, list) {
+		if (pkt->cancel_token != vsk)
+			continue;
+		list_move(&pkt->list, &freeme);
+	}
+	spin_unlock_bh(&vsock->send_pkt_list_lock);
+
+	list_for_each_entry_safe(pkt, n, &freeme, list) {
+		if (pkt->reply)
+			cnt++;
+		list_del(&pkt->list);
+		virtio_transport_free_pkt(pkt);
+	}
+
+	if (cnt) {
+		struct vhost_virtqueue *tx_vq = &vsock->vqs[VSOCK_VQ_TX];
+		int new_cnt;
+
+		new_cnt = atomic_sub_return(cnt, &vsock->queued_replies);
+		if (new_cnt + cnt >= tx_vq->num && new_cnt < tx_vq->num)
+			vhost_poll_queue(&tx_vq->poll);
+	}
+
+	return 0;
+}
+
 static struct virtio_vsock_pkt *
 vhost_vsock_alloc_pkt(struct vhost_virtqueue *vq,
 		      unsigned int out, unsigned int in)
@@ -664,6 +704,7 @@ static struct virtio_transport vhost_transport = {
 		.release                  = virtio_transport_release,
 		.connect                  = virtio_transport_connect,
 		.shutdown                 = virtio_transport_shutdown,
+		.cancel_pkt               = vhost_transport_cancel_pkt,
 
 		.dgram_enqueue            = virtio_transport_dgram_enqueue,
 		.dgram_dequeue            = virtio_transport_dgram_dequeue,
diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
index f275896..f32ed9a 100644
--- a/include/net/af_vsock.h
+++ b/include/net/af_vsock.h
@@ -100,6 +100,9 @@ struct vsock_transport {
 	void (*destruct)(struct vsock_sock *);
 	void (*release)(struct vsock_sock *);
 
+	/* Cancel all pending packets sent on vsock. */
+	int (*cancel_pkt)(struct vsock_sock *vsk);
+
 	/* Connections. */
 	int (*connect)(struct vsock_sock *);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 3/4] vsock: add pkt cancel capability
  2016-12-12 12:21   ` [PATCH v4 2/4] vhost-vsock: add pkt cancel capability Peng Tao
@ 2016-12-12 12:21     ` Peng Tao
       [not found]     ` <1481545269-18104-4-git-send-email-bergwolf@gmail.com>
  2016-12-13 10:04     ` [PATCH v4 2/4] vhost-vsock: add pkt cancel capability Jorgen S. Hansen
  2 siblings, 0 replies; 10+ messages in thread
From: Peng Tao @ 2016-12-12 12:21 UTC (permalink / raw)
  To: netdev; +Cc: virtualization, Stefan Hajnoczi, David Miller, Jorgen Hansen, kvm

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
 net/vmw_vsock/virtio_transport.c | 42 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
index 936d7ee..b7b78ce 100644
--- a/net/vmw_vsock/virtio_transport.c
+++ b/net/vmw_vsock/virtio_transport.c
@@ -170,6 +170,47 @@ virtio_transport_send_pkt(struct virtio_vsock_pkt *pkt)
 	return len;
 }
 
+static int
+virtio_transport_cancel_pkt(struct vsock_sock *vsk)
+{
+	struct virtio_vsock *vsock;
+	struct virtio_vsock_pkt *pkt, *n;
+	int cnt = 0;
+	LIST_HEAD(freeme);
+
+	vsock = virtio_vsock_get();
+	if (!vsock) {
+		return -ENODEV;
+	}
+
+	spin_lock_bh(&vsock->send_pkt_list_lock);
+	list_for_each_entry_safe(pkt, n, &vsock->send_pkt_list, list) {
+		if (pkt->cancel_token != vsk)
+			continue;
+		list_move(&pkt->list, &freeme);
+	}
+	spin_unlock_bh(&vsock->send_pkt_list_lock);
+
+	list_for_each_entry_safe(pkt, n, &freeme, list) {
+		if (pkt->reply)
+			cnt++;
+		list_del(&pkt->list);
+		virtio_transport_free_pkt(pkt);
+	}
+
+	if (cnt) {
+		struct virtqueue *rx_vq = vsock->vqs[VSOCK_VQ_RX];
+		int new_cnt;
+
+		new_cnt = atomic_sub_return(cnt, &vsock->queued_replies);
+		if (new_cnt + cnt >= virtqueue_get_vring_size(rx_vq) &&
+		    new_cnt < virtqueue_get_vring_size(rx_vq))
+			queue_work(virtio_vsock_workqueue, &vsock->rx_work);
+	}
+
+	return 0;
+}
+
 static void virtio_vsock_rx_fill(struct virtio_vsock *vsock)
 {
 	int buf_len = VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE;
@@ -419,6 +460,7 @@ static struct virtio_transport virtio_transport = {
 		.release                  = virtio_transport_release,
 		.connect                  = virtio_transport_connect,
 		.shutdown                 = virtio_transport_shutdown,
+		.cancel_pkt               = virtio_transport_cancel_pkt,
 
 		.dgram_bind               = virtio_transport_dgram_bind,
 		.dgram_dequeue            = virtio_transport_dgram_dequeue,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 4/4] vsock: cancel packets when failing to connect
       [not found]     ` <1481545269-18104-4-git-send-email-bergwolf@gmail.com>
@ 2016-12-12 12:21       ` Peng Tao
  0 siblings, 0 replies; 10+ messages in thread
From: Peng Tao @ 2016-12-12 12:21 UTC (permalink / raw)
  To: netdev; +Cc: virtualization, Stefan Hajnoczi, David Miller, Jorgen Hansen, kvm

Otherwise we'll leave the packets queued until releasing vsock device.
E.g., if guest is slow to start up, resulting ETIMEDOUT on connect, guest
will get the connect requests from failed host sockets.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
 net/vmw_vsock/af_vsock.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 8a398b3..c73b03a 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1101,10 +1101,19 @@ static const struct proto_ops vsock_dgram_ops = {
 	.sendpage = sock_no_sendpage,
 };
 
+static int vsock_transport_cancel_pkt(struct vsock_sock *vsk)
+{
+	if (!transport->cancel_pkt)
+		return -EOPNOTSUPP;
+
+	return transport->cancel_pkt(vsk);
+}
+
 static void vsock_connect_timeout(struct work_struct *work)
 {
 	struct sock *sk;
 	struct vsock_sock *vsk;
+	int cancel = 0;
 
 	vsk = container_of(work, struct vsock_sock, dwork.work);
 	sk = sk_vsock(vsk);
@@ -1115,8 +1124,11 @@ static void vsock_connect_timeout(struct work_struct *work)
 		sk->sk_state = SS_UNCONNECTED;
 		sk->sk_err = ETIMEDOUT;
 		sk->sk_error_report(sk);
+		cancel = 1;
 	}
 	release_sock(sk);
+	if (cancel)
+		vsock_transport_cancel_pkt(vsk);
 
 	sock_put(sk);
 }
@@ -1223,11 +1235,13 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr,
 			err = sock_intr_errno(timeout);
 			sk->sk_state = SS_UNCONNECTED;
 			sock->state = SS_UNCONNECTED;
+			vsock_transport_cancel_pkt(vsk);
 			goto out_wait;
 		} else if (timeout == 0) {
 			err = -ETIMEDOUT;
 			sk->sk_state = SS_UNCONNECTED;
 			sock->state = SS_UNCONNECTED;
+			vsock_transport_cancel_pkt(vsk);
 			goto out_wait;
 		}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 0/4] vsock: cancel connect packets when failing to connect
  2016-12-12 12:21 [PATCH v4 0/4] vsock: cancel connect packets when failing to connect Peng Tao
  2016-12-12 12:21 ` [PATCH v4 1/4] vsock: track pkt owner vsock Peng Tao
@ 2016-12-13  9:50 ` Stefan Hajnoczi
  2017-01-06  2:22   ` Peng Tao
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Hajnoczi @ 2016-12-13  9:50 UTC (permalink / raw)
  To: Peng Tao
  Cc: kvm, netdev, virtualization, Stefan Hajnoczi, David Miller,
	Jorgen Hansen


[-- Attachment #1.1: Type: text/plain, Size: 1792 bytes --]

On Mon, Dec 12, 2016 at 08:21:05PM +0800, Peng Tao wrote:
> Currently, if a connect call fails on a signal or timeout (e.g., guest is still
> in the process of starting up), we'll just return to caller and leave the connect
> packet queued and they are sent even though the connection is considered a failure,
> which can confuse applications with unwanted false connect attempt.
> 
> The patchset enables vsock (both host and guest) to cancel queued packets when
> a connect attempt is considered to fail.
> 
> v4 changelog:
>   - drop two unnecessary void * cast
>   - update new callback commnet
> v3 changelog:
>   - define cancel_pkt callback in struct vsock_transport rather than struct virtio_transport
>   - rename virtio_vsock_pkt->vsk to virtio_vsock_pkt->cancel_token
> v2 changelog:
>   - fix queued_replies counting and resume tx/rx when necessary
> 
> Cheers,
> Tao
> 
> Peng Tao (4):
>   vsock: track pkt owner vsock
>   vhost-vsock: add pkt cancel capability
>   vsock: add pkt cancel capability
>   vsock: cancel packets when failing to connect
> 
>  drivers/vhost/vsock.c                   | 41 ++++++++++++++++++++++++++++++++
>  include/linux/virtio_vsock.h            |  2 ++
>  include/net/af_vsock.h                  |  3 +++
>  net/vmw_vsock/af_vsock.c                | 14 +++++++++++
>  net/vmw_vsock/virtio_transport.c        | 42 +++++++++++++++++++++++++++++++++
>  net/vmw_vsock/virtio_transport_common.c |  7 ++++++
>  6 files changed, 109 insertions(+)
> 
> -- 
> 2.7.4
> 
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 2/4] vhost-vsock: add pkt cancel capability
  2016-12-12 12:21   ` [PATCH v4 2/4] vhost-vsock: add pkt cancel capability Peng Tao
  2016-12-12 12:21     ` [PATCH v4 3/4] vsock: " Peng Tao
       [not found]     ` <1481545269-18104-4-git-send-email-bergwolf@gmail.com>
@ 2016-12-13 10:04     ` Jorgen S. Hansen
  2 siblings, 0 replies; 10+ messages in thread
From: Jorgen S. Hansen @ 2016-12-13 10:04 UTC (permalink / raw)
  To: Peng Tao
  Cc: netdev@vger.kernel.org, Stefan Hajnoczi, David Miller,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org


> On Dec 12, 2016, at 1:21 PM, Peng Tao <bergwolf@gmail.com> wrote:
> 
> To allow canceling all packets of a connection.
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Peng Tao <bergwolf@gmail.com>
> ---
> drivers/vhost/vsock.c  | 41 +++++++++++++++++++++++++++++++++++++++++
> include/net/af_vsock.h |  3 +++
> 2 files changed, 44 insertions(+)
> 
> diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
> index a504e2e0..fef8808 100644
> --- a/drivers/vhost/vsock.c
> +++ b/drivers/vhost/vsock.c
> @@ -218,6 +218,46 @@ vhost_transport_send_pkt(struct virtio_vsock_pkt *pkt)
> 	return len;
> }
> 
> +static int
> +vhost_transport_cancel_pkt(struct vsock_sock *vsk)
> +{
> +	struct vhost_vsock *vsock;
> +	struct virtio_vsock_pkt *pkt, *n;
> +	int cnt = 0;
> +	LIST_HEAD(freeme);
> +
> +	/* Find the vhost_vsock according to guest context id  */
> +	vsock = vhost_vsock_get(vsk->remote_addr.svm_cid);
> +	if (!vsock)
> +		return -ENODEV;
> +
> +	spin_lock_bh(&vsock->send_pkt_list_lock);
> +	list_for_each_entry_safe(pkt, n, &vsock->send_pkt_list, list) {
> +		if (pkt->cancel_token != vsk)
> +			continue;
> +		list_move(&pkt->list, &freeme);
> +	}
> +	spin_unlock_bh(&vsock->send_pkt_list_lock);
> +
> +	list_for_each_entry_safe(pkt, n, &freeme, list) {
> +		if (pkt->reply)
> +			cnt++;
> +		list_del(&pkt->list);
> +		virtio_transport_free_pkt(pkt);
> +	}
> +
> +	if (cnt) {
> +		struct vhost_virtqueue *tx_vq = &vsock->vqs[VSOCK_VQ_TX];
> +		int new_cnt;
> +
> +		new_cnt = atomic_sub_return(cnt, &vsock->queued_replies);
> +		if (new_cnt + cnt >= tx_vq->num && new_cnt < tx_vq->num)
> +			vhost_poll_queue(&tx_vq->poll);
> +	}
> +
> +	return 0;
> +}
> +
> static struct virtio_vsock_pkt *
> vhost_vsock_alloc_pkt(struct vhost_virtqueue *vq,
> 		      unsigned int out, unsigned int in)
> @@ -664,6 +704,7 @@ static struct virtio_transport vhost_transport = {
> 		.release                  = virtio_transport_release,
> 		.connect                  = virtio_transport_connect,
> 		.shutdown                 = virtio_transport_shutdown,
> +		.cancel_pkt               = vhost_transport_cancel_pkt,
> 
> 		.dgram_enqueue            = virtio_transport_dgram_enqueue,
> 		.dgram_dequeue            = virtio_transport_dgram_dequeue,
> diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
> index f275896..f32ed9a 100644
> --- a/include/net/af_vsock.h
> +++ b/include/net/af_vsock.h
> @@ -100,6 +100,9 @@ struct vsock_transport {
> 	void (*destruct)(struct vsock_sock *);
> 	void (*release)(struct vsock_sock *);
> 
> +	/* Cancel all pending packets sent on vsock. */
> +	int (*cancel_pkt)(struct vsock_sock *vsk);
> +
> 	/* Connections. */
> 	int (*connect)(struct vsock_sock *);
> 
> -- 
> 2.7.4
> 

Reviewed-by: Jorgen Hansen <jhansen@vmware.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 0/4] vsock: cancel connect packets when failing to connect
  2016-12-13  9:50 ` [PATCH v4 0/4] vsock: cancel connect packets when failing to connect Stefan Hajnoczi
@ 2017-01-06  2:22   ` Peng Tao
  2017-01-09 10:06     ` Stefan Hajnoczi
  0 siblings, 1 reply; 10+ messages in thread
From: Peng Tao @ 2017-01-06  2:22 UTC (permalink / raw)
  To: Stefan Hajnoczi, David Miller
  Cc: netdev@vger.kernel.org, kvm, Jorgen Hansen, Stefan Hajnoczi,
	virtualization

On Tue, Dec 13, 2016 at 5:50 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Mon, Dec 12, 2016 at 08:21:05PM +0800, Peng Tao wrote:
>> Currently, if a connect call fails on a signal or timeout (e.g., guest is still
>> in the process of starting up), we'll just return to caller and leave the connect
>> packet queued and they are sent even though the connection is considered a failure,
>> which can confuse applications with unwanted false connect attempt.
>>
>> The patchset enables vsock (both host and guest) to cancel queued packets when
>> a connect attempt is considered to fail.
>>
>> v4 changelog:
>>   - drop two unnecessary void * cast
>>   - update new callback commnet
>> v3 changelog:
>>   - define cancel_pkt callback in struct vsock_transport rather than struct virtio_transport
>>   - rename virtio_vsock_pkt->vsk to virtio_vsock_pkt->cancel_token
>> v2 changelog:
>>   - fix queued_replies counting and resume tx/rx when necessary
>>
>> Cheers,
>> Tao
>>
>> Peng Tao (4):
>>   vsock: track pkt owner vsock
>>   vhost-vsock: add pkt cancel capability
>>   vsock: add pkt cancel capability
>>   vsock: cancel packets when failing to connect
>>
>>  drivers/vhost/vsock.c                   | 41 ++++++++++++++++++++++++++++++++
>>  include/linux/virtio_vsock.h            |  2 ++
>>  include/net/af_vsock.h                  |  3 +++
>>  net/vmw_vsock/af_vsock.c                | 14 +++++++++++
>>  net/vmw_vsock/virtio_transport.c        | 42 +++++++++++++++++++++++++++++++++
>>  net/vmw_vsock/virtio_transport_common.c |  7 ++++++
>>  6 files changed, 109 insertions(+)
>>
>> --
>> 2.7.4
>>
>> _______________________________________________
>> Virtualization mailing list
>> Virtualization@lists.linux-foundation.org
>> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
ping~

It looks like the patchsets are reviewed but not merged. Is there any blocker?

Cheers,
Tao

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 0/4] vsock: cancel connect packets when failing to connect
  2017-01-06  2:22   ` Peng Tao
@ 2017-01-09 10:06     ` Stefan Hajnoczi
  2017-01-17  9:25       ` Jorgen S. Hansen
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Hajnoczi @ 2017-01-09 10:06 UTC (permalink / raw)
  To: Peng Tao
  Cc: kvm, netdev@vger.kernel.org, virtualization, Stefan Hajnoczi,
	David Miller, Jorgen Hansen


[-- Attachment #1.1: Type: text/plain, Size: 2273 bytes --]

On Fri, Jan 06, 2017 at 10:22:56AM +0800, Peng Tao wrote:
> On Tue, Dec 13, 2016 at 5:50 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> > On Mon, Dec 12, 2016 at 08:21:05PM +0800, Peng Tao wrote:
> >> Currently, if a connect call fails on a signal or timeout (e.g., guest is still
> >> in the process of starting up), we'll just return to caller and leave the connect
> >> packet queued and they are sent even though the connection is considered a failure,
> >> which can confuse applications with unwanted false connect attempt.
> >>
> >> The patchset enables vsock (both host and guest) to cancel queued packets when
> >> a connect attempt is considered to fail.
> >>
> >> v4 changelog:
> >>   - drop two unnecessary void * cast
> >>   - update new callback commnet
> >> v3 changelog:
> >>   - define cancel_pkt callback in struct vsock_transport rather than struct virtio_transport
> >>   - rename virtio_vsock_pkt->vsk to virtio_vsock_pkt->cancel_token
> >> v2 changelog:
> >>   - fix queued_replies counting and resume tx/rx when necessary
> >>
> >> Cheers,
> >> Tao
> >>
> >> Peng Tao (4):
> >>   vsock: track pkt owner vsock
> >>   vhost-vsock: add pkt cancel capability
> >>   vsock: add pkt cancel capability
> >>   vsock: cancel packets when failing to connect
> >>
> >>  drivers/vhost/vsock.c                   | 41 ++++++++++++++++++++++++++++++++
> >>  include/linux/virtio_vsock.h            |  2 ++
> >>  include/net/af_vsock.h                  |  3 +++
> >>  net/vmw_vsock/af_vsock.c                | 14 +++++++++++
> >>  net/vmw_vsock/virtio_transport.c        | 42 +++++++++++++++++++++++++++++++++
> >>  net/vmw_vsock/virtio_transport_common.c |  7 ++++++
> >>  6 files changed, 109 insertions(+)
> >>
> >> --
> >> 2.7.4
> >>
> >> _______________________________________________
> >> Virtualization mailing list
> >> Virtualization@lists.linux-foundation.org
> >> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
> >
> > Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> ping~
> 
> It looks like the patchsets are reviewed but not merged. Is there any blocker?

If Jorgen is sending pull requests then it should go through him.

Otherwise David Miller could apply it.

Stefan

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 0/4] vsock: cancel connect packets when failing to connect
  2017-01-09 10:06     ` Stefan Hajnoczi
@ 2017-01-17  9:25       ` Jorgen S. Hansen
  0 siblings, 0 replies; 10+ messages in thread
From: Jorgen S. Hansen @ 2017-01-17  9:25 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: kvm@vger.kernel.org, netdev@vger.kernel.org, Peng Tao,
	virtualization@lists.linux-foundation.org, Stefan Hajnoczi,
	David Miller


> On Jan 9, 2017, at 11:06 AM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> 
> On Fri, Jan 06, 2017 at 10:22:56AM +0800, Peng Tao wrote:
>> On Tue, Dec 13, 2016 at 5:50 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
>>> On Mon, Dec 12, 2016 at 08:21:05PM +0800, Peng Tao wrote:
>>>> Currently, if a connect call fails on a signal or timeout (e.g., guest is still
>>>> in the process of starting up), we'll just return to caller and leave the connect
>>>> packet queued and they are sent even though the connection is considered a failure,
>>>> which can confuse applications with unwanted false connect attempt.
>>>> 
>>>> The patchset enables vsock (both host and guest) to cancel queued packets when
>>>> a connect attempt is considered to fail.
>>>> 
>>>> v4 changelog:
>>>>  - drop two unnecessary void * cast
>>>>  - update new callback commnet
>>>> v3 changelog:
>>>>  - define cancel_pkt callback in struct vsock_transport rather than struct virtio_transport
>>>>  - rename virtio_vsock_pkt->vsk to virtio_vsock_pkt->cancel_token
>>>> v2 changelog:
>>>>  - fix queued_replies counting and resume tx/rx when necessary
>>>> 
>>>> Cheers,
>>>> Tao
>>>> 
>>>> Peng Tao (4):
>>>>  vsock: track pkt owner vsock
>>>>  vhost-vsock: add pkt cancel capability
>>>>  vsock: add pkt cancel capability
>>>>  vsock: cancel packets when failing to connect
>>>> 
>>>> drivers/vhost/vsock.c                   | 41 ++++++++++++++++++++++++++++++++
>>>> include/linux/virtio_vsock.h            |  2 ++
>>>> include/net/af_vsock.h                  |  3 +++
>>>> net/vmw_vsock/af_vsock.c                | 14 +++++++++++
>>>> net/vmw_vsock/virtio_transport.c        | 42 +++++++++++++++++++++++++++++++++
>>>> net/vmw_vsock/virtio_transport_common.c |  7 ++++++
>>>> 6 files changed, 109 insertions(+)
>>>> 
>>>> --
>>>> 2.7.4
>>>> 
>>>> _______________________________________________
>>>> Virtualization mailing list
>>>> Virtualization@lists.linux-foundation.org
>>>> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
>>> 
>>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>> ping~
>> 
>> It looks like the patchsets are reviewed but not merged. Is there any blocker?
> 
> If Jorgen is sending pull requests then it should go through him.
> 
> Otherwise David Miller could apply it.

We are usually not involved in applying changes from outside VMware; those are applied by David Miller.

Thanks,
Jørgen
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-01-17  9:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-12 12:21 [PATCH v4 0/4] vsock: cancel connect packets when failing to connect Peng Tao
2016-12-12 12:21 ` [PATCH v4 1/4] vsock: track pkt owner vsock Peng Tao
2016-12-12 12:21   ` [PATCH v4 2/4] vhost-vsock: add pkt cancel capability Peng Tao
2016-12-12 12:21     ` [PATCH v4 3/4] vsock: " Peng Tao
     [not found]     ` <1481545269-18104-4-git-send-email-bergwolf@gmail.com>
2016-12-12 12:21       ` [PATCH v4 4/4] vsock: cancel packets when failing to connect Peng Tao
2016-12-13 10:04     ` [PATCH v4 2/4] vhost-vsock: add pkt cancel capability Jorgen S. Hansen
2016-12-13  9:50 ` [PATCH v4 0/4] vsock: cancel connect packets when failing to connect Stefan Hajnoczi
2017-01-06  2:22   ` Peng Tao
2017-01-09 10:06     ` Stefan Hajnoczi
2017-01-17  9:25       ` Jorgen S. Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).