Commit 8d9853d9 authored by Ben Hutchings's avatar Ben Hutchings Committed by Jeff Garzik

sfc: Use a separate workqueue for resets

This avoids deadlock in case a reset is triggered during self-test.
Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 9dadae68
...@@ -1762,7 +1762,7 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type) ...@@ -1762,7 +1762,7 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type)
efx->reset_pending = method; efx->reset_pending = method;
queue_work(efx->workqueue, &efx->reset_work); queue_work(efx->reset_workqueue, &efx->reset_work);
} }
/************************************************************************** /**************************************************************************
...@@ -1907,14 +1907,28 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type, ...@@ -1907,14 +1907,28 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
goto fail1; goto fail1;
} }
efx->reset_workqueue = create_singlethread_workqueue("sfc_reset");
if (!efx->reset_workqueue) {
rc = -ENOMEM;
goto fail2;
}
return 0; return 0;
fail2:
destroy_workqueue(efx->workqueue);
efx->workqueue = NULL;
fail1: fail1:
return rc; return rc;
} }
static void efx_fini_struct(struct efx_nic *efx) static void efx_fini_struct(struct efx_nic *efx)
{ {
if (efx->reset_workqueue) {
destroy_workqueue(efx->reset_workqueue);
efx->reset_workqueue = NULL;
}
if (efx->workqueue) { if (efx->workqueue) {
destroy_workqueue(efx->workqueue); destroy_workqueue(efx->workqueue);
efx->workqueue = NULL; efx->workqueue = NULL;
...@@ -1977,7 +1991,7 @@ static void efx_pci_remove(struct pci_dev *pci_dev) ...@@ -1977,7 +1991,7 @@ static void efx_pci_remove(struct pci_dev *pci_dev)
* scheduled from this point because efx_stop_all() has been * scheduled from this point because efx_stop_all() has been
* called, we are no longer registered with driverlink, and * called, we are no longer registered with driverlink, and
* the net_device's have been removed. */ * the net_device's have been removed. */
flush_workqueue(efx->workqueue); flush_workqueue(efx->reset_workqueue);
efx_pci_remove_main(efx); efx_pci_remove_main(efx);
...@@ -2098,7 +2112,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, ...@@ -2098,7 +2112,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
* scheduled since efx_stop_all() has been called, and we * scheduled since efx_stop_all() has been called, and we
* have not and never have been registered with either * have not and never have been registered with either
* the rtnetlink or driverlink layers. */ * the rtnetlink or driverlink layers. */
cancel_work_sync(&efx->reset_work); flush_workqueue(efx->reset_workqueue);
/* Retry if a recoverably reset event has been scheduled */ /* Retry if a recoverably reset event has been scheduled */
if ((efx->reset_pending != RESET_TYPE_INVISIBLE) && if ((efx->reset_pending != RESET_TYPE_INVISIBLE) &&
......
...@@ -616,7 +616,9 @@ union efx_multicast_hash { ...@@ -616,7 +616,9 @@ union efx_multicast_hash {
* @pci_dev: The PCI device * @pci_dev: The PCI device
* @type: Controller type attributes * @type: Controller type attributes
* @legacy_irq: IRQ number * @legacy_irq: IRQ number
* @workqueue: Workqueue for resets, port reconfigures and the HW monitor * @workqueue: Workqueue for port reconfigures and the HW monitor.
* Work items do not hold and must not acquire RTNL.
* @reset_workqueue: Workqueue for resets. Work item will acquire RTNL.
* @reset_work: Scheduled reset workitem * @reset_work: Scheduled reset workitem
* @monitor_work: Hardware monitor workitem * @monitor_work: Hardware monitor workitem
* @membase_phys: Memory BAR value as physical address * @membase_phys: Memory BAR value as physical address
...@@ -684,6 +686,7 @@ struct efx_nic { ...@@ -684,6 +686,7 @@ struct efx_nic {
const struct efx_nic_type *type; const struct efx_nic_type *type;
int legacy_irq; int legacy_irq;
struct workqueue_struct *workqueue; struct workqueue_struct *workqueue;
struct workqueue_struct *reset_workqueue;
struct work_struct reset_work; struct work_struct reset_work;
struct delayed_work monitor_work; struct delayed_work monitor_work;
resource_size_t membase_phys; resource_size_t membase_phys;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment