Project

General

Profile

Actions

Feature #14810

closed

pcieadm show-devs should use current values for type

Added by Robert Mustacchi 3 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

Today, when you're using pcieadm show-devs the type column is showing the device's theoretical configuration. For example, if you have a device that is theoretically capable of running at Gen 4 x16, but is plugged into a Gen 3 x4 slot, this'll show up as Gen 4 x16. This has been somewhat confusing to other folks who have been trying to read through this and assume that it means that the device has linked up that way. This changes the default around here to use the current speed / width which anecdotally seems to be what is expected.

Actions #1

Updated by Electric Monk 3 months ago

  • Gerrit CR set to 2238
Actions #2

Updated by Robert Mustacchi 3 months ago

To test this I went and took a system that has a PCIe Gen 4 device that is linked up at Gen 3 speeds:

rm@romulus ~ $ pfexec /usr/lib/pci/pcieadm show-cfgspace -d nvme7 pcie.linkcap pcie.linksts
PCI Express Capability (0x10)
  Link Capabilities: 0x43ac44
    |--> Maximum Link Speed: 16.0 GT/s (0x4)
    |--> Maximum Link Width: 0x4
    |--> ASPM Support: L0s/L1 (0xc00)
    |--> L0s Exit Latency: 128-256ns (0x2000)
    |--> L1 Exit Latency: reserved (0x38000)
    |--> Clock Power Management: unsupported (0x0)
    |--> Surprise Down Error Reporting: unsupported (0x0)
    |--> Data Link Layer Active Reporting: unsupported (0x0)
    |--> Link Bandwidth Notification Capability: unsupported (0x0)
    |--> ASPM Optionality Compliance: compliant (0x400000)
    |--> Port Number: 0x0
  Link Status: 0x1043
    |--> Link Speed: 8.0 GT/s (0x3)
    |--> Link Width: 0x4
    |--> Link Training: no (0x0)

If we look at this in pcieadm before hand:

rm@romulus ~ $ /usr/lib/pci/pcieadm show-devs nvme7
BDF     TYPE           DRIVER         DEVICE
83/0/0  PCIe Gen 4x4   nvme7          7450 MAX NVMe SSD

We'll see that it's showing as a gen4 device which while true is operating at gen 3 speeds. With a fixed version of this we now see:

rm@romulus ~ $ ./pcieadm show-devs nvme7
BDF     TYPE           DRIVER         DEVICE
83/0/0  PCIe Gen 3x4   nvme7          7450 MAX NVMe SSD

In addition, I ran the pcieadm test suites:

rm@romulus ~ $ /opt/util-tests/tests/pcieadmtest 
TEST PASSED: invalid arguments 
TEST PASSED: invalid arguments -d
TEST PASSED: invalid arguments foobar
TEST PASSED: invalid arguments save-cfgspace
TEST PASSED: invalid arguments save-cfgspace -a
TEST PASSED: invalid arguments save-cfgspace -d
TEST PASSED: invalid arguments save-cfgspace -d final
TEST PASSED: invalid arguments save-cfgspace -a -d fantasy
TEST PASSED: invalid arguments show-devs -h
TEST PASSED: invalid arguments show-devs -p
TEST PASSED: invalid arguments show-devs -s -o
TEST PASSED: invalid arguments show-cfgspace
TEST PASSED: invalid arguments show-cfgspace -d -H
TEST PASSED: invalid arguments show-cfgspace -d
TEST PASSED: invalid arguments show-cfgspace -f
TEST PASSED: invalid arguments show-cfgspace -h
TEST PASSED: invalid arguments show-cfgspace -L
TEST PASSED: invalid arguments show-cfgspace -L -n -f /opt/util-tests/tests/pci/igb.pci
TEST PASSED: invalid arguments show-cfgspace -L -p -f /opt/util-tests/tests/pci/igb.pci
TEST PASSED: invalid arguments show-cfgspace -p -f /opt/util-tests/tests/pci/igb.pci
TEST PASSED: invalid arguments show-cfgspace -o foo -f /opt/util-tests/tests/pci/igb.pci
TEST PASSED: invalid arguments show-cfgspace -L -o foo -f /opt/util-tests/tests/pci/igb.pci
TEST PASSED: show-cfgspace -f /dev/stdin header0.vendor header0.device
TEST PASSED: show-cfgspace -L -f /dev/stdin header0.vendor header0.device
TEST PASSED: show-cfgspace -n -f /dev/stdin header0.vendor header0.device
TEST PASSED: show-cfgspace -L -H -f /dev/stdin header0.vendor header0.device
TEST PASSED: show-cfgspace -f /dev/stdin ltr
TEST PASSED: show-cfgspace -p -o short,value -f /dev/stdin ltr
TEST PASSED: show-cfgspace -p -o short,value -f /dev/stdin header0.vendor header0.device
TEST PASSED: show-cfgspace -f /dev/stdin ht
TEST PASSED: show-cfgspace -f /dev/stdin ht.msi
TEST PASSED: show-cfgspace -f /dev/stdin ht.msi.command
TEST PASSED: show-cfgspace -p -o value,short -f /dev/stdin ht
TEST PASSED: show-cfgspace -p -o value,short -f /dev/stdin ht.msi
TEST PASSED: show-cfgspace -p -o value,short -f /dev/stdin ht.msi.command
TEST PASSED: show-cfgspace -f /dev/stdin pcie.linksts atelier
TEST PASSED: show-cfgspace -p -o short,value -f /dev/stdin pcie.linksts atelier
All tests passed successfully!
rm@romulus ~ $ 
rm@romulus ~ $ pfexec /opt/util-tests/tests/pcieadm-priv 
successfully listed devices
TEST PASSED: show-devs 0/0/0
BDF     TYPE           DRIVER         DEVICE
0/0/0   PCI            amdzen_stub0   Starship/Matisse Root Complex
pcieadm: filter '9000/9000/9000' did not match any devices
TEST PASSED: show-devs 0/0/0 9000/9000/9000
TEST PASSED: show-cfgspace -d 0/0/0
TEST PASSED: save-cfgspace -d 0/0/0
TEST PASSED: show-devs amdzen_stub0
BDF     TYPE           DRIVER         DEVICE
0/0/0   PCI            amdzen_stub0   Starship/Matisse Root Complex
pcieadm: filter '9000/9000/9000' did not match any devices
TEST PASSED: show-devs amdzen_stub0 9000/9000/9000
TEST PASSED: show-cfgspace -d amdzen_stub0
TEST PASSED: save-cfgspace -d amdzen_stub0
TEST PASSED: show-devs /pci@0,0/pci1458,1000@0
BDF     TYPE           DRIVER         DEVICE
0/0/0   PCI            amdzen_stub0   Starship/Matisse Root Complex
pcieadm: filter '9000/9000/9000' did not match any devices
TEST PASSED: show-devs /pci@0,0/pci1458,1000@0 9000/9000/9000
TEST PASSED: show-cfgspace -d /pci@0,0/pci1458,1000@0
TEST PASSED: save-cfgspace -d /pci@0,0/pci1458,1000@0
pcieadm: filter '/enoent' did not match any devices
TEST PASSED: show-devs /enoent
TEST PASSED: save-cfgspace -a
All tests passed successfully!
Actions #3

Updated by Electric Monk 3 months ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit a68304eb6e91ead0cd793eae3030b924ca68adb4

commit  a68304eb6e91ead0cd793eae3030b924ca68adb4
Author: Robert Mustacchi <rm@fingolfin.org>
Date:   2022-07-20T20:55:43.000Z

    14810 pcieadm show-devs should use current values for type
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
    Approved by: Garrett D'Amore <garrett@damore.org>

Actions

Also available in: Atom PDF