diff mbox

lspci tries to open non-existent files

Message ID 20090629110741.GI5480@parisc-linux.org (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Matthew Wilcox June 29, 2009, 11:07 a.m. UTC
On Mon, Jun 29, 2009 at 01:04:53PM +0530, M. Mohan Kumar wrote:
> With recent pciutils, lspci tries to open non-existent files in sysfs and
> issues following warning messages:
> 
> pcilib: sysfs_fill_slots: Cannot open /sys/bus/pci/slots/control/address: No
> such file or directory
> pcilib: sysfs_fill_slots: Cannot open /sys/bus/pci/slots/0000:01:00.0/address:
> No such file or directory
> 
> Above warning message is displayed when using a 2.6.16 based distro kernel
> and pciutils 3.1.2 and 3.1 versions. This problem is not seen in 3.0
> version.
> 
> If the files don't exist, should not we return without displaying any
> warning?

Yes, we should.  Can you try this patch?

Comments

M. Mohan Kumar June 29, 2009, 11:28 a.m. UTC | #1
On Mon, Jun 29, 2009 at 05:07:41AM -0600, Matthew Wilcox wrote:
> On Mon, Jun 29, 2009 at 01:04:53PM +0530, M. Mohan Kumar wrote:
> > With recent pciutils, lspci tries to open non-existent files in sysfs and
> > issues following warning messages:
> > 
> > pcilib: sysfs_fill_slots: Cannot open /sys/bus/pci/slots/control/address: No
> > such file or directory
> > pcilib: sysfs_fill_slots: Cannot open /sys/bus/pci/slots/0000:01:00.0/address:
> > No such file or directory
> > 
> > Above warning message is displayed when using a 2.6.16 based distro kernel
> > and pciutils 3.1.2 and 3.1 versions. This problem is not seen in 3.0
> > version.
> > 
> > If the files don't exist, should not we return without displaying any
> > warning?
> 
> Yes, we should.  Can you try this patch?

Thank you Matthew, this patch fixes this problem. Is it already part of
pciutils source?

Regards,
M. Mohan Kumar.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Matthew Wilcox June 29, 2009, 3:55 p.m. UTC | #2
On Mon, Jun 29, 2009 at 04:58:47PM +0530, M. Mohan Kumar wrote:
> On Mon, Jun 29, 2009 at 05:07:41AM -0600, Matthew Wilcox wrote:
> > On Mon, Jun 29, 2009 at 01:04:53PM +0530, M. Mohan Kumar wrote:
> > > With recent pciutils, lspci tries to open non-existent files in sysfs and
> > > issues following warning messages:
> > > 
> > > pcilib: sysfs_fill_slots: Cannot open /sys/bus/pci/slots/control/address: No
> > > such file or directory
> > > pcilib: sysfs_fill_slots: Cannot open /sys/bus/pci/slots/0000:01:00.0/address:
> > > No such file or directory
> > > 
> > > Above warning message is displayed when using a 2.6.16 based distro kernel
> > > and pciutils 3.1.2 and 3.1 versions. This problem is not seen in 3.0
> > > version.
> > > 
> > > If the files don't exist, should not we return without displaying any
> > > warning?
> > 
> > Yes, we should.  Can you try this patch?
> 
> Thank you Matthew, this patch fixes this problem. Is it already part of
> pciutils source?

Not yet ... need to wait for Martin to apply it ;-)
Martin Mareš June 29, 2009, 5 p.m. UTC | #3
Hi!

> Not yet ... need to wait for Martin to apply it ;-)

Applied.

				Have a nice fortnight
M. Mohan Kumar June 30, 2009, 6:35 a.m. UTC | #4
On Mon, Jun 29, 2009 at 07:00:37PM +0200, Martin Mares wrote:
> Hi!
> 
> > Not yet ... need to wait for Martin to apply it ;-)
> 
> Applied.

Thank you very much Matthew and Martin.

Regards,
M. Mohan Kumar
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jike Song June 30, 2009, 10:06 a.m. UTC | #5
On Mon, Jun 29, 2009 at 7:07 PM, Matthew Wilcox<matthew@wil.cx> wrote:
> On Mon, Jun 29, 2009 at 01:04:53PM +0530, M. Mohan Kumar wrote:
>>
>> If the files don't exist, should not we return without displaying any
>> warning?
>
> Yes, we should.  Can you try this patch?

Hi Willy, specify -M to lspci still produce lots of errors like these:

pcilib: Cannot open /sys/bus/pci/devices/0000:00:02.0/config
pcilib: Cannot open /sys/bus/pci/devices/0000:00:04.0/config
pcilib: Cannot open /sys/bus/pci/devices/0000:00:05.0/config
pcilib: Cannot open /sys/bus/pci/devices/0000:00:06.0/config
pcilib: Cannot open /sys/bus/pci/devices/0000:00:08.0/config
pcilib: Cannot open /sys/bus/pci/devices/0000:00:09.0/config
pcilib: Cannot open /sys/bus/pci/devices/0000:00:0a.0/config
{8204 more lines snipped}

Would you please also fix this?
Matthew Wilcox June 30, 2009, 12:23 p.m. UTC | #6
On Tue, Jun 30, 2009 at 06:06:56PM +0800, Jike Song wrote:
> On Mon, Jun 29, 2009 at 7:07 PM, Matthew Wilcox<matthew@wil.cx> wrote:
> > On Mon, Jun 29, 2009 at 01:04:53PM +0530, M. Mohan Kumar wrote:
> >>
> >> If the files don't exist, should not we return without displaying any
> >> warning?
> >
> > Yes, we should. ??Can you try this patch?
> 
> Hi Willy, specify -M to lspci still produce lots of errors like these:
> 
> pcilib: Cannot open /sys/bus/pci/devices/0000:00:02.0/config

To be fair, what you're trying to do there makes no sense:

       -M     Invoke  bus  mapping  mode which performs a thorough scan of all
              PCI devices, including those behind misconfigured  bridges  etc.
              This  option  is  available only to root and it gives meaningful
              results only if combined with direct hardware access mode  (oth-
              erwise the results are identical to normal listing modes, modulo
              bugs in lspci). Please note that the bus mapper doesn't  support
              PCI domains and scans only domain 0.

I'd be inclined to make lspci error out when trying -M with sysfs or procfs.
diff mbox

Patch

diff --git a/lib/sysfs.c b/lib/sysfs.c
index 2419b41..ef00a3b 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -221,11 +221,13 @@  sysfs_fill_slots(struct pci_access *a)
       if (n < 0 || n >= OBJNAMELEN)
 	a->error("File name too long");
       file = fopen(namebuf, "r");
+      /*
+       * Old versions of Linux had a fakephp which didn't have an 'address'
+       * file.  There's no useful information to be gleaned from these
+       * devices, pretend they're not there
+       */
       if (!file)
-	{
-	  a->warning("sysfs_fill_slots: Cannot open %s: %s", namebuf, strerror(errno));
-	  continue;
-	}
+	continue;
 
       if (!fgets(buf, sizeof(buf), file) || sscanf(buf, "%x:%x:%x", &dom, &bus, &dev) < 3)
 	a->warning("sysfs_fill_slots: Couldn't parse entry address %s", buf);