diff options
author | Bjorn Helgaas <[email protected]> | 2020-06-25 18:14:55 -0500 |
---|---|---|
committer | Bjorn Helgaas <[email protected]> | 2020-07-07 15:09:01 -0500 |
commit | 2a7e32d0547f41c5ce244f84cf5d6ca7fccee7eb (patch) | |
tree | c8d7a0c40ba2ddaccec88f6cd623cd0babfc1f0e /tools/perf/util/scripting-engines/trace-event-perl.c | |
parent | b3a9e3b9622ae10064826dccb4f7a52bd88c7407 (diff) |
PCI: Fix pci_cfg_wait queue locking problem
The pci_cfg_wait queue is used to prevent user-space config accesses to
devices while they are recovering from reset.
Previously we used these operations on pci_cfg_wait:
__add_wait_queue(&pci_cfg_wait, ...)
__remove_wait_queue(&pci_cfg_wait, ...)
wake_up_all(&pci_cfg_wait)
The wake_up acquires the wait queue lock, but the add and remove do not.
Originally these were all protected by the pci_lock, but cdcb33f98244
("PCI: Avoid possible deadlock on pci_lock and p->pi_lock"), moved
wake_up_all() outside pci_lock, so it could race with add/remove
operations, which caused occasional kernel panics, e.g., during vfio-pci
hotplug/unplug testing:
Unable to handle kernel read from unreadable memory at virtual address ffff802dac469000
Resolve this by using wait_event() instead of __add_wait_queue() and
__remove_wait_queue(). The wait queue lock is held by both wait_event()
and wake_up_all(), so it provides mutual exclusion.
Fixes: cdcb33f98244 ("PCI: Avoid possible deadlock on pci_lock and p->pi_lock")
Link: https://lore.kernel.org/linux-pci/[email protected]/T/#u
Based-on: https://lore.kernel.org/linux-pci/[email protected]/
Based-on-patch-by: Xiang Zheng <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
Tested-by: Xiang Zheng <[email protected]>
Cc: Heyi Guo <[email protected]>
Cc: Biaoxiang Ye <[email protected]>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-perl.c')
0 files changed, 0 insertions, 0 deletions