Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1444917imw; Tue, 5 Jul 2022 09:33:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1satHz44TUOcAqUvaA/coSTrEwwy3bDwVuDk4wGDWXkrmZi1gjhZ5vuTCNFXZ6O0WtfUZEa X-Received: by 2002:a17:90b:693:b0:1ef:4d94:412d with SMTP id m19-20020a17090b069300b001ef4d94412dmr32235424pjz.27.1657038788991; Tue, 05 Jul 2022 09:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657038788; cv=none; d=google.com; s=arc-20160816; b=UjtqG5fj8v6PgKh9cgeIy1yzAFgJKRAGS3UMdqbo7pgpbMZ+LY0cvXP6ceQE9v/bEw xwNXak6hgOexm3vK5QjxO5BjGGvF6d5JHRQLB6Zviqh4DXDnTRNtTEZdTOOuuWtg8KvY JRskXGyeqngYcwwut9Ve+shs5TlKUBG+hmHie+HemWWdDd16PuxYL1GcVA8eqLFbezRk 3h1GUkINcw2t2/VsqYMJ0PitseRMzprD1EZd6QG8k28jqDUwgxIm3PXpIHzKLbPXMxgz lr+tCi26CWHUkVYdrg9unG1GFGvMFxuB5j6hDRTc8XtaxI2uIiG6HDkIZ7eNw0w4mn/j qoRg== 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=sChclduKae/84cDz0BrZ+MP0tp+PTlAr9CZeDjfj13Q=; b=XjIyLLjR5w8pW47t7YFlzCsyTocJS8NsL95ZH9gutu/JGv5ZybKcAoaBKQoPeixY91 YgjovP6vtEK5mV/aOVpmclvP0VOB4yK0nARPHMstA8y/IH22fs1xI7CCMAQGboG4EV3z brU8xrc3ZiE1g8wclecm8WfVI9taLG1nDy0Wl34/tZOsQRpIwQCCqsuFY3glPf50GCt+ pOM0x4yC0ap6mXu3Fwaiep+LKqEbP0U/h2nPfmDomFquRp0KfWerJLzASRFbAc2AGu1B wbUZ3ND5LpMfJbZ3YodOz2ayjCWHqLo60qYcGW4GyKXUYzGwhBEg1NREfEbtpYaEUI8a E0lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=ARfWpr8p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 f7-20020a17090274c700b0016be7a7ee70si6520945plt.175.2022.07.05.09.32.56; Tue, 05 Jul 2022 09:33:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=ARfWpr8p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231171AbiGEQa1 (ORCPT + 99 others); Tue, 5 Jul 2022 12:30:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232674AbiGEQaD (ORCPT ); Tue, 5 Jul 2022 12:30:03 -0400 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37E501CFEF for ; Tue, 5 Jul 2022 09:30:01 -0700 (PDT) Received: by mail-qt1-x831.google.com with SMTP id ay10so14416603qtb.1 for ; Tue, 05 Jul 2022 09:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=sChclduKae/84cDz0BrZ+MP0tp+PTlAr9CZeDjfj13Q=; b=ARfWpr8plwJhNlfMsfgbkLKFpSjayQPH+TVLj9njVh+9ZVwwYS0Q5lpx3QESUlwiJ0 Xau0D8DTEtlBLA2TKJjGb0eWyuHzYJSySzH16w8i60Ucpq6lkPkx/9MUbSA7H8PkF9mf vy2eLsJPe5CP1cJVF8B6Y7AsRY7nQqxYHkWBv4hIekpX2n63jyIHOZts2vGssV+p6X7i o5tnF3lXu1HBK0CIU9B+BuQxS3B79T/BqxNUUNBMTSi7dFTn3cejUhBmCkHwZYPAldDy CzT6wuFA6Z8An5ETNanvoj5+zinJwVg3guVjtkzMtWjvDNeS+j8gPF7lh16xjKsVoTSd rVXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=sChclduKae/84cDz0BrZ+MP0tp+PTlAr9CZeDjfj13Q=; b=bWR5xdXoiEOpOzICil2ETwPyiH59XlvY+Yg84HTp28AiClH6YtlKt0uAsI6iicpJeu Ljq4uT/zPF6BgyvFjkbuY4wBlKLFxVqj2hyVCGWp8DA2Uxc9LXsgTQ3sd+l7tGYUxQyE tNYIS4qFRHP/ZOoT4j9A+FVvVIzfP5ICeLLwW+3GW5OAFqDSKK6lj7teKXK/UZ/86LyM lf2b7A2ihKtYV45Qm30y05m0zRnjfJYA7jWwP/Rrq4Y9uIU+G+oyNy/LF/8dh4bVdKz/ jjpu4LjoVGuwh8aDn0wEd3aaHh3R5Tx4WFnSz/xrocEGJqfeginpft+HANGajfzsr3qt mr7g== X-Gm-Message-State: AJIora8ZUqofMIySRBk8Vy+m2yhYcV3JvPYmgDXdF6Xe0hG/Knk5HHq/ PvEF/58qf67LOvDiY6Eamgi//g== X-Received: by 2002:a05:6214:27cc:b0:470:9aaa:94b5 with SMTP id ge12-20020a05621427cc00b004709aaa94b5mr32033702qvb.129.1657038600343; Tue, 05 Jul 2022 09:30:00 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-129.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.129]) by smtp.gmail.com with ESMTPSA id k11-20020a05620a0b8b00b006b25570d1c2sm11328498qkh.12.2022.07.05.09.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 09:29:59 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1o8lR1-006YYv-9I; Tue, 05 Jul 2022 13:29:59 -0300 Date: Tue, 5 Jul 2022 13:29:59 -0300 From: Jason Gunthorpe To: Christoph Hellwig Cc: Logan Gunthorpe , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Stephen Bates , Dan Williams , Christian =?utf-8?B?S8O2bmln?= , John Hubbard , Don Dutile , Matthew Wilcox , Daniel Vetter , Minturn Dave B , Jason Ekstrand , Dave Hansen , Xiong Jianxin , Bjorn Helgaas , Ira Weiny , Robin Murphy , Martin Oliveira , Chaitanya Kulkarni , Ralph Campbell , Bjorn Helgaas Subject: Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem() Message-ID: <20220705162959.GH23621@ziepe.ca> References: <20220615161233.17527-1-logang@deltatee.com> <20220615161233.17527-21-logang@deltatee.com> <20220629064854.GD17576@lst.de> <99242789-66a6-bbd2-b56a-e47891f4522e@deltatee.com> <20220629175906.GU23621@ziepe.ca> <20220705075108.GB17451@lst.de> <20220705135102.GE23621@ziepe.ca> <20220705161240.GB13721@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220705161240.GB13721@lst.de> 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_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 05, 2022 at 06:12:40PM +0200, Christoph Hellwig wrote: > On Tue, Jul 05, 2022 at 10:51:02AM -0300, Jason Gunthorpe wrote: > > > In fact I'm not even sure this should be a character device, it seems > > > to fit it way better with the PCI sysfs hierchacy, just like how we > > > map MMIO resources, which these are anyway. And once it is on sysfs > > > we do have a uniqueue inode and need none of the pseudofs stuff, and > > > don't need all the glue code in nvme either. > > > > Shouldn't there be an allocator here? It feels a bit weird that the > > entire CMB is given to a single process, it is a sharable resource, > > isn't it? > > Making the entire area given by the device to the p2p allocator available > to user space seems sensible to me. That is what the current series does, > and what a sysfs interface would do as well. That makes openning the mmap exclusive with the in-kernel allocator - so it means opening the mmap fails if something else is using a P2P page and once the mmap is open all kernel side P2P allocations will fail? Which seems inelegant, I would expect the the mmap operation to request some pages from the P2P allocator and provide them to userspace so user and kernel workflows can co-exist using the same CMB. Jason