Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3073300rwo; Thu, 3 Aug 2023 21:44:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFi5ydn5L+L0SHqg9QdrVC16AL+xFwq29l1qE2VmHLI0JlSB/w7PxGSzMICSPXFcONEDwRK X-Received: by 2002:a05:6358:e4a7:b0:139:d5f0:c027 with SMTP id by39-20020a056358e4a700b00139d5f0c027mr828898rwb.30.1691124265801; Thu, 03 Aug 2023 21:44:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691124265; cv=none; d=google.com; s=arc-20160816; b=gFFH+qQ1awxkv41BY3CCzNwvOtf8/tHTDv/+KplUEbFkwmdMR2fSok79bfL6QldTnE +/0zTDbcQ9N2oFBKakA7gFJ32Qh/3rr8ZWdsPlhehkYYppKzRDHUGKjLOjFQlJs5Y7gF brbsehiGCJr77dAkrPNoC2pRnFAaPk9U5bh+yHgplt06GTKgC6sBFkfFT0AyEX0Z5ZR+ mmBRv/gV4KkW5g9J2Z5oNg4QH+FH3vY2w3mPB1CZfhdCHRId01Y4ewpQffVfoTfmpn3R 1iYyMpUXDz8wWJmEXT+Z5r24pyupphgDGVtp01+A4E7B29til6/lqCvq3uvbCAWEK3Fp Ee5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=aDFuCPil4pEoLXHYo0Ls7o77K/H32wrnIMBAQN1MPHk=; fh=SBJBgBlppiMg2doejj7+2VMiQ7BjjRLIz8wkKnLkM1o=; b=D50CEvvSwwxVCu9rNZZmn6DEecAhtetKjhjwdh9Mpr1d5RziMsvcOWX9iCCz5h40g7 af5Bi6S6wTaM95FebxFDEAkhHpSm3h09Hyg170k8w5DfopoK95Av/sStgfJTY7DX6Jz3 pNtLreopnjfdNluhwUr7UZeVqB3EJJzERk5E3fdv11w0f6X21PREH61JfjCSLjwQ3U77 +B3reP3a3nPhK6HeB2ZmCdNY9FYzDzjD/9HE6US/5xYh9C957UW0hT2BzIhNBLxih/78 m2hhC+mnV7AQn2WxmKvnXrTaibfWzuL47s0BHs3SNawWltW2jB0mC7ioTrh9BerjP7Od T0gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=hlmtKbG2; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l123-20020a633e81000000b0056424625524si1150721pga.219.2023.08.03.21.44.13; Thu, 03 Aug 2023 21:44:25 -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=@bytedance.com header.s=google header.b=hlmtKbG2; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232238AbjHDEQt (ORCPT + 99 others); Fri, 4 Aug 2023 00:16:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230157AbjHDEQp (ORCPT ); Fri, 4 Aug 2023 00:16:45 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 547AA3595 for ; Thu, 3 Aug 2023 21:16:18 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2b9cbaee7a9so26646921fa.0 for ; Thu, 03 Aug 2023 21:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1691122576; x=1691727376; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=aDFuCPil4pEoLXHYo0Ls7o77K/H32wrnIMBAQN1MPHk=; b=hlmtKbG2KrbEEPRHkFHomIqd3it6JQzSyCXO8KEnc7gH627jiD/g1QCZY2teTeo2tN gNcFOuNVfd/1LTIoyAZqGEXs9cLWYiJVOKfumFUC4g/ZSl/JAylvGdy3RK7t7fDO6gnE ylkutQ7MeB5QQDH+l8yYEHBNssCTEYh1nZ+F5IjhYsNBirqO4sgKkYJRjpd6fPZF0+4s vd4ErP5Y2wCVSfZgXxM6xmRLfVTnVjS0By9Ae+rsexsgIaXU0Xxcgcv2CBrSGjsred+F VH93jsHGvJgRoFwaHepHrMXJhMLBDdmlcOpr5WhHyNf7N/QEP3Ey1lOagS95r3l536mM Ha+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691122576; x=1691727376; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aDFuCPil4pEoLXHYo0Ls7o77K/H32wrnIMBAQN1MPHk=; b=VS90GbhVUPMGbGHd9+6rE03Kpm6wNwBFLw2Fp6AMMRGmfNmS0dwaP4maaV33gb5gHU 40tFbuPu1Ae/mQvxYd3HANrbuhNnppNbgzzgFUUq1xSONPOAayidis5bPwdCQ5bAtVtx lBSQiKVtR8MSQC61tyhOvVMHvQ2xE1tFz74aTDPxzD/KesoRrLyr6SctuS3raHKG+Vzr 3GSpKNk2pNOAF+WOG+y55IuAZt+e4o2++ChWfbN97WLpPees8S7hRAqD6o8HHpYR6GW1 tiEasA6ARs7eTRD/8/8eE2U9aiLDWHK1C4ZDZ6OfKoZU717PnlQLqbeCTvQToaDs96/i 6GIQ== X-Gm-Message-State: AOJu0YxqCQATymoMixiMX//ft8H/HQjse1itAGpqVvnyRrfukxd5ZjX3 8HQfjVjeLjQwIlWgHhQ7+qsryAPtlhkPMl/H8expwA== X-Received: by 2002:a2e:97d7:0:b0:2b9:f3b4:6808 with SMTP id m23-20020a2e97d7000000b002b9f3b46808mr554724ljj.29.1691122576570; Thu, 03 Aug 2023 21:16:16 -0700 (PDT) MIME-Version: 1.0 References: <20230803140441.53596-1-huangjie.albert@bytedance.com> In-Reply-To: From: =?UTF-8?B?6buE5p2w?= Date: Fri, 4 Aug 2023 12:16:05 +0800 Message-ID: Subject: Re: [External] Re: [RFC Optimizing veth xsk performance 00/10] To: Paolo Abeni Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Pavel Begunkov , Yunsheng Lin , Kees Cook , Richard Gobert , "open list:NETWORKING DRIVERS" , open list , "open list:XDP (eXpress Data Path)" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Paolo Abeni =E4=BA=8E2023=E5=B9=B48=E6=9C=883=E6=97=A5= =E5=91=A8=E5=9B=9B 22:20=E5=86=99=E9=81=93=EF=BC=9A > > On Thu, 2023-08-03 at 22:04 +0800, huangjie.albert wrote: > > AF_XDP is a kernel bypass technology that can greatly improve performan= ce. > > However, for virtual devices like veth, even with the use of AF_XDP soc= kets, > > there are still many additional software paths that consume CPU resourc= es. > > This patch series focuses on optimizing the performance of AF_XDP socke= ts > > for veth virtual devices. Patches 1 to 4 mainly involve preparatory wor= k. > > Patch 5 introduces tx queue and tx napi for packet transmission, while > > patch 9 primarily implements zero-copy, and patch 10 adds support for > > batch sending of IPv4 UDP packets. These optimizations significantly re= duce > > the software path and support checksum offload. > > > > I tested those feature with > > A typical topology is shown below: > > veth<-->veth-peer veth1-peer<--->vet= h1 > > 1 | | 7 > > |2 6| > > | | > > bridge<------->eth0(mlnx5)- switch -eth1(mlnx5)<--->bridge1 > > 3 4 5 > > (machine1) (machine2) > > AF_XDP socket is attach to veth and veth1. and send packets to physical= NIC(eth0) > > veth:(172.17.0.2/24) > > bridge:(172.17.0.1/24) > > eth0:(192.168.156.66/24) > > > > eth1(172.17.0.2/24) > > bridge1:(172.17.0.1/24) > > eth0:(192.168.156.88/24) > > > > after set default route . snat . dnat. we can have a tests > > to get the performance results. > > > > packets send from veth to veth1: > > af_xdp test tool: > > link:https://github.com/cclinuxer/libxudp > > send:(veth) > > ./objs/xudpperf send --dst 192.168.156.88:6002 -l 1300 > > recv:(veth1) > > ./objs/xudpperf recv --src 172.17.0.2:6002 > > > > udp test tool:iperf3 > > send:(veth) > > iperf3 -c 192.168.156.88 -p 6002 -l 1300 -b 60G -u > > Should be: '-b 0' otherwise you will experience additional overhead. > with -b 0: performance: performance:(test weth libxdp lib) UDP : 320 Kpps (with 100% cpu) AF_XDP no zerocopy + no batch : 480 Kpps (with ksoftirqd 100% cpu) AF_XDP with zerocopy + no batch : 540 Kpps (with ksoftirqd 100% cpu) AF_XDP with batch + zerocopy : 1.5 Mpps (with ksoftirqd 15% cpu) thanks. > And you would likely pin processes and irqs to ensure BH and US run on > different cores of the same numa node. > > Cheers, > > Paolo >