Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp26029imm; Fri, 21 Sep 2018 09:43:39 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbj6UacJNhIeFvmmfNpi9nzmOtWF/CLxCZSsa6X5w0ztQRUMpHd7X9QQmwoIiZzj4yl5YqQ X-Received: by 2002:a63:6ce:: with SMTP id 197-v6mr41421745pgg.338.1537548218946; Fri, 21 Sep 2018 09:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537548218; cv=none; d=google.com; s=arc-20160816; b=vzYePK98Hiw3gxWOo7HRv9IN/mLUNtfSeMo5Uo+dSEJOBcnfJSVbAowdXrkeNUfh1T jaLiSjjmS2xnpmeVUtkmaydPCSmtymrarZr4BNkW6VGyisfXJrNFkOo10keLiOjpL9ii M2hnW5FSrf0WApN2VagXGKm+qnfsHgr6LYsAaEE0nDEDiyz81GlwME1q44pmQRGDzY9i PCLtpRUZnMT0CLwrEcqYQaZXTxvLIo5PWLN4LsMn6XP1rg6NLbXhLzMvPHu49eJaaF78 FTUtmj/W7l2BLvc13uMmBBMJQWxflJnlTi8wUGYP8Tb5iwysJ2G/sxYxrxIga9HPdfWE ncnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KRrv5bcO8O5nR4nFxKFfWUT2BNx12/7tsBZoAxjUSok=; b=meZLwGxFgSBSCmVchSMjc3qa7SunHdkxoCNNEYUse8ULoHQcIMBqlj2ycyTfqF0YI+ B2iurq7Rmw4x9gq0j71WpsSH/1SwHBnv/ZYvGu0sKDYW1BeBBQhQ3ZfhBQOmXDUNXg/y TI5vP6ahpXo5H8M+qD99q0b9/zw2YEf8bzhjiYvTfR5OM2FflvyE6Ii/rHpdXxuhQJFW EUUKhUUI5LySOPAafocOG1MG7UiBFWlZ/IqJVUxL9E4QDCFu4KigrBmg573gKwO6qQE/ qbYJ8dc/cruQOBiJd8KzlgAO8flcSgzfjA5vdOxWqkG27uqhshdCT8JAK86hl4DL8bEW hFyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=W3IER1PT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x29-v6si7541042pga.674.2018.09.21.09.43.23; Fri, 21 Sep 2018 09:43:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=W3IER1PT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390802AbeIUWbJ (ORCPT + 99 others); Fri, 21 Sep 2018 18:31:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:40960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389683AbeIUWbJ (ORCPT ); Fri, 21 Sep 2018 18:31:09 -0400 Received: from localhost (unknown [150.199.191.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 420FA21565; Fri, 21 Sep 2018 16:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1537548087; bh=y/cdrkvx/4VQFEwAC2tZK5bwdY3HlVZb3pjDHaBktzQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=W3IER1PTSm/Izcw1HvfR6LVGCzICd/6jXkKRZQg+uHKj8SEjFhjfisNqOAbTu2eHc Unpzr+tUDoyYSdBY8nRitSaibhmvqUGrG8ZWDdNHOnI3AbGbogxYkH/VMHUbQt7nHF XXsq9/qatJLnyNYuNudzqUcsOtShrJjIHSIrk9GI= Date: Fri, 21 Sep 2018 11:41:26 -0500 From: Bjorn Helgaas To: Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org, linux-nvdimm@lists.01.org, linux-block@vger.kernel.org, Stephen Bates , Christoph Hellwig , Keith Busch , Sagi Grimberg , Bjorn Helgaas , Jason Gunthorpe , Max Gurtovoy , Dan Williams , =?iso-8859-1?B?Suly9G1l?= Glisse , Benjamin Herrenschmidt , Alex Williamson , Christian =?iso-8859-1?Q?K=F6nig?= , Jens Axboe , Jonathan Corbet Subject: Re: [PATCH v6 06/13] PCI/P2PDMA: Add P2P DMA driver writer's documentation Message-ID: <20180921164126.GI224714@bhelgaas-glaptop.roam.corp.google.com> References: <20180913001156.4115-1-logang@deltatee.com> <20180913001156.4115-7-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180913001156.4115-7-logang@deltatee.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 12, 2018 at 06:11:49PM -0600, Logan Gunthorpe wrote: > Add a restructured text file describing how to write drivers > with support for P2P DMA transactions. The document describes > how to use the APIs that were added in the previous few > commits. > > Also adds an index for the PCI documentation tree even though this > is the only PCI document that has been converted to restructured text > at this time. > > Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas > +With the client list in hand, the orchestrator may then call > +:c:func:`pci_p2pmem_find()` to obtain a published P2P memory provider > +that is supported (behind the same root port) as all the clients. If more > +than one provider is supported, the one nearest to all the clients will > +be chosen first. If there are more than one provider is an equal distance s/If there are more/If more/ > +away, the one returned will be chosen at random. This function returns the PCI s/the one returned will be chosen at random/one will be chosen arbitrarily/ ? (I doubt it's really random) > +device to use for the provider with a reference taken and therefore > +when it's no longer needed it should be returned with pci_dev_put(). > +Struct Page Caveats > +------------------- > + > +Driver writers should be very careful about not passing these special > +struct pages to code that isn't prepared for it. At this time, the kernel > +interfaces do not have any checks for ensuring this. This obviously > +precludes passing these pages to userspace. Sounds like landmines here since the reader probably can't translate "code that isn't prepared for it" into a list of interfaces that are off-limits. But that's a VM issue that is above my pay grade, so I'm not suggesting any change; just pointing out something that makes me wonder "hmmm..., how would I act on this?" > +P2P memory is also technically IO memory but should never have any side > +effects behind it. Thus, the order of loads and stores should not be important > +and ioreadX(), iowriteX() and friends should not be necessary. > +However, as the memory is not cache coherent, if access ever needs to > +be protected by a spinlock then :c:func:`mmiowb()` must be used before > +unlocking the lock. (See ACQUIRES VS I/O ACCESSES in > +Documentation/memory-barriers.txt)