From: Bobby Eshleman <bobbyeshleman@gmail.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: Bobby Eshleman <bobby.eshleman@gmail.com>,
Wei Liu <wei.liu@kernel.org>, Cong Wang <cong.wang@bytedance.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Bobby Eshleman <bobby.eshleman@bytedance.com>,
Jiang Wang <jiang.wang@bytedance.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Dexuan Cui <decui@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Eric Dumazet <edumazet@google.com>,
netdev@vger.kernel.org, Stefan Hajnoczi <stefanha@redhat.com>,
kvm@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
linux-hyperv@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH 2/6] vsock: return errors other than -ENOMEM to socket
Date: Mon, 26 Sep 2022 21:30:53 +0000 [thread overview]
Message-ID: <YzIaDbYnbFUT6Jr/@bullseye> (raw)
In-Reply-To: <20220926132145.utv2rzswhejhxrvb@sgarzare-redhat>
On Mon, Sep 26, 2022 at 03:21:45PM +0200, Stefano Garzarella wrote:
> On Mon, Aug 15, 2022 at 10:56:05AM -0700, Bobby Eshleman wrote:
> > This commit allows vsock implementations to return errors
> > to the socket layer other than -ENOMEM. One immediate effect
> > of this is that upon the sk_sndbuf threshold being reached -EAGAIN
> > will be returned and userspace may throttle appropriately.
> >
> > Resultingly, a known issue with uperf is resolved[1].
> >
> > Additionally, to preserve legacy behavior for non-virtio
> > implementations, hyperv/vmci force errors to be -ENOMEM so that behavior
> > is unchanged.
> >
> > [1]: https://gitlab.com/vsock/vsock/-/issues/1
> >
> > Signed-off-by: Bobby Eshleman <bobby.eshleman@bytedance.com>
> > ---
> > include/linux/virtio_vsock.h | 3 +++
> > net/vmw_vsock/af_vsock.c | 3 ++-
> > net/vmw_vsock/hyperv_transport.c | 2 +-
> > net/vmw_vsock/virtio_transport_common.c | 3 ---
> > net/vmw_vsock/vmci_transport.c | 9 ++++++++-
> > 5 files changed, 14 insertions(+), 6 deletions(-)
> >
> > diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
> > index 17ed01466875..9a37eddbb87a 100644
> > --- a/include/linux/virtio_vsock.h
> > +++ b/include/linux/virtio_vsock.h
> > @@ -8,6 +8,9 @@
> > #include <net/sock.h>
> > #include <net/af_vsock.h>
> >
> > +/* Threshold for detecting small packets to copy */
> > +#define GOOD_COPY_LEN 128
> > +
>
> This change seems unrelated.
>
> Please move it in the patch where you need this.
> Maybe it's better to add a prefix if we move it in an header file (e.g.
> VIRTIO_VSOCK_...).
>
> Thanks,
> Stefano
>
Oh yes, definitely.
Thanks,
Bobby
> > enum virtio_vsock_metadata_flags {
> > VIRTIO_VSOCK_METADATA_FLAGS_REPLY = BIT(0),
> > VIRTIO_VSOCK_METADATA_FLAGS_TAP_DELIVERED = BIT(1),
> > diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
> > index e348b2d09eac..1893f8aafa48 100644
> > --- a/net/vmw_vsock/af_vsock.c
> > +++ b/net/vmw_vsock/af_vsock.c
> > @@ -1844,8 +1844,9 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg,
> > written = transport->stream_enqueue(vsk,
> > msg, len - total_written);
> > }
> > +
> > if (written < 0) {
> > - err = -ENOMEM;
> > + err = written;
> > goto out_err;
> > }
> >
> > diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c
> > index fd98229e3db3..e99aea571f6f 100644
> > --- a/net/vmw_vsock/hyperv_transport.c
> > +++ b/net/vmw_vsock/hyperv_transport.c
> > @@ -687,7 +687,7 @@ static ssize_t hvs_stream_enqueue(struct vsock_sock *vsk, struct msghdr *msg,
> > if (bytes_written)
> > ret = bytes_written;
> > kfree(send_buf);
> > - return ret;
> > + return ret < 0 ? -ENOMEM : ret;
> > }
> >
> > static s64 hvs_stream_has_data(struct vsock_sock *vsk)
> > diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> > index 920578597bb9..d5780599fe93 100644
> > --- a/net/vmw_vsock/virtio_transport_common.c
> > +++ b/net/vmw_vsock/virtio_transport_common.c
> > @@ -23,9 +23,6 @@
> > /* How long to wait for graceful shutdown of a connection */
> > #define VSOCK_CLOSE_TIMEOUT (8 * HZ)
> >
> > -/* Threshold for detecting small packets to copy */
> > -#define GOOD_COPY_LEN 128
> > -
> > static const struct virtio_transport *
> > virtio_transport_get_ops(struct vsock_sock *vsk)
> > {
> > diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
> > index b14f0ed7427b..c927a90dc859 100644
> > --- a/net/vmw_vsock/vmci_transport.c
> > +++ b/net/vmw_vsock/vmci_transport.c
> > @@ -1838,7 +1838,14 @@ static ssize_t vmci_transport_stream_enqueue(
> > struct msghdr *msg,
> > size_t len)
> > {
> > - return vmci_qpair_enquev(vmci_trans(vsk)->qpair, msg, len, 0);
> > + int err;
> > +
> > + err = vmci_qpair_enquev(vmci_trans(vsk)->qpair, msg, len, 0);
> > +
> > + if (err < 0)
> > + err = -ENOMEM;
> > +
> > + return err;
> > }
> >
> > static s64 vmci_transport_stream_has_data(struct vsock_sock *vsk)
> > --
> > 2.35.1
> >
>
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2022-09-26 21:31 UTC|newest]
Thread overview: 101+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-15 17:56 [PATCH 0/6] virtio/vsock: introduce dgrams, sk_buff, and qdisc Bobby Eshleman
2022-08-15 17:56 ` [PATCH 1/6] vsock: replace virtio_vsock_pkt with sk_buff Bobby Eshleman
2022-08-16 2:30 ` [virtio-dev] " Bobby Eshleman
2022-08-16 2:30 ` Bobby Eshleman
2022-08-15 17:56 ` [PATCH 2/6] vsock: return errors other than -ENOMEM to socket Bobby Eshleman
2022-08-15 20:01 ` kernel test robot
2022-08-15 20:01 ` kernel test robot
2022-08-15 23:13 ` kernel test robot
2022-08-15 23:13 ` kernel test robot
2022-08-16 2:16 ` kernel test robot
2022-08-16 2:16 ` kernel test robot
2022-08-16 2:30 ` Bobby Eshleman
2022-08-16 2:30 ` [virtio-dev] " Bobby Eshleman
2022-08-17 5:28 ` Arseniy Krasnov
2022-09-26 13:21 ` Stefano Garzarella
2022-09-26 13:21 ` Stefano Garzarella
2022-09-26 21:30 ` Bobby Eshleman [this message]
2022-08-15 17:56 ` [PATCH 3/6] vsock: add netdev to vhost/virtio vsock Bobby Eshleman
2022-08-16 2:31 ` [virtio-dev] " Bobby Eshleman
2022-08-16 2:31 ` Bobby Eshleman
2022-08-16 16:38 ` Michael S. Tsirkin
2022-08-16 16:38 ` Michael S. Tsirkin
2022-08-16 6:18 ` Bobby Eshleman
2022-08-16 18:07 ` Jakub Kicinski
2022-08-16 7:02 ` Bobby Eshleman
2022-08-16 23:07 ` Jakub Kicinski
2022-08-16 8:29 ` Bobby Eshleman
2022-08-17 1:15 ` Jakub Kicinski
2022-08-16 10:50 ` Bobby Eshleman
2022-08-17 17:20 ` Michael S. Tsirkin
2022-08-17 17:20 ` Michael S. Tsirkin
2022-08-18 4:34 ` Jason Wang
2022-08-18 4:34 ` Jason Wang
2022-08-17 1:23 ` [External] " Cong Wang .
2022-09-06 10:58 ` Michael S. Tsirkin
2022-09-06 10:58 ` Michael S. Tsirkin
2022-08-18 14:20 ` Bobby Eshleman
2022-08-15 17:56 ` [PATCH 4/6] virtio/vsock: add VIRTIO_VSOCK_F_DGRAM feature bit Bobby Eshleman
2022-08-16 2:31 ` [virtio-dev] " Bobby Eshleman
2022-08-16 2:31 ` Bobby Eshleman
2022-09-26 13:17 ` Stefano Garzarella
2022-09-26 13:17 ` Stefano Garzarella
2022-09-26 21:52 ` Bobby Eshleman
2022-08-15 17:56 ` [PATCH 5/6] virtio/vsock: add support for dgram Bobby Eshleman
2022-08-15 21:02 ` kernel test robot
2022-08-15 21:02 ` kernel test robot
2022-08-16 2:32 ` [virtio-dev] " Bobby Eshleman
2022-08-16 2:32 ` Bobby Eshleman
2022-08-17 5:01 ` [virtio-dev] " Arseniy Krasnov
2022-08-16 9:57 ` Bobby Eshleman
2022-08-16 9:57 ` Bobby Eshleman
2022-08-18 8:24 ` Arseniy Krasnov
2022-08-17 5:42 ` Arseniy Krasnov
2022-08-16 9:58 ` Bobby Eshleman
2022-08-16 9:58 ` Bobby Eshleman
2022-08-18 8:35 ` Arseniy Krasnov
2022-08-16 20:52 ` Bobby Eshleman
2022-08-16 20:52 ` Bobby Eshleman
2022-08-19 4:30 ` Arseniy Krasnov
2022-08-15 17:56 ` [PATCH 6/6] vsock_test: add tests for vsock dgram Bobby Eshleman
2022-08-16 2:32 ` [virtio-dev] " Bobby Eshleman
2022-08-16 2:32 ` Bobby Eshleman
2022-08-15 20:39 ` [PATCH 0/6] virtio/vsock: introduce dgrams, sk_buff, and qdisc Michael S. Tsirkin
2022-08-15 20:39 ` Michael S. Tsirkin
2022-08-16 1:55 ` Bobby Eshleman
2022-08-16 2:29 ` Bobby Eshleman
2022-08-16 2:29 ` [virtio-dev] " Bobby Eshleman
2022-08-16 7:00 ` Stefano Garzarella
2022-08-16 2:35 ` Bobby Eshleman
2022-08-17 6:54 ` Michael S. Tsirkin
2022-08-17 6:54 ` Michael S. Tsirkin
2022-08-16 9:42 ` Bobby Eshleman
2022-08-17 17:02 ` Michael S. Tsirkin
2022-08-17 17:02 ` Michael S. Tsirkin
2022-08-16 11:08 ` Bobby Eshleman
2022-08-17 17:53 ` Michael S. Tsirkin
2022-08-17 17:53 ` Michael S. Tsirkin
2022-08-16 12:10 ` Bobby Eshleman
2022-08-18 4:28 ` Jason Wang
2022-08-18 4:28 ` Jason Wang
2022-09-06 9:00 ` Stefano Garzarella
2022-09-06 9:00 ` Stefano Garzarella
2022-09-06 13:26 ` Stefan Hajnoczi
2022-09-06 13:26 ` Stefan Hajnoczi
2022-08-18 14:39 ` Bobby Eshleman
2022-09-08 8:30 ` Stefano Garzarella
2022-09-08 8:30 ` Stefano Garzarella
2022-09-08 14:36 ` Call to discuss vsock netdev/sk_buff [was Re: [PATCH 0/6] virtio/vsock: introduce dgrams, sk_buff, and qdisc] Stefano Garzarella
2022-09-08 14:36 ` Stefano Garzarella
2022-09-09 18:13 ` Bobby Eshleman
2022-09-12 18:12 ` Stefano Garzarella
2022-09-12 18:12 ` Stefano Garzarella
2022-09-09 23:33 ` Bobby Eshleman
2022-09-16 3:51 ` Stefano Garzarella
2022-09-16 3:51 ` Stefano Garzarella
2022-09-10 16:29 ` Bobby Eshleman
2022-09-26 13:42 ` [PATCH 0/6] virtio/vsock: introduce dgrams, sk_buff, and qdisc Stefano Garzarella
2022-09-26 13:42 ` Stefano Garzarella
2022-09-26 21:44 ` Bobby Eshleman
2022-09-27 17:45 ` Stefano Garzarella
2022-09-27 17:45 ` Stefano Garzarella
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YzIaDbYnbFUT6Jr/@bullseye \
--to=bobbyeshleman@gmail.com \
--cc=bobby.eshleman@bytedance.com \
--cc=bobby.eshleman@gmail.com \
--cc=cong.wang@bytedance.com \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=edumazet@google.com \
--cc=haiyangz@microsoft.com \
--cc=jiang.wang@bytedance.com \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=sthemmin@microsoft.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.