From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 942FFC4332F for ; Tue, 12 Dec 2023 14:27:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EB2E310E5D4; Tue, 12 Dec 2023 14:27:07 +0000 (UTC) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64CD010E5D4 for ; Tue, 12 Dec 2023 14:27:05 +0000 (UTC) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-54dca2a3f16so10521025a12.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=lists.freedesktop.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=lTM3YYYFhPQJUwwtzZ0qLVn5ey6KvGpLnn2vBQzVt1u2P4Us1T2k3+NkikL7FkEgJ/ dCUWogDi/JdX61/9rsPhqm8Jg04KM3NApWPskcXrM3Hvm2/K1QE49QanZHO/4pty7sss S6a+ndLhA6+53VhpuAPyCfnGzs9+21nX46FmwzHokwc1YVKP5mN+5VlYS07LPlsiIKqZ HSCcmISrsbstE8oloZhS5J80eRrtNJJuWePXQvZXF/zK/S6pq/uwfsvDrw5BGrgQncf3 hvNaj8mOZXW9xOCVHrrCQGYSuAXqoe05mtXyiqMrjw0IkJoLDniCPz1A1Pz9weGlpbac dtug== 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=a5QgEbGzu7ry83y4cWpIwG2L++S1mGYbyMROxukieroUBbcyK9Oor8K7TySfWk22PO VidTqWietXaIGipD96qlGY3EfiaS/5EfDCgVenSA4+P8erogJ2azWAojrloDVu0tJfBb HZYHGIiJDaDJQ1ZUD7ZfAlJXjYkWB5yB5VuO6p0zpMjF5gims97z84ZvLxj59HAz2A5O tSd5M11xP25QbX9zxNTEMzlHI8kfqdcGJtJ5b4d/7wXyYnfdidBikI3FKwwKQOwOrLNY 0OrY7ynHSwoHGUjhoR/F9XurcjhFufp8gSkz4YuNNj4XadE882M1jNBCOJuxMO1jotOL SpAQ== X-Gm-Message-State: AOJu0YxXyIEKfWgIcqNeDQUIUcq7N+9DTHRjYoau5lwTYqCBtr9taH+m 2kM7q9joXZg+lLvu7huURWqXTPPJPExV4Sz+C+cFug== 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) 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, Kaiyuan Zhang , dri-devel@lists.freedesktop.org, Eric Dumazet , linux-kselftest@vger.kernel.org, Shuah Khan , Sumit Semwal , linux-arch@vger.kernel.org, Willem de Bruijn , Jeroen de Borst , Jonathan Corbet , Christoph Hellwig , Jakub Kicinski , Paolo Abeni , linux-media@vger.kernel.org, Jesper Dangaard Brouer , Arnd Bergmann , Shailend Chand , Shakeel Butt , Harshitha Ramamurthy , Willem de Bruijn , netdev@vger.kernel.org, David Ahern , Ilias Apalodimas , linux-kernel@vger.kernel.org, =?UTF-8?Q?Christian_K=C3=B6nig?= , Yunsheng Lin , Praveen Kaligineedi , bpf@vger.kernel.org, "David S. Miller" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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