From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by mail.toke.dk (Postfix) with ESMTPS id 6B7C09CD431 for ; Fri, 9 Dec 2022 01:07:53 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=gxJbp+K+ Received: by mail-ej1-x632.google.com with SMTP id n20so7918197ejh.0 for ; Thu, 08 Dec 2022 16:07:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=z1CwUhBKmLcc3xJp3He22HceM+mQGWDmDbOf77l5NqM=; b=gxJbp+K+xSIY2Tw7y11kyN08+NF9vOjJGyOJz/OzimhKI+CYgouud592Mm0a3Z1aM6 +6i6BISH02DtViIB1QnVegxqZPIZvi640JecDglTb6WUp3OpBbGemk8ufEoHC0g9VnnO GcM1DkDyyN40ZQ0UWvPusB1dKEh2a0u5w5Dil3VcXeRpbfz73eQRvl8+dmHCI7YsiYjP ACK2zDeuIosWoDIIy8SlS6J3xvZ+grUvhfABUXskgtVt8ks+LPaLUy2ITv3iqahOPtjc TeokU3Q3tq4j0BBAQaGI9wqf+UAzc5/3i2MI+XzoaeVgAkw5Ygr719TviaW4ubzB9zeG 72IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=z1CwUhBKmLcc3xJp3He22HceM+mQGWDmDbOf77l5NqM=; b=qyn8JnO9KBuXxFwrFPgsTJI930w+PX8caZpXkRKnX+gPZ+f0c+bRHvBD4RfwU/l/75 S1pZvE+OV73sftlBG1b6EiEuCgCTnq0jitJ+esH0WfAnq6+HXzmqU5gBnjtOPvnk5rgi I+0UzIZlxPOTyiSxEXNrbYzhbe9LWizb7hdnvZSEc/Naj0GlEnY8sZUiqpEwn3v3jk0m K8bKdSU4De8NfrLGmcBJSAw9xsJalyQrSHIa8giJ4ODEaHMUsIkR0YuhVxvuAOqTkl+Y AYrNkO6dB4nJfnmWzvZ9Cve8RQHAcsPKn6y4Co3x0Rocd0AH/3d/FZU4wldALVSnbtXq P9Sg== X-Gm-Message-State: ANoB5pk3D2m90+iMWPt6dknSjyGtOvn3JkDeMjaNzb6j8SgJ3KlZfJYo QZMonAN5FGlOL6sDIf3aubuprunfGuedFsFPxR4= X-Google-Smtp-Source: AA0mqf5MBoRl5V/v1iYdBNTpKJISTGcSH8pQUcix3SxBfo+HxXBJiIUnBX1QhChef6NXc79hZt3TSPH2rCTGnvxh3Ro= X-Received: by 2002:a17:907:76cb:b0:7c0:870b:3dda with SMTP id kf11-20020a17090776cb00b007c0870b3ddamr35410213ejc.676.1670544471573; Thu, 08 Dec 2022 16:07:51 -0800 (PST) MIME-Version: 1.0 References: <20221206024554.3826186-1-sdf@google.com> <20221206024554.3826186-12-sdf@google.com> <875yellcx6.fsf@toke.dk> <87359pl9zy.fsf@toke.dk> In-Reply-To: <87359pl9zy.fsf@toke.dk> From: Alexei Starovoitov Date: Thu, 8 Dec 2022 16:07:39 -0800 Message-ID: To: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: SHK22ADDOVR2VBFMZTNRRYLOCZ3KKZVJ X-Message-ID-Hash: SHK22ADDOVR2VBFMZTNRRYLOCZ3KKZVJ X-MailFrom: alexei.starovoitov@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Stanislav Fomichev , bpf , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Hao Luo , Jiri Olsa , Saeed Mahameed , David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, Network Development X-Mailman-Version: 3.3.7 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v3 11/12] mlx5: Support RX XDP metadata List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, Dec 8, 2022 at 4:02 PM Toke H=C3=B8iland-J=C3=B8rgensen wrote: > > Stanislav Fomichev writes: > > > On Thu, Dec 8, 2022 at 2:59 PM Toke H=C3=B8iland-J=C3=B8rgensen wrote: > >> > >> Stanislav Fomichev writes: > >> > >> > From: Toke H=C3=B8iland-J=C3=B8rgensen > >> > > >> > Support RX hash and timestamp metadata kfuncs. We need to pass in th= e cqe > >> > pointer to the mlx5e_skb_from* functions so it can be retrieved from= the > >> > XDP ctx to do this. > >> > >> So I finally managed to get enough ducks in row to actually benchmark > >> this. With the caveat that I suddenly can't get the timestamp support = to > >> work (it was working in an earlier version, but now > >> timestamp_supported() just returns false). I'm not sure if this is an > >> issue with the enablement patch, or if I just haven't gotten the > >> hardware configured properly. I'll investigate some more, but figured > >> I'd post these results now: > >> > >> Baseline XDP_DROP: 25,678,262 pps / 38.94 ns/pkt > >> XDP_DROP + read metadata: 23,924,109 pps / 41.80 ns/pkt > >> Overhead: 1,754,153 pps / 2.86 ns/pkt > >> > >> As per the above, this is with calling three kfuncs/pkt > >> (metadata_supported(), rx_hash_supported() and rx_hash()). So that's > >> ~0.95 ns per function call, which is a bit less, but not far off from > >> the ~1.2 ns that I'm used to. The tests where I accidentally called th= e > >> default kfuncs cut off ~1.3 ns for one less kfunc call, so it's > >> definitely in that ballpark. > >> > >> I'm not doing anything with the data, just reading it into an on-stack > >> buffer, so this is the smallest possible delta from just getting the > >> data out of the driver. I did confirm that the call instructions are > >> still in the BPF program bytecode when it's dumped back out from the > >> kernel. > >> > >> -Toke > >> > > > > Oh, that's great, thanks for running the numbers! Will definitely > > reference them in v4! > > Presumably, we should be able to at least unroll most of the > > _supported callbacks if we want, they should be relatively easy; but > > the numbers look fine as is? > > Well, this is for one (and a half) piece of metadata. If we extrapolate > it adds up quickly. Say we add csum and vlan tags, say, and maybe > another callback to get the type of hash (l3/l4). Those would probably > be relevant for most packets in a fairly common setup. Extrapolating > from the ~1 ns/call figure, that's 8 ns/pkt, which is 20% of the > baseline of 39 ns. > > So in that sense I still think unrolling makes sense. At least for the > _supported() calls, as eating a whole function call just for that is > probably a bit much (which I think was also Jakub's point in a sibling > thread somewhere). imo the overhead is tiny enough that we can wait until generic 'kfunc inlining' infra is ready. We're planning to dual-compile some_kernel_file.c into native arch and into bpf arch. Then the verifier will automatically inline bpf asm of corresponding kfunc.