It takes around 8.7 seconds to execute lspci on my machine. Then it is fast for about 10 seconds (results might be cached somewhere) and then it gets slow again. By using strace I have found out that the problem is with accessing /sys/bus/pci/devices/0000:01:00.0/config. Indeed, if I try to `cat` that file, the operation takes the above mentioned time intervals to execute. The 01:00.0 device is NVIDIA Corporation GK107GLM [Quadro K1100M] (rev a1). I did a system upgrade 3 weeks ago and a part of that was a kernel update: Erase kernel-4.2.8-300.fc23.x86_64 Install kernel-4.3.5-300.fc23.x86_64 Erase kernel-core-4.2.8-300.fc23.x86_64 Install kernel-core-4.3.5-300.fc23.x86_64 Upgraded kernel-headers-4.3.3-303.fc23.x86_64 Upgrade 4.3.5-300.fc23.x86_64 Erase kernel-modules-4.2.8-300.fc23.x86_64 Install kernel-modules-4.3.5-300.fc23.x86_64 So it might be related to it. I do not remember seeing the problem before. (The initial problem that I was solving was slow `sudo su` on my system, see https://bugzilla.redhat.com/show_bug.cgi?id=1306524).
I'm having a similar issue. It started after I switched to a computer with an Nvidia GPU. (I switched to an ThinkPad X1 Extreme gen 2, with an Nvidia GTX 1650 Max-Q, from an otherwise-identical X1 Extreme gen 2 without discrete graphics). lspci takes variable time. Sometimes up to 5 seconds or so, or down to a few hundred milliseconds if I've run it recently. Many programs are also slow to start. I've noticed this specifically with alacritty, kitty, and gnome-system-monitor. With all of these, when I use strace to see what's taking the time, the slow step is reading from /sys/bus/pci/devices/0000:05:02.0/config, which corresponds to the Nvidia GPU. The problem is intermittent; sometimes it goes away for a few hours, then comes back. This happens regardless of whether nouveau is loaded, or the Nvidia proprietary driver, or neither. When I use "envycontrol -s integrated" to disable the Nvidia GPU completely, the GPU no longer shows up in lspci, but the problem is still there; the slow step is reading from a different device instead.