Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp23836lqm; Tue, 30 Apr 2024 11:30:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXrjoXFjlDl8P4i5KzvCCMTUuThan5UhbzfPAOIXeJdbOuI1qG3ImBX9YAo/Y9WzI+atEyVfP1pFCPdxBs02mWDyGs/CFQDdm82B+lPEQ== X-Google-Smtp-Source: AGHT+IEyLTJxWoJFNPlvPE902elUlG7WvIfuoIjWuN6nSJvQ+vcRxIogmYF8ZvBFc3ygjdzTpR+W X-Received: by 2002:a05:6512:6e:b0:515:fc44:b3f7 with SMTP id i14-20020a056512006e00b00515fc44b3f7mr218157lfo.24.1714501809260; Tue, 30 Apr 2024 11:30:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714501809; cv=pass; d=google.com; s=arc-20160816; b=rJlgVuKKA2CnpRlMCaV5gvqWOwDl0+CsTvksRUKP+b5qDlNwhuW0mqxWQkdDx4OUhy +BQaqS8NwGylHvK7fCSeKK4v9RSL+VHVU45QgB/RlW/rohOg9wjTE9FwHrdzWvxqPEeG ZM5nKb9ul7uzNz5t1gYJNrqek+/jeLl2Gsk04vMqtFbRE7NLDGs/vs/NbuMuZTykof61 17g1pmS3hBxXmoM4xh84pgBmjN2lPbmlRUDCCA5sQE4EYFb4h3IOitGgFfKlX/UMO8tH qbJJsRtKQBq1ri1WPgz4zPMuVcAVkzGG3GyrtjdgNWgFOi/oXD7ZGvtDPDiXhubAiASt 3aQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=l1aj9TYKSBdPXW7U/K10knZmptyDbqlwkvpIjAvkFLw=; fh=2j3Pej8xY6QNQpCvrfdiVtUi9Nka4Dre08YQZ1FpKvk=; b=DPgTK0Ceq5Noracel0HlIaFlPAoHiwkJd/wxsbrcbvGSFCeyWEJ1qaqn0LiO7xcD7u e5sgbYNTuEYCNN2dJoM95drtHRqIPTwRcvUCG2CUBDLjggzM/99hekXo5G/kPatwMB6S OKmlxnbU5S+w1TCl0cE7QMrHoSYW2XPHeXC0GKvZXJ8har5LLRGm+XBj1Ha+PIt3wDh2 7q9VtO1VF/Xvx0Ar7CzLBiqbBezaPJSFch7+FP93FTPeikI4O1cdohYWgoWuBRNdHy3+ tS6RWHcn+7bQIxmEasIIhdQMJfDQ14fJbkTj9GkusnYbzeaZ5EkFyqbTIlUj2a86b72R fx8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=uQNkA40U; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-164587-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164587-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o22-20020a17090611d600b00a58ea693f5dsi4176684eja.408.2024.04.30.11.30.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 11:30:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164587-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=@google.com header.s=20230601 header.b=uQNkA40U; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-164587-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164587-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 am.mirrors.kernel.org (Postfix) with ESMTPS id CC8E11F25085 for ; Tue, 30 Apr 2024 18:30:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A23361836D1; Tue, 30 Apr 2024 18:29:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uQNkA40U" Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 AA0351836EB for ; Tue, 30 Apr 2024 18:29:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714501790; cv=none; b=YGCbBgp0Mki2Rrzly9uNcM8QtIXBSmTuw2P++0q4kiAhh/KD1c6qtLkvZBfiOLC5vezr55zlnhLveNH85FvcWrRONYkTCjoLcdhpeNU40gpIBOhgy+5YOmIXH6iv56TwUIkEah8spi6rvPJ3EU4G4m7zpg5dVWjv9+Qk1kpr2+M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714501790; c=relaxed/simple; bh=4qmsTK6gsAp5ggmO11EIahCqaDERkMqdREmKHL1EhBY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=u3TC2kH/FgHIkyTS6tPnT6LkSA2LyYP6w+sYULYmXTaZBaDEsaDqObN8+2Qsm5r2LncsIBnVmm62LA1uxPQGCkzMqFXAP0AqyA5K4CrXUYCDja/gmAjZiCmZAZmZM28sPRsccI2lokiVeHue3PKa6t/dILGTMcKJfldW4dWu538= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uQNkA40U; arc=none smtp.client-ip=209.85.208.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2e0a34b2899so28019771fa.3 for ; Tue, 30 Apr 2024 11:29:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714501787; x=1715106587; darn=vger.kernel.org; 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=l1aj9TYKSBdPXW7U/K10knZmptyDbqlwkvpIjAvkFLw=; b=uQNkA40Uv+64tJUyAefZWORZ0K+RgW2c5ariOT3Gye0uRCur7O5X3Gn1e9MlnwaC9k 4N46pXEsc/htnCzwsrewkLoXD8Q3cY594QxvtatRbs9utARfDfdHirspzubeicVw3HJF VmjCOS4j5A7gGC+Hzd9FAnU2Ss2siq4jDjvH1im3GGteLySjS1ETNS9ArCOz8RSL/DJd EtIqpVID8YdfV/7uYqER445NWCiJSpgp0GdcGsj7mO0EvcdG784607wO0IguFyXP4Dka 7ISIY488W0EqU4Y/slwRbM8bFJ2Y9BcM6zXG5JxUFTqdiGoK76x4u2p6/61HUi1Q2fAl Z6iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714501787; x=1715106587; 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=l1aj9TYKSBdPXW7U/K10knZmptyDbqlwkvpIjAvkFLw=; b=EsITqs7MfkdFXc/u3plW7slzvJfu2i435ECqK+EcVSdpFVxxbRnDc15WJzTewP8Y/h muMtnXhHFbybJyhsJLHCR4lzvEyPDnaWbmvqL+wclyFBGCXVzzVMCwBh+KsaaddUbVjz aE7gCa8RNkwo8e9XsqQO+cipLRFjzvUqHN8auqgv81xB6JyX88XckEvFfakH88JBa3Tt Kr0loe9QNeGGPc1pAmQ4i26v+OVh4AiNJaDbNhDcwNaEuVSQh8CxaVHrQuY9ewyWTWvS s1lov8oE84oyn4PUD6Yql50kbiqBnW9EubBd1UUTY1vvyEidTaNGbQy3qvRrQFmNyQZh 26ig== X-Forwarded-Encrypted: i=1; AJvYcCUoNIjoLUsf09u4+68XD5+Sb2hLI+ncYANcveF3UhRnskMG77Hc9RZco2Q15MGVN2w2E1EdJ8eAvxsqqdXqswxTPGv0g+3rDxZBGMfc X-Gm-Message-State: AOJu0YzVoLp9tOS+PzUCplly7umqXmOz0ZdR7VICyqKjb+djwrg/pE/r aqWnyfb4U2vnMea3Cb8nuiP4L49Edk1MsE6eGDEJ2qwqkunGw3C++QZTqw1Wvd086dOuBNn7vz9 A5RI0Nb8K8lFYvbTy6jX/wwSizKhhTvFtraDG X-Received: by 2002:a19:ca1b:0:b0:51c:d05b:6b8d with SMTP id a27-20020a19ca1b000000b0051cd05b6b8dmr194410lfg.23.1714501786252; Tue, 30 Apr 2024 11:29:46 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240403002053.2376017-1-almasrymina@google.com> <20240403002053.2376017-8-almasrymina@google.com> <8357256a-f0e9-4640-8fec-23341fc607db@davidwei.uk> In-Reply-To: From: Mina Almasry Date: Tue, 30 Apr 2024 11:29:31 -0700 Message-ID: Subject: Re: [RFC PATCH net-next v8 07/14] page_pool: devmem support To: Jens Axboe Cc: David Wei , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-arch@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Andreas Larsson , Jesper Dangaard Brouer , Ilias Apalodimas , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Arnd Bergmann , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Steffen Klassert , Herbert Xu , David Ahern , Willem de Bruijn , Shuah Khan , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Amritha Nambiar , Maciej Fijalkowski , Alexander Mikhalitsyn , Kaiyuan Zhang , Christian Brauner , Simon Horman , David Howells , Florian Westphal , Yunsheng Lin , Kuniyuki Iwashima , Arseniy Krasnov , Aleksander Lobakin , Michael Lass , Jiri Pirko , Sebastian Andrzej Siewior , Lorenzo Bianconi , Richard Gobert , Sridhar Samudrala , Xuan Zhuo , Johannes Berg , Abel Wu , Breno Leitao , Pavel Begunkov , Jason Gunthorpe , Shailend Chand , Harshitha Ramamurthy , Shakeel Butt , Jeroen de Borst , Praveen Kaligineedi , linux-mm@kvack.org, Matthew Wilcox Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 30, 2024 at 6:46=E2=80=AFAM Jens Axboe wrote: > > On 4/26/24 8:11 PM, Mina Almasry wrote: > > On Fri, Apr 26, 2024 at 5:18?PM David Wei wrote: > >> > >> On 2024-04-02 5:20 pm, Mina Almasry wrote: > >>> @@ -69,20 +106,26 @@ net_iov_binding(const struct net_iov *niov) > >>> */ > >>> typedef unsigned long __bitwise netmem_ref; > >>> > >>> +static inline bool netmem_is_net_iov(const netmem_ref netmem) > >>> +{ > >>> +#if defined(CONFIG_PAGE_POOL) && defined(CONFIG_DMA_SHARED_BUFFER) > >> > >> I am guessing you added this to try and speed up the fast path? It's > >> overly restrictive for us since we do not need dmabuf necessarily. I > >> spent a bit too much time wondering why things aren't working only to > >> find this :( > > > > My apologies, I'll try to put the changelog somewhere prominent, or > > notify you when I do something that I think breaks you. > > > > Yes, this is a by-product of a discussion with regards to the > > page_pool benchmark regressions due to adding devmem. There is some > > background on why this was added and the impact on the > > bench_page_pool_simple tests in the cover letter. > > > > For you, I imagine you want to change this to something like: > > > > #if defined(CONFIG_PAGE_POOL) > > #if defined(CONFIG_DMA_SHARED_BUFFER) || defined(CONFIG_IOURING) > > > > or something like that, right? Not sure if this is something I should > > do here or if something more appropriate to be in the patches you > > apply on top. > > In general, attempting to hide overhead behind config options is always > a losing proposition. It merely serves to say "look, if these things > aren't enabled, the overhead isn't there", while distros blindly enable > pretty much everything and then you're back where you started. > The history there is that this check adds 1 cycle regression to the page_pool fast path benchmark. The regression last I measured is 8->9 cycles, so in % wise it's a quite significant 12.5% (more details in the cover letter[1]). I doubt I can do much better than that to be honest. There was a desire not to pay this overhead in setups that will likely not care about devmem, like embedded devices maybe, or setups without GPUs. Adding a CONFIG check here seemed like very low hanging fruit, but yes it just hides the overhead in some configs, not really removes it. There was a discussion about adding this entire netmem/devmem work under a new CONFIG. There was pushback particularly from Willem that at the end of the day what is enabled on most distros is what matters and we added code churn and CONFIG churn for little value. If there is significant pushback to the CONFIG check I can remove it. I don't feel like it's critical, it just mirco-optimizes some setups that doesn't really care about this work area. [1] https://lore.kernel.org/netdev/20240403002053.2376017-1-almasrymina@goo= gle.com/ --=20 Thanks, Mina