Message ID | 99da938b-3e67-150c-2f74-41d917a95950@sberdevices.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp646315vqo; Sat, 25 Mar 2023 16:06:31 -0700 (PDT) X-Google-Smtp-Source: AKy350YNm9CX05LrxHEIr+tSQY8mH9z99KTDX+YuHMUkPgD7yQkuDS18hDVyZJa5cWIugmlBBaIw X-Received: by 2002:a17:90b:4b0a:b0:23f:7625:49b6 with SMTP id lx10-20020a17090b4b0a00b0023f762549b6mr8028512pjb.37.1679785591555; Sat, 25 Mar 2023 16:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679785591; cv=none; d=google.com; s=arc-20160816; b=CxE6bXVnG9lYKTELvc2zufnUgD69x0K5lNs1sVURt0a3YcnZVIX9tlZSHwwreRFFJG RDSbaPvspSvk+9xbxM0yxs9jhgH1Ou/gEipppnNjODRhe3wfKspBGy0aMhd+vAtTqD2k v+gepN9j0lwgIAQtKF3JwMDPgw71Trs0pth9kvPDouPKH09/gtzRedsxr5nkFJOTvWeF O4HlNaGV4baDq7rYnNNOIlxuuUsI53aWLx+/B8pjpJvdZner0hx0+2eEgxpVwUAoXtw+ owY5D6YiXkhlLuNoh84R7F1JbzLXeCWWScKPxawiXsqcWNZ4r7+7beiGC2MXkxmbWc9A IsoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :in-reply-to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=bkc6d1yYqgIUYawce1wHqHL23hRQ4dzBaaa6S+OuT/c=; b=nQQ6o6tMev/2mrkQx33S4VZMT2qVi4M+80lG5qvuKJeIIqzOdT/nOYc+PliuRjev+7 5BZboGf1G9/cIFRyowlwPrCPeEt2vzF+DUU5eLHCkloQlkVgnzokOmeDT0wysD3CGWXV KPLWlsy3AiE2Z/UdUyOs6PxWrfEMggubOReo7WS9tb0L8uMllKcg5uWGQPui6dxwkUvS XlO9T23+q4e9CDPvhLY5HxyeNOZZ47qyrJzjt77QjcwX4oxfAujAI+pN4+8A2murKMGb rMGYY541tWCKCoy67wfoJmQd2K4D50cRpzWcstEhboSTSbguxkvbzqI/UfrKs9zIpPER bsRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=eyVwZfIR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020a17090a1fc200b00205da45d8a5si2775823pjz.124.2023.03.25.16.06.18; Sat, 25 Mar 2023 16:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=eyVwZfIR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231888AbjCYWQd (ORCPT <rfc822;makky5685@gmail.com> + 99 others); Sat, 25 Mar 2023 18:16:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjCYWQb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 25 Mar 2023 18:16:31 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BB97CC30; Sat, 25 Mar 2023 15:16:30 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 8FCD45FD02; Sun, 26 Mar 2023 01:16:28 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1679782588; bh=bkc6d1yYqgIUYawce1wHqHL23hRQ4dzBaaa6S+OuT/c=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type; b=eyVwZfIRi1ANQNCylXloNg95A3u5qjMOKvXJQlTt++/OSkQfTS34zrtLO+UUjWsXU gnvUT11dd7l+O6EZTNHBU2PJrAWk/pN+mQ37xSUQuA7U1HRkF8Ntv/cFomi96UwR2S 87SAOv5/eS5nIJc1iGeaNFHY5Xk5kJEUJHJTrcMre8uF7ffN7L3PCCBHnVyzyXCLcz JyxOXbpkCvJCIPWDmUCctdKpfwk/t2CTqQQ6Xp4qs9BtR13ZV98ZtbxdWsp644dN5n EuEw+si670/5qpFin/owGhU69ddY6OjXquroBphysgiUzdk3GTRZqeHtl6D7SyOlBw jaFPVFatlXmDQ== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Sun, 26 Mar 2023 01:16:27 +0300 (MSK) Message-ID: <99da938b-3e67-150c-2f74-41d917a95950@sberdevices.ru> Date: Sun, 26 Mar 2023 01:13:11 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Content-Language: en-US In-Reply-To: <97f19214-ba04-c47e-7486-72e8aa16c690@sberdevices.ru> To: Stefan Hajnoczi <stefanha@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Bobby Eshleman <bobby.eshleman@bytedance.com> CC: <kvm@vger.kernel.org>, <virtualization@lists.linux-foundation.org>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <kernel@sberdevices.ru>, <oxffffaa@gmail.com>, <avkrasnov@sberdevices.ru> From: Arseniy Krasnov <avkrasnov@sberdevices.ru> Subject: [RFC PATCH v1 1/2] vsock: return errors other than -ENOMEM to socket Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH01.sberdevices.ru (172.16.1.4) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/03/25 20:38:00 #21009968 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761382856213173177?= X-GMAIL-MSGID: =?utf-8?q?1761382856213173177?= |
Series |
return errors other than -ENOMEM to socket
|
|
Commit Message
Arseniy Krasnov
March 25, 2023, 10:13 p.m. UTC
This removes behaviour, where error code returned from any transport
was always switched to ENOMEM. This works in the same way as:
commit
c43170b7e157 ("vsock: return errors other than -ENOMEM to socket"),
but for receive calls.
Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
---
net/vmw_vsock/af_vsock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Sun, Mar 26, 2023 at 01:13:11AM +0300, Arseniy Krasnov wrote: >This removes behaviour, where error code returned from any transport >was always switched to ENOMEM. This works in the same way as: >commit >c43170b7e157 ("vsock: return errors other than -ENOMEM to socket"), >but for receive calls. > >Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> >--- > net/vmw_vsock/af_vsock.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c >index 19aea7cba26e..9262e0b77d47 100644 >--- a/net/vmw_vsock/af_vsock.c >+++ b/net/vmw_vsock/af_vsock.c >@@ -2007,7 +2007,7 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg, > > read = transport->stream_dequeue(vsk, msg, len - copied, flags); In vmci_transport_stream_dequeue() vmci_qpair_peekv() and vmci_qpair_dequev() return VMCI_ERROR_* in case of errors. Maybe we should return -ENOMEM in vmci_transport_stream_dequeue() if those functions fail to keep the same behavior. CCing Bryan, Vishnu, and pv-drivers@vmware.com The other transports seem okay to me. Thanks, Stefano > if (read < 0) { >- err = -ENOMEM; >+ err = read; > break; > } > >@@ -2058,7 +2058,7 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg, > msg_len = transport->seqpacket_dequeue(vsk, msg, flags); > > if (msg_len < 0) { >- err = -ENOMEM; >+ err = msg_len; > goto out; > } > >-- >2.25.1 >
I pressed send too early... CCing Bryan, Vishnu, and pv-drivers@vmware.com On Tue, Mar 28, 2023 at 11:39 AM Stefano Garzarella <sgarzare@redhat.com> wrote: > > On Sun, Mar 26, 2023 at 01:13:11AM +0300, Arseniy Krasnov wrote: > >This removes behaviour, where error code returned from any transport > >was always switched to ENOMEM. This works in the same way as: > >commit > >c43170b7e157 ("vsock: return errors other than -ENOMEM to socket"), > >but for receive calls. > > > >Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> > >--- > > net/vmw_vsock/af_vsock.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > >diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c > >index 19aea7cba26e..9262e0b77d47 100644 > >--- a/net/vmw_vsock/af_vsock.c > >+++ b/net/vmw_vsock/af_vsock.c > >@@ -2007,7 +2007,7 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg, > > > > read = transport->stream_dequeue(vsk, msg, len - copied, flags); > > In vmci_transport_stream_dequeue() vmci_qpair_peekv() and > vmci_qpair_dequev() return VMCI_ERROR_* in case of errors. > > Maybe we should return -ENOMEM in vmci_transport_stream_dequeue() if > those functions fail to keep the same behavior. > > CCing Bryan, Vishnu, and pv-drivers@vmware.com > > The other transports seem okay to me. > > Thanks, > Stefano > > > if (read < 0) { > >- err = -ENOMEM; > >+ err = read; > > break; > > } > > > >@@ -2058,7 +2058,7 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg, > > msg_len = transport->seqpacket_dequeue(vsk, msg, flags); > > > > if (msg_len < 0) { > >- err = -ENOMEM; > >+ err = msg_len; > > goto out; > > } > > > >-- > >2.25.1 > >
On 28.03.2023 12:42, Stefano Garzarella wrote: > I pressed send too early... > > CCing Bryan, Vishnu, and pv-drivers@vmware.com > > On Tue, Mar 28, 2023 at 11:39 AM Stefano Garzarella <sgarzare@redhat.com> wrote: >> >> On Sun, Mar 26, 2023 at 01:13:11AM +0300, Arseniy Krasnov wrote: >>> This removes behaviour, where error code returned from any transport >>> was always switched to ENOMEM. This works in the same way as: >>> commit >>> c43170b7e157 ("vsock: return errors other than -ENOMEM to socket"), >>> but for receive calls. >>> >>> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> >>> --- >>> net/vmw_vsock/af_vsock.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c >>> index 19aea7cba26e..9262e0b77d47 100644 >>> --- a/net/vmw_vsock/af_vsock.c >>> +++ b/net/vmw_vsock/af_vsock.c >>> @@ -2007,7 +2007,7 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg, >>> >>> read = transport->stream_dequeue(vsk, msg, len - copied, flags); >> >> In vmci_transport_stream_dequeue() vmci_qpair_peekv() and >> vmci_qpair_dequev() return VMCI_ERROR_* in case of errors. >> >> Maybe we should return -ENOMEM in vmci_transport_stream_dequeue() if >> those functions fail to keep the same behavior. Yes, seems i missed it, because several months ago we had similar question for send logic: https://www.spinics.net/lists/kernel/msg4611091.html And it was ok to not handle VMCI send path in this way. So i think current implementation for tx is a little bit buggy, because VMCI specific error from 'vmci_qpair_enquev()' is returned to af_vsock.c. I think error conversion must be added to VMCI transport for tx also. Good thing is that Hyper-V uses general error codes. Thanks, Arseniy >> >> CCing Bryan, Vishnu, and pv-drivers@vmware.com >> >> The other transports seem okay to me. >> >> Thanks, >> Stefano >> >>> if (read < 0) { >>> - err = -ENOMEM; >>> + err = read; >>> break; >>> } >>> >>> @@ -2058,7 +2058,7 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg, >>> msg_len = transport->seqpacket_dequeue(vsk, msg, flags); >>> >>> if (msg_len < 0) { >>> - err = -ENOMEM; >>> + err = msg_len; >>> goto out; >>> } >>> >>> -- >>> 2.25.1 >>> >
On Tue, Mar 28, 2023 at 01:42:19PM +0300, Arseniy Krasnov wrote: > > >On 28.03.2023 12:42, Stefano Garzarella wrote: >> I pressed send too early... >> >> CCing Bryan, Vishnu, and pv-drivers@vmware.com >> >> On Tue, Mar 28, 2023 at 11:39 AM Stefano Garzarella <sgarzare@redhat.com> wrote: >>> >>> On Sun, Mar 26, 2023 at 01:13:11AM +0300, Arseniy Krasnov wrote: >>>> This removes behaviour, where error code returned from any transport >>>> was always switched to ENOMEM. This works in the same way as: >>>> commit >>>> c43170b7e157 ("vsock: return errors other than -ENOMEM to socket"), >>>> but for receive calls. >>>> >>>> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> >>>> --- >>>> net/vmw_vsock/af_vsock.c | 4 ++-- >>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c >>>> index 19aea7cba26e..9262e0b77d47 100644 >>>> --- a/net/vmw_vsock/af_vsock.c >>>> +++ b/net/vmw_vsock/af_vsock.c >>>> @@ -2007,7 +2007,7 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg, >>>> >>>> read = transport->stream_dequeue(vsk, msg, len - copied, flags); >>> >>> In vmci_transport_stream_dequeue() vmci_qpair_peekv() and >>> vmci_qpair_dequev() return VMCI_ERROR_* in case of errors. >>> >>> Maybe we should return -ENOMEM in vmci_transport_stream_dequeue() if >>> those functions fail to keep the same behavior. > >Yes, seems i missed it, because several months ago we had similar question for send >logic: >https://www.spinics.net/lists/kernel/msg4611091.html >And it was ok to not handle VMCI send path in this way. So i think current implementation >for tx is a little bit buggy, because VMCI specific error from 'vmci_qpair_enquev()' is >returned to af_vsock.c. I think error conversion must be added to VMCI transport for tx >also. Good point! These are negative values, so there are no big problems, but I don't know what the user expects in this case. @Vishnu Do we want to return an errno to the user or a VMCI_ERROR_*? In both cases I think we should do the same for both enqueue and dequeue. > >Good thing is that Hyper-V uses general error codes. Yeah! Thanks, Stefano > >Thanks, Arseniy >>> >>> CCing Bryan, Vishnu, and pv-drivers@vmware.com >>> >>> The other transports seem okay to me. >>> >>> Thanks, >>> Stefano >>> >>>> if (read < 0) { >>>> - err = -ENOMEM; >>>> + err = read; >>>> break; >>>> } >>>> >>>> @@ -2058,7 +2058,7 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg, >>>> msg_len = transport->seqpacket_dequeue(vsk, msg, flags); >>>> >>>> if (msg_len < 0) { >>>> - err = -ENOMEM; >>>> + err = msg_len; >>>> goto out; >>>> } >>>> >>>> -- >>>> 2.25.1 >>>> >> >
On 28.03.2023 14:19, Stefano Garzarella wrote: > On Tue, Mar 28, 2023 at 01:42:19PM +0300, Arseniy Krasnov wrote: >> >> >> On 28.03.2023 12:42, Stefano Garzarella wrote: >>> I pressed send too early... >>> >>> CCing Bryan, Vishnu, and pv-drivers@vmware.com >>> >>> On Tue, Mar 28, 2023 at 11:39 AM Stefano Garzarella <sgarzare@redhat.com> wrote: >>>> >>>> On Sun, Mar 26, 2023 at 01:13:11AM +0300, Arseniy Krasnov wrote: >>>>> This removes behaviour, where error code returned from any transport >>>>> was always switched to ENOMEM. This works in the same way as: >>>>> commit >>>>> c43170b7e157 ("vsock: return errors other than -ENOMEM to socket"), >>>>> but for receive calls. >>>>> >>>>> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> >>>>> --- >>>>> net/vmw_vsock/af_vsock.c | 4 ++-- >>>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>>> >>>>> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c >>>>> index 19aea7cba26e..9262e0b77d47 100644 >>>>> --- a/net/vmw_vsock/af_vsock.c >>>>> +++ b/net/vmw_vsock/af_vsock.c >>>>> @@ -2007,7 +2007,7 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg, >>>>> >>>>> read = transport->stream_dequeue(vsk, msg, len - copied, flags); >>>> >>>> In vmci_transport_stream_dequeue() vmci_qpair_peekv() and >>>> vmci_qpair_dequev() return VMCI_ERROR_* in case of errors. >>>> >>>> Maybe we should return -ENOMEM in vmci_transport_stream_dequeue() if >>>> those functions fail to keep the same behavior. >> >> Yes, seems i missed it, because several months ago we had similar question for send >> logic: >> https://www.spinics.net/lists/kernel/msg4611091.html >> And it was ok to not handle VMCI send path in this way. So i think current implementation >> for tx is a little bit buggy, because VMCI specific error from 'vmci_qpair_enquev()' is >> returned to af_vsock.c. I think error conversion must be added to VMCI transport for tx >> also. > > Good point! > > These are negative values, so there are no big problems, but I don't > know what the user expects in this case. > > @Vishnu Do we want to return an errno to the user or a VMCI_ERROR_*? Small remark, as i can see, VMCI_ERROR_ is not exported to user in include/uapi, so IIUC user won't be able to interpret such values correctly. Thanks, Arseniy > > In both cases I think we should do the same for both enqueue and > dequeue. > >> >> Good thing is that Hyper-V uses general error codes. > > Yeah! > > Thanks, > Stefano > >> >> Thanks, Arseniy >>>> >>>> CCing Bryan, Vishnu, and pv-drivers@vmware.com >>>> >>>> The other transports seem okay to me. >>>> >>>> Thanks, >>>> Stefano >>>> >>>>> if (read < 0) { >>>>> - err = -ENOMEM; >>>>> + err = read; >>>>> break; >>>>> } >>>>> >>>>> @@ -2058,7 +2058,7 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg, >>>>> msg_len = transport->seqpacket_dequeue(vsk, msg, flags); >>>>> >>>>> if (msg_len < 0) { >>>>> - err = -ENOMEM; >>>>> + err = msg_len; >>>>> goto out; >>>>> } >>>>> >>>>> -- >>>>> 2.25.1 >>>>> >>> >> >
> On Mar 28, 2023, at 4:20 AM, Arseniy Krasnov <AVKrasnov@sberdevices.ru> wrote: > > !! External Email > > On 28.03.2023 14:19, Stefano Garzarella wrote: >> On Tue, Mar 28, 2023 at 01:42:19PM +0300, Arseniy Krasnov wrote: >>> >>> >>> On 28.03.2023 12:42, Stefano Garzarella wrote: >>>> I pressed send too early... >>>> >>>> CCing Bryan, Vishnu, and pv-drivers@vmware.com >>>> >>>> On Tue, Mar 28, 2023 at 11:39 AM Stefano Garzarella <sgarzare@redhat.com> wrote: >>>>> >>>>> On Sun, Mar 26, 2023 at 01:13:11AM +0300, Arseniy Krasnov wrote: >>>>>> This removes behaviour, where error code returned from any transport >>>>>> was always switched to ENOMEM. This works in the same way as: >>>>>> commit >>>>>> c43170b7e157 ("vsock: return errors other than -ENOMEM to socket"), >>>>>> but for receive calls. >>>>>> >>>>>> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> >>>>>> --- >>>>>> net/vmw_vsock/af_vsock.c | 4 ++-- >>>>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>>>> >>>>>> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c >>>>>> index 19aea7cba26e..9262e0b77d47 100644 >>>>>> --- a/net/vmw_vsock/af_vsock.c >>>>>> +++ b/net/vmw_vsock/af_vsock.c >>>>>> @@ -2007,7 +2007,7 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg, >>>>>> >>>>>> read = transport->stream_dequeue(vsk, msg, len - copied, flags); >>>>> >>>>> In vmci_transport_stream_dequeue() vmci_qpair_peekv() and >>>>> vmci_qpair_dequev() return VMCI_ERROR_* in case of errors. >>>>> >>>>> Maybe we should return -ENOMEM in vmci_transport_stream_dequeue() if >>>>> those functions fail to keep the same behavior. >>> >>> Yes, seems i missed it, because several months ago we had similar question for send >>> logic: >>> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.spinics.net%2Flists%2Fkernel%2Fmsg4611091.html&data=05%7C01%7Cvdasa%40vmware.com%7C3b17793425384debe75708db2f7eec8c%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638155994413494900%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MMfFcKuFFvMcJrbToKvWvIB%2FZmzp%2BdGGVWFVWztuSzg%3D&reserved=0 >>> And it was ok to not handle VMCI send path in this way. So i think current implementation >>> for tx is a little bit buggy, because VMCI specific error from 'vmci_qpair_enquev()' is >>> returned to af_vsock.c. I think error conversion must be added to VMCI transport for tx >>> also. >> >> Good point! >> >> These are negative values, so there are no big problems, but I don't >> know what the user expects in this case. >> >> @Vishnu Do we want to return an errno to the user or a VMCI_ERROR_*? > > Small remark, as i can see, VMCI_ERROR_ is not exported to user in include/uapi, > so IIUC user won't be able to interpret such values correctly. > > Thanks, Arseniy Let's just return -ENOMEM from vmci transport in case of error in vmci_transport_stream_enqueue and vmci_transport_stream_dequeue. @Arseniy, Could you please add a separate patch in this set to handle the above? Thanks, Vishnu > >> >> In both cases I think we should do the same for both enqueue and >> dequeue. >> >>> >>> Good thing is that Hyper-V uses general error codes. >> >> Yeah! >> >> Thanks, >> Stefano >> >>> >>> Thanks, Arseniy >>>>> >>>>> CCing Bryan, Vishnu, and pv-drivers@vmware.com >>>>> >>>>> The other transports seem okay to me. >>>>> >>>>> Thanks, >>>>> Stefano >>>>> >>>>>> if (read < 0) { >>>>>> - err = -ENOMEM; >>>>>> + err = read; >>>>>> break; >>>>>> } >>>>>> >>>>>> @@ -2058,7 +2058,7 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg, >>>>>> msg_len = transport->seqpacket_dequeue(vsk, msg, flags); >>>>>> >>>>>> if (msg_len < 0) { >>>>>> - err = -ENOMEM; >>>>>> + err = msg_len; >>>>>> goto out; >>>>>> } >>>>>> >>>>>> -- >>>>>> 2.25.1 >>>>>> >>>> >>> >> > > !! External Email: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender.
On 30.03.2023 00:44, Vishnu Dasa wrote: > > >> On Mar 28, 2023, at 4:20 AM, Arseniy Krasnov <AVKrasnov@sberdevices.ru> wrote: >> >> !! External Email >> >> On 28.03.2023 14:19, Stefano Garzarella wrote: >>> On Tue, Mar 28, 2023 at 01:42:19PM +0300, Arseniy Krasnov wrote: >>>> >>>> >>>> On 28.03.2023 12:42, Stefano Garzarella wrote: >>>>> I pressed send too early... >>>>> >>>>> CCing Bryan, Vishnu, and pv-drivers@vmware.com >>>>> >>>>> On Tue, Mar 28, 2023 at 11:39 AM Stefano Garzarella <sgarzare@redhat.com> wrote: >>>>>> >>>>>> On Sun, Mar 26, 2023 at 01:13:11AM +0300, Arseniy Krasnov wrote: >>>>>>> This removes behaviour, where error code returned from any transport >>>>>>> was always switched to ENOMEM. This works in the same way as: >>>>>>> commit >>>>>>> c43170b7e157 ("vsock: return errors other than -ENOMEM to socket"), >>>>>>> but for receive calls. >>>>>>> >>>>>>> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> >>>>>>> --- >>>>>>> net/vmw_vsock/af_vsock.c | 4 ++-- >>>>>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>>>>> >>>>>>> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c >>>>>>> index 19aea7cba26e..9262e0b77d47 100644 >>>>>>> --- a/net/vmw_vsock/af_vsock.c >>>>>>> +++ b/net/vmw_vsock/af_vsock.c >>>>>>> @@ -2007,7 +2007,7 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg, >>>>>>> >>>>>>> read = transport->stream_dequeue(vsk, msg, len - copied, flags); >>>>>> >>>>>> In vmci_transport_stream_dequeue() vmci_qpair_peekv() and >>>>>> vmci_qpair_dequev() return VMCI_ERROR_* in case of errors. >>>>>> >>>>>> Maybe we should return -ENOMEM in vmci_transport_stream_dequeue() if >>>>>> those functions fail to keep the same behavior. >>>> >>>> Yes, seems i missed it, because several months ago we had similar question for send >>>> logic: >>>> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.spinics.net%2Flists%2Fkernel%2Fmsg4611091.html&data=05%7C01%7Cvdasa%40vmware.com%7C3b17793425384debe75708db2f7eec8c%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638155994413494900%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MMfFcKuFFvMcJrbToKvWvIB%2FZmzp%2BdGGVWFVWztuSzg%3D&reserved=0 >>>> And it was ok to not handle VMCI send path in this way. So i think current implementation >>>> for tx is a little bit buggy, because VMCI specific error from 'vmci_qpair_enquev()' is >>>> returned to af_vsock.c. I think error conversion must be added to VMCI transport for tx >>>> also. >>> >>> Good point! >>> >>> These are negative values, so there are no big problems, but I don't >>> know what the user expects in this case. >>> >>> @Vishnu Do we want to return an errno to the user or a VMCI_ERROR_*? >> >> Small remark, as i can see, VMCI_ERROR_ is not exported to user in include/uapi, >> so IIUC user won't be able to interpret such values correctly. >> >> Thanks, Arseniy > > Let's just return -ENOMEM from vmci transport in case of error in > vmci_transport_stream_enqueue and vmci_transport_stream_dequeue. > > @Arseniy, > Could you please add a separate patch in this set to handle the above? Sure, ack, in the next few days! Thanks, Arseniy > > Thanks, > Vishnu > >> >>> >>> In both cases I think we should do the same for both enqueue and >>> dequeue. >>> >>>> >>>> Good thing is that Hyper-V uses general error codes. >>> >>> Yeah! >>> >>> Thanks, >>> Stefano >>> >>>> >>>> Thanks, Arseniy >>>>>> >>>>>> CCing Bryan, Vishnu, and pv-drivers@vmware.com >>>>>> >>>>>> The other transports seem okay to me. >>>>>> >>>>>> Thanks, >>>>>> Stefano >>>>>> >>>>>>> if (read < 0) { >>>>>>> - err = -ENOMEM; >>>>>>> + err = read; >>>>>>> break; >>>>>>> } >>>>>>> >>>>>>> @@ -2058,7 +2058,7 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg, >>>>>>> msg_len = transport->seqpacket_dequeue(vsk, msg, flags); >>>>>>> >>>>>>> if (msg_len < 0) { >>>>>>> - err = -ENOMEM; >>>>>>> + err = msg_len; >>>>>>> goto out; >>>>>>> } >>>>>>> >>>>>>> -- >>>>>>> 2.25.1 >>>>>>> >>>>> >>>> >>> >> >> !! External Email: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender. > >
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 19aea7cba26e..9262e0b77d47 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -2007,7 +2007,7 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg, read = transport->stream_dequeue(vsk, msg, len - copied, flags); if (read < 0) { - err = -ENOMEM; + err = read; break; } @@ -2058,7 +2058,7 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg, msg_len = transport->seqpacket_dequeue(vsk, msg, flags); if (msg_len < 0) { - err = -ENOMEM; + err = msg_len; goto out; }