Message ID | 4d34fac8-7170-5a3e-5043-42a9f7e4b5b3@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 b10csp116969vqo; Thu, 30 Mar 2023 13:32:51 -0700 (PDT) X-Google-Smtp-Source: AKy350ZQwZ/os22sNT+cLFm8imVr/Kv7kUuzvD5QRQekBnkpSbOUqrV3RAcACcfDVIL6WjmCcSYa X-Received: by 2002:a17:907:a4c7:b0:947:80a4:5cce with SMTP id vq7-20020a170907a4c700b0094780a45ccemr2064727ejc.65.1680208371538; Thu, 30 Mar 2023 13:32:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680208371; cv=none; d=google.com; s=arc-20160816; b=R2Is+Ea/kTz606cVvh4div10lsMU8Han+5E+d4SyF64tDoZMr4VWFsd5dxwClNgoW9 tb2R+Ue80DOX5TQyJsbOPkMw9EuIq0+qnai9qp4pWSbR9ae8AYTplK6EUKGS3vBaGWyf h4FKfl571W55jgqjQMuytc4pKszJ1uy4tRs3zRS5wOg2+xMhm0NCWO4E2f33d7UIMUAg ILdPipha13Apst3jCGZpWkq7YJpRQxF8nbLqCtLH8siUlDu5Z3c4usUakkQrExB8lraN ezYwOlRk+354HU+R4Ep0IJMsINbrHefkov1ydZ6vcEazy+ZpWE2ucHgppenQSqYyRJOg NkJA== 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=CER4MNFQ6t3C6FIfst1okLvyzbLyUopRquokWOtBnsQ=; b=OStsLTR8ngq/o7M0RqgWnUX1mHpBuBzLB+MZSh2kjFJc3oIPkiNLGdP77uRs/aieRM NX1My6KL26vnnfqlC8P5vrm53fmgDqgdnc8wZ7Srp/JxhmmNiURK0t2fNQ5FMSAStWpG Mt473RVWCU05UcBB/4rZkQEKvsPBpGno2gQVVMXnMrJUT/EfbLpf51hjULS9V3BLdWpo pShhCbXHC9xlMzEdDauGXu79G4JoPQPjhaQdOnpGYS8//oqwPW582aEVg6R+5U87RAmr wxsjB+TEj4Fa+NXSoJwpAjexuler56qjBr6iLrXZkjDRPBKGFNg81f/lGKOcAlRgaZ2V JNZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b="MY/7gFs0"; 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 uz29-20020a170907119d00b008e0363188e3si386107ejb.953.2023.03.30.13.32.27; Thu, 30 Mar 2023 13:32:51 -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="MY/7gFs0"; 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 S229735AbjC3URP (ORCPT <rfc822;rua109.linux@gmail.com> + 99 others); Thu, 30 Mar 2023 16:17:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjC3URO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 30 Mar 2023 16:17:14 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B2EBBDDE; Thu, 30 Mar 2023 13:17:13 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id D0D635FD0B; Thu, 30 Mar 2023 23:17:11 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1680207431; bh=CER4MNFQ6t3C6FIfst1okLvyzbLyUopRquokWOtBnsQ=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type; b=MY/7gFs0FihHvg4So5SMlp4NMyXRUE6sJZcDV58zb6qwCkGHGzc4YGHXU71vuWZFX DKih2599fybEo6cshMRBSyEdug2F+Msodtx3gYo9XR37O0Y+LvdyTQYDP9xQt/Q3dn TgqnzU7Uru7H6SVVRql5Cd3UFKm4RI0IHt/xPzE3OuvLEDRsC6kYwS03befvS+iX3r GgL9L2n9QYRlFL3GVqYXmTtfl6ZjyuNe5dkQomhAoA1/bsNp9RPbFKYbioWD75y7eD gjGNg7jnWcDlP1FIeCBn90nrHo+JN/KYbQUCey6wzm26WkSJ0oXGItCVXSXqfSF68y ydb+VTAMdnF2g== 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 23:17:11 +0300 (MSK) Message-ID: <4d34fac8-7170-5a3e-5043-42a9f7e4b5b3@sberdevices.ru> Date: Thu, 30 Mar 2023 23:13:46 +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: <dead4842-333a-015e-028b-302151336ff9@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>, Bryan Tan <bryantan@vmware.com>, Vishnu Dasa <vdasa@vmware.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>, <pv-drivers@vmware.com> From: Arseniy Krasnov <avkrasnov@sberdevices.ru> Subject: [RFC PATCH v3 2/4] vsock/vmci: convert VMCI error code to -ENOMEM on receive 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/30 18:07:00 #21069213 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?1761826173068696322?= X-GMAIL-MSGID: =?utf-8?q?1761826173068696322?= |
Series |
vsock: return errors other than -ENOMEM to socket
|
|
Commit Message
Arseniy Krasnov
March 30, 2023, 8:13 p.m. UTC
This adds conversion of VMCI specific error code to general -ENOMEM. It
is needed, because af_vsock.c passes error value returned from transport
to the user, which does not expect to get VMCI_ERROR_* values.
Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
---
net/vmw_vsock/vmci_transport.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
Comments
On 30.03.2023 23:13, Arseniy Krasnov wrote: > This adds conversion of VMCI specific error code to general -ENOMEM. It > is needed, because af_vsock.c passes error value returned from transport > to the user, which does not expect to get VMCI_ERROR_* values. @Stefano, I have some doubts about this commit message, as it says "... af_vsock.c passes error value returned from transport to the user ...", but this behaviour is implemented only in the next patch. Is it ok, if both patches are in a single patchset? For patch 1 I think it is ok, as it fixes current implementation. Thanks, Arseniy > > Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> > --- > net/vmw_vsock/vmci_transport.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c > index 95cc4d79ba29..b370070194fa 100644 > --- a/net/vmw_vsock/vmci_transport.c > +++ b/net/vmw_vsock/vmci_transport.c > @@ -1831,10 +1831,17 @@ static ssize_t vmci_transport_stream_dequeue( > size_t len, > int flags) > { > + ssize_t err; > + > if (flags & MSG_PEEK) > - return vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg, len, 0); > + err = vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg, len, 0); > else > - return vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg, len, 0); > + err = vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg, len, 0); > + > + if (err < 0) > + err = -ENOMEM; > + > + return err; > } > > static ssize_t vmci_transport_stream_enqueue(
> On Mar 30, 2023, at 1:18 PM, Arseniy Krasnov <AVKrasnov@sberdevices.ru> wrote: > > !! External Email > > On 30.03.2023 23:13, Arseniy Krasnov wrote: >> This adds conversion of VMCI specific error code to general -ENOMEM. It >> is needed, because af_vsock.c passes error value returned from transport >> to the user, which does not expect to get VMCI_ERROR_* values. > > @Stefano, I have some doubts about this commit message, as it says "... af_vsock.c > passes error value returned from transport to the user ...", but this > behaviour is implemented only in the next patch. Is it ok, if both patches > are in a single patchset? > > For patch 1 I think it is ok, as it fixes current implementation. > > Thanks, Arseniy > >> >> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> Code change looks good to me. Will let you figure out the commit message with Stefano. Thanks! Reviewed-by: Vishnu Dasa <vdasa@vmware.com> >> --- >> net/vmw_vsock/vmci_transport.c | 11 +++++++++-- >> 1 file changed, 9 insertions(+), 2 deletions(-) >> >> diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c >> index 95cc4d79ba29..b370070194fa 100644 >> --- a/net/vmw_vsock/vmci_transport.c >> +++ b/net/vmw_vsock/vmci_transport.c >> @@ -1831,10 +1831,17 @@ static ssize_t vmci_transport_stream_dequeue( >> size_t len, >> int flags) >> { >> + ssize_t err; >> + >> if (flags & MSG_PEEK) >> - return vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg, len, 0); >> + err = vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg, len, 0); >> else >> - return vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg, len, 0); >> + err = vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg, len, 0); >> + >> + if (err < 0) >> + err = -ENOMEM; >> + >> + return err; >> } >> >> static ssize_t vmci_transport_stream_enqueue( > > !! External Email: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender.
On Thu, Mar 30, 2023 at 11:18:36PM +0300, Arseniy Krasnov wrote: > > >On 30.03.2023 23:13, Arseniy Krasnov wrote: >> This adds conversion of VMCI specific error code to general -ENOMEM. It >> is needed, because af_vsock.c passes error value returned from transport >> to the user, which does not expect to get VMCI_ERROR_* values. > >@Stefano, I have some doubts about this commit message, as it says "... af_vsock.c >passes error value returned from transport to the user ...", but this >behaviour is implemented only in the next patch. Is it ok, if both patches >are in a single patchset? Yes indeed it is not clear. In my opinion we can do one of these 2 things: 1. Update the message, where we can say that this is a preparation patch for the next changes where af_vsock.c will directly return transport values to the user, so we need to return an errno. 2. Merge this patch and patch 3 in a single patch. Both are fine for my point of view, take your choice ;-) Thanks, Stefano
On 31.03.2023 10:12, Stefano Garzarella wrote: > On Thu, Mar 30, 2023 at 11:18:36PM +0300, Arseniy Krasnov wrote: >> >> >> On 30.03.2023 23:13, Arseniy Krasnov wrote: >>> This adds conversion of VMCI specific error code to general -ENOMEM. It >>> is needed, because af_vsock.c passes error value returned from transport >>> to the user, which does not expect to get VMCI_ERROR_* values. >> >> @Stefano, I have some doubts about this commit message, as it says "... af_vsock.c >> passes error value returned from transport to the user ...", but this >> behaviour is implemented only in the next patch. Is it ok, if both patches >> are in a single patchset? > > Yes indeed it is not clear. In my opinion we can do one of these 2 > things: > > 1. Update the message, where we can say that this is a preparation patch > for the next changes where af_vsock.c will directly return transport > values to the user, so we need to return an errno. > > 2. Merge this patch and patch 3 in a single patch. > > Both are fine for my point of view, take your choice ;-) Ok! Thanks for this! Thanks, Arseniy > > Thanks, > Stefano >
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c index 95cc4d79ba29..b370070194fa 100644 --- a/net/vmw_vsock/vmci_transport.c +++ b/net/vmw_vsock/vmci_transport.c @@ -1831,10 +1831,17 @@ static ssize_t vmci_transport_stream_dequeue( size_t len, int flags) { + ssize_t err; + if (flags & MSG_PEEK) - return vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg, len, 0); + err = vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg, len, 0); else - return vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg, len, 0); + err = vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg, len, 0); + + if (err < 0) + err = -ENOMEM; + + return err; } static ssize_t vmci_transport_stream_enqueue(