On Thu, Jul 03, 2025 at 07:31:10PM GMT, 拴何 wrote: > Hi Sunil, > Thanks for your reply! (really appricate it). > This WARNING truly occurred. Through the added debug info, I found > that the device was registered to proc via pci_proc_init and > acpi_pci_root_add paths respectively, which ultimately triggered > the warning message. > Let me try to reproduce it on qemu first. I'll keep you updated. > Thanks again. > I think you have uncovered a valid bug. There is nothing preventing (except the blessings of the initcall order) the occurence of the race between pci_proc_init() and pci_bus_add_device(). I think it went mostly unnoticed because, pci_proc_init() gets called very early before any PCI devices were registered. So for_each_pci_dev() loop never gets executed. But in your case, looks like the PCI device is available somehow before pci_proc_init() gets executed. Now, it is not very clear to me how the device becomes available at this point. It might be due to some other issue. But in anycase, I think we need to get rid of calling pci_proc_attach_device() from pci_proc_init() as I don't see a reason to call this function from two different places. pci_bus_add_device() should be the one calling this function as it is the one adding the PCI device. Ironically, I do see a similar pattern for sysfs also. Maybe there is (or was) a reason to create these files from two different places? - Mani -- மணிவண்ணன் சதாசிவம்