Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5049561imu; Tue, 29 Jan 2019 11:54:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN6utoVrYxyzEawWFd9IBO6LKY+/JzJEyH77vbhEgF8899gZzQm1B7Z+KeV/jeTVGW1YywcN X-Received: by 2002:a17:902:720c:: with SMTP id ba12mr27498803plb.79.1548791679025; Tue, 29 Jan 2019 11:54:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548791678; cv=none; d=google.com; s=arc-20160816; b=QId5ROHGeE2jfTvZIyjCZkMlluHbqd5i28SQ0BzccKZKRvms6EMY8cl0m5ScDZpMKG WlTp+6dg5G4aGTjvvdUfNWtbQUxef98I3KklWGbuTp07AiMRfrnL6NTd0B6v7urPxtkH ffWSirVoMaJh2T+Grd2dBqC28K7seoBXXjUyWAVYWl3JOmH7zyqBche8Aq3YZjMydM5A gnseBFGciZU+LBN1tEJqvwFsvc7Mr6bp5Jue8cK+sHzMBlf4A+oFyaDrIuE528KDZRwK FYKm2eSHmJ+oltS2CJUYb/T12DqCXareev0wCIBCCn9jN76fjz/NxGzSHdRQS4xCwi9G iAxg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=75hsV7Pqqt0+N491/wcw4j7zb4wvemt5Snw3rZEGqXY=; b=Cx0/covcVwLM7sQH0XBDV/6EezVDkrTGRpT2eBtCtD7OC2guWfrNS42g/iLKWDyhX/ 72FFjEjMI0zSQ/mbm1+PpMqV3cOYkAHzkhoQENlaLEcK4NQRRnJ8L/DaOJhagLFl10gN MMANFzbPvi2kIQQyiMR9Y2j8bY+9Ur0/G7Fccev2dCky7pr1y0wXdnKIWzbpYAW6oplG p+xK4Qx8mcP8EAz9hdC9qcf+gGXEYGYCaIM5iUvBNjZk7/gRaABPfVNLh9xK/ttAoZnh XTc1DRs2ULwy4bOfIfFFv81i8P2BZpDEqbxqR9pFtXueMJWdxboKpHXhyD8SCGH8eohO w1dQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x66si36223808pfk.73.2019.01.29.11.54.23; Tue, 29 Jan 2019 11:54:38 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728988AbfA2TxI (ORCPT + 99 others); Tue, 29 Jan 2019 14:53:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34468 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726984AbfA2TxH (ORCPT ); Tue, 29 Jan 2019 14:53:07 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CF0B97AE8B; Tue, 29 Jan 2019 19:53:06 +0000 (UTC) Received: from redhat.com (ovpn-122-2.rdu2.redhat.com [10.10.122.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E322419745; Tue, 29 Jan 2019 19:53:04 +0000 (UTC) Date: Tue, 29 Jan 2019 14:53:02 -0500 From: Jerome Glisse To: Greg Kroah-Hartman Cc: Logan Gunthorpe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Rafael J . Wysocki" , Bjorn Helgaas , Christian Koenig , Felix Kuehling , Jason Gunthorpe , linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, Christoph Hellwig , Marek Szyprowski , Robin Murphy , Joerg Roedel , iommu@lists.linux-foundation.org Subject: Re: [RFC PATCH 1/5] pci/p2p: add a function to test peer to peer capability Message-ID: <20190129195302.GI3176@redhat.com> References: <20190129174728.6430-1-jglisse@redhat.com> <20190129174728.6430-2-jglisse@redhat.com> <20190129194426.GB32069@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190129194426.GB32069@kroah.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 29 Jan 2019 19:53:07 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 29, 2019 at 08:44:26PM +0100, Greg Kroah-Hartman wrote: > On Tue, Jan 29, 2019 at 11:24:09AM -0700, Logan Gunthorpe wrote: > > > > > > On 2019-01-29 10:47 a.m., jglisse@redhat.com wrote: > > > +bool pci_test_p2p(struct device *devA, struct device *devB) > > > +{ > > > + struct pci_dev *pciA, *pciB; > > > + bool ret; > > > + int tmp; > > > + > > > + /* > > > + * For now we only support PCIE peer to peer but other inter-connect > > > + * can be added. > > > + */ > > > + pciA = find_parent_pci_dev(devA); > > > + pciB = find_parent_pci_dev(devB); > > > + if (pciA == NULL || pciB == NULL) { > > > + ret = false; > > > + goto out; > > > + } > > > + > > > + tmp = upstream_bridge_distance(pciA, pciB, NULL); > > > + ret = tmp < 0 ? false : true; > > > + > > > +out: > > > + pci_dev_put(pciB); > > > + pci_dev_put(pciA); > > > + return false; > > > +} > > > +EXPORT_SYMBOL_GPL(pci_test_p2p); > > > > This function only ever returns false.... > > I guess it was nevr actually tested :( > > I feel really worried about passing random 'struct device' pointers into > the PCI layer. Are we _sure_ it can handle this properly? > Oh yes i fixed it on the test rig and forgot to patch my local git tree. My bad. Cheers, J?r?me