Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1972436imm; Sun, 12 Aug 2018 04:03:15 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzi1hc7z3bNeWUoAW4d6pHpoa9ZoC5laOejGwzupembxYpwKczTLzfehwBVIcVQsRXUx2Iv X-Received: by 2002:a65:4304:: with SMTP id j4-v6mr13395064pgq.109.1534071795410; Sun, 12 Aug 2018 04:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534071795; cv=none; d=google.com; s=arc-20160816; b=zBOVD/Vhjh4ih+URs7q/kcFBGR1dS0OOg3KQaP5cgb0x3BzYmtCvfnRg3VNHOkp79B tOd3R1CeOG6Wa7Ow+/CWiJA0ikKUkLwCui7XHRkCs/VpV2qYGjHg3TklQaCR4kKBKl1/ N7WKZJrJPet6LIlT2p/wlwN8YJsv9Vo0rWWKdEMfLDxg6vUpTDfrH9MDMLRK9LZ1V8ST iCtG11yZrAddefgwMadFQEU7yzVWjQo62uHurcNbtKvgnK6jaR2G786z+IRElMwuuaH2 hIiVhd/VAGkWgMYfml9jgMURQglOCerJejWifHc5Om3qvYpMCAfa4DxelpXh63f3RlRA rB8Q== 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:arc-authentication-results; bh=guxkt9C5JZnE8ExIp37Ab4vE9GUxxYJQPmkNQfvg21o=; b=znIZpoXRJ4GnaMg/k9NNXmZnPFG7R0ZWU/0dS2FL+/p8Mqb+LvmR1aY6HUE5fPN0/H 7vnDiv+yyiByVDCyxNffFBS/3YRdt24qqco8XJVkPC0RazhgScXmCocR1flsF+rdJzfJ Pc/ISn3J6xXj97eMOeuqO4QBMGk8/38gnqpzTqGw4qbbwwLj5+pQvyU4YCC0cupqZl7y 5WOkUj4zx0Jy6jW8Bu774kSqe39WCA3VwW8BrS2lGpBAy0pXZeU/QhKrZ/6OpOpdpCH6 RAKpTUKZaBuaCcK9ad6hr0xWn220x/xrDgOBQSTejcMQhljG1kXyWnQM0aDsC0FW3YNG Si7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Jri0mRsS; 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 d37-v6si11625087plb.430.2018.08.12.04.03.00; Sun, 12 Aug 2018 04:03:15 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Jri0mRsS; 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 S1728015AbeHLNJe (ORCPT + 99 others); Sun, 12 Aug 2018 09:09:34 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59698 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727549AbeHLNJe (ORCPT ); Sun, 12 Aug 2018 09:09:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=guxkt9C5JZnE8ExIp37Ab4vE9GUxxYJQPmkNQfvg21o=; b=Jri0mRsSasUVxrK4cRW5P24hO XM4MHhpaMguPgcavYTVN0yGucGiuc37wN96+KeTaSBut5k4K0Yby45E5s0x0xyfVZJ/2vO83udXkT I/oFqbmCutF+PCT+rYNSFyPoDSqbTBsyc10pr2/6z2ePCE76GFK4DSfnw1PN/mj/BuX/kqf8SQ2AS KevdiixXnBjOxezXdnlVdOoS6FpSfdwvzOWejsxF49DNHUsoJtLYP08D/G89IFhzIyzw7yoCWW8Nv bhipFwWznXLORJ5ziYVdgKvcqRRiurw0BFaNeutHK+iHA1enKpUHkw1i32qQNs2bzVQiGwh2pa8GC TwFhgOSSg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fonen-0001Sb-Un; Sun, 12 Aug 2018 10:31:33 +0000 Date: Sun, 12 Aug 2018 03:31:33 -0700 From: Matthew Wilcox To: Martin Mares Cc: Logan Gunthorpe , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-doc@vger.kernel.org, Stephen Bates , Christoph Hellwig , Bjorn Helgaas , Jonathan Corbet , Ingo Molnar , Thomas Gleixner , "Paul E. McKenney" , Marc Zyngier , Kai-Heng Feng , Frederic Weisbecker , Dan Williams , =?iso-8859-1?B?Suly9G1l?= Glisse , Benjamin Herrenschmidt , Alex Williamson , Christian =?iso-8859-1?Q?K=F6nig?= Subject: Re: lspci: Display path to device Message-ID: <20180812103133.GB2984@bombadil.infradead.org> References: <20180717170204.30470-1-logang@deltatee.com> <20180717203900.GA1771@bombadil.infradead.org> <20180810145655.GA16533@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 12, 2018 at 11:28:37AM +0200, Martin Mares wrote: > Hello! > > > One is that using -P and -s together doesn't work because we haven't > > scanned the entire topology. > > Fixed. When topology is required, we now scan all devices and apply the > filters later. Thanks! > > The other is that even when not using -s, the topology isn't fully represented: > > > > $ ./lspci-mm -PF tests/fujitsu-p8010.lspci |grep 3com > > 00:1e.0/00.0 Network controller: 3Com Corporation 3com 3CRWE154G72 [Office Connect Wireless LAN Adapter] (rev 01) > > Ah well, it seems that the tree mode never worked with CardBus bridges. Fixed. Haha! I can't believe we never noticed that in the last twenty years! And we're fixing it even though PCI CardBus bridges are now completely obsolete (my current laptop has no slots of that form factor; my previous laptop has an ExpressCard slot; I had to go back to my previous-previous laptop from 2008 to find sample hardware to test CardBus). > After some pondering, I changed the format of the paths to include bus numbers > in all steps. I think it is more intuitive. I agree it's more intuitive, but it's not the format that Logan's code is expecting, so it's not as useful for my purposes. How about this? $ ./lspci -PF tests/fujitsu-p8010.lspci -s 1d:00.0 00:1e.0/03.0/00.0 Network controller: 3Com Corporation 3com 3CRWE154G72 [Office Connect Wireless LAN Adapter] (rev 01) $ ./lspci -PPF tests/fujitsu-p8010.lspci -s 1d:00.0 00:1e.0/1c:03.0/1d:00.0 Network controller: 3Com Corporation 3com 3CRWE154G72 [Office Connect Wireless LAN Adapter] (rev 01) I pondered asking Logan to change his parser to include the bus number as a solution, but then I remembered the entire point of this is to make specifying a device robust against bus number assignmnet changes. I suppose we could have the parser accept and ignore the bus number ... diff --git a/lspci.c b/lspci.c index 75cb5b9..3dabbde 100644 --- a/lspci.c +++ b/lspci.c @@ -50,7 +50,8 @@ static char help_msg[] = "-xxxx\t\tShow hex-dump of the 4096-byte extended config space (root only)\n" "-b\t\tBus-centric view (addresses and IRQ's as seen by the bus)\n" "-D\t\tAlways show domain numbers\n" -"-P\t\tDisplay bus path in addition to bus and device number\n" +"-P\t\tDisplay bridge path in addition to bus and device number\n" +"-PP\t\tDisplay bus path in addition to bus and device number\n" "\n" "Resolving of device ID's to names:\n" "-n\t\tShow numeric ID's\n" @@ -264,7 +265,10 @@ show_slot_path(struct device *d) if (br && br->br_dev) { show_slot_path(br->br_dev); - printf("/%02x:%02x.%d", p->bus, p->dev, p->func); + if (opt_path > 1) + printf("/%02x:%02x.%d", p->bus, p->dev, p->func); + else + printf("/%02x.%d", p->dev, p->func); return; } } diff --git a/lspci.man b/lspci.man index 78b5c96..55fadb1 100644 --- a/lspci.man +++ b/lspci.man @@ -98,6 +98,10 @@ have only domain 0. .TP .B -P Identify PCI devices by path through each bridge, instead of by bus number. +.TP +.B -PP +Identify PCI devices by path through each bridge, showing the bus number as +well as the device number. .SS Options to control resolving ID's to names .TP