Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp36059431rwd; Mon, 10 Jul 2023 17:24:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlHpElSvcRpJyhFg/wRdKNJKPkvUO3wLNtcIjxBswtN3F0+fStfkdR2LeaRpDE5FNXHDcMQX X-Received: by 2002:a17:903:228a:b0:1b6:6b90:7c2f with SMTP id b10-20020a170903228a00b001b66b907c2fmr13527614plh.55.1689035085180; Mon, 10 Jul 2023 17:24:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689035085; cv=none; d=google.com; s=arc-20160816; b=adYzrNRVkAsKwlYiwDPTVgoyKjfh37FEOzyXklWzTsvQusUXkMQ7lbEa12Um9chBKH VgZYbEZZLdnpwQC+FOzhzhAq+y+FySn/qREhMlFjXKLfoTMbmqfLynSfrwBauCy5Ikt5 N9+q6aPt21ISYLQ4IATl9CW48hPsC3Dn/YRBde+qpCPbaETSB02lUNWJD5xcTV745JG0 1kJv20VlWOtXpt/bumDfTfGlVi4e8CIf8PwpGxdyS2PkSH9LXh++9fi2g+frvvcBPDwu oOKNwKPY5RylPGnnoTcD/TNy7bA4AimO84lmDHPpCP7txZqi+Eatjt4PbqkplhPQ1D+t NHBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=C1+7UfAMLI/Nu08LQwOr0R45kQ38N0MvpsViC9OWNis=; fh=/ZoTLQvdI1elGflbQNYm7NXKgW9CKAkadDnr0Qn4wns=; b=yOuVXHiIThWOePFzGRxBejmqUVu6Hmbhy7RGiygAXtW8Md4CtfqC67npIy2chHpky4 zQNqBKyQBBHxhzmchUvb0ehjwYGcx59ahABG38n35glffu+10Cm+5+LrQG1eTBeVCLj+ PLS+llroLhdECFOk7WD9yHozBNnU1EDwz15eJRbzKjPuIl+MKb8e5OJdZKxV8Y9mG67y v6f8xIEEXcxIBXgmo+Pf1eAKB5OCJHSVGeSUSSk0Ee4Rdg8RgZexIpH1p7uVnDNLpSKX oSPetv1mUsyLiY5w8xx8H0bVlMPz6FGjvOUNRzrKcgIxGHqtlK0LykvexNMMiINCr7CU k+uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="lOjm4Lx/"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a17090311c800b001b53c722c3fsi621402plh.597.2023.07.10.17.24.34; Mon, 10 Jul 2023 17:24:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="lOjm4Lx/"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230296AbjGJXtb (ORCPT + 60 others); Mon, 10 Jul 2023 19:49:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbjGJXt3 (ORCPT ); Mon, 10 Jul 2023 19:49:29 -0400 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D1B51AC for ; Mon, 10 Jul 2023 16:49:28 -0700 (PDT) Received: by mail-qv1-xf2f.google.com with SMTP id 6a1803df08f44-635dbfa710dso30181666d6.0 for ; Mon, 10 Jul 2023 16:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1689032967; x=1691624967; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=C1+7UfAMLI/Nu08LQwOr0R45kQ38N0MvpsViC9OWNis=; b=lOjm4Lx/2UPcQ0vl1fIalkQvnZK8D4gJI18w5QRFNsP45noSZ/Hlwqq9fLf6qno8S0 GvM986sAXOOWD+3KlsW4spYFl1h5PPJyrFeDcdlNkEDclq35TvtosJh62CTCTkoRD9GK MqGXs6RSufFFgYmbGJAlQr1lrEr/1f2OYUXg5i3nLAJvb7ECX/2/AfZpA3lyMOZeND1n lFl8txf7CyG92a7kngcJ7Vq6bV3YMDykveds9sCnMS+V3OZ/EyLY8FCZCXVFPUP4B0LH qdqAHT53dGIFQ6ev9mJkB5oMnZhst31KWNYei6EFEyMLWMXAOhxl5/HniRY/5EQC+kez oVfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689032967; x=1691624967; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=C1+7UfAMLI/Nu08LQwOr0R45kQ38N0MvpsViC9OWNis=; b=FeaM0QMEpD3AdWAfKetOvPp3M+MnSBiRzeKaU2GhwYVr1Dwwi7V5TNk0t6uH/HdZ0r hvRBSWTA6YlFDqCp24H7aUnZNN4b5rMpc9WXbOH1NxuCmKbffsK+WiLByPbTxmojYcHo Gy/iJgbkg2O8XZFErIuFiHZxDEi8qvIk5XXk6tBCqVFMYRRO5uQrQ22xwkchOX7KsFbP qc4ghWL8DNDX+4Q6Zo/7+YvzO0GCp0Ds/0xVEgG1ap5IgViTTBNFhaWk+PXC3v/g9K3F jc1eEgEaadGRYA7PgtDGrxTO4Rij01ygkTUMp4wBHuBQOAI3eOl4tMmrnCTXLyXKhvEs Mepw== X-Gm-Message-State: ABy/qLatI97mBOS3WUTz6aUNU4kYRAFs60iAD+FbDp/jIJQ92Ls1BA9K y++dh8/fRNMNR2XzVSQFQtZ4vQ== X-Received: by 2002:a0c:b3ce:0:b0:636:fda0:a23 with SMTP id b14-20020a0cb3ce000000b00636fda00a23mr10701191qvf.27.1689032967061; Mon, 10 Jul 2023 16:49:27 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-25-194.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.25.194]) by smtp.gmail.com with ESMTPSA id u14-20020a0c8dce000000b00632191a70a2sm370778qvb.103.2023.07.10.16.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jul 2023 16:49:26 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1qJ0dB-00063Y-Eu; Mon, 10 Jul 2023 20:49:25 -0300 Date: Mon, 10 Jul 2023 20:49:25 -0300 From: Jason Gunthorpe To: Mina Almasry , Christoph Hellwig , John Hubbard , Dan Williams Cc: David Ahern , Jakub Kicinski , Jesper Dangaard Brouer , brouer@redhat.com, Alexander Duyck , Yunsheng Lin , davem@davemloft.net, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Bianconi , Yisen Zhuang , Salil Mehta , Eric Dumazet , Sunil Goutham , Geetha sowjanya , Subbaraya Sundeep , hariprasad , Saeed Mahameed , Leon Romanovsky , Felix Fietkau , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno , Jesper Dangaard Brouer , Ilias Apalodimas , linux-rdma@vger.kernel.org, linux-wireless@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Jonathan Lemon Subject: Re: Memory providers multiplexing (Was: [PATCH net-next v4 4/5] page_pool: remove PP_FLAG_PAGE_FRAG flag) Message-ID: References: <20230616122140.6e889357@kernel.org> <20230619110705.106ec599@kernel.org> <5e0ac5bb-2cfa-3b58-9503-1e161f3c9bd5@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Mon, Jul 10, 2023 at 04:02:59PM -0700, Mina Almasry wrote: > On Mon, Jul 10, 2023 at 10:44 AM Jason Gunthorpe wrote: > > > > On Wed, Jul 05, 2023 at 06:17:39PM -0700, Mina Almasry wrote: > > > > > Another issue is that in networks with low MTU, we could be DMAing > > > 1400/1500 bytes into each allocation, which is problematic if the > > > allocation is 8K+. I would need to investigate a bit to see if/how to > > > solve that, and we may end up having to split the page and again run > > > into the 'not enough room in struct page' problem. > > > > You don't have an intree driver to use this with, so who knows, but > > the out of tree GPU drivers tend to use a 64k memory management page > > size, and I don't expect you'd make progress with a design where a 64K > > naturaly sized allocator is producing 4k/8k non-compound pages just > > for netdev. We are still struggling with pagemap support for variable > > page size folios, so there is a bunch of technical blockers before > > drivers could do this. > > > > This is why it is so important to come with a complete in-tree > > solution, as we cannot review this design if your work is done with > > hacked up out of tree drivers. > > > > I think you're assuming the proposal requires dma-buf exporter driver > changes, and I have a 'hacked up out of tree driver' not visible to > you. Oh, I thought it was obvious what you did in patch 1 was a total non-starter when I said you can't abuse the ZONE_DEVICE pages like this. You must create ZONE_DEVICE P2P pages, not MEMORY_DEVICE_PRIVATE to represent P2P memory, and you can't do that automatically from the dmabuf core code. Without doing this the DMA API doesn't actually work properly because it doesn't have enough information to know about what the underlying exporter is. The entire point of DEVICE_PRIVATE is that the page content, and access to the page's physical location, is *explicitly* unavailable to anyone but the pgmap owner. > > Fully and properly adding P2P ZONE_DEVICE to a real world driver is a > > pretty big ask still. > > There is no such ask. Well, there is from me if you want to use stuct pages as handles for P2P memory. That is what we have defined in the pgmap area. Also I should warn you that your 'option 2' is being NAK'd by Christoph for now, we are not adding any new code around DMABUF's hacky use of NULL sg_page scatterlist for P2P memory either. I've been working on solutions here but it is slow going. > On dma-buf changes required. I do need approval from the dma-buf > maintainers, It is a neat hack, of sorts, to abuse DEVICE_PRIVATE to create struct pages for the exclusive use of pagepool - but you need more approval than just dmabuf maintainers to abuse the pgmap framework like this. At least from my position I want to see MEMORY_DEVICE_PCI_P2PDMA used to represent P2P memory. You haven't CC'd anyone from the mm community so I've added some people here to see if there are other opinions. To be clear, you need an explicit ack from mm people on the abusive use of pgmap in patch 1. I know it is not what you want to hear, but there are actual reasons why the P2P DMA problem has been festering for so long, and hacky quick fixes like this are not going to be enough.. Jason