Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1741864

Re: [PATCH 3/4] pci aer: fix deadlock in do_recovery

From Govindarajulu Varadarajan <gvaradar@cisco.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/4] pci aer: fix deadlock in do_recovery
Date 2017-09-29 01:50 +0200
Message-ID <uuQJ3-6Xj-1@gated-at.bofh.it> (permalink)
References <uusx3-6r-9@gated-at.bofh.it> <uusx4-6r-21@gated-at.bofh.it> <uuKaB-2Wc-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 28 Sep 2017, Sinan Kaya wrote:

> On 9/27/2017 5:42 PM, Govindarajulu Varadarajan wrote:
>> CPU0					CPU1
>> ---------------------------------------------------------------------
>> __driver_attach()
>> device_lock(&dev->mutex) <--- device mutex lock here
>> driver_probe_device()
>> pci_enable_sriov()
>> pci_iov_add_virtfn()
>> pci_device_add()
>> 					aer_isr()		<--- pci aer error
>> 					do_recovery()
>> 					broadcast_error_message()
>> 					pci_walk_bus()
>> 					down_read(&pci_bus_sem) <--- rd sem
>
> How about releasing the device_lock here on CPU0?>

pci_device_add() is called by driver's pci probe function. device_lock(dev)
should be held before calling pci driver probe function.

> or in other words keep device_lock as short as possible?

The problem is not the duration device_lock is held. It is the order two locks
are aquired. We cannot control or implement a restriction that during
device_lock() is held, driver probe should not call pci function which aquires
pci_bus_sem. And in case of pci aer, aer handler needs to call driver err_handler()
for which we need to hold device_lock() before calling err_handler(). In order
to find all the devices on a pci bus, we should hold pci_bus_sem to do
pci_walk_bus().

>> down_write(&pci_bus_sem) <-- stuck on wr sem
>> 					report_error_detected()
>> 					device_lock(&dev->mutex)<--- DEAD LOCK

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] pci aer: fix deadlock in do_recovery Govindarajulu Varadarajan <gvaradar@cisco.com> - 2017-09-28 00:00 +0200
  [PATCH 1/4] pci: introduce __pci_walk_bus for caller with pci_bus_sem held Govindarajulu Varadarajan <gvaradar@cisco.com> - 2017-09-28 00:00 +0200
    Re: [PATCH 1/4] pci: introduce __pci_walk_bus for caller with  pci_bus_sem held Sinan Kaya <okaya@codeaurora.org> - 2017-09-28 18:20 +0200
      Re: [PATCH 1/4] pci: introduce __pci_walk_bus for caller with  pci_bus_sem held Govindarajulu Varadarajan <gvaradar@cisco.com> - 2017-09-29 02:00 +0200
  [PATCH 3/4] pci aer: fix deadlock in do_recovery Govindarajulu Varadarajan <gvaradar@cisco.com> - 2017-09-28 00:00 +0200
    Re: [PATCH 3/4] pci aer: fix deadlock in do_recovery Sinan Kaya <okaya@codeaurora.org> - 2017-09-28 18:50 +0200
      Re: [PATCH 3/4] pci aer: fix deadlock in do_recovery Govindarajulu Varadarajan <gvaradar@cisco.com> - 2017-09-29 01:50 +0200
        Re: [PATCH 3/4] pci aer: fix deadlock in do_recovery Sinan Kaya <okaya@codeaurora.org> - 2017-09-29 15:40 +0200
          Re: [PATCH 3/4] pci aer: fix deadlock in do_recovery Govindarajulu Varadarajan <gvaradar@cisco.com> - 2017-09-30 08:10 +0200
  [PATCH 4/4] lockdep: make MAX_LOCK_DEPTH configurable from Kconfig Govindarajulu Varadarajan <gvaradar@cisco.com> - 2017-09-28 00:00 +0200
    Re: [PATCH 4/4] lockdep: make MAX_LOCK_DEPTH configurable from  Kconfig Peter Zijlstra <peterz@infradead.org> - 2017-09-28 11:30 +0200
      Re: [PATCH 4/4] lockdep: make MAX_LOCK_DEPTH configurable from  Kconfig Govindarajulu Varadarajan <gvaradar@cisco.com> - 2017-09-29 02:00 +0200
        Re: [PATCH 4/4] lockdep: make MAX_LOCK_DEPTH configurable from  Kconfig Bjorn Helgaas <helgaas@kernel.org> - 2017-09-29 18:30 +0200
          Re: [PATCH 4/4] lockdep: make MAX_LOCK_DEPTH configurable from  Kconfig Govindarajulu Varadarajan <gvaradar@cisco.com> - 2017-09-30 08:10 +0200
  [PATCH 2/4] pci: code refactor pci_bus_lock/unlock/trylock Govindarajulu Varadarajan <gvaradar@cisco.com> - 2017-09-28 00:00 +0200

csiph-web