Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2100827rdh; Tue, 26 Sep 2023 12:24:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6HYt3BEdWp8BhX6i37nBQ154eZS7T92H82MbNQrzMcdGVUSls2O04hjMdQ/GQM7Ss+NSD X-Received: by 2002:a05:6a20:4425:b0:15d:ec88:356e with SMTP id ce37-20020a056a20442500b0015dec88356emr14609503pzb.41.1695756276389; Tue, 26 Sep 2023 12:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695756276; cv=none; d=google.com; s=arc-20160816; b=ElU4jhPeYrs/jVBM+rAU0XmwQEHfG0Hy25aiB91dp/oulMKXRd5VXX5mbLF9UzLVNL dg2nJKpgrFXJdLhD0kAkANA21CqE8fiyqBv0oxUTrd3Hb5/KrM3jix3nL7fmFdjBKdNo bQb2VNnU2yGNK0LhtbbBrNY7ilOlvfuKjzYvvmA9WOUxJrvVOrYRjoiAi75c1puMXyn9 TqOgnYs4vd0LsDgSNFfwT+2ivXLkZ+wngEOSYmWnd5FE466DnL9pjuoz4wavNy3MSq6+ ckCRXNBTuThtiQ2cvZseHZmFVJCK9B8xwPc+0czjUUf6PpQW8OWMvykldWvbaOktsFE9 MNDA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=t4iH3vwVxFoPswV3u1qhZq4zjltOD47zGEuJH78n1q8=; fh=JEq7ZyqHwnKMAbPjHbEHIOO1u1YxTWxtQlCbJmwG+xw=; b=kbJfkHAk4H96tBneTEeM2cZ+kV5IYLZqbZtYJ53W8QZOyL81YkthUTqrsyRxRemY2Y 8cRGkA9Ca7ImhE6L9W9h0cOONNu+I2aMDK6YCZvil35Yn3WK7UtN6Fid2shAZUwp8qQO 4Ts9ROwfiExTJEpsAJvIimeLH8CoqnVjsvVDtklZTdsLLhUOVBBNlbCyj+qNiXKjdq1j 755xjCltUgbbtzQYKHDhwCepjaRDBPZak0cx6KUgA21WSEmCfjJFeJMEoB9NVSTof+dk 3JHJesSnCvjRWo99BOyuSCDUWbultchi5RDvfBMHIQmEgx1nZajGzMHxp1SVs4ASBaw+ V5WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=He8T1iUO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z7-20020a056a001d8700b0068e26ca7f00si12871370pfw.39.2023.09.26.12.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 12:24:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=He8T1iUO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 57850801C021; Tue, 26 Sep 2023 05:56:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230125AbjIZM4s (ORCPT + 99 others); Tue, 26 Sep 2023 08:56:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234536AbjIZM4q (ORCPT ); Tue, 26 Sep 2023 08:56:46 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B199120 for ; Tue, 26 Sep 2023 05:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695732958; 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: in-reply-to:in-reply-to:references:references; bh=t4iH3vwVxFoPswV3u1qhZq4zjltOD47zGEuJH78n1q8=; b=He8T1iUOw+/JiwJFI6AXLU8mK9wC2o1tBRe/v2RmRwkUW+naovHjUmznaLkIYfBmlpxKVa i6hH3zJbLjB5YwnLoEP39HaX10cXPUdnAvtJXt5MhdK0VhR9U8wzcn0vv8XmbMHDwfdWLF WKSE05Q1X5evFsuj+ubU1H6mfOMU9tE= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-561-AhZA-KZ0P_-Tp9lMmgCqug-1; Tue, 26 Sep 2023 08:55:56 -0400 X-MC-Unique: AhZA-KZ0P_-Tp9lMmgCqug-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9adb6dd9e94so728872066b.2 for ; Tue, 26 Sep 2023 05:55:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695732955; x=1696337755; h=in-reply-to: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=t4iH3vwVxFoPswV3u1qhZq4zjltOD47zGEuJH78n1q8=; b=HGdeUZvOuplEs06TkwiWSi+2L+y5/KSDfosFWIs5IQoF/IQTz9NJ1RB+sb1eUxSOe4 W/vnO5voa8UoyIeVzD1lMuIAT1Q4EVKH5NptT1biTwNrzrx1pS0X7UVmO8rxrSQZC51o OjPK+PZfDlhd8AlEZVsL2V/IzkcCnFFyccQAi8ezXEiGxk3owuddlJ3Y6Lir/ca9EXtO 1OMCfFJH+DTB06lr9NNhgHFomX/PSXslaViYFhaBbmxKTuIFj105QsHEUN/5S4ZyAURi d6mfoNqSZSBiKyWF2VnRWhzZrLy8zX3Wzs4z9UaWb7VZEXQULXSU9+iScImy1bgTL2tf iO3A== X-Gm-Message-State: AOJu0YyVlwPLU4ZuXDE+nRzZUe/9GxNxKY5LigBtQg/VanF+CTsxiB6g 7/w5n8I6SYJfKu3pM+4Dj/6uN+xQLZLUhVRQkKYMTbUEZ+Op7VEh7Db+xEEnM7+TWtxuz9mXGkm hFjz3yjJjMZlOMdbXb446s92g X-Received: by 2002:a17:906:30d5:b0:9ad:c763:c3fd with SMTP id b21-20020a17090630d500b009adc763c3fdmr9300573ejb.28.1695732955240; Tue, 26 Sep 2023 05:55:55 -0700 (PDT) X-Received: by 2002:a17:906:30d5:b0:9ad:c763:c3fd with SMTP id b21-20020a17090630d500b009adc763c3fdmr9300558ejb.28.1695732954899; Tue, 26 Sep 2023 05:55:54 -0700 (PDT) Received: from sgarzare-redhat ([46.6.146.182]) by smtp.gmail.com with ESMTPSA id e8-20020a170906374800b0099cf840527csm7748029ejc.153.2023.09.26.05.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 05:55:54 -0700 (PDT) Date: Tue, 26 Sep 2023 14:55:50 +0200 From: Stefano Garzarella To: Arseniy Krasnov Cc: Stefan Hajnoczi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Michael S. Tsirkin" , Jason Wang , 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: [PATCH net-next v1 02/12] vsock: read from socket's error queue Message-ID: <3oys2ouhlkitsjx7q7utp7wkitnnl4kisl2r54wwa2addd644p@jzyu7ubfrcog> References: <20230922052428.4005676-1-avkrasnov@salutedevices.com> <20230922052428.4005676-3-avkrasnov@salutedevices.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20230922052428.4005676-3-avkrasnov@salutedevices.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 26 Sep 2023 05:56:45 -0700 (PDT) On Fri, Sep 22, 2023 at 08:24:18AM +0300, Arseniy Krasnov wrote: >This adds handling of MSG_ERRQUEUE input flag in receive call. This flag >is used to read socket's error queue instead of data queue. Possible >scenario of error queue usage is receiving completions for transmission >with MSG_ZEROCOPY flag. This patch also adds new defines: 'SOL_VSOCK' >and 'VSOCK_RECVERR'. > >Signed-off-by: Arseniy Krasnov >--- > Changelog: > v5(big patchset) -> v1: > * R-b tag removed, due to added defines to 'include/uapi/linux/vsock.h'. > Both 'SOL_VSOCK' and 'VSOCK_RECVERR' are needed by userspace, so > they were placed to 'include/uapi/linux/vsock.h'. At the same time, > the same define for 'SOL_VSOCK' was placed to 'include/linux/socket.h'. > This is needed because this file contains SOL_XXX defines for different > types of socket, so it prevents situation when another new SOL_XXX > will use constant 287. > > include/linux/socket.h | 1 + > include/uapi/linux/vsock.h | 9 +++++++++ > net/vmw_vsock/af_vsock.c | 6 ++++++ > 3 files changed, 16 insertions(+) > create mode 100644 include/uapi/linux/vsock.h > >diff --git a/include/linux/socket.h b/include/linux/socket.h >index 39b74d83c7c4..cfcb7e2c3813 100644 >--- a/include/linux/socket.h >+++ b/include/linux/socket.h >@@ -383,6 +383,7 @@ struct ucred { > #define SOL_MPTCP 284 > #define SOL_MCTP 285 > #define SOL_SMC 286 >+#define SOL_VSOCK 287 > > /* IPX options */ > #define IPX_TYPE 1 >diff --git a/include/uapi/linux/vsock.h b/include/uapi/linux/vsock.h >new file mode 100644 >index 000000000000..b25c1347a3b8 >--- /dev/null >+++ b/include/uapi/linux/vsock.h We already have include/uapi/linux/vm_sockets.h Should we include these changes there instead of creating a new header? >@@ -0,0 +1,9 @@ >+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ >+#ifndef _UAPI_LINUX_VSOCK_H >+#define _UAPI_LINUX_VSOCK_H >+ >+#define SOL_VSOCK 287 Why we need to re-define this also here? In that case, should we protect with some guards to avoid double defines? >+ >+#define VSOCK_RECVERR 1 >+ >+#endif /* _UAPI_LINUX_VSOCK_H */ >diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c >index d841f4de33b0..4fd11bf34bc7 100644 >--- a/net/vmw_vsock/af_vsock.c >+++ b/net/vmw_vsock/af_vsock.c >@@ -110,6 +110,8 @@ > #include > #include > #include >+#include >+#include > > static int __vsock_bind(struct sock *sk, struct sockaddr_vm *addr); > static void vsock_sk_destruct(struct sock *sk); >@@ -2137,6 +2139,10 @@ vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, > int err; > > sk = sock->sk; >+ >+ if (unlikely(flags & MSG_ERRQUEUE)) >+ return sock_recv_errqueue(sk, msg, len, SOL_VSOCK, VSOCK_RECVERR); >+ > vsk = vsock_sk(sk); > err = 0; > >-- >2.25.1 >