[SPDK] Potential defect in pci_unplug()
Niu, Yawei <yawei.niu at intel.com>
| Newsgroups | dev.linux.lists.spdk |
|---|---|
| Message-ID | <[email protected]> |
Hi, In the pci_unplug() (dpdk/drivers/bus/pci/pci_common.c), why do we call rte_devargs_remove() to remove the saved device args? That looks a defect to me, since that’ll result in the hot removed device failed to be detected when it’s plugged back (when white list option was provided), the situation is described following: 1. App starts with white list option provided, let’s suppose the device in white list is: 0000:81:00.0; 2. rte_devargs_add() is called to add this device arg on rte_eal_init(); 3. Issue “echo 1 > /sys/bus/pci/devices/0000\:81\:00.0/remove” to hot remove the device; 4. pci_unplug() is called to remove the device, and rte_devargs_remove() is called, so this device arg for white list is remove too; 5. Issue “echo 1 > /sys/bus/pci/rescan” then “PCI_WHITELIST=”0000:81:00.0” spdk/script/setup.sh” to do hot plug; 6. In pci_scan_one(), new dev is generated, however, the dev->device.devargs is set NULL since the device args has been removed on device unplug; 7. rte_pci_probe() does white list scan, however, it unexpectedly skips the device because the devargs of the device is NULL now; I don’t fully understand the DPDK code, but this rte_devargs_remove() in pci_unplug() doesn’t make sense to me (when I commented it out, seems everything will work as expected). Is this a glitch or I missed anything? Thanks -Niu