Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1631556rwl; Wed, 29 Mar 2023 22:19:47 -0700 (PDT) X-Google-Smtp-Source: AKy350Z5yO2t83+N2sdqUPWNmMV/D8DxuXjMswY+WkehuqPBjz4ssAevF9X5ujDvO8bhQpkk1ObV X-Received: by 2002:a05:6a20:394f:b0:e3:e236:bbfc with SMTP id r15-20020a056a20394f00b000e3e236bbfcmr819258pzg.0.1680153586897; Wed, 29 Mar 2023 22:19:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680153586; cv=none; d=google.com; s=arc-20160816; b=TEXSkKtUbtun9eFRHCUa4WnZ2PblvX8Gin8JV7nbq6Fc1JDvVRJa3bgenVMll8MDB8 kCbHQIxH6tfJ3ZoC4ADmC8T8HEgX4+WN3ksyVJCGauN6iCjLfq9OUzUgl9nx4eu9OKN4 2BSK7xWlbdoo894tImk5PDOXBdgBC5VjpFAZ4XDdAQD2JxGOAPANN7+AWuUuKfDSuIde UX84x5b8ROK1plC+vWHFXom5ZSJ2+w6bEj1CEixEi9uaDVfsfN3bOKbhWlf3USZBwdL1 G7ADFI5pCCpg6sIFqZObyZH58izrpjIsSK8v2aheS6g3H/7WB6oTxVOqJ1dtzss4bnT+ ccOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=gsOfma4lyrnLfMCE/+bHkDrhbc8nxtLfnG2vBKGjSSM=; b=SbnY4kvgzwB2uupTBK6PzXUoLj1hQMaASoQX1+j9vJFNyDOvc0snpPIx9lcUoFbqgi CzTuoGOML7E84/+ytMGK7k7B2XItHtvyns/DPeGxRC22T5+ForqEacCt/hMpGMUUkOWT 0onLIfIek1enNftnb4CtfD3fGuv0UqBeieQzDW7pgPyoduVTtSbH+49Kq8BcTEeXQv0g BEVIZBaJakWNuhYlfWLU27kw3MlTCI6R4a63qUfpLTT2DH5M8FYgfNsKc00MQkW7bHtu gxqGHfe8VlCXinINMBm5J45YHGtg3u645RrBFho+T9qYSMqljdG8qG+NYHnuOH3GA+1a 7KJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=Qw8MY1vt; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s6-20020a656446000000b00502e7159b0fsi1080256pgv.175.2023.03.29.22.19.35; Wed, 29 Mar 2023 22:19:46 -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=Qw8MY1vt; 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 S229692AbjC3FQv (ORCPT + 99 others); Thu, 30 Mar 2023 01:16:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjC3FQt (ORCPT ); Thu, 30 Mar 2023 01:16:49 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E11B05245; Wed, 29 Mar 2023 22:16:45 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 31F0C5FD25; Thu, 30 Mar 2023 08:16:42 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1680153402; bh=gsOfma4lyrnLfMCE/+bHkDrhbc8nxtLfnG2vBKGjSSM=; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; b=Qw8MY1vtgsYAnokKaNQqF8gVvlA5wi0remxRsT75tXYda5TGvQy4mxmjusPuL0XIv D/8qWwy+2FQivrGj1phwfwvd98P41Bq6htKNX2cyXIK89jey8YknwPNQ9Bbryct0Py 4b9lEKRnUkhCGLYN8ENfIVQ5kUkrSu6BOVBSVFoJOIuH359eW0KhE9MFPgehEfRisl S6FeTgCEQ7i1G5dNYuVxhVBOTJFcMa7OkvMbEmLFUQMxuB/wtQa1HyYvK9rSVGvsOJ lmCeJRo/4NbDFyV6vQbfF6jXGQDX+r9/l4aPRxoL4AOqDhqaewHnTLkken4D1GOhFC hn7Hm3wKlTRrw== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Thu, 30 Mar 2023 08:16:36 +0300 (MSK) Message-ID: <3083bb71-45bd-0738-14b6-fe2860c61b09@sberdevices.ru> Date: Thu, 30 Mar 2023 08:13:12 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [RFC PATCH v1 1/2] vsock: return errors other than -ENOMEM to socket Content-Language: en-US To: Vishnu Dasa , Stefano Garzarella CC: Bryan Tan , Pv-drivers , Stefan Hajnoczi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Bobby Eshleman , "kvm@vger.kernel.org" , Linux Virtualization , "netdev@vger.kernel.org" , LKML , kernel , Krasnov Arseniy References: <97f19214-ba04-c47e-7486-72e8aa16c690@sberdevices.ru> <99da938b-3e67-150c-2f74-41d917a95950@sberdevices.ru> <0f0a8603-e8a1-5fb2-23d9-5773c808ef85@sberdevices.ru> <64451c35-5442-73cb-4398-2b907dd810cc@sberdevices.ru> From: Arseniy Krasnov In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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/30 01:24:00 #21043458 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,NICE_REPLY_A,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: X-Mailing-List: linux-kernel@vger.kernel.org On 30.03.2023 00:44, Vishnu Dasa wrote: > > >> On Mar 28, 2023, at 4:20 AM, Arseniy Krasnov 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 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 >>>>>>> --- >>>>>>> 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. > >