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.129.124]) by mail.toke.dk (Postfix) with ESMTPS id 0E38AA7ED95 for ; Thu, 08 Aug 2024 19:22:49 +0200 (CEST) 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=CsFiq7p4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723137768; 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: in-reply-to:in-reply-to:references:references; bh=7jdTVRq/ML5O9MM/Zy15y5zkZSHABz60MdmEFuSzK3g=; b=CsFiq7p4aCPhVDYWHe/5H8D0BibOeGHFN6W+zSXubIyGwYg6CjDAsD44HJhnVtpVWVrsu8 KlIGHHCMk8WjvMHqQg2GeuBHOh0zez1w2NlQm7SLCqSpCUMo/1fCZfoznUBsVIa6wZkIFF Y+SDIXF2DCHS1OFQs4kIfDmeZyGIwos= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-387-NTdHHua4MyG31R4b0mRanA-1; Thu, 08 Aug 2024 13:22:45 -0400 X-MC-Unique: NTdHHua4MyG31R4b0mRanA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42808efc688so8484985e9.0 for ; Thu, 08 Aug 2024 10:22:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723137764; x=1723742564; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7jdTVRq/ML5O9MM/Zy15y5zkZSHABz60MdmEFuSzK3g=; b=FOwRe2iC/O5Fe7V1W8dRFmyzIHw2byLDZT5YgM2R110hUnl4x/bSumnWG5UIkNo9Q7 ouGll8QMThgHS2FFUQzJMsEWoAHuaKBUtn+qqSzBayTwRl1GGX+EzSDwzfj6sapKqmSJ Epis6NUVa9wM0l3Bgu0bTa9+SxapPYyseRKHBAhJ4qyWUaMBHhBHRUbT5yNSRp13MoIL AwL8u9UyGmaoPXJ9I4giLnVTEN/h64wdIOMRV2VQzmTQP4dSaBEii9XZOydZgRF3Px0a hfMdy/XZmZXocguLpUiMWOgr69bBqhjL+Nx/yOxnzK1+TqTpJ1+dRFopE6cQNB2IBKnZ 9UuQ== X-Forwarded-Encrypted: i=1; AJvYcCWbjUar1xNwCYUJlkgyOWaS7b01qFCKKVRKSvj4nAnimPPErONXD69B7umduX4eHhqBgVzOCZI82LOy0FzbiiAWJYpScIf2hE73 X-Gm-Message-State: AOJu0YxkpJnTD5zl/roHy63lYTVRVP02z83+wbM6W++sQ0KEu1aIEAh5 uK0rg+k7iOqBpkWWJTxaGb78JmmTbgmh8TTZ6YsdJwVXO3h0jubJ1Wz84bfPTWx8gudo81nISiX 5UNvCfxF/gALNCN8FC0qSy+uDBksb1GOx8anWRnH4cGhujxpRKB6MK9ps4Q== X-Received: by 2002:a5d:4534:0:b0:366:e89c:342b with SMTP id ffacd0b85a97d-36d2757d4bfmr1810240f8f.52.1723137764136; Thu, 08 Aug 2024 10:22:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHqdtChQBZpN1JH7puu+XlXH02XOmQ5DJetV/Nf/lePk3KFQrsqH/VR0g9ltlQzH8bHk2zFcA== X-Received: by 2002:a5d:4534:0:b0:366:e89c:342b with SMTP id ffacd0b85a97d-36d2757d4bfmr1810211f8f.52.1723137763564; Thu, 08 Aug 2024 10:22:43 -0700 (PDT) Received: from localhost (53.116.107.80.static.otenet.gr. [80.107.116.53]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36d2716c684sm2560176f8f.28.2024.08.08.10.22.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:22:42 -0700 (PDT) Date: Thu, 8 Aug 2024 19:22:39 +0200 From: Lorenzo Bianconi To: Alexander Lobakin Message-ID: References: <20220628194812.1453059-1-alexandr.lobakin@intel.com> <20220628194812.1453059-33-alexandr.lobakin@intel.com> <54aab7ec-80e9-44fd-8249-fe0cabda0393@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="gWopvvUjnRev2ziB" Content-Disposition: inline In-Reply-To: <54aab7ec-80e9-44fd-8249-fe0cabda0393@intel.com> Message-ID-Hash: IM7SSVCA3OSRAKTU3237HJGFOCBKHVU2 X-Message-ID-Hash: IM7SSVCA3OSRAKTU3237HJGFOCBKHVU2 X-MailFrom: lorenzo.bianconi@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: Daniel Xu , Alexander Lobakin , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Larysa Zaremba , Michal Swiatkowski , Jesper Dangaard Brouer , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , "toke@redhat.com" , Lorenzo Bianconi , David Miller , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesse Brandeburg , John Fastabend , Yajun Deng , Willem de Bruijn , "bpf@vger.kernel.org" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, xdp-hints@xdp-project.net X-Mailman-Version: 3.3.9 Precedence: list Subject: [xdp-hints] Re: [PATCH RFC bpf-next 32/52] bpf, cpumap: switch to GRO from netif_receive_skb_list() List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --gWopvvUjnRev2ziB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > From: Lorenzo Bianconi > Date: Thu, 8 Aug 2024 06:54:06 +0200 >=20 > >> Hi Alexander, > >> > >> On Tue, Jun 28, 2022, at 12:47 PM, Alexander Lobakin wrote: > >>> cpumap has its own BH context based on kthread. It has a sane batch > >>> size of 8 frames per one cycle. > >>> GRO can be used on its own, adjust cpumap calls to the > >>> upper stack to use GRO API instead of netif_receive_skb_list() which > >>> processes skbs by batches, but doesn't involve GRO layer at all. > >>> It is most beneficial when a NIC which frame come from is XDP > >>> generic metadata-enabled, but in plenty of tests GRO performs better > >>> than listed receiving even given that it has to calculate full frame > >>> checksums on CPU. > >>> As GRO passes the skbs to the upper stack in the batches of > >>> @gro_normal_batch, i.e. 8 by default, and @skb->dev point to the > >>> device where the frame comes from, it is enough to disable GRO > >>> netdev feature on it to completely restore the original behaviour: > >>> untouched frames will be being bulked and passed to the upper stack > >>> by 8, as it was with netif_receive_skb_list(). > >>> > >>> Signed-off-by: Alexander Lobakin > >>> --- > >>> kernel/bpf/cpumap.c | 43 ++++++++++++++++++++++++++++++++++++++----- > >>> 1 file changed, 38 insertions(+), 5 deletions(-) > >>> > >> > >> AFAICT the cpumap + GRO is a good standalone improvement. I think > >> cpumap is still missing this. >=20 > The only concern for having GRO in cpumap without metadata from the NIC > descriptor was that when the checksum status is missing, GRO calculates > the checksum on CPU, which is not really fast. > But I remember sometimes GRO was faster despite that. >=20 > >> > >> I have a production use case for this now. We want to do some intellig= ent > >> RX steering and I think GRO would help over list-ified receive in some= cases. > >> We would prefer steer in HW (and thus get existing GRO support) but no= t all > >> our NICs support it. So we need a software fallback. > >> > >> Are you still interested in merging the cpumap + GRO patches? >=20 > For sure I can revive this part. I was planning to get back to this > branch and pick patches which were not related to XDP hints and send > them separately. >=20 > >=20 > > Hi Daniel and Alex, > >=20 > > Recently I worked on a PoC to add GRO support to cpumap codebase: > > - https://github.com/LorenzoBianconi/bpf-next/commit/a4b8264d5000ecf016= da5a2dd9ac302deaf38b3e > > Here I added GRO support to cpumap through gro-cells. > > - https://github.com/LorenzoBianconi/bpf-next/commit/da6cb32a4674aa7240= 1c7414c9a8a0775ef41a55 > > Here I added GRO support to cpumap trough napi-threaded APIs (with a = some > > changes to them). >=20 > Hmm, when I was testing it, adding a whole NAPI to cpumap was sorta > overkill, that's why I separated GRO structure from &napi_struct. if we consider the NAPI-threaded implementation, we have the same architect= ure we have in current cpumap codebase, a thread for each cpumap entry, the only different is we can rely on GRO APIs. Regards, Lorenzo >=20 > Let me maybe find some free time, I would then test all 3 solutions > (mine, gro_cells, threaded NAPI) and pick/send the best? >=20 > >=20 > > Please note I have not run any performance tests so far, just verified = it does > > not crash (I was planning to resume this work soon). Please let me know= if it > > works for you. > >=20 > > Regards, > > Lorenzo > >=20 > >> > >> Thanks, > >> Daniel >=20 > Thanks, > Olek >=20 --gWopvvUjnRev2ziB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCZrT+3AAKCRA6cBh0uS2t rNmOAQCJ9AZ6VVqlHeY+Ep7EQlMd0ybYpws3TIoQ8xaHVmjHyAD9HFXaElQMwHQ4 DACmDzL52jcn/Xv3bji9aj2oL+3shwg= =3Ltv -----END PGP SIGNATURE----- --gWopvvUjnRev2ziB--