Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4337049rwl; Wed, 28 Dec 2022 02:39:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXsamLwoufciuyrNFPHy37CyLO9hONAchBh6WPhYMEBW/BfNULhkGYhjbsTl5m87waWYmOV9 X-Received: by 2002:a05:6a20:2d2a:b0:af:ea1d:ab23 with SMTP id g42-20020a056a202d2a00b000afea1dab23mr50807037pzl.55.1672223989988; Wed, 28 Dec 2022 02:39:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672223989; cv=none; d=google.com; s=arc-20160816; b=VFrc2ceY2nyls+esIYPb/Zvkeg0Y+JRULrEcZRKSTJmDAhG+g3zZV3YA6abIlK7r4n gwIO+ckUEenwyQ7hX8CBJz+cowBeVYqGOtsff8csF8OG8UfszCLAtwcs6xU3unk/3BcG 7qgp1Ec5UwXGmE7rAc0xOf/G3aE3yuibGajn/mew8+KwXTLWfJoswVnXaR1xgROUm3Gd qZYVKPUiKoG7y/Wt/3kfdNDSinfTnrfkunYEjYkwTAzM31Mi3LzxFwU2UErkUbYzURX0 H4YzCfJgRYmvajJm4c+TUnI8NSd7rHVY9s9edGdDbOjg7x1ibu5AEW3c5Rd7FlqYmdVp AhAw== 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:references :cc:to:from:subject:user-agent:mime-version:date:message-id; bh=5CpA8D0OFMh7y4206177vOT4ER6Co5gYW7Rc7Dvanes=; b=DZyl8G+kxkQ4zUPRy5rb7qLH1PJXkoyRLvIKGaRltC2EwuaNHVTxJ7cNIRSR8uMuF6 /2drAAs248Ebq8guRpo+FLaGo7VZq5Y+Bi3ojxPZXW8mFfIIj9Nqt/8nKBmG/LWUXmoe 0cDBr5oa/TpLqcylesBrAOvFAicbblzMzYteYpVfV/Y5JouDiXKKxfhIb+5jBkKg7aTy GVgT1myJrs/aVkyCEbW5hLPd7iXM1LqVFa3hYRjNprkigx0PUrvSCESLtypDuob0ZBuH AmcT86dTv7Syzug9FdlqqVqh3sNWfTxtG4OoQ5IltvBNeZQ1QlaSI9wP74t8nW8/EknV oXgg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c1-20020a170902d48100b0016f1eb1317esi17313548plg.471.2022.12.28.02.39.41; Wed, 28 Dec 2022 02:39:49 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232176AbiL1K0T (ORCPT + 64 others); Wed, 28 Dec 2022 05:26:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbiL1K0S (ORCPT ); Wed, 28 Dec 2022 05:26:18 -0500 Received: from out30-1.freemail.mail.aliyun.com (out30-1.freemail.mail.aliyun.com [115.124.30.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33EA4B4C; Wed, 28 Dec 2022 02:26:15 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0VYHHvkd_1672223171; Received: from 30.221.128.170(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0VYHHvkd_1672223171) by smtp.aliyun-inc.com; Wed, 28 Dec 2022 18:26:12 +0800 Message-ID: <732a4b17-f774-aad9-1803-16cc8c7b43c7@linux.alibaba.com> Date: Wed, 28 Dec 2022 18:26:09 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [RFC PATCH net-next v2 0/5] net/smc:Introduce SMC-D based loopback acceleration From: Wen Gu To: kgraul@linux.ibm.com, wenjia@linux.ibm.com, jaka@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <1671506505-104676-1-git-send-email-guwen@linux.alibaba.com> In-Reply-To: <1671506505-104676-1-git-send-email-guwen@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,NUMERIC_HTTP_ADDR,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 On 2022/12/20 11:21, Wen Gu wrote: > Hi, all > > # Background > > As previously mentioned in [1], we (Alibaba Cloud) are trying to use SMC > to accelerate TCP applications in cloud environment, improving inter-host > or inter-VM communication. > > In addition of these, we also found the value of SMC-D in scenario of local > inter-process communication, such as accelerate communication between containers > within the same host. So this RFC tries to provide a SMC-D loopback solution > in such scenario, to bring a significant improvement in latency and throughput > compared to TCP loopback. > > # Design > > This patch set provides a kind of SMC-D loopback solution. > > Patch #1/5 and #2/5 provide an SMC-D based dummy device, preparing for the > inter-process communication acceleration. Except for loopback acceleration, > the dummy device can also meet the requirements mentioned in [2], which is > providing a way to test SMC-D logic for broad community without ISM device. > > +------------------------------------------+ > | +-----------+ +-----------+ | > | | process A | | process B | | > | +-----------+ +-----------+ | > | ^ ^ | > | | +---------------+ | | > | | | SMC stack | | | > | +--->| +-----------+ |<--| | > | | | dummy | | | > | | | device | | | > | +-+-----------+-+ | > | VM | > +------------------------------------------+ > > Patch #3/5, #4/5, #5/5 provides a way to avoid data copy from sndbuf to RMB > and improve SMC-D loopback performance. Through extending smcd_ops with two > new semantic: attach_dmb and detach_dmb, sender's sndbuf shares the same > physical memory region with receiver's RMB. The data copied from userspace > to sender's sndbuf directly reaches the receiver's RMB without unnecessary > memory copy in the same kernel. > > +----------+ +----------+ > | socket A | | socket B | > +----------+ +----------+ > | ^ > | +---------+ | > regard as | | ----------| > local sndbuf | B's | regard as > | | RMB | local RMB > |-------> | | > +---------+ > > # Benchmark Test > > * Test environments: > - VM with Intel Xeon Platinum 8 core 2.50GHz, 16 GiB mem. > - SMC sndbuf/RMB size 1MB. > > * Test object: > - TCP: run on TCP loopback. > - domain: run on UNIX domain. > - SMC lo: run on SMC loopback device with patch #1/5 ~ #2/5. > - SMC lo-nocpy: run on SMC loopback device with patch #1/5 ~ #5/5. > > 1. ipc-benchmark (see [3]) > > - ./ -c 1000000 -s 100 > > TCP domain SMC-lo SMC-lo-nocpy > Message > rate (msg/s) 75140 129548(+72.41) 152266(+102.64%) 151914(+102.17%) > > 2. sockperf > > - serv: taskset -c sockperf sr --tcp > - clnt: taskset -c sockperf { tp | pp } --tcp --msg-size={ 64000 for tp | 14 for pp } -i 127.0.0.1 -t 30 > > TCP SMC-lo SMC-lo-nocpy > Bandwidth(MBps) 4943.359 4936.096(-0.15%) 8239.624(+66.68%) > Latency(us) 6.372 3.359(-47.28%) 3.25(-49.00%) > > 3. iperf3 > > - serv: taskset -c iperf3 -s > - clnt: taskset -c iperf3 -c 127.0.0.1 -t 15 > > TCP SMC-lo SMC-lo-nocpy > Bitrate(Gb/s) 40.5 41.4(+2.22%) 76.4(+88.64%) > > 4. nginx/wrk > > - serv: nginx > - clnt: wrk -t 8 -c 500 -d 30 http://127.0.0.1:80 > > TCP SMC-lo SMC-lo-nocpy > Requests/s 154643.22 220894.03(+42.84%) 226754.3(+46.63%) > > > # Discussion > > 1. API between SMC-D and ISM device > > As Jan mentioned in [2], IBM are working on placing an API between SMC-D > and the ISM device for easier use of different "devices" for SMC-D. > > So, considering that the introduction of attach_dmb or detach_dmb can > effectively avoid data copying from sndbuf to RMB and brings obvious > throughput advantages in inter-VM or inter-process scenarios, can the > attach/detach semantics be taken into consideration when designing the > API to make it a standard ISM device behavior? > > Maybe our RFC of SMC-D based inter-process acceleration (this one) and > inter-VM acceleration (will coming soon, which is the update of [1]) The patch of SMC-D + virtio-ism device is now discussed in virtio community: https://lists.oasis-open.org/archives/virtio-comment/202212/msg00030.html > can provide some examples for new API design. And we are very glad to > discuss this on the mail list. > > 2. Way to select different ISM-like devices > > With the proposal of SMC-D loopback 'device' (this RFC) and incoming > device used for inter-VM acceleration as update of [1], SMC-D has more > options to choose from. So we need to consider that how to indicate > supported devices, how to determine which one to use, and their priority... > > IMHO, this may require an update of CLC message and negotiation mechanism. > Again, we are very glad to discuss this with you on the mailing list. > > [1] https://lore.kernel.org/netdev/20220720170048.20806-1-tonylu@linux.alibaba.com/ > [2] https://lore.kernel.org/netdev/35d14144-28f7-6129-d6d3-ba16dae7a646@linux.ibm.com/ > [3] https://github.com/goldsborough/ipc-bench > > v1->v2 > 1. Fix some build WARNINGs complained by kernel test rebot > Reported-by: kernel test robot > 2. Add iperf3 test data. > > Wen Gu (5): > net/smc: introduce SMC-D loopback device > net/smc: choose loopback device in SMC-D communication > net/smc: add dmb attach and detach interface > net/smc: avoid data copy from sndbuf to peer RMB in SMC-D loopback > net/smc: logic of cursors update in SMC-D loopback connections > > include/net/smc.h | 3 + > net/smc/Makefile | 2 +- > net/smc/af_smc.c | 88 +++++++++++- > net/smc/smc_cdc.c | 59 ++++++-- > net/smc/smc_cdc.h | 1 + > net/smc/smc_clc.c | 4 +- > net/smc/smc_core.c | 62 +++++++++ > net/smc/smc_core.h | 2 + > net/smc/smc_ism.c | 39 +++++- > net/smc/smc_ism.h | 2 + > net/smc/smc_loopback.c | 358 +++++++++++++++++++++++++++++++++++++++++++++++++ > net/smc/smc_loopback.h | 63 +++++++++ > 12 files changed, 662 insertions(+), 21 deletions(-) > create mode 100644 net/smc/smc_loopback.c > create mode 100644 net/smc/smc_loopback.h >