From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C95BC43334 for ; Tue, 5 Jul 2022 16:30:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 06A296B0071; Tue, 5 Jul 2022 12:30:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 01AA76B0073; Tue, 5 Jul 2022 12:30:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E24786B0074; Tue, 5 Jul 2022 12:30:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D08F36B0071 for ; Tue, 5 Jul 2022 12:30:01 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 87A1F203F8 for ; Tue, 5 Jul 2022 16:30:01 +0000 (UTC) X-FDA: 79653583002.18.DC4244F Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by imf05.hostedemail.com (Postfix) with ESMTP id 2151E10000D for ; Tue, 5 Jul 2022 16:30:01 +0000 (UTC) Received: by mail-qt1-f182.google.com with SMTP id ay10so14416604qtb.1 for ; Tue, 05 Jul 2022 09:30:00 -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=JJIQkinLc7EUKkkQcbn50ZQze/GagGX1bKrbY4gzAVst2rFsxaJblsPFoa1+sk12yV yPTkm+5mv4EsJ8VIOs7sVuIlAOdjXsvQV7u7la7YIYSjL1fMaHU505IDVXFTdJ9ic/yJ gAswIn0bY+JDAEI9OheS3f0T6w9l4R9mohF8zMsUZyC0zIZOtbTbEka/3TXX89IKslOd FN/fuVf5wc2IrKhPg64qyJfbGI5y0I0FYYxOq5iO4rmoqMnE7fJTfQ9TyDddwYGAJxdf Y1stMJdSpYq1Bz/SmUGxtsmmAiMo6lBUf6/XhuKUCY5R7m2JO/s7OoiYhdd4AHmA48pJ lFxA== X-Gm-Message-State: AJIora/6SdIQVo/+uG3uXIIslKfeFrhtz6ox7qwU01kYh4tV9w5VaHf0 NOFrunwG5CdHiOxy0PEm5tUD+g== X-Google-Smtp-Source: AGRyM1tPLgF/oa5jp6ch7h66vURUmccxqkvEu70fGN2pQIZRW9uE0+BIJoib0UJtgkigroai62+FZA== 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> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657038601; a=rsa-sha256; cv=none; b=yoV0J1x6H3fVM6mgcM8B/Dkj2PARbFWHtfl4BioiPt6MBHEEqrmIjJqEVcm3Frpy/m2cm9 C/+FiOw/GLSNJRqQ5QzCen/O3CizJZPTMwDvb3gFxPJPcKMNweBvwUZpvF/4MCFgtisrXt 9q5DrsVn/o9/eioyA9Zan16i8LhVp2s= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=ziepe.ca header.s=google header.b=ARfWpr8p; dmarc=none; spf=pass (imf05.hostedemail.com: domain of jgg@ziepe.ca designates 209.85.160.182 as permitted sender) smtp.mailfrom=jgg@ziepe.ca ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657038601; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sChclduKae/84cDz0BrZ+MP0tp+PTlAr9CZeDjfj13Q=; b=YXKs7yEBUi7yO2HpGtoa5H7xS8AqPPFkSE2+yGaJmnnwAnZoavhMualhFQF1VrpLvnZd3X 2EO5y66K/Pjd6rqWQlzlB6blejgZSTpcuGOpPyv4vwB/QCVEqJkWPM8sHzpnkLl29dmQLe HP6Fd9G0JNdYcZ20nmR1QaF+1wzcnnI= Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=ziepe.ca header.s=google header.b=ARfWpr8p; dmarc=none; spf=pass (imf05.hostedemail.com: domain of jgg@ziepe.ca designates 209.85.160.182 as permitted sender) smtp.mailfrom=jgg@ziepe.ca X-Rspam-User: X-Stat-Signature: uokwoabnteynnf1pj39nxyw6rpo9d634 X-Rspamd-Queue-Id: 2151E10000D X-Rspamd-Server: rspam04 X-HE-Tag: 1657038601-227541 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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