Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp442698rdb; Fri, 17 Nov 2023 03:28:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHd6qkkE/mpbzCF9gxOKl/mrhgYDa2eMqvIeweniXYb4NG9uGhAKLbBHgr4I60+diXn92f6 X-Received: by 2002:a17:902:7789:b0:1cc:6cc3:d9fa with SMTP id o9-20020a170902778900b001cc6cc3d9famr9396835pll.67.1700220489602; Fri, 17 Nov 2023 03:28:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700220489; cv=none; d=google.com; s=arc-20160816; b=n0pp1DmDq1InvKhXmhWGynnroel3EMFJ2xVFDm4wESB10a30eMX014/ErRqPoYaIHl kZZbZK6fF8cob4Z9o2QHMw/mKsuQaVXjaBYZzCuGlt+HG8jyHCPYmJWJZ9pTBUZcP3/H F+rLzuQnuXB79iaixrHXOuD9hOKBsA3u/Dg+Bowh8g/SiKx9oQL4UDjdAXWYYG74TMsO jeYsrckf8SpRMMGXkAO/vtClmMHSeNDbEu+3WhWhsXLsvlstOVNwCHpnhz0ESkIFTtGs Li5T/IdsGpFXOZwsCxn7O6uPfKiqY0f3IvJ+GAT1pyZP9OfpW1vi6mybdYkNuU4HPYj8 5+vg== 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=1+aDr+EhSKk0qSbfAZXZp2e0RQxYMzKfdq2ztv95+Ks=; fh=fkynkL3yuvQaVTKhvOCtdefEketx8fCH0wxfikYrBCQ=; b=BmRMvSPZc9w1eoMXo4BtOcexqYGm/2MYUF1Z14SeGce533wZRPOTOWfMHQYbfnvJ5c Lv8TgteZoOslQYL9WQ25yKRBBV5d2aW/uTrHG+iH2rPUfgUW6a+m1HoO4BgaPLJIavE7 Av9SCG2hKb50ViytHdNLxyu28zxxOKYKLDO5QX0TZXDFWeOPEs8Ip/sxTvh5KA/dK3Xn vLbPzjl+cm998hxsTM7C0F7nxlKSDpo73RQkZoJWgXiUmIpgkLkVCiBeyWVo0LwJr4KC PVHLOpIQRCaNaSw9FcYdLSkNgCZYKyuRXA1Nei/2YTipZaiRO857gELDXPpqQXh68b8v 0LbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id jj4-20020a170903048400b001cc5d28bb2csi1551818plb.151.2023.11.17.03.28.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 03:28:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 ECD87820002A; Fri, 17 Nov 2023 03:28:06 -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 S1343584AbjKQL1x (ORCPT + 99 others); Fri, 17 Nov 2023 06:27:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230051AbjKQL1w (ORCPT ); Fri, 17 Nov 2023 06:27:52 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9575CA6; Fri, 17 Nov 2023 03:27:48 -0800 (PST) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SWvfX5qpSzNnw5; Fri, 17 Nov 2023 19:23:32 +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; Fri, 17 Nov 2023 19:27:46 +0800 Subject: Re: [PATCH RFC 3/8] memory-provider: dmabuf devmem memory provider To: David Ahern , Jason Gunthorpe , Mina Almasry CC: 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> <15c404e4-8efa-cc1c-174f-0752005b6755@huawei.com> From: Yunsheng Lin Message-ID: Date: Fri, 17 Nov 2023 19:27:45 +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: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.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]); Fri, 17 Nov 2023 03:28:07 -0800 (PST) On 2023/11/16 23:58, David Ahern wrote: > On 11/16/23 4:12 AM, Yunsheng Lin wrote: >> On 2023/11/16 1:57, David Ahern wrote: >>> On 11/15/23 2:21 AM, Yunsheng Lin wrote: >>>> On 2023/11/14 21:16, Jason Gunthorpe wrote: >>>>> On Tue, Nov 14, 2023 at 04:21:26AM -0800, Mina Almasry wrote: >>>>> >>>>>> Actually because you put the 'strtuct page for devmem' in >>>>>> skb->bv_frag, the net stack will grab the 'struct page' for devmem >>>>>> using skb_frag_page() then call things like page_address(), kmap, >>>>>> get_page, put_page, etc, etc, etc. >>>>> >>>>> Yikes, please no. If net has its own struct page look alike it has to >>>>> stay entirely inside net. A non-mm owned struct page should not be >>>>> passed into mm calls. It is just way too hacky to be seriously >>>>> considered :( >>>> >>>> Yes, that is something this patchset is trying to do, defining its own >>>> struct page look alike for page pool to support devmem. >>>> >>> >>> Networking needs to be able to move away from struct page references. >>> The devmem and host memory for Rx use cases do not need to be page based. >> >> Yes, I am agreed the ultimate goal is to move away from struct page >> references. But I am not sure if we can do it right away as there >> still are different types of existing 'struct page' in the netstack, >> see: >> >> https://lore.kernel.org/all/8b7d25eb-1f10-3e37-8753-92b42da3fb34@huawei.com/ > > yes, that is the point of a blended approach -- pages and buffers (or > iov) -- leveraging the LSB of the address. That proposal is the right I am not sure leveraging the LSB of the address is necessary yet, as it does not seems to provide the type check protection, it seems to just provide a way to demux between pages(including page pool owned page and non-page pool owned page) and page pool owned buffer. That info is avaliable through the page->pp_magic and page->pp->mp_* too if we mirror the page pool specific union in 'struct page'. > direction to be moving for co-existence. Adding fake struct page > instances is the wrong direction. Perhaps a fake struct page with type check protection is the right direction? Intergrating devmem to page pool without a unified metadata between pages and buffers or without a proper abstract layer does not seems like the good direction either. > . >