Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3199984rdb; Thu, 16 Nov 2023 03:11:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTS+yr7TQA8Gmw37pZEKdBVdh3MlrzfXnxfQMAMD2ANNgLr0fQ4QeYQc37K/rd+g+VHhFe X-Received: by 2002:a05:6a20:2589:b0:16c:b5be:5f6c with SMTP id k9-20020a056a20258900b0016cb5be5f6cmr13742623pzd.54.1700133094095; Thu, 16 Nov 2023 03:11:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700133094; cv=none; d=google.com; s=arc-20160816; b=E/0N6iUbBNsbBzE/mmCCuCPj9v/u3tDkmUE3xju4GPH4VkPomYi6yMEr8aY2/p6o+O nabA+GdkNAGZVTimNtNgZ2duPZ5rAWebasJQTPrL6hAOa4jSwlpu3Kj4jHWxlOzVDiz6 S0E3gPrDAPBRz5nD1AUDXA+qjrR1qj6G+IckV8pLCUh9yOO7OGdK02h1flYd0PkvAbzP w1XjE02b7veJpjbHzgZfMYDZGamELmc+0Xuif7jK+5PtwbTElawd129Ws1ZuCSzZaq7s 6d/0FDPtx4uUbbQKsu9oQA8qWnCJkf35eXHolF1HCBTwdrLe2GQoXY6IaV/1fPpW/i4b B3Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=qnm52Ta4dNVczGsdakLpT8WhxXkmvZ5dNKnfNIVHQpg=; fh=kCCFXBJ+ZbBHWINkJFqJ5N6H/9vHboLtzIjweoTeaNg=; b=0yeIGN2Y9903cvCc+qTWJFFhIbdpFR4EyyyMApVSWsbVh0y0ZnsgxNYXHJ2+EjHIW/ PKE+VSi0ZV7lsXCMPEMmN172d99i5SxxKWWYcZBHmvPwvIGLqRd0nXCROw78eXrtsfWI q2FlFrQ19xqbVPYGszxUSXnmKvvCwrGAjeq1NIAON3+qjERySdtn28i/jyNvhQRE+84i GKAARIbuwb3/EEX/63g+NhJY9i/6g9HwFxMyQxI6EMOgw3jYd6f/rXROR0f5dq34gZy9 wt2Zdxp947D5JsAQ1VJ3TyhvWRUMMh5GCulSfwDgbI/GpDZkdraD/8RCXjDkFqirIncN 29Gg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id z11-20020a1709027e8b00b001cc54202425si11609202pla.409.2023.11.16.03.11.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 03:11:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id ECBA3808FBDD; Thu, 16 Nov 2023 03:10:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345082AbjKPLKY (ORCPT + 99 others); Thu, 16 Nov 2023 06:10:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbjKPLKN (ORCPT ); Thu, 16 Nov 2023 06:10:13 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD8641991; Thu, 16 Nov 2023 03:10:04 -0800 (PST) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SWHKX3FJ1zsR46; Thu, 16 Nov 2023 19:06:40 +0800 (CST) Received: from [10.69.30.204] (10.69.30.204) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 16 Nov 2023 19:10:01 +0800 Subject: Re: [PATCH RFC 3/8] memory-provider: dmabuf devmem memory provider To: Jason Gunthorpe CC: Mina Almasry , Jakub Kicinski , , , , , Willem de Bruijn , Kaiyuan Zhang , Jesper Dangaard Brouer , Ilias Apalodimas , Eric Dumazet , =?UTF-8?Q?Christian_K=c3=b6nig?= , Matthew Wilcox , Linux-MM References: <20231113130041.58124-1-linyunsheng@huawei.com> <20231113130041.58124-4-linyunsheng@huawei.com> <20231113180554.1d1c6b1a@kernel.org> <0c39bd57-5d67-3255-9da2-3f3194ee5a66@huawei.com> From: Yunsheng Lin Message-ID: <0a1cdd5a-c4c5-3d77-20a2-2beb8e3a6411@huawei.com> Date: Thu, 16 Nov 2023 19:10:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-3.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 16 Nov 2023 03:10:55 -0800 (PST) On 2023/11/15 21:38, Jason Gunthorpe wrote: > On Wed, Nov 15, 2023 at 05:21:02PM +0800, Yunsheng Lin wrote: > >>>>> I would expect net stack, page pool, driver still see the 'struct page', >>>>> only memory provider see the specific struct for itself, for the above, >>>>> devmem memory provider sees the 'struct page_pool_iov'. >>>>> >>>>> The reason I still expect driver to see the 'struct page' is that driver >>>>> will still need to support normal memory besides devmem. >>> >>> I wouldn't say this approach is unreasonable, but it does have to be >>> done carefully to isolate the mm. Keeping the struct page in the API >>> is going to make this very hard. >> >> I would expect that most of the isolation is done in page pool, as far as >> I can see: > > It is the sort of thing that is important enough it should have > compiler help via types to prove that it is being done > properly. Otherwise it will be full of mistakes over time. Yes, agreed. I have done something similar as willy has done for some of folio conversion as below: +#define PAGE_POOL_MATCH(pg, iov) \ + static_assert(offsetof(struct page, pg) == \ + offsetof(struct page_pool_iov, iov)) +PAGE_POOL_MATCH(flags, res0); +PAGE_POOL_MATCH(pp_magic, pp_magic); +PAGE_POOL_MATCH(pp, pp); ... Not sure if we need to add new API for driver to use when the driver need the devmem support yet. > > Jason > . >