Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38307964rwd; Wed, 12 Jul 2023 06:07:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlFv+jtuDyeFa/bW6BzBmLfj4NQLQcy22/mGijQ/JP64uxmf85GQ1u9TM4YNjHpkqX5azo91 X-Received: by 2002:a17:906:410:b0:988:797c:759c with SMTP id d16-20020a170906041000b00988797c759cmr15566364eja.69.1689167237930; Wed, 12 Jul 2023 06:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689167237; cv=none; d=google.com; s=arc-20160816; b=yEpd0bhlNERAW5iOGvoLrJ5yThhksxZZLBNruMZlvOCOPm+TxSJSAJj3gA8izDe6mU se1ed+URSg3cJVejhWOf9v8jGu4079MGQow05LS3JbRjphZp1B8ef2jaEf2+HVPKBmnd l3hOA7z9WBlb85nIE/A4SXv9rALm0vLH5jLa2CoJfa4SNFVYBs/xrbtgLbBt7iXPe/4L /6Akn6iMjJUx5SISGdOXNoY5Z5s1d9KlLLezsX+W5DuIPIBZlIJrmuxeFCNBtP7BW5SO 7gDAWzuQSVt8UVevKG3KknK+r82WPmUrzZSMSG+rp1ZM8vxRhHcu9NhiaBsz5NHWq93S ppbg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YWpuSX94flQxvT/7GFNnyt8FcFburvzifDepq9lHVso=; fh=Uc4b/v34ABoIsnnaHZuC9GimoQNrB+PbKD41BKezbu0=; b=bGun2wC4yyTJ+H6VPZnUsPGgglfiYhyCZqwRIvbZ4A+dueYobpWWD8GkYe89J0Q46g 3WM3lqJ4lt2XvZAa+hcSLF6nSs2xEmg7PZwQeQ322rk6+qKCoA7ODpCjXfvg5mQ2sisf F4gANxyRxQQZifg3PGGhrQuJGRPg5lPf2jXGxsAqk+eIaTnA4VlqFLeOjK6dbfBd/m6V IfIJVBkuqczEFyIqy/p8XMNua9kcX80JI5K68JGvNex3eRZd/1L0tJJDQgWI4k1Vxhup k7l8KyMcWXRVkgLv/jecgapCr0g1zWwTWFTX1FYsb0TsOjOau261g8qJEueF/wFpFLRN SI3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=iYD+caT5; 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 ov2-20020a170906fc0200b00992aa293b8csi4416551ejb.332.2023.07.12.06.07.02; Wed, 12 Jul 2023 06:07:17 -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=iYD+caT5; 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 S233210AbjGLNB5 (ORCPT + 60 others); Wed, 12 Jul 2023 09:01:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232140AbjGLNB4 (ORCPT ); Wed, 12 Jul 2023 09:01:56 -0400 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8935719B9 for ; Wed, 12 Jul 2023 06:01:52 -0700 (PDT) Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-765942d497fso651062785a.1 for ; Wed, 12 Jul 2023 06:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1689166911; x=1691758911; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=YWpuSX94flQxvT/7GFNnyt8FcFburvzifDepq9lHVso=; b=iYD+caT5C5DZuj4SVL8bXKmm54Fife2Oz9uLMzl6trcTZ3BhImO/CJ2diP8cel4MIq XvWzM2pXRBQEjLiVo3Hgt06eJWjI2g2knQDKpA2bpSVnKpPcB5kCx3F2DSBXcUoh1RcW evRk6qNJjMFTRHZraP9CHksMsuP51beQli1rjtg5cRvCFZIiXfjjqzmq7912pS2ynyNH /SqCiWdXv8u7bRbNQhIjI9Y4D6U/0F8mt1bkXpyu60M2tzC25xcrXZUnG7XOxux/chyn iUj28ba/siqynf7x2SgrK9XpRda5v7gelAg/mnDloWN4XKIrIZHL0ttb9xLfMYOzQPpS n/hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689166911; x=1691758911; h=in-reply-to: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=YWpuSX94flQxvT/7GFNnyt8FcFburvzifDepq9lHVso=; b=IMu2TxrUyv7k7inJWaxCK2nI+dFqw5ZBI4ZTvqcPDjm9/59NCwq1YmyLJOpmfSOxc+ ypRLFeSOfbpgXWApjKg4SHIbl3ja46w8kDiS831kRXJ2yFwoPgjoZFu8SFzVZCfXvnC6 EF1s6Dl9PaTlnOTItvmv00P2CHDObFgnvBgSElzxuwpuAGcGczXtG8JuykuEunM+jlKE +7PiQyfiTOxYsLhh4dS990nac/9COpaC0IMT5NRJNlVOS/fHS/6qpGwpX6YFhKjlynNZ or679cA614vOXL6qFVN5q5S6w2VieFzmmpGuDMxuce4Ue89Fd6jrsZ412cQS9PrXE8Wq VzHg== X-Gm-Message-State: ABy/qLYB1VkBG28l5WG+AqPh1LmnNFwfBNAlQyP+qNgmMNsiVhE/tadd ElQ1ROHaxZybIYTnyBp9IxU95w== X-Received: by 2002:ae9:dfc5:0:b0:767:d847:278a with SMTP id t188-20020ae9dfc5000000b00767d847278amr6940605qkf.74.1689166911567; Wed, 12 Jul 2023 06:01:51 -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 u17-20020a05620a121100b007673f8803c3sm2105604qkj.96.2023.07.12.06.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 06:01:47 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1qJZTU-000OJR-6S; Wed, 12 Jul 2023 10:01:44 -0300 Date: Wed, 12 Jul 2023 10:01:44 -0300 From: Jason Gunthorpe To: Mina Almasry Cc: David Ahern , Samiullah Khawaja , Willem de Bruijn , Jakub Kicinski , Christoph Hellwig , John Hubbard , Dan Williams , 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 , Christian =?utf-8?B?S8O2bmln?= , logang@deltatee.com, Bjorn Helgaas Subject: Re: Memory providers multiplexing (Was: [PATCH net-next v4 4/5] page_pool: remove PP_FLAG_PAGE_FRAG flag) Message-ID: References: <20230710215906.49514550@kernel.org> <20230711050445.GA19323@lst.de> <20230711090047.37d7fe06@kernel.org> <04187826-8dad-d17b-2469-2837bafd3cd5@kernel.org> <20230711093224.1bf30ed5@kernel.org> <20230711133915.03482fdc@kernel.org> <2263ae79-690e-8a4d-fca2-31aacc5c9bc6@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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,URIBL_BLOCKED autolearn=unavailable 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 Tue, Jul 11, 2023 at 08:42:24PM -0700, Mina Almasry wrote: > 1. The device memory driver would be the p2pdma provider. It would > expose a user API which allocates a device memory region, calls > pci_p2pdma_add_resource() and pci_p2pmem_publish() on it, and returns > a reference to it to the userspace. This is not quite right, if you convert any of the GPU drivers to use P2PDMA you are going to need to restructure the p2pmem stuff to seperate the genalloc. The GPU driver must continue to be the owner and allocator of the MMIO memory it already controls, we can't have two allocators working in parallel. The genalloc stuff supports the special NVMe use case, I don't know of anything else that would like to work that way. > 2. The NIC driver would be the p2pdma client and orchestrator. It > would expose a user API which binds an rxq to a pci device. Prior to > the bind the user API would check that the pci device has published > p2p memory (pci_has_p2pmem()), and check the the p2p mem is accessible > to the driver (pci_p2pdma_distance() I think), etc. This doesn't fit the programming model for GPUs at all. You don't want to get packets landing in random GPU memory that a kernel side allocator selects, you want packets landing in GPU memory owned by a specific process that owns the TCP connection. This is why DMABUF is used here as it gives a handle to the GPU memory. What you want is to get the P2P pages either directly from the DMABUF or via pin_user_pages() on the DMABUF's mmap. > AFAICT, all the concerns brought up in this thread are sidestepped by > using p2pdma. I need not allocate struct pages in the core dma-buf > code anymore (or anywhere), and I need not allocate pgmaps. I would > just re-use the p2pdma support. Well, as I said it is going to be a big ask to P2P enable any of the DRM drivers. And you still have the netmem vs zone_device struct page conflict to figure out But it is alot closer to reasonable than this RFC. Jason