From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UIduafO1" Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C132FD for ; Tue, 12 Dec 2023 06:27:05 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-54dca2a3f16so10521019a12.0 for ; Tue, 12 Dec 2023 06:27:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702391224; x=1702996024; 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=bCZPRFlYELlSqnd7f+LApbuWWSOTUwHuWf2lhre3cTY=; b=UIduafO1DT3E/9yl00OWV+EjecVJ2FWvoAE4REaS2pOQdZ5ihOPnmfePL8xZYamHU+ 0bXdkQaFPcH+FNZUpV7sZkEfd1gxLFPT7iafcK+X1tDXmEDEmcxRpFnLgOAi5rKjJSJE kPh9hyCUmvQcO6XQlE9+02ZQ9DAaghh/c0BDDAnoU0hXa9ki1ZKwacHa16PIjHxqmaqU wx1GQSmZ2SY8SXxd7oAzT5MhZ2IaE6sVCFpAlw4lA3vJU6CF9WDBKObpxNNV3XxiTls4 qYzMjNmnbxO2y0Fdcv2yT4IOj3kaBYFvTAcGYv5O4HzqMn0R7j8VITzuWnP+Jdg5UaMy +51Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702391224; x=1702996024; 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=bCZPRFlYELlSqnd7f+LApbuWWSOTUwHuWf2lhre3cTY=; b=skMptx5IM5fw+GFdCFBStTt2ak0ZXVrE+GMErIKNjAeaOr/YL9b1SmDWJHS50cuY6y RQourpZmpbumlDrZBD+RFguqHpjYpkFPYlHeGZpHDoSLittfUsyKfAcvtdmgkRv8FAvG frvfk0LrUPjWBDht2AUIHGbfN8ulDA7hIRJC/3IAXm9pS0mGSZ6aVyxvE3aUOhfxE/T8 q3kODpmULAAKozB33waA6PnyVCVCh0dFQTayPv/0nNP6RzgcqXX2QRxAZDHDbNRt1Zhk ee7vBp0UYyKo/Umv2bz64y17hbGoJwI244o7vxE6d2xsrwV9QpfVH1Vfs8QOXrJIBGq3 X6gw== X-Gm-Message-State: AOJu0Yx+nUdt5r5MCMPwB76PsAst4aK31TwG+4deHMKocd2TPf0k1kkW addF3auV2L1TPgsK7DSFLjeisBiri50wPvBHOW/Jtg== X-Google-Smtp-Source: AGHT+IEOyCkF2DgwL7RBhVnTjCksBIhJaDTVsJX1VcMmek5dl3277Sns8cp70gbrdUy6r5MpVMdk0OJS5kwbSqhfdhU= X-Received: by 2002:a17:906:51de:b0:9f2:859f:713e with SMTP id v30-20020a17090651de00b009f2859f713emr7079811ejk.3.1702391223630; Tue, 12 Dec 2023 06:27:03 -0800 (PST) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231208005250.2910004-1-almasrymina@google.com> <20231208005250.2910004-9-almasrymina@google.com> <20231212122535.GA3029808@nvidia.com> In-Reply-To: <20231212122535.GA3029808@nvidia.com> From: Mina Almasry Date: Tue, 12 Dec 2023 06:26:51 -0800 Message-ID: Subject: Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider To: Jason Gunthorpe 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 , David Ahern , 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 , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Dec 12, 2023 at 4:25=E2=80=AFAM Jason Gunthorpe wr= ote: > > On Thu, Dec 07, 2023 at 04:52:39PM -0800, Mina Almasry wrote: > > > +static inline struct page_pool_iov *page_to_page_pool_iov(struct page = *page) > > +{ > > + if (page_is_page_pool_iov(page)) > > + return (struct page_pool_iov *)((unsigned long)page & ~PP= _IOV); > > + > > + DEBUG_NET_WARN_ON_ONCE(true); > > + return NULL; > > +} > > We already asked not to do this, please do not allocate weird things > can call them 'struct page' when they are not. It undermines the > maintainability of the mm to have things mis-typed like > this. Introduce a new type for your thing so the compiler can check it > properly. > There is a new type introduced, it's the page_pool_iov. We set the LSB on page_pool_iov* and cast it to page* only to avoid the churn of renaming page* to page_pool_iov* in the page_pool and all the net drivers using it. Is that not a reasonable compromise in your opinion? Since the LSB is set on the resulting page pointers, they are not actually usuable as pages, and are never passed to mm APIs per your requirement. --=20 Thanks, Mina