Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2554766rdb; Fri, 8 Dec 2023 11:28:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDT+UMLSN1uxdnMFMBGewOB0/G4CJWqKkpJxL8cxfxTgb/c1/8+CM4gLPcve9CekNcFd19 X-Received: by 2002:a17:90a:a581:b0:285:a1fb:4ffd with SMTP id b1-20020a17090aa58100b00285a1fb4ffdmr549844pjq.1.1702063690583; Fri, 08 Dec 2023 11:28:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702063690; cv=none; d=google.com; s=arc-20160816; b=KG0zx/nnIXyQ4fHLXgrVxdmOs4u4ES6mo13cW6J+TZmPYAdDl8uL1yTZvQnVjgbhhc awWkBnZm8EDResOSOIl2vbZ/Zi9Apkhw0nvMDuIdHR+9MxILaGhgnvkV7vL11HZMpd8B QVSouoK+mtKMzr4C1M2XgmOXcSEW1UwUTwQjJG+A00gDDd3m88hC55QDgu3XGskhdfdD 0EakUrO+dDYZp0wma4JVZUranvuocNry7D6GFLfkOkNkk6zkRegJto+frxqcCt3knIZk hFN+gli79xhYiH6K2Faqy37sGq/hSdZ6JmqMycB58FrOm3zgHEUdNOpAKhaeSvjaLtf3 N1hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=l8NyCuiiYgH2NC+1+G5jDZqmw10slLAD5tJccxA3IOU=; fh=3vdDtv+sUddP2wEEeB9sfn0I6QTRYGCWb3VYJk0Hkkw=; b=OklRTds9Ktm4+pRngVe18yESlgnz77fYJE2pOatZMhtMrUL5wzJ92+DDbbwnY/yg7i KtsHhnuRPJ/KYBwBhDhZhe3oDNVTf1W/YSaLH4H8/ymqCFWkoMARElj1vMTb+w39XhY1 WWlj1T3BR4q/72sFIjwFzakImg/PZsCyoykmKDxB8KB61kw2ddxqW3X06mLPEQTwGuw/ +LKsrHnkmicIfnCAImZgTIh1q94snBU55FESjAtT7Eyxj/S7V4IaZp1v5ulAqsQXKa0g juN3HAAi71YPevfes1H+/IsaDKH7nMj5rOquZgrEpaxbeKWpKQ/5V3rsecUolmOhl80E 9rnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wn+1Kwpq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id x8-20020a17090a0bc800b00286a297bfd4si3233103pjd.127.2023.12.08.11.28.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 11:28:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wn+1Kwpq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 059D6834BA52; Fri, 8 Dec 2023 11:28:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233856AbjLHT1z (ORCPT + 99 others); Fri, 8 Dec 2023 14:27:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229572AbjLHT1x (ORCPT ); Fri, 8 Dec 2023 14:27:53 -0500 Received: from mail-vs1-xe34.google.com (mail-vs1-xe34.google.com [IPv6:2607:f8b0:4864:20::e34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54AEA171D for ; Fri, 8 Dec 2023 11:27:59 -0800 (PST) Received: by mail-vs1-xe34.google.com with SMTP id ada2fe7eead31-4649c501c1fso674301137.2 for ; Fri, 08 Dec 2023 11:27:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702063678; x=1702668478; 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=l8NyCuiiYgH2NC+1+G5jDZqmw10slLAD5tJccxA3IOU=; b=wn+1KwpqOUvxlWkstW/oLVbPJnEIbHmb7s+/7bNNdsLzC5es3QyjG7Brk00hx3A6mh OIStZpmgQX/LMTKzWJqSZz4j0zw4pQUGBKsOQFf9DKFAVfSpdNo1H/KXlBmGtl2H0j+U 9KwWuVdPoPr5D1mbz0YJDqfPoZgz2rYqKu2cZppU9/+B0WqEpFpkLZlrLJvpMc5JVKjw RlHM68qjUHN7ZsT+fZl55v0QgcUIRlyYMukcCCqMvenFm3i+rl6ShntIlQ8m4OHbPLw3 PEjbCV7s9dQKS+JQ4ri+ztcXrYEzdoSCIpqUuO+J4s0aUh/43HpTTpthoYyVf5D440YC MKtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702063678; x=1702668478; 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=l8NyCuiiYgH2NC+1+G5jDZqmw10slLAD5tJccxA3IOU=; b=XcxiRm/5pK2WXwjXgp911GcCt/OAIm6TJ79JJbPWkV9UYcYt957fpJg5vCbeJCbtUv WQ1Mpi2TnvbEm7QTOnpN3clrw78qbsUqnPLM89BI6kq3QoIAduwkiAFVF7t3nZua/v68 XVcwbg7WhensYe7EZuokpNVgSIJ6QmWgMziaeeNlggFfRFoI/VuhvlhkdnGCv4VdfEKv Dzrb17X84ndwlmkeYTuwGU/E3goGsoQfpL7CBTBlmQZ0nfQ3EVK6kqX50J/jhAdJMeZl HBciMzEM1mFkSgMMqVNqwkl3RniDhsaH0j25RHl3K2CpXL1pRjLkljoCZ9mblh9ePVF4 dpKg== X-Gm-Message-State: AOJu0YyuJYGP71YxwdwAlbBrrJDDyx+Xjc21M5KBC6LkABJvcHiz4Rqj miL0ybPz++jMIXHRqNztUPJeQPFnPmIyZn0AiyMPeA== X-Received: by 2002:a05:6102:6ca:b0:464:944d:44de with SMTP id m10-20020a05610206ca00b00464944d44demr731655vsg.27.1702063678195; Fri, 08 Dec 2023 11:27:58 -0800 (PST) MIME-Version: 1.0 References: <20231208005250.2910004-1-almasrymina@google.com> <20231208005250.2910004-8-almasrymina@google.com> <462da4bf-34f8-40c4-8772-9850b3127baf@kernel.org> In-Reply-To: <462da4bf-34f8-40c4-8772-9850b3127baf@kernel.org> From: Mina Almasry Date: Fri, 8 Dec 2023 11:27:47 -0800 Message-ID: Subject: Re: [net-next v1 07/16] netdev: netdevice devmem allocator To: David Ahern Cc: Shailend Chand , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, bpf@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Jeroen de Borst , Praveen Kaligineedi , Jesper Dangaard Brouer , Ilias Apalodimas , Arnd Bergmann , Willem de Bruijn , Shuah Khan , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Yunsheng Lin , Harshitha Ramamurthy , Shakeel Butt , Willem de Bruijn , Kaiyuan Zhang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 08 Dec 2023 11:28:08 -0800 (PST) On Fri, Dec 8, 2023 at 9:56=E2=80=AFAM David Ahern wro= te: > > On 12/7/23 5:52 PM, Mina Almasry wrote: > > diff --git a/net/core/dev.c b/net/core/dev.c > > index b8c8be5a912e..30667e4c3b95 100644 > > --- a/net/core/dev.c > > +++ b/net/core/dev.c > > @@ -2120,6 +2120,41 @@ static int netdev_restart_rx_queue(struct net_de= vice *dev, int rxq_idx) > > return err; > > } > > > > +struct page_pool_iov *netdev_alloc_dmabuf(struct netdev_dmabuf_binding= *binding) > > +{ > > + struct dmabuf_genpool_chunk_owner *owner; > > + struct page_pool_iov *ppiov; > > + unsigned long dma_addr; > > + ssize_t offset; > > + ssize_t index; > > + > > + dma_addr =3D gen_pool_alloc_owner(binding->chunk_pool, PAGE_SIZE, > > Any reason not to allow allocation sizes other than PAGE_SIZE? e.g., > 2048 for smaller MTUs or 8192 for larger ones. It can be a property of > page_pool and constant across allocations vs allowing different size for > each allocation. Only for simplicity. Supporting non-PAGE_SIZE is certainly possible, but in my estimation it's a huge can of worms worthy of itss own series. I find this series complicated to implement and review and support as-is, and if reasonable I would like to punt that as a future improvement. At the minimum, I think the needed changes are: 1. The memory provider needs to report to the page pool the alloc size. 2. The page_pool needs to handle non-PAGE_SIZE memory regions. 3. The drivers need to handle non-PAGE_SIZE memory regions. Drivers today handle fragged pages, but that is different because it's a PAGE_SIZE region that is fragged. This is a non-PAGE_SIZE region in the first place. 4. Any PAGE_SIZE assumptions in the entire net stack need to be removed. At Google we mostly use page aligned MTUs so we're likely not that interested in sub PAGE_SIZE allocations, but we are interested in n * PAGE_SIZE allocations, but, I hope, in a separate followup effort. --=20 Thanks, Mina