Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4211247rwl; Tue, 28 Mar 2023 04:23:06 -0700 (PDT) X-Google-Smtp-Source: AKy350aNviDztHL/lplXUC+TtB7WgIebkRJlZNgV7w973UhTXJYNiywYe4qFV6wna09spiTHnIOt X-Received: by 2002:a17:906:bcc6:b0:932:e368:fbe7 with SMTP id lw6-20020a170906bcc600b00932e368fbe7mr13980890ejb.29.1680002585886; Tue, 28 Mar 2023 04:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680002585; cv=none; d=google.com; s=arc-20160816; b=ekmoFEvfuoj2XbRfgtnUnHLYBPddhm/Fc4W/uSrO959DtkvVzGqmR8q+mWSXojAK7C vneKEUMHcExoGxx8ccbW8sBmqU0xVrshpS6Btcz2msKbMFRg+RYS8HZb4SsqR9Dv8Yja GzfqlopTMAZuCFj1FHZ6VvctcSDbyZEipEXaThj33cwuuy9YAwRgAYgm/NJ3QHvdaCUf FkpHZ10Poh9ursMrx22ak0/Zr/suPp26He1c0Nk/JHetPTqF+r5Xe5KYHbKf25j6dzxN oUehBDJ13JlJQJU1oISedyGfAjS5PnLZAcY1ncPVnS/40JJH5TXfqVJbtsK2bkWhff9K UjCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xTS3qxFhBqMP5asqq6o4vShlFpc+3Cgiy/wm+SvxL0Q=; b=GN2g2rvSgsmUH5109zO0csAVQVmDg4ZcRiJrr8WpReSb+WBa81MrJo51Ys3SG6pCb5 SGGEZjEaj4YXeCn6efJui3wWDml8XjPC3EbHg3ZkA/tzGFDGKZFG8RiY5LQi8pUQbPRs bETMRvqIQGJ9sGy/EdfmYh1IGlKzTuej1GeDzIwQklhlT3B9wB/ioZELPKuTtRT/+FsL +LUvSI8tS2ocLVqXSM70nR/O451e1zHiPtdk0urr80fO3BBNpIDwHKIH9Yp/SnM4/K0t dScCOozB/LOsc3wx29Q3Fy3qj9ZQ3E7ijrx/690hEmEjDzrTvYZoABAab3JShzicgaC+ zp7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qb0Y7OAB; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a4-20020a17090682c400b00922528b3dcesi30313431ejy.983.2023.03.28.04.22.41; Tue, 28 Mar 2023 04:23:05 -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=@redhat.com header.s=mimecast20190719 header.b=Qb0Y7OAB; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232345AbjC1LUN (ORCPT + 99 others); Tue, 28 Mar 2023 07:20:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231536AbjC1LUK (ORCPT ); Tue, 28 Mar 2023 07:20:10 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F04C172A for ; Tue, 28 Mar 2023 04:19:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680002363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xTS3qxFhBqMP5asqq6o4vShlFpc+3Cgiy/wm+SvxL0Q=; b=Qb0Y7OAB52XJgumnzG0fviDjrBnJCpKLXOl0k16/hdy6l/Fw5s8qby6ULM24BE0wXcng7+ NZxUYna7KXLu47J6yu5+4tTxd4VJkaxbUIWBmiGydpnlWxmRnBEIDJZMyxYyMdJu5fSGTx XZeYIGMb52/b0+PvNAZrouWz5CK94Hc= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-574-BlRK-DhLPYOqb3L7WZWJkg-1; Tue, 28 Mar 2023 07:19:20 -0400 X-MC-Unique: BlRK-DhLPYOqb3L7WZWJkg-1 Received: by mail-qv1-f72.google.com with SMTP id y19-20020ad445b3000000b005a5123cb627so4833488qvu.20 for ; Tue, 28 Mar 2023 04:19:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680002359; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xTS3qxFhBqMP5asqq6o4vShlFpc+3Cgiy/wm+SvxL0Q=; b=3NKZdU14eQAb42pWe59fABmvvSY1EagAiSQfLkkstq1dhBYWjv99VF8hf8KvqDrjSe l1QhoIOCX0ffjNBetAnwbaEwKmqRkeFIEtzc1QZw3PiAyQuuW8bWwmADgupRqYpPLTHn xRpqjXEC+76NtyGcvsUJreOIeaA4307mWoKmZflHnxJss22lG1h9GO2Q0yBZcNHljbI+ Rloh/cZqJ0PYWpki6F93/3Dl93kqM9yjz1Vqb4Ra6dYUS57Rz2y8xvwE/+rHgDWzRWer JQRaUUf+q17owRlM7636TjzniOvkDk4Z4xrM8Qq49Sch5gDrEIKerIsxsI2HTzM/tKRZ Ptrw== X-Gm-Message-State: AO0yUKXttlZ8LhcijqVOBHrjwNrTVOWn9SExrb/JOHcwXbNDt8+o+LIg wWhPlvbtRizFmlVN4ntsJznthgGjkwGuNwGeSG/7zFznw9Xhau2v+e8qHzHLbDF4iZovVoGXuXO kdMB3a+xq0jAo93YWjgaRAoSy X-Received: by 2002:a05:622a:88:b0:3d8:3aed:66f4 with SMTP id o8-20020a05622a008800b003d83aed66f4mr26549978qtw.41.1680002359531; Tue, 28 Mar 2023 04:19:19 -0700 (PDT) X-Received: by 2002:a05:622a:88:b0:3d8:3aed:66f4 with SMTP id o8-20020a05622a008800b003d83aed66f4mr26549929qtw.41.1680002359066; Tue, 28 Mar 2023 04:19:19 -0700 (PDT) Received: from sgarzare-redhat (host-82-53-134-98.retail.telecomitalia.it. [82.53.134.98]) by smtp.gmail.com with ESMTPSA id v127-20020a379385000000b007456c75edbbsm17581456qkd.129.2023.03.28.04.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Mar 2023 04:19:18 -0700 (PDT) Date: Tue, 28 Mar 2023 13:19:13 +0200 From: Stefano Garzarella To: Arseniy Krasnov , Vishnu Dasa Cc: Bryan Tan , VMware PV-Drivers Reviewers , Stefan Hajnoczi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Bobby Eshleman , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@sberdevices.ru, oxffffaa@gmail.com Subject: Re: [RFC PATCH v1 1/2] vsock: return errors other than -ENOMEM to socket Message-ID: References: <97f19214-ba04-c47e-7486-72e8aa16c690@sberdevices.ru> <99da938b-3e67-150c-2f74-41d917a95950@sberdevices.ru> <0f0a8603-e8a1-5fb2-23d9-5773c808ef85@sberdevices.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0f0a8603-e8a1-5fb2-23d9-5773c808ef85@sberdevices.ru> X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 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://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 >>>> >> >