Project

General

Profile

Actions

Bug #13714

closed

pcieadm pci check misses renamed nodes

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

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

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

The check in pcieadm to determine if a node is a PCI device or not relies on the name of the node in the devices tree starting with pci. However, this isn't the case for two particular cases:

  • VGA adapters are often renamed displayX
  • The PCI ISA bridge is renamed isaX

To deal with this the logic in pcieadm should consult not just the node name, but also we've chosen to look at the compatible property and look for an instance of pciexclass or pciclass, which are entries that should always be present based on PCI device codes.

Actions #1

Updated by Electric Monk 4 months ago

  • Gerrit CR set to 1413
Actions #2

Updated by Robert Mustacchi 4 months ago

To test this, on both my own system and on one reported by a user I looked at the difference in show-devs output. With the fix in place, this now showed two new devices: the display device (in my case from the BMC, from the user a nvidia device) and the PCI->ISA bridge. I also ran the full test suite:

rm@beowulf:~$ /opt/util-tests/tests/pcieadmtest ; pfexec /opt/util-tests/tests/pcieadm-priv ; pfexec /opt/util-tests/bin/utiltest 
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!
successfully listed devices
TEST PASSED: show-devs 0/0/0
TEST PASSED: show-cfgspace -d 0/0/0
TEST PASSED: save-cfgspace -d 0/0/0
TEST PASSED: show-devs /pci@0,0/pci1849,1480@0
TEST PASSED: show-cfgspace -d /pci@0,0/pci1849,1480@0
TEST PASSED: save-cfgspace -d /pci@0,0/pci1849,1480@0
TEST PASSED: show-devs amdzen_stub0
TEST PASSED: show-cfgspace -d amdzen_stub0
TEST PASSED: save-cfgspace -d amdzen_stub0
TEST PASSED: save-cfgspace -a
All tests passed successfully!
Test: /opt/util-tests/tests/allowed-ips (run as root)             [00:00] [PASS]
Test: /opt/util-tests/tests/chown_test (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/date_test (run as root)               [00:00] [PASS]
Test: /opt/util-tests/tests/find/findtest (run as root)           [00:00] [PASS]
Test: /opt/util-tests/tests/grep_test (run as root)               [00:03] [PASS]
Test: /opt/util-tests/tests/head/head_test (run as root)          [00:00] [PASS]
Test: /opt/util-tests/tests/libjedec_test (run as root)           [00:00] [PASS]
Test: /opt/util-tests/tests/libsff/libsff (run as root)           [00:00] [PASS]
Test: /opt/util-tests/tests/make_test (run as root)               [00:00] [PASS]
Test: /opt/util-tests/tests/mdb/mdbtest (run as root)             [00:00] [PASS]
Test: /opt/util-tests/tests/mergeq/mqt (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/mergeq/wqt (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/pcidbtest (run as root)               [00:01] [PASS]
Test: /opt/util-tests/tests/pcieadm-priv (run as root)            [00:03] [PASS]
Test: /opt/util-tests/tests/pcieadmtest (run as root)             [00:03] [PASS]
Test: /opt/util-tests/tests/printf_test (run as root)             [00:00] [PASS]
Test: /opt/util-tests/tests/set-linkprop (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/sleep/sleeptest (run as root)         [00:23] [PASS]
Test: /opt/util-tests/tests/smbios (run as root)                  [00:00] [PASS]
Test: /opt/util-tests/tests/xargs_test (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/awk/runtests.sh (run as nobody)       [02:57] [PASS]
Test: /opt/util-tests/tests/ctf/precheck (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/ctf/ctftest (run as root)             [00:06] [PASS]
Test: /opt/util-tests/tests/demangle/afl-fast (run as root)       [00:01] [PASS]
Test: /opt/util-tests/tests/demangle/gcc-libstdc++ (run as root)  [00:00] [PASS]
Test: /opt/util-tests/tests/demangle/llvm-stdcxxabi (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libcustr/custr_remove (run as root)   [00:00] [PASS]
Test: /opt/util-tests/tests/libcustr/custr_trunc (run as root)    [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_00_blank (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_01_boolean (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_02_numbers (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_03_empty_arrays (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_04_number_arrays (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_05_strings (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_06_nested (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_07_nested_arrays (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/sed/sed_addr (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/sed/multi_test (run as root)          [00:00] [PASS]

Results Summary
PASS      38

Running Time:   00:03:47
Percent passed: 100.0%
Log directory:  /var/tmp/test_results/20210415T090220
Actions #3

Updated by Electric Monk 4 months ago

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

git commit 414dafc0a71bccb9c69d6801ed11ba1016a8082b

commit  414dafc0a71bccb9c69d6801ed11ba1016a8082b
Author: Robert Mustacchi <rm@fingolfin.org>
Date:   2021-04-15T20:44:29.000Z

    13714 pcieadm pci check misses renamed nodes
    13715 pcieadm save-cfgspace doesn't work with b/d/f
    13716 pcieadm save-cfgspace -a can't open files
    Reviewed by: C Fraire <cfraire@me.com>
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF