Skip to contentSkip to conversation

lspci: Skip scanning empty slot in sysfs_fill_slots

PATCH Martin Mares 2 participants 3 messages Oct 29, 2013 – Nov 10, 2013 1 message not in the archive PCI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hello!

Quoted 6 lines

When slot is empty, lspci will report "pcilib: sysfs_fill_slots:
Couldn't parse entry address 0000:01",this is because address entry will only contain domain and bus number when the slot is empty.

[root@uselp6 ~]# cat /sys/bus/pci/slots/U5802.001.RCHB059-P1-C7/address 0000:01

Is this behavior intentional? It does not make much sense to me.

Have a nice fortnight

Signature · 3 lines
Martin `MJ' Mares                          <[email protected]>   http://mj.ucw.cz/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
This line is umop apisdn.
#2 lore raw
Quoted 6 lines · Martin Mares

Hello!

Quoted 4 lines

When slot is empty, lspci will report "pcilib: sysfs_fill_slots:
Couldn't parse entry address 0000:01",this is because address entry will only contain domain and bus number when the slot is empty.

Quoted 6 lines
Quoted 2 lines

[root@uselp6 ~]# cat /sys/bus/pci/slots/U5802.001.RCHB059-P1-C7/address 0000:01

Is this behavior intentional? It does not make much sense to me.

Have a nice fortnight

although I am not a expert in PCI, seems this related to PCI hotplug. And I also found a description in kernel source code

"
Placeholder slots:
In most cases, @pci_bus, @slot_nr will be sufficient to uniquely identify a slot. There is one notable exception - pSeries (rpaphp), where the @slot_nr cannot be determined until a device is actually inserted into the slot. In this scenario, the caller may pass -1 for @slot_nr.The following semantics are imposed when the caller passes @slot_nr == -1. First, we no longer check for an existing %struct pci_slot, as there may be many slots with @slot_nr of -1. The other change in semantics is user-visible, which is the 'address' parameter presented in sysfs will consist solely of a dddd:bb tuple, where dddd is the PCI domain of the %struct pci_bus and bb is the bus number. In other words, the devfn of the 'placeholder' slot will not be displayed.
"

so when slots are empty in some cases, "address" solely contain dddd:bb tuple. But lspci will originally assume address in dddd:dd:dd tuple. so we should skip dddd:bb case in sysfs_fill_slots

#3 lore raw

Hello!

Quoted 5 lines

although I am not a expert in PCI, seems this related to PCI hotplug. And I also found a description in kernel source code

"
Placeholder slots:

[...]

Thanks for the explanation. I have just applied a fix similar to yours.

Have a nice fortnight

Signature · 3 lines
Martin `MJ' Mares                          <[email protected]>   http://mj.ucw.cz/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
A LISP programmer knows value of everything, but cost of nothing.