Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp417610rdb; Sat, 16 Dec 2023 14:07:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IF25GU1rVXAOdJXSJgrtFmQDTyhGeYy4sz1VzXKEFnmp5NBBwQwPfPLXxn2zJkyat6RkFAy X-Received: by 2002:a17:902:bb8f:b0:1d3:8341:b928 with SMTP id m15-20020a170902bb8f00b001d38341b928mr3271182pls.115.1702764428555; Sat, 16 Dec 2023 14:07:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702764428; cv=none; d=google.com; s=arc-20160816; b=a+prgULAgYSS546y6LDbKNtjbUJCAnYLF4VrZ0xHprrVGjvdTIoXSx3VJLWviPSF+S R5OwuMlRoQeQjp9h6hQW1BvD/3RLE4v6emAKnRJaS2dlftjN4nPZvL8WAHPjP0NYLrAE AKpq3E1dlzrgh7PN32mlSV7W1kLxPqq6bWJ8QhqFISyH7iyQdlg23IqAPs/+oieaer9O DSytoI7woCyZQ4DHd/BBkQIgc2rCf7GUT1yorUfxWf+NwQdbe2Z15DXYTq5ob3xlwCCO b1KnROyiQUreL6znUw1MwgAWlEHbP/gOOPj7Psoy0aFMAsIZC8ZqX1V+etUzg/OFNzpE Il3A== ARC-Message-Signature: i=1; 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=+A7W+kQw39I0W+Av8fUPMRQeHZ3+3clgt7HAcEmlw4M=; fh=OfLTHDC0vaGtIpyp3kspSuh1JNSG2zLbx1m74UejaC8=; b=SDeL6gegaBDx5Jqi+6IF6SIyk5MYBK4BW1dQuMnaRk+BvvAAkdaCU1EcHRZ/xWEwzn BUhUbuJGo+K3DeWu7QyG3abfx+3cYcDvaT9m9yOjXfTEnPNw+sUjdtKWv5+B/jfnt3Ma kptdlAb5NrF10CPRvKfJvPp4fw3nMvT50gLko4Ooi36xCuxOecySq4+MQGUB8XB2+qU3 jS7nAd+2d2i5m4VKWwZnoU9xpsydAvjf1xxMqiv/PAVODD2wb++QP3CiTkY9upoeJpLU HP7DP3ph2j5kszuGf4qO1yYOQ7K71Ntx98XRLR0sXFvAfe3QqtjS7UA3YlqkJ7VEZKGD n5QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=lLU0lYDS; spf=pass (google.com: domain of linux-kernel+bounces-2380-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2380-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b17-20020a170903229100b001d381846edesi3567597plh.25.2023.12.16.14.07.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 14:07:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2380-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=@google.com header.s=20230601 header.b=lLU0lYDS; spf=pass (google.com: domain of linux-kernel+bounces-2380-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2380-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 34DCE2849F5 for ; Sat, 16 Dec 2023 22:07:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4A47358BA; Sat, 16 Dec 2023 22:06:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lLU0lYDS" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (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 61E2D34CFD for ; Sat, 16 Dec 2023 22:06:53 +0000 (UTC) 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-ej1-f41.google.com with SMTP id a640c23a62f3a-9fa2714e828so211545166b.1 for ; Sat, 16 Dec 2023 14:06:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702764412; x=1703369212; 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=+A7W+kQw39I0W+Av8fUPMRQeHZ3+3clgt7HAcEmlw4M=; b=lLU0lYDSOvL7Pdd2ht480XXWFbTog77uJW3GTfVxty9Yo6ftdBe0qIAvqkxneVS8iw su0w5Q+ZgOL9reXN36S6iswgCRkkzJpOgZL1tkEHTPF5aC/6gPgsjfFlFsV9uy2lOvNa CliMKrSAutKrFZTp2jJ1NQ1jxdY/Rw9s2yUIeUtrOgdqbaMpQ1/448fznFnXN+W9V2Ib yT8JWrMA0TRzIFxIn/wS8aFice/kLFTkekGFkJuZpP1MVvH1KXVUuYrvZNBawl/Uwbwj bYOGEtIU/RCzWJ+bMRfLcFJaOfy7T38M+WdmyKnfaddKScHuw0BoB20QzKDZzgD3BXMc 7q9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702764412; x=1703369212; 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=+A7W+kQw39I0W+Av8fUPMRQeHZ3+3clgt7HAcEmlw4M=; b=kHAg2bLSL1F3RtgnBI2ApP9TemwyPXfTxqP/xoukVFmP5TXQwTZxtuhb9/s8bcGi6U pr1ZNF8ZqMv1zNZ8GpkmXTAwmjSIEu3ut61LruO2N8u1i/FNsCFp2Cw84whjZR5mkNcX RHQp/wgbV02mRLoysSoexolf7AXHqdKXxF6FWwLjmrCwR/QLXXq1YQMMMNgoI6kdQ24S Djxjndtz7A/bJ/XqAZ4AA3ARLDjsSAhcvuXwxjBRznG/PQ47c8oIdWB4BCUkJ4B0Dv0f YM3jLxlzrBNhCjlf5ZqDwenbvxTx3haSGV3Wly7PMG8ddl5lY7LW2eE2C0YtwgLqZPY1 HlJw== X-Gm-Message-State: AOJu0YxW/6Qh/sHDuNXN7fW3l+rQWoD955X6izm4eRWAs4Vj7jv7o7sn yQj7ETSe6ieSgoAApU4AVd93GY97aiuVFwIPROoHkQ== X-Received: by 2002:a17:907:7d8c:b0:a19:a19b:55ef with SMTP id oz12-20020a1709077d8c00b00a19a19b55efmr7448815ejc.127.1702764411294; Sat, 16 Dec 2023 14:06:51 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231214020530.2267499-1-almasrymina@google.com> <20231214020530.2267499-5-almasrymina@google.com> <20231215021114.ipvdx2bwtxckrfdg@google.com> <20231215190126.1040fa12@kernel.org> In-Reply-To: From: Mina Almasry Date: Sat, 16 Dec 2023 14:06:37 -0800 Message-ID: Subject: Re: [RFC PATCH net-next v1 4/4] net: page_pool: use netmem_t instead of struct page in API To: Shakeel Butt Cc: Jakub Kicinski , Yunsheng Lin , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Greg Kroah-Hartman , "Rafael J. Wysocki" , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Michael Chan , "David S. Miller" , Eric Dumazet , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Wei Fang , Shenwei Wang , Clark Wang , NXP Linux Team , Jeroen de Borst , Praveen Kaligineedi , Shailend Chand , Yisen Zhuang , Salil Mehta , Jesse Brandeburg , Tony Nguyen , Thomas Petazzoni , Marcin Wojtas , Russell King , Sunil Goutham , Geetha sowjanya , Subbaraya Sundeep , hariprasad , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , AngeloGioacchino Del Regno , Saeed Mahameed , Leon Romanovsky , Horatiu Vultur , UNGLinuxDriver@microchip.com, "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Jassi Brar , Ilias Apalodimas , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Siddharth Vadapalli , Ravi Gunasekaran , Roger Quadros , Jiawen Wu , Mengyuan Lou , Ronak Doshi , VMware PV-Drivers Reviewers , Ryder Lee , Shayne Chen , Kalle Valo , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Stefan Hajnoczi , Stefano Garzarella , Shuah Khan , =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Jason Gunthorpe , Willem de Bruijn Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Dec 16, 2023 at 11:47=E2=80=AFAM Shakeel Butt = wrote: > > On Fri, Dec 15, 2023 at 7:01=E2=80=AFPM Jakub Kicinski = wrote: > > > > On Fri, 15 Dec 2023 02:11:14 +0000 Shakeel Butt wrote: > > > > From my POV it has to be the first one. We want to abstract the mem= ory > > > > type from the drivers as much as possible, not introduce N new memo= ry > > > > types and ask the driver to implement new code for each of them > > > > separately. > > > > > > Agree with Mina's point. Let's aim to decouple memory types from > > > drivers. > > > > What does "decouple" mean? Drivers should never convert netmem > > to pages. Either a path in the driver can deal with netmem, > > i.e. never touch the payload, or it needs pages. > I'm guessing the paths in the driver that need pages will have to be disabled for non-paged netmem, which is fine. One example that I ran into with GVE is that it calls page_address() to copy small packets instead of adding them as a frag. I can add a netmem_address() that returns page_address() for pages, and NULL for non-pages (never passing non-pages to mm code). The driver can detect that the netmem has no address, and disable the optimization for non-paged netmem. > "Decouple" might not be the right word. What I wanted to say was to > avoid too much specialization such that we have to have a new API for > every new fancy thing. > > > > > Perhaps we should aim to not export netmem_to_page(), > > prevent modules from accessing it directly. > > +1. This is an aggressive approach and I like it. I'll try to make it work (should be fine). -- Thanks, Mina