Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5042002imu; Tue, 29 Jan 2019 11:45:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN7i1mGsoFf1j86ponb5AjVRoUVIUVoNRvqhhxzg1yCYEdfO0G8kaby4ofua685uaxRSUgXL X-Received: by 2002:a63:5e43:: with SMTP id s64mr25008307pgb.101.1548791127145; Tue, 29 Jan 2019 11:45:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548791127; cv=none; d=google.com; s=arc-20160816; b=FAPZ6/FM/dbhFZm6F2zgD9MaTTGM0MGdZ0yKB468hSnBiSUWkeZJkS0rlUtKEzAjFU nzZnXvGIf9QwJntgkIvxebUXQCfGCQ6PNz9PjwGNOSqhFiCr7yoy/LfEwdxJE8Cukalr ON0Ru2LgLQcAGfdzz+43vkIvd35TbQ4Y4sGF7LYmecdLjeWfhPVpWX7mMHZKDYaSlCYT 4H92829b0bUJO1uMveCYqJeKZXR7JMgfNjXeXSlEkzTexbdEFfXt5mE9KFz2gI91gPZP Jbq1roC5lfMB0NcX5q6uohicHDQGq0VnSHd6UHPf3UorWdr2xYpbqBa3cTlC/yktiG+w 02lg== 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=CFj7Pa5g2DeCYTbq6ol+Q6V8iNt1uylJ9ZpQIyhLCfM=; b=vBCHPaWvScBq1WHYcJgbgeD7rER59mULcOHTf9FOTW+Dl62OuhhV9liFuSCKXYgyhj JrIJJ86v9oplaSpesq8UtUAWwjgZQm4fluVTok1kIQFpPJwBJuFbTii6fgUWWfbHIwBU befz7A6ukoZBOHskkerlxeBjr9pZg29Q3P+RjZpBtNhoffSv3GXcnmaMShKWs2yw9sfa Inv9KRh/QEe1OUnF7Zya/i8XYOplcJOTo3K2SFCvMsh0SvXbE4qxsfnMfxUea01wJkK/ UPi7tZVpzuqkvGriHp2pgCXcBHpWLgfFR73GWAZOaRf59ch2KiNmlUtxv6L57BMN4E6S WiPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KZ49LH+j; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y29si35408075pgk.376.2019.01.29.11.45.11; Tue, 29 Jan 2019 11:45:27 -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; dkim=pass header.i=@kernel.org header.s=default header.b=KZ49LH+j; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729355AbfA2Toa (ORCPT + 99 others); Tue, 29 Jan 2019 14:44:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:42652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726828AbfA2To3 (ORCPT ); Tue, 29 Jan 2019 14:44:29 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 1840F20882; Tue, 29 Jan 2019 19:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548791068; bh=viEJwDEtg1GHjzjkuyc+bBKWHo390MegK+/fo4Fble8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KZ49LH+jLUB5srps9pOXePp/VyVK991R5wyjKZybFUFX8MoQbeRfWiIJ2VIgtJ0ON BIFTzisFgCYTDNpFD+PiiDclPm8bLV+kxGugwnruf/jhxkgGGOSQHLA6pLyhwHnCkM j3wL4ZpMUUn9yw+WfZbhWycVuoC0YG+hjkARojvo= Date: Tue, 29 Jan 2019 20:44:26 +0100 From: Greg Kroah-Hartman To: Logan Gunthorpe Cc: jglisse@redhat.com, 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: <20190129194426.GB32069@kroah.com> References: <20190129174728.6430-1-jglisse@redhat.com> <20190129174728.6430-2-jglisse@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.2 (2019-01-07) 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 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? thanks, greg k-h