Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp197479pxj; Wed, 9 Jun 2021 21:08:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrqaYc9JpF0N7/bLrDM4TC7veWyftQ5HFDYsYVPkDSa71i8mn/vAgEVys8AYmUzGvpBeTr X-Received: by 2002:a17:906:6c88:: with SMTP id s8mr2654107ejr.129.1623298130723; Wed, 09 Jun 2021 21:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623298130; cv=none; d=google.com; s=arc-20160816; b=pIRaGi0kJ4cntoJeTxLzJsC2uJQbMSqoSAYdDdS0l4hoAg1v7MZWusmeOcsx2KJHHN ce1EHbxl4DvqTsFfi2Ekc0Pk86kxcOQtHcjRqAbAt/xYS8leDLiobi5C9l2pTtQ8GOK4 rmMmeChDzVA0nzLRoc1Q0TwE8Pu2lGEZLkZsP9BCQoOtiJZkeFpEnZHmFz07x9RtOcxy Q6SEVQxpFW8mM27KLtjfy5hlVz8YDbmQO2Iyrxi4IxmNso5t8LJutOy3Ax4enTWWYKzt M8WvT18FxRvenTpFTDmZA1MwUjKASL/DIA6bNG1z4sLMg7cj8JeYX4HXeKniQ398smkZ jAvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=SXvZ6tuoPkEIoxHMDeEeqKamN/QqFwtdpQS3VL200LM=; b=lhGLc4YLLYx5num6M3MAoi8xDwc8QXlnwqjAvO6a7Ljbh29TZmcSf8dzRR9EbTKkgh ZAf+j/YdTCL1f8D8ccp8JnxutchHzBDUVbCKRTBJuE0xMlIAbOyu+j68L8bSvd0dyyS5 vBc58fAUCmzJq327/WbIDXDML5IoOSyfgEBc3tZZlcskkd79nXIxjur/Zh+OPSGriGOT t9FITw/yN07kkXV2QB+bpUnkOKBb4Y7IFxxPzD9yuAIYnDxaSW1+AYRocNZ7dQDlybBK NGwheDj4/+XVdAZgjGXTmXXL8f1E3PLnzvAw/x87nDoUKjXh5SC173mg4e1elzIlIWV5 8Y3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=anlLlpn7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l14si1341726eji.721.2021.06.09.21.08.27; Wed, 09 Jun 2021 21:08:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=anlLlpn7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229874AbhFJEEt (ORCPT + 99 others); Thu, 10 Jun 2021 00:04:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42696 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbhFJEEr (ORCPT ); Thu, 10 Jun 2021 00:04:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623297771; 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=SXvZ6tuoPkEIoxHMDeEeqKamN/QqFwtdpQS3VL200LM=; b=anlLlpn7xbZZyoP5l93owSI0ZdMFSAvPB9zG3OQycsRkmQg7KkFew0MDl02L5qOpnQxM/x UpANjbfZiLW23LECy4DOKaDFE4pdOJCJAb5kYuFvAYpfpws3hmH7IqC9RCbW/fWoQPnfzn f+me0GUjJQgt2ZgVqHWemOMjoWQo4zk= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-297-i4SvnH7MNe-6oHgO9iI4hw-1; Thu, 10 Jun 2021 00:02:50 -0400 X-MC-Unique: i4SvnH7MNe-6oHgO9iI4hw-1 Received: by mail-pf1-f200.google.com with SMTP id s5-20020aa78d450000b02902ace63a7e93so471455pfe.8 for ; Wed, 09 Jun 2021 21:02:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=SXvZ6tuoPkEIoxHMDeEeqKamN/QqFwtdpQS3VL200LM=; b=SEXdQPmLIUpu6ngEx3Q77fDPnCo0uGZpooM56k/GSVspmGQ21/gSRS6CfvaHeequwG vey8knfu5DNtRBnewRRN5gHOuEh0ty/ocicq4rngjBx9f2UsaCvuidXB0h04/WwoLMlF Ftc/9SoJnBbw+6myZK4Y7EbUSGSCRXeunNFDvSL69+0NdU2I+nPJQy1OHrHmqm2R3tNL sxFRN0EJawSy1sDo1eXm0LUYoFkRUjt0sB0jr04PVG/Q3JSWLWFXDEJLNTmdlscyisoz QdFwNxVWeqv+HvPtraOose7JglucmOuj3sMSK0sZUbtQXCv8ELqBEa7v1Fh29KMpj73N QIYQ== X-Gm-Message-State: AOAM5318p5PWJlkIh6sEaWRmLWcsN6YIf2gCOEJBSmKhpa1/UiL1di+q NX3hp0Gq0ooYHkTmHNpDGCEMGfq4KUbR5YibMQNvTzxLWV/cVQkslNN9zEH9QXl1KeTeeNWVr2Q 9ehSwSqkh1RWP0g3HFyzKDvnBAXcP9aOT9rGSjYaFEIGuD9myxfq2136wVAWBOs2nO9l5yTTdzk eT X-Received: by 2002:a62:30c2:0:b029:289:116c:ec81 with SMTP id w185-20020a6230c20000b0290289116cec81mr1068678pfw.42.1623297768812; Wed, 09 Jun 2021 21:02:48 -0700 (PDT) X-Received: by 2002:a62:30c2:0:b029:289:116c:ec81 with SMTP id w185-20020a6230c20000b0290289116cec81mr1068621pfw.42.1623297768474; Wed, 09 Jun 2021 21:02:48 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id j7sm6490106pjf.0.2021.06.09.21.02.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Jun 2021 21:02:48 -0700 (PDT) Subject: Re: [RFC v1 0/6] virtio/vsock: introduce SOCK_DGRAM support To: "Jiang Wang ." Cc: Stefano Garzarella , virtualization@lists.linux-foundation.org, Stefan Hajnoczi , "Michael S. Tsirkin" , Arseny Krasnov , jhansen@vmware.comments, cong.wang@bytedance.com, Xiongchun Duan , Yongji Xie , =?UTF-8?B?5p+056iz?= , "David S. Miller" , Jakub Kicinski , Steven Rostedt , Ingo Molnar , Colin Ian King , Jorgen Hansen , Andra Paraschiv , Norbert Slusarek , Lu Wei , Alexander Popov , kvm@vger.kernel.org, Networking , linux-kernel@vger.kernel.org References: <20210609232501.171257-1-jiang.wang@bytedance.com> From: Jason Wang Message-ID: Date: Thu, 10 Jun 2021 12:02:35 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/6/10 上午11:43, Jiang Wang . 写道: > On Wed, Jun 9, 2021 at 6:51 PM Jason Wang wrote: >> >> 在 2021/6/10 上午7:24, Jiang Wang 写道: >>> This patchset implements support of SOCK_DGRAM for virtio >>> transport. >>> >>> Datagram sockets are connectionless and unreliable. To avoid unfair contention >>> with stream and other sockets, add two more virtqueues and >>> a new feature bit to indicate if those two new queues exist or not. >>> >>> Dgram does not use the existing credit update mechanism for >>> stream sockets. When sending from the guest/driver, sending packets >>> synchronously, so the sender will get an error when the virtqueue is full. >>> When sending from the host/device, send packets asynchronously >>> because the descriptor memory belongs to the corresponding QEMU >>> process. >> >> What's the use case for the datagram vsock? >> > One use case is for non critical info logging from the guest > to the host, such as the performance data of some applications. Anything that prevents you from using the stream socket? > > It can also be used to replace UDP communications between > the guest and the host. Any advantage for VSOCK in this case? Is it for performance (I guess not since I don't exepct vsock will be faster). An obvious drawback is that it breaks the migration. Using UDP you can have a very rich features support from the kernel where vsock can't. > >>> The virtio spec patch is here: >>> https://www.spinics.net/lists/linux-virtualization/msg50027.html >> >> Have a quick glance, I suggest to split mergeable rx buffer into an >> separate patch. > Sure. > >> But I think it's time to revisit the idea of unifying the virtio-net and >> virtio-vsock. Otherwise we're duplicating features and bugs. > For mergeable rxbuf related code, I think a set of common helper > functions can be used by both virtio-net and virtio-vsock. For other > parts, that may not be very beneficial. I will think about more. > > If there is a previous email discussion about this topic, could you send me > some links? I did a quick web search but did not find any related > info. Thanks. We had a lot: [1] https://patchwork.kernel.org/project/kvm/patch/5BDFF537.3050806@huawei.com/ [2] https://lists.linuxfoundation.org/pipermail/virtualization/2018-November/039798.html [3] https://www.lkml.org/lkml/2020/1/16/2043 Thanks > >> Thanks >> >> >>> For those who prefer git repo, here is the link for the linux kernel: >>> https://github.com/Jiang1155/linux/tree/vsock-dgram-v1 >>> >>> qemu patch link: >>> https://github.com/Jiang1155/qemu/tree/vsock-dgram-v1 >>> >>> >>> To do: >>> 1. use skb when receiving packets >>> 2. support multiple transport >>> 3. support mergeable rx buffer >>> >>> >>> Jiang Wang (6): >>> virtio/vsock: add VIRTIO_VSOCK_F_DGRAM feature bit >>> virtio/vsock: add support for virtio datagram >>> vhost/vsock: add support for vhost dgram. >>> vsock_test: add tests for vsock dgram >>> vhost/vsock: add kconfig for vhost dgram support >>> virtio/vsock: add sysfs for rx buf len for dgram >>> >>> drivers/vhost/Kconfig | 8 + >>> drivers/vhost/vsock.c | 207 ++++++++-- >>> include/linux/virtio_vsock.h | 9 + >>> include/net/af_vsock.h | 1 + >>> .../trace/events/vsock_virtio_transport_common.h | 5 +- >>> include/uapi/linux/virtio_vsock.h | 4 + >>> net/vmw_vsock/af_vsock.c | 12 + >>> net/vmw_vsock/virtio_transport.c | 433 ++++++++++++++++++--- >>> net/vmw_vsock/virtio_transport_common.c | 184 ++++++++- >>> tools/testing/vsock/util.c | 105 +++++ >>> tools/testing/vsock/util.h | 4 + >>> tools/testing/vsock/vsock_test.c | 195 ++++++++++ >>> 12 files changed, 1070 insertions(+), 97 deletions(-) >>>