From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mail.toke.dk (Postfix) with ESMTPS id 97DCE9CD471 for ; Fri, 9 Dec 2022 01:29:24 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ws5XSH2l DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670545763; 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=rXx2Twk1+W1ucSQ4nMRX7RYtEvwHBW6Ct/o/6tTJ6Z0=; b=Ws5XSH2lVrgWxYDY9ZDl4heJKcZ6urnXqG6Hkf311yKdqBSa5JsXJ33YRG7/r8WKFRo7Ga HPmz3YSEb2BruL1FtsNYJJaW+thfPxS/dw4fEBZaYCbhHLcBO60f6nLHkJ+2H0/jb5MrfI i2d4xAEGcNPMZT9Bp3LWD0vtw0SNarA= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-424-TWUMPCojNyeBeIkmf0p76g-1; Thu, 08 Dec 2022 19:29:19 -0500 X-MC-Unique: TWUMPCojNyeBeIkmf0p76g-1 Received: by mail-ed1-f70.google.com with SMTP id c9-20020a05640227c900b00463de74bc15so415814ede.13 for ; Thu, 08 Dec 2022 16:29:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U8OBtv2yIS04AYX7W/1P+gUfW6hywQvsnowxXELDSU8=; b=ctxP30lI+fuawCrAxa7YN+SCnWVV2sNOQBD+BbFQPKYkYQN3bkF9akL5x/NbLbXEW3 9xfRVtObO7IHT85BVvjlYNrN8WvjouLC22jib6Fq3x1iKBYAAz56cpqcH8MExlBK77nI j4C3sEFn0UtUfMAX6lUML8vN1y03JPiASe2C/VjrMnz7nCt+NCyU8hC5xHv4ae0pf3qU JI36SB7YxGAmH64rcskqZylz6DRUFzoDoSsf9Od3W7rj7PrxvhsabmX0EQCEpPrndZuf 4bVz6f6qYjspZPVRdJSprExS4Putem9JZDOo5jNnEbTdfHikUjwvAF37T1s8CEdWNLfY LkZQ== X-Gm-Message-State: ANoB5pmJcJwSq0NJx6pTLUS/OBbJWRz3e9FpMNXs6UoGONOtRZN7n8hA wpNQraMmEtjy8UaFMaiWtgLJfJKie4GWMu85Rm9tFACUCkkoRXPhDkEWpx4WR/qXzLqNmPQwouD zZK6+WUSt3FRqbW1gQpqW X-Received: by 2002:a17:906:b1c6:b0:78d:f455:b5d4 with SMTP id bv6-20020a170906b1c600b0078df455b5d4mr3296188ejb.20.1670545758517; Thu, 08 Dec 2022 16:29:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf4CiSJlchin364iECYsvkMB+OkYb0iDARFbXm2MDItjFmcJFlFLVTWkkyiVuplDVnQSKpjTAA== X-Received: by 2002:a17:906:b1c6:b0:78d:f455:b5d4 with SMTP id bv6-20020a170906b1c600b0078df455b5d4mr3296167ejb.20.1670545758084; Thu, 08 Dec 2022 16:29:18 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id n11-20020a170906118b00b007be696512ecsm10123228eja.187.2022.12.08.16.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 16:29:17 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 4C35982E9CE; Fri, 9 Dec 2022 01:29:16 +0100 (CET) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Alexei Starovoitov In-Reply-To: References: <20221206024554.3826186-1-sdf@google.com> <20221206024554.3826186-12-sdf@google.com> <875yellcx6.fsf@toke.dk> <87359pl9zy.fsf@toke.dk> X-Clacks-Overhead: GNU Terry Pratchett Date: Fri, 09 Dec 2022 01:29:16 +0100 Message-ID: <87tu25ju77.fsf@toke.dk> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KPMZIRAN5KRPXOVOJNSE2VV6GQPFEPUV X-Message-ID-Hash: KPMZIRAN5KRPXOVOJNSE2VV6GQPFEPUV X-MailFrom: toke@redhat.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: Alexei Starovoitov writes: > 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 t= he cqe >> >> > pointer to the mlx5e_skb_from* functions so it can be retrieved fro= m 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 t= he >> >> 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-stac= k >> >> 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. Is that "planning" or "actively working on"? Just trying to get a sense of the time frames here, as this sounds neat, but also something that could potentially require quite a bit of fiddling with the build system to get to work? :) -Toke