Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp877995rwo; Sat, 22 Jul 2023 01:55:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlGnDkJZMcgOJu8DMC7BQfA7ke2rZWcgApOASvhxjCmvcYJeCG/aIVZLCeBOe/6WQSNXr0A9 X-Received: by 2002:a17:907:778b:b0:99b:4a2b:2ea3 with SMTP id ky11-20020a170907778b00b0099b4a2b2ea3mr3843097ejc.17.1690016139498; Sat, 22 Jul 2023 01:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690016139; cv=none; d=google.com; s=arc-20160816; b=rRfzGMGG3YrMfjBixW7Arwxn8yjjKOc9Hhm7b9eLfPFpo7A4xaNX6C1Yz131EdEnWp 3i6pvtHifTUgUSCSK68/HOs4P0bEKmhde5WuHDK+YVNeO/kToG2lg0J5OrieYMnePA2T 1S4rgKL3DZy0r460H73BvU+JxDfkrBR4uTEh8nybULY8jehbZu3+a6HznGiFXiWo7E9b v9pOEn6Taaxucuz4D5d81jUfAArGm64TUSn+zeyWnF991iUi+tRgdEYPgGvp9xCMtJvo ntsik7EQOFzHCHO3AsqNfDDO477+C1ivgFbHKALoDqvikWbiXyzqju1Bwk8Gh2dHjvHk mi4Q== 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=QyYUMX0Di+DYHpFJu8zvRU6It7/9y7UIhzZCenvkn0o=; fh=gicCo0dQiQFaNz62sfde6n/X9p96axbF7Nv+z8HweFM=; b=XCXa15MGREz9dWJVT68yim4t0V7bbL05Pp/vWNj3cS/6XaofIQffE0o6f/AKUck4Zn rNzIkG+HE/kZRvDkPaEbaKG9ISY4R3BUWBcwhjTsl+24icEndYwhu2Zth5eMyv1osyno s6Ey2ZtC9n+OkrH7T32SqHPNX1c4Kn68E6Pcz7WZXjNwvtNMHqcXcvW6NWlX4qJjLpoV STvwPMZVukcUoeVx6Dmi+UoN2Faa7I/DKdl3EAM1ZPg5uRt7i2CMvvtsFkPFZox2MIBl tfColvS7dIuFy/9xx9EzjP3wSYxkl5rPga+SmSC7MLtZxwg0gH5L6EbOcQdZHNWZVPV2 YFGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=PyACiV3F; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ko20-20020a170907987400b009930e13a56fsi3144755ejc.346.2023.07.22.01.55.16; Sat, 22 Jul 2023 01:55:39 -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=@gmail.com header.s=20221208 header.b=PyACiV3F; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229882AbjGVIvm (ORCPT + 99 others); Sat, 22 Jul 2023 04:51:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbjGVIvl (ORCPT ); Sat, 22 Jul 2023 04:51:41 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C803226A5; Sat, 22 Jul 2023 01:51:38 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4fa16c6a85cso4220146e87.3; Sat, 22 Jul 2023 01:51:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690015897; x=1690620697; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=QyYUMX0Di+DYHpFJu8zvRU6It7/9y7UIhzZCenvkn0o=; b=PyACiV3FFTcr3SXC45LvL0AMrRejdovuWeJyIdUJq4Ntmpjp5tyxrQlkvsrPxcazyo 9XJWOsLfbjH5ZX8+hwn/L5XiGN7zdXwVOsTG4muw56tiw2n0siY7doXTRL+yPUHhQhe8 4/riAhBHiwge2ju/lh5Opp72mIilzAnseQHtSJcd2UeHXQxQhaEq4pEaRBBa90S3yQF7 ajoveOW6QI03LDikm+Kum1HSOdRC9yoFmI3mpOnB1ljOc9h836t8jQmwOeV5D0xEdxmo Y46dxWa+QQ/3q/f6UswTlfGFy2qm4Vq/b57NXPCvqheu6SkWd0FcmMCxm8MK0pz8Mo1p mdUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690015897; x=1690620697; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QyYUMX0Di+DYHpFJu8zvRU6It7/9y7UIhzZCenvkn0o=; b=eVxWpbWoPtNWocQsDms61MQvz5TVHiR59cS7IUbq5wZm2M6Xm/YHl+c6VEpc5kkOf5 k23sFZdYapJ0jqicf5cYh+8ceJmx0UEPVQYtX9H5NBKUzBTCVlukRpKCFHORj+JTgz88 KAdZkP2kRR2QHZ8wjhaCsEGK3dmiTg51XbxRmcySrfuFp6y6Nf+M82RMZlgIoaPpIR+h tG0Y/jhzsW84fs/ufqvm1/cb9MnKcsspiGU/2ds/sGmlScaBzd3rQgAjCRBa7bqwh6ch VCvZ6gePK+U1MMNN/jWb99WfCqSt9chVDuu8XzkFphwlU63nmiKIRb8eDba49l4W4bv5 546A== X-Gm-Message-State: ABy/qLar3l+fzfyaOXSTveBdw/LV7guVHHAIx9+M3TmrIFrbKxCCE5Ec rgjOthHVzqScqU8PVgZ2u08= X-Received: by 2002:a05:6512:e9a:b0:4f6:1433:fca0 with SMTP id bi26-20020a0565120e9a00b004f61433fca0mr3008113lfb.0.1690015896866; Sat, 22 Jul 2023 01:51:36 -0700 (PDT) Received: from ?IPV6:2a00:1e88:c228:ec00:1b41:4959:c1a0:b9eb? ([2a00:1e88:c228:ec00:1b41:4959:c1a0:b9eb]) by smtp.gmail.com with ESMTPSA id v15-20020a056512048f00b004fbbf9e58bbsm1123695lfq.126.2023.07.22.01.51.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 22 Jul 2023 01:51:36 -0700 (PDT) Message-ID: <713f3fe4-2249-2d13-c25f-5a6f673201da@gmail.com> Date: Sat, 22 Jul 2023 11:51:34 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH RFC net-next v5 00/14] virtio/vsock: support datagrams Content-Language: en-US To: Bobby Eshleman , Stefan Hajnoczi , Stefano Garzarella , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Bryan Tan , Vishnu Dasa , VMware PV-Drivers Reviewers Cc: Dan Carpenter , Simon Horman , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, bpf@vger.kernel.org, Jiang Wang References: <20230413-b4-vsock-dgram-v5-0-581bd37fdb26@bytedance.com> From: Arseniy Krasnov In-Reply-To: <20230413-b4-vsock-dgram-v5-0-581bd37fdb26@bytedance.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hello Bobby! Thanks for this patchset! I left some comments and continue review and tests in the next few days Thanks, Arseniy On 19.07.2023 03:50, Bobby Eshleman wrote: > Hey all! > > This series introduces support for datagrams to virtio/vsock. > > It is a spin-off (and smaller version) of this series from the summer: > https://lore.kernel.org/all/cover.1660362668.git.bobby.eshleman@bytedance.com/ > > Please note that this is an RFC and should not be merged until > associated changes are made to the virtio specification, which will > follow after discussion from this series. > > Another aside, the v4 of the series has only been mildly tested with a > run of tools/testing/vsock/vsock_test. Some code likely needs cleaning > up, but I'm hoping to get some of the design choices agreed upon before > spending too much time making it pretty. > > This series first supports datagrams in a basic form for virtio, and > then optimizes the sendpath for all datagram transports. > > The result is a very fast datagram communication protocol that > outperforms even UDP on multi-queue virtio-net w/ vhost on a variety > of multi-threaded workload samples. > > For those that are curious, some summary data comparing UDP and VSOCK > DGRAM (N=5): > > vCPUS: 16 > virtio-net queues: 16 > payload size: 4KB > Setup: bare metal + vm (non-nested) > > UDP: 287.59 MB/s > VSOCK DGRAM: 509.2 MB/s > > Some notes about the implementation... > > This datagram implementation forces datagrams to self-throttle according > to the threshold set by sk_sndbuf. It behaves similar to the credits > used by streams in its effect on throughput and memory consumption, but > it is not influenced by the receiving socket as credits are. > > The device drops packets silently. > > As discussed previously, this series introduces datagrams and defers > fairness to future work. See discussion in v2 for more context around > datagrams, fairness, and this implementation. > > Signed-off-by: Bobby Eshleman > --- > Changes in v5: > - teach vhost to drop dgram when a datagram exceeds the receive buffer > - now uses MSG_ERRQUEUE and depends on Arseniy's zerocopy patch: > "vsock: read from socket's error queue" > - replace multiple ->dgram_* callbacks with single ->dgram_addr_init() > callback > - refactor virtio dgram skb allocator to reduce conflicts w/ zerocopy series > - add _fallback/_FALLBACK suffix to dgram transport variables/macros > - add WARN_ONCE() for table_size / VSOCK_HASH issue > - add static to vsock_find_bound_socket_common > - dedupe code in vsock_dgram_sendmsg() using module_got var > - drop concurrent sendmsg() for dgram and defer to future series > - Add more tests > - test EHOSTUNREACH in errqueue > - test stream + dgram address collision > - improve clarity of dgram msg bounds test code > - Link to v4: https://lore.kernel.org/r/20230413-b4-vsock-dgram-v4-0-0cebbb2ae899@bytedance.com > > Changes in v4: > - style changes > - vsock: use sk_vsock(vsk) in vsock_dgram_recvmsg instead of > &sk->vsk > - vsock: fix xmas tree declaration > - vsock: fix spacing issues > - virtio/vsock: virtio_transport_recv_dgram returns void because err > unused > - sparse analysis warnings/errors > - virtio/vsock: fix unitialized skerr on destroy > - virtio/vsock: fix uninitialized err var on goto out > - vsock: fix declarations that need static > - vsock: fix __rcu annotation order > - bugs > - vsock: fix null ptr in remote_info code > - vsock/dgram: make transport_dgram a fallback instead of first > priority > - vsock: remove redundant rcu read lock acquire in getname() > - tests > - add more tests (message bounds and more) > - add vsock_dgram_bind() helper > - add vsock_dgram_connect() helper > > Changes in v3: > - Support multi-transport dgram, changing logic in connect/bind > to support VMCI case > - Support per-pkt transport lookup for sendto() case > - Fix dgram_allow() implementation > - Fix dgram feature bit number (now it is 3) > - Fix binding so dgram and connectible (cid,port) spaces are > non-overlapping > - RCU protect transport ptr so connect() calls never leave > a lockless read of the transport and remote_addr are always > in sync > - Link to v2: https://lore.kernel.org/r/20230413-b4-vsock-dgram-v2-0-079cc7cee62e@bytedance.com > > --- > Bobby Eshleman (13): > af_vsock: generalize vsock_dgram_recvmsg() to all transports > af_vsock: refactor transport lookup code > af_vsock: support multi-transport datagrams > af_vsock: generalize bind table functions > af_vsock: use a separate dgram bind table > virtio/vsock: add VIRTIO_VSOCK_TYPE_DGRAM > virtio/vsock: add common datagram send path > af_vsock: add vsock_find_bound_dgram_socket() > virtio/vsock: add common datagram recv path > virtio/vsock: add VIRTIO_VSOCK_F_DGRAM feature bit > vhost/vsock: implement datagram support > vsock/loopback: implement datagram support > virtio/vsock: implement datagram support > > Jiang Wang (1): > test/vsock: add vsock dgram tests > > drivers/vhost/vsock.c | 64 ++- > include/linux/virtio_vsock.h | 10 +- > include/net/af_vsock.h | 14 +- > include/uapi/linux/virtio_vsock.h | 2 + > net/vmw_vsock/af_vsock.c | 281 ++++++++++--- > net/vmw_vsock/hyperv_transport.c | 13 - > net/vmw_vsock/virtio_transport.c | 26 +- > net/vmw_vsock/virtio_transport_common.c | 190 +++++++-- > net/vmw_vsock/vmci_transport.c | 60 +-- > net/vmw_vsock/vsock_loopback.c | 10 +- > tools/testing/vsock/util.c | 141 ++++++- > tools/testing/vsock/util.h | 6 + > tools/testing/vsock/vsock_test.c | 680 ++++++++++++++++++++++++++++++++ > 13 files changed, 1320 insertions(+), 177 deletions(-) > --- > base-commit: 37cadc266ebdc7e3531111c2b3304fa01b2131e8 > change-id: 20230413-b4-vsock-dgram-3b6eba6a64e5 > > Best regards,