Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp338546rdd; Tue, 9 Jan 2024 05:59:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHYA0Q6Rsx+WuAAJnp1CeBy+PIRX5AmxrzKSt1grHlYvEiQxAtVvfsNgGLLNu0c/hVdHr8O X-Received: by 2002:a17:90a:de0e:b0:28b:fee8:17e0 with SMTP id m14-20020a17090ade0e00b0028bfee817e0mr946082pjv.19.1704808781664; Tue, 09 Jan 2024 05:59:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704808781; cv=none; d=google.com; s=arc-20160816; b=zbloR8sdlK2snKslIB2mxUStIFfwrKNR/0Tld1rFQL7sbAILr0I0FHDQ5IDYGZoqSz 5cfSvRi7RgsO+Ve9AD8qpdKCzlwjaV6aRm/ReD+3d8grZpxOlnkGS139C+twPJPcEy7t DYrgVj4WAOYTVdFo/TUW97tlFiB3sczBDE5CRnF1Pjxs+Qu735vtGSEvyeLu7AbYoK+M f0v2q/Nu9n1eVp1+az3Gcu/lpBZb2mdNLpjM9jn+RkuZWDzAmrt9j0v+SW7eJmn3cJ/p gf7o8ELTNI1Y6MRXT989EoVtTImHFdPCbqX3HlowtNsuyDQLcBdkopPrwi5sbpZXD32X jSow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:references:in-reply-to :message-id:cc:to:from:date:dkim-signature; bh=1zbwLQvCGi9ayqIqzz1ygZ1oEKO7pDe3S64K7yitgQ0=; fh=fLEF0Ljo7IbpIsPI1ocNXDDQceYJOkKVZq2YY8Eq6Sg=; b=FBQn0r3RCRTCTb0jfcrhasiqF18LnfVFTZXbs+9ZV8FMERo5ECihO0TXDEms9vYzoT J+IRicw6ZsvrLTe15kuPFIEg4FRRGYgKX/BIDwn9A8gAQfShl50ZSD1HfK/eWVeQ4LyR jnMOADFf6LgGX6MAnV6g5f7QgeXKN8jCzfrz3O3ZsargJsNx90Xqy8es8DXhbYmeP38s KZ2h5rrPrYzvq4jr4E11prvBMBhAdVDBwrs9IntAcKpsOKgnCNr1jmx+aLq0DLHt6wZB Ae1ujkme41Oe0PYnDokGIXSChLyOetp56msGrH/ic6sUkd5bphiMKHsDLGbkzgGljbqN 1BSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ePEaYJhs; spf=pass (google.com: domain of linux-kernel+bounces-20927-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20927-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id a1-20020a17090ad80100b0028bce1c4f8csi1518393pjv.187.2024.01.09.05.59.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:59:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20927-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ePEaYJhs; spf=pass (google.com: domain of linux-kernel+bounces-20927-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20927-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5138028667B for ; Tue, 9 Jan 2024 13:59:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7BE7F39856; Tue, 9 Jan 2024 13:59:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ePEaYJhs" Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54FAA38FBB; Tue, 9 Jan 2024 13:59:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-78104f6f692so241039085a.1; Tue, 09 Jan 2024 05:59:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704808768; x=1705413568; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=1zbwLQvCGi9ayqIqzz1ygZ1oEKO7pDe3S64K7yitgQ0=; b=ePEaYJhspVqzmTmxEkAm9U4segPzUmfrJ4+49viIDJ7CscrC+xxJIkuQFFUAqowX6g d7VmePvYwd101z8Doxu+WXtaYGENTirSxJ0peKKAUaa6Bs4mY3dRSZdOK85pICg9y6CQ VZCiyLpjgpqprKnYAbTZb7YQI3mUrSods7sm5CcFByxfzxr4k0YYHpuFYckypjJPVepi 2iwncRG0xurpaHRxnPiELRlWAXXQMzROoZAtzsgl0rWj97X5WNo05PLSmQsKoKigcUK0 dNK/AMUZklL3ujoXLa4NXP8bLp4Vox0STs9UMjUafAtJXIklGJC6mfW9sGSrRjenwm5Q HCnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704808768; x=1705413568; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=1zbwLQvCGi9ayqIqzz1ygZ1oEKO7pDe3S64K7yitgQ0=; b=RGO/3ATU5lPLVBDlNLV4/WUKYEIJHVvzNiRs/Przh643WJbClgl25NkAclAj1I+1vx GVBOFdVL719v8tRkhzyJQl61Bvp3ZId2A7xHlkhkY/K6ejgC5utDBipsTuz0T3fQTzq/ VUAzpo/IcfvMVXlCwXysOQAx+dOQOlUrqOrhcVNGNM2GRjgXT4Xk1HSyYgIukm1Wo/G+ zhumonLMQwC+Fq2fgkQ63IRZdRgQTyYQqj1KwI7GG7w89mdTCEypjox49DMgf4jQDMcs ynG3CGDyoW9NGX4l/Woo0DgYk2t+/ednj2/3SaeOPiPfEXOGQpNzkyWLBcYwS4otlrJb wdVA== X-Gm-Message-State: AOJu0YxgjPQkc3mF/SpdMMm1Px1PcdxQIMJ6LOhyCohKuZo07givpco9 OY4uudbsI1l4A+SnyrOvRgA= X-Received: by 2002:a37:c20d:0:b0:781:21c6:83a6 with SMTP id i13-20020a37c20d000000b0078121c683a6mr1019863qkm.12.1704808767992; Tue, 09 Jan 2024 05:59:27 -0800 (PST) Received: from localhost (48.230.85.34.bc.googleusercontent.com. [34.85.230.48]) by smtp.gmail.com with ESMTPSA id b2-20020a05620a118200b0076db5b792basm806838qkk.75.2024.01.09.05.59.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:59:27 -0800 (PST) Date: Tue, 09 Jan 2024 08:59:27 -0500 From: Willem de Bruijn To: Alexander Lobakin , Willem de Bruijn Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maciej Fijalkowski , Michal Kubiak , Larysa Zaremba , Alexei Starovoitov , Daniel Borkmann , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <659d513f5c0f6_161283294f5@willemb.c.googlers.com.notmuch> In-Reply-To: References: <20231223025554.2316836-1-aleksander.lobakin@intel.com> <20231223025554.2316836-6-aleksander.lobakin@intel.com> <658c4328425f7_a33e629412@willemb.c.googlers.com.notmuch> Subject: Re: [PATCH RFC net-next 05/34] idpf: convert header split mode to libie + napi_build_skb() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Alexander Lobakin wrote: > From: Willem De Bruijn > Date: Wed, 27 Dec 2023 10:30:48 -0500 > > > Alexander Lobakin wrote: > >> Currently, idpf uses the following model for the header buffers: > >> > >> * buffers are allocated via dma_alloc_coherent(); > >> * when receiving, napi_alloc_skb() is called and then the header is > >> copied to the newly allocated linear part. > >> > >> This is far from optimal as DMA coherent zone is slow on many systems > >> and memcpy() neutralizes the idea and benefits of the header split. > > > > Do you have data showing this? > > Showing slow coherent DMA or memcpy()? > Try MIPS for the first one. > For the second -- try comparing performance on ice with the "legacy-rx" > private flag disabled and enabled. > > > > > The assumption for the current model is that the headers will be > > touched shortly after, so the copy just primes the cache. > > They won't be touched in many cases. E.g. XDP_DROP. > Or headers can be long. memcpy(32) != memcpy(128). > The current model allocates a new skb with a linear part, which is a > real memory allocation. napi_build_skb() doesn't allocate anything > except struct sk_buff, which is usually available in the NAPI percpu cache. > If build_skb() wasn't more effective, it wouldn't be introduced. > The current model just assumes default socket traffic with ~40-byte > headers and no XDP etc. > > > > > The single coherently allocated region for all headers reduces > > IOTLB pressure. > > page_pool pages are mapped once at allocation. > > > > > It is possible that the alternative model is faster. But that is not > > trivially obvious. > > > > I think patches like this can stand on their own. Probably best to > > leave them out of the dependency series to enable XDP and AF_XDP. > > You can't do XDP on DMA coherent zone. To do this memcpy(), you need > allocate a new skb with a linear part, which is usually done after XDP, > otherwise it's too much overhead and little-to-no benefits comparing to > generic skb XDP. > The current idpf code is just not compatible with the XDP code in this > series, it's pointless to do double work. > > Disabling header split when XDP is enabled (alternative option) means > disabling TCP zerocopy and worse performance in general, I don't > consider this. My concern is if optimizations for XDP might degrade the TCP/IP common path. XDP_DROP and all of XDP even is a niche feature by comparison. The current driver behavior was not the first for IDPF, but arrived at based on extensive performance debugging. An earlier iteration used separate header buffers. Switching to a single coherent allocated buffer region significantly increased throughput / narrowed the gap between header-split and non-header-split mode. I follow your argument and the heuristics are reasonable. My request is only that this decision is based on real data for this driver and modern platforms. We cannot regress TCP/IP hot path performance.