Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp167652lqp; Wed, 22 May 2024 00:10:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV+oHHCTsOncKoxuyvIuosuXgJ8y1mMnR/XQsLrVdH5eqkvVGa/pcm0kcXsajdXNt2noOpWmKMYlsIiyo7+PkE4W/mjOQYluwuZx+URkA== X-Google-Smtp-Source: AGHT+IHe7/Q8projRM3zCaAwUxIEX9zNor1NZoFR6nh3GKpH+bGbeEfnkwiHeg5tgz5xm9Ad6cjI X-Received: by 2002:a50:9508:0:b0:572:9c4c:2503 with SMTP id 4fb4d7f45d1cf-57832c7e74emr525839a12.38.1716361809249; Wed, 22 May 2024 00:10:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716361809; cv=pass; d=google.com; s=arc-20160816; b=sZhqzwb1rAoZ6gh5y50eXGRehXhB3I2k8Vt97sLIquwpqOoQPoQ8gDAxb5O6Z0qWnf EpxZLMr1nRiH3G9qY/5zrXtewxwe4/L99KtDfHqV54iXAYIygXBkwghxr0yxqqRhdc/R Szv8Hu8SZ00aI2oIuylq753Ke2jNnLD7gAZHgIPd6XWfhmtSQZZRTcCbI9XkMi/RaiQm kVVThGzOJjC2kKMRjVR2JibEvwzQaqYqZ5w+/7/AzNrs0Jc2YtAtmR5bMwSndKEbNnK9 zPplTcbah0Wml2DZJCegc3vxtWb/n3KKn8Y9MXh6FDG+sS7xtA6O8crupF1TJofP8Mra cNIQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=fk5tenTq/BCFrK61trlFY6kY4PWkLZYCtrjfGIFzHNU=; fh=nE5YiQvOFxtCvybnUKq8036cc5AMFyH1yUwSv5drll0=; b=Hsgx3i/9++uduDWxbrRB2M4lPOCtc3Wa1MXbigaiUJrOcq7+7ooeT6ZEKo0OvEEWES DiKIO1AYSGgRlkkJr8Fi+jP79+HF1tuRmvtE6FqdrFHoC+J0MlV++lng1u0tHyS7dert 0A7ojy7T85SS2nxnIG8SLHrFmupptuLUd9QyANi/a/kKg8aSs1CjanO68EinWtEN/p0H 4e05AWlJNlwXUXUtlmTQp+jsg0KI1fbU1PiT21/RfzLaNgbDUXORuzX7HWVo/d6RZRfT PEc1h4vCOczWy/bkDsUv5NXozHQr5l5Gegij4qQwEvRhh2JCvP4ittNiT7px56uxp84O rSsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jsCV06B3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-185840-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c362c42si14625452a12.522.2024.05.22.00.10.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 00:10:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185840-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jsCV06B3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-185840-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D0DA11F22116 for ; Wed, 22 May 2024 07:10:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 37C7D7CF1A; Wed, 22 May 2024 07:09:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jsCV06B3" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F0CE757E3; Wed, 22 May 2024 07:09:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716361793; cv=none; b=a9nho3/ngfo+koRgIVxS5JjNelYF8iH4TmeNdYIKztF/odQ8uoAK5bJFMD265BOt76JBsTh4hh597QD9jwS7qZmn7X5hzf5kv+uW/HnO3TxNsz2yF61yGG32Ix0O1y1W9v9WyavHkIk0nK0aL29gHzXx6YaFoNRJoPK/c1yE4n8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716361793; c=relaxed/simple; bh=TR/+w1xfGGKNjUy7DN+IkbPohsKmp5v8H4Jsop/xNhc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=irOHYGg+d+h2cOlICRR4adjiSgmrqClrw3ltfHB0HZ22RytfHeUYHflXzkGPZAYP/PSKtB9svzB3gR7N+hwQWGQSj8aFywkSlJH+98OhizSicO/ttoMcXb2IuPs6oJE4RcCmJiImM7LdHMKURdKfO75ASxtTt8zGvP1fa1fZXqQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jsCV06B3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2236FC2BD11; Wed, 22 May 2024 07:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716361792; bh=TR/+w1xfGGKNjUy7DN+IkbPohsKmp5v8H4Jsop/xNhc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=jsCV06B3hNueOFpV9R3NBPzP39pX+viO1rf2EXTvJL6MKySVfWh8yEST1zBzpfDZZ elDNJaQQofBB2SQXnOqJw44mG1ueOaSten3N9uy+k/j9zpug382mtkY4OLbZOZ0K6N mu/1jTdmBfpPrcPumJA+dL4nxwegxmuprFGIl/Ac08ikhs7X7eFPrHrCGLMuwLGGLA lex5cyNkYq4CxqpKwwmoyUF0V8olmSBNES6JrujtBPxVuf2fOIyrenMZIc+lhDI7x6 uNi1BgK3Rf8LsEAovC37eMd5EvstnFgu79sMjnVy99tdijwSgHj/gv7z/lZ1DoX5J/ 0ma7z11puuPaA== Message-ID: Date: Wed, 22 May 2024 09:09:45 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next 14/15 v2] net: Reference bpf_redirect_info via task_struct on PREEMPT_RT. To: Sebastian Andrzej Siewior Cc: Alexei Starovoitov , =?UTF-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , LKML , Network Development , "David S. Miller" , Boqun Feng , Daniel Borkmann , Eric Dumazet , Frederic Weisbecker , Ingo Molnar , Jakub Kicinski , Paolo Abeni , Peter Zijlstra , Thomas Gleixner , Waiman Long , Will Deacon , Alexei Starovoitov , Andrii Nakryiko , Eduard Zingerman , Hao Luo , Jiri Olsa , John Fastabend , KP Singh , Martin KaFai Lau , Song Liu , Stanislav Fomichev , Yonghong Song , bpf , Arnaldo Carvalho de Melo References: <20240503182957.1042122-15-bigeasy@linutronix.de> <87y18mohhp.fsf@toke.dk> <20240507123636.cTnT7TvU@linutronix.de> <93062ce7-8dfa-48a9-a4ad-24c5a3993b41@kernel.org> <20240510162121.f-tvqcyf@linutronix.de> <20240510162214.zNWRKgFU@linutronix.de> <4949dca0-377a-45b1-a0fd-17bdf5a6ab10@kernel.org> <20240514054345.DZkx7fJs@linutronix.de> <20240517161553.SSh4BNQO@linutronix.de> Content-Language: en-US From: Jesper Dangaard Brouer In-Reply-To: <20240517161553.SSh4BNQO@linutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 17/05/2024 18.15, Sebastian Andrzej Siewior wrote: > On 2024-05-14 14:20:03 [+0200], Jesper Dangaard Brouer wrote: >> Trick for CPU-map to do early drop on remote CPU: >> >> # ./xdp-bench redirect-cpu --cpu 3 --remote-action drop ixgbe1 >> >> I recommend using Ctrl+\ while running to show more info like CPUs being >> used and what kthread consumes. To catch issues e.g. if you are CPU >> redirecting to same CPU as RX happen to run on. > > Okay. So I reworked the last two patches make the struct part of > task_struct and then did as you suggested: > > Unpatched: > |Sending: > |Show adapter(s) (eno2np1) statistics (ONLY that changed!) > |Ethtool(eno2np1 ) stat: 952102520 ( 952,102,520) <= port.tx_bytes /sec > |Ethtool(eno2np1 ) stat: 14876602 ( 14,876,602) <= port.tx_size_64 /sec > |Ethtool(eno2np1 ) stat: 14876602 ( 14,876,602) <= port.tx_unicast /sec > |Ethtool(eno2np1 ) stat: 446045897 ( 446,045,897) <= tx-0.bytes /sec > |Ethtool(eno2np1 ) stat: 7434098 ( 7,434,098) <= tx-0.packets /sec > |Ethtool(eno2np1 ) stat: 446556042 ( 446,556,042) <= tx-1.bytes /sec > |Ethtool(eno2np1 ) stat: 7442601 ( 7,442,601) <= tx-1.packets /sec > |Ethtool(eno2np1 ) stat: 892592523 ( 892,592,523) <= tx_bytes /sec > |Ethtool(eno2np1 ) stat: 14876542 ( 14,876,542) <= tx_packets /sec > |Ethtool(eno2np1 ) stat: 2 ( 2) <= tx_restart /sec > |Ethtool(eno2np1 ) stat: 2 ( 2) <= tx_stopped /sec > |Ethtool(eno2np1 ) stat: 14876622 ( 14,876,622) <= tx_unicast /sec > | > |Receive: > |eth1->? 8,732,508 rx/s 0 err,drop/s > | receive total 8,732,508 pkt/s 0 drop/s 0 error/s > | cpu:10 8,732,508 pkt/s 0 drop/s 0 error/s > | enqueue to cpu 3 8,732,510 pkt/s 0 drop/s 7.00 bulk-avg > | cpu:10->3 8,732,510 pkt/s 0 drop/s 7.00 bulk-avg > | kthread total 8,732,506 pkt/s 0 drop/s 205,650 sched > | cpu:3 8,732,506 pkt/s 0 drop/s 205,650 sched > | xdp_stats 0 pass/s 8,732,506 drop/s 0 redir/s > | cpu:3 0 pass/s 8,732,506 drop/s 0 redir/s > | redirect_err 0 error/s > | xdp_exception 0 hit/s > > I verified that the "drop only" case hits 14M packets/s while this > redirect part reports 8M packets/s. > Great, this is a good test. The transmit speed 14.88 Mpps is 10G wirespeed at smallest Ethernet packet size (84 bytes with overhead + intergap, 10*10^9/(84*8) = 14880952). > Patched: > |Sending: > |Show adapter(s) (eno2np1) statistics (ONLY that changed!) > |Ethtool(eno2np1 ) stat: 952635404 ( 952,635,404) <= port.tx_bytes /sec > |Ethtool(eno2np1 ) stat: 14884934 ( 14,884,934) <= port.tx_size_64 /sec > |Ethtool(eno2np1 ) stat: 14884928 ( 14,884,928) <= port.tx_unicast /sec > |Ethtool(eno2np1 ) stat: 446496117 ( 446,496,117) <= tx-0.bytes /sec > |Ethtool(eno2np1 ) stat: 7441602 ( 7,441,602) <= tx-0.packets /sec > |Ethtool(eno2np1 ) stat: 446603461 ( 446,603,461) <= tx-1.bytes /sec > |Ethtool(eno2np1 ) stat: 7443391 ( 7,443,391) <= tx-1.packets /sec > |Ethtool(eno2np1 ) stat: 893086506 ( 893,086,506) <= tx_bytes /sec > |Ethtool(eno2np1 ) stat: 14884775 ( 14,884,775) <= tx_packets /sec > |Ethtool(eno2np1 ) stat: 14 ( 14) <= tx_restart /sec > |Ethtool(eno2np1 ) stat: 14 ( 14) <= tx_stopped /sec > |Ethtool(eno2np1 ) stat: 14884937 ( 14,884,937) <= tx_unicast /sec > | > |Receive: > |eth1->? 8,735,198 rx/s 0 err,drop/s > | receive total 8,735,198 pkt/s 0 drop/s 0 error/s > | cpu:6 8,735,198 pkt/s 0 drop/s 0 error/s > | enqueue to cpu 3 8,735,193 pkt/s 0 drop/s 7.00 bulk-avg > | cpu:6->3 8,735,193 pkt/s 0 drop/s 7.00 bulk-avg > | kthread total 8,735,191 pkt/s 0 drop/s 208,054 sched > | cpu:3 8,735,191 pkt/s 0 drop/s 208,054 sched > | xdp_stats 0 pass/s 8,735,191 drop/s 0 redir/s > | cpu:3 0 pass/s 8,735,191 drop/s 0 redir/s > | redirect_err 0 error/s > | xdp_exception 0 hit/s > Great basically zero overhead. Awesome you verified this! > This looks to be in the same range/ noise level. top wise I have > ksoftirqd at 100% and cpumap/./map at ~60% so I hit CPU speed limit on a > 10G link. For our purpose of testing XDP_REDIRECT code, that you are modifying, this is what we want. Where RX CPU/NAPI is the bottleneck, given remote cpumap CPU have idle cycles (also indicated by the 208,054 sched stats). > perf top shows I appreciate getting this perf data. As we are explicitly dealing with splitting workload across CPUs, it worth mentioning that perf support displaying and filtering on CPUs. This perf commands include the CPU number (zero indexed): # perf report --sort cpu,comm,dso,symbol --no-children For this benchmark, to focus, I would reduce this to: # perf report --sort cpu,symbol --no-children The perf tool can also use -C to filter on some CPUs like: # perf report --sort cpu,symbol --no-children -C 3,6 > | 18.37% bpf_prog_4f0ffbb35139c187_cpumap_l4_hash [k] bpf_prog_4f0ffbb35139c187_cpumap_l4_hash This bpf_prog_4f0ffbb35139c187_cpumap_l4_hash is running on RX CPU doing the load-balancing. > | 13.15% [kernel] [k] cpu_map_kthread_run This runs on remote cpumap CPU (in this case CPU 3). > | 12.96% [kernel] [k] ixgbe_poll > | 6.78% [kernel] [k] page_frag_free The page_frag_free call might run on remote cpumap CPU. > | 5.62% [kernel] [k] xdp_do_redirect > > for the top 5. Is this something that looks reasonable? Yes, except I had to guess how the workload was split between CPUs ;-) Thanks for doing these benchmarks! :-) --Jesper