netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 1/2] ibmvnic: Fix releasing of sub-CRQ IRQs in interrupt context
@ 2016-10-27 17:28 Thomas Falcon
  2016-10-27 17:28 ` [PATCH net v1 2/2] ibmvnic: Fix missing brackets in init_sub_crq_irqs Thomas Falcon
  2016-10-29 21:19 ` [PATCH net v2 1/2] ibmvnic: Fix releasing of sub-CRQ IRQs in interrupt context David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Falcon @ 2016-10-27 17:28 UTC (permalink / raw)
  To: netdev

Schedule these XPORT event tasks in the shared workqueue
so that IRQs are not freed in an interrupt context when
sub-CRQs are released.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
v2: correct warnings by kbuild bot
---
 drivers/net/ethernet/ibm/ibmvnic.c | 35 ++++++++++++++++++++++++-----------
 drivers/net/ethernet/ibm/ibmvnic.h |  1 +
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 213162d..a922fb9 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -3232,6 +3232,27 @@ static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter)
 	spin_unlock_irqrestore(&adapter->inflight_lock, flags);
 }
 
+static void ibmvnic_xport_event(struct work_struct *work)
+{
+	struct ibmvnic_adapter *adapter = container_of(work,
+						       struct ibmvnic_adapter,
+						       ibmvnic_xport);
+	struct device *dev = &adapter->vdev->dev;
+	long rc;
+
+	ibmvnic_free_inflight(adapter);
+	release_sub_crqs(adapter);
+	if (adapter->migrated) {
+		rc = ibmvnic_reenable_crq_queue(adapter);
+		if (rc)
+			dev_err(dev, "Error after enable rc=%ld\n", rc);
+		adapter->migrated = false;
+		rc = ibmvnic_send_crq_init(adapter);
+		if (rc)
+			dev_err(dev, "Error sending init rc=%ld\n", rc);
+	}
+}
+
 static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
 			       struct ibmvnic_adapter *adapter)
 {
@@ -3267,15 +3288,7 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
 		if (gen_crq->cmd == IBMVNIC_PARTITION_MIGRATED) {
 			dev_info(dev, "Re-enabling adapter\n");
 			adapter->migrated = true;
-			ibmvnic_free_inflight(adapter);
-			release_sub_crqs(adapter);
-			rc = ibmvnic_reenable_crq_queue(adapter);
-			if (rc)
-				dev_err(dev, "Error after enable rc=%ld\n", rc);
-			adapter->migrated = false;
-			rc = ibmvnic_send_crq_init(adapter);
-			if (rc)
-				dev_err(dev, "Error sending init rc=%ld\n", rc);
+			schedule_work(&adapter->ibmvnic_xport);
 		} else if (gen_crq->cmd == IBMVNIC_DEVICE_FAILOVER) {
 			dev_info(dev, "Backing device failover detected\n");
 			netif_carrier_off(netdev);
@@ -3284,8 +3297,7 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
 			/* The adapter lost the connection */
 			dev_err(dev, "Virtual Adapter failed (rc=%d)\n",
 				gen_crq->cmd);
-			ibmvnic_free_inflight(adapter);
-			release_sub_crqs(adapter);
+			schedule_work(&adapter->ibmvnic_xport);
 		}
 		return;
 	case IBMVNIC_CRQ_CMD_RSP:
@@ -3726,6 +3738,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
 	SET_NETDEV_DEV(netdev, &dev->dev);
 
 	INIT_WORK(&adapter->vnic_crq_init, handle_crq_init_rsp);
+	INIT_WORK(&adapter->ibmvnic_xport, ibmvnic_xport_event);
 
 	spin_lock_init(&adapter->stats_lock);
 
diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
index 878e2c0..dd775d9 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.h
+++ b/drivers/net/ethernet/ibm/ibmvnic.h
@@ -1048,5 +1048,6 @@ struct ibmvnic_adapter {
 	u8 map_id;
 
 	struct work_struct vnic_crq_init;
+	struct work_struct ibmvnic_xport;
 	bool failover;
 };
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net v1 2/2] ibmvnic: Fix missing brackets in init_sub_crq_irqs
  2016-10-27 17:28 [PATCH net v2 1/2] ibmvnic: Fix releasing of sub-CRQ IRQs in interrupt context Thomas Falcon
@ 2016-10-27 17:28 ` Thomas Falcon
  2016-10-29 21:19   ` David Miller
  2016-10-29 21:19 ` [PATCH net v2 1/2] ibmvnic: Fix releasing of sub-CRQ IRQs in interrupt context David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Falcon @ 2016-10-27 17:28 UTC (permalink / raw)
  To: netdev

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
v1: caught by kbuild bot with -Wmisleading-indentation after
    after submitting previous patch
---
 drivers/net/ethernet/ibm/ibmvnic.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index a922fb9..5f44c55 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1461,14 +1461,16 @@ static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter)
 	return rc;
 
 req_rx_irq_failed:
-	for (j = 0; j < i; j++)
+	for (j = 0; j < i; j++) {
 		free_irq(adapter->rx_scrq[j]->irq, adapter->rx_scrq[j]);
 		irq_dispose_mapping(adapter->rx_scrq[j]->irq);
+	}
 	i = adapter->req_tx_queues;
 req_tx_irq_failed:
-	for (j = 0; j < i; j++)
+	for (j = 0; j < i; j++) {
 		free_irq(adapter->tx_scrq[j]->irq, adapter->tx_scrq[j]);
 		irq_dispose_mapping(adapter->rx_scrq[j]->irq);
+	}
 	release_sub_crqs_no_irqs(adapter);
 	return rc;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net v2 1/2] ibmvnic: Fix releasing of sub-CRQ IRQs in interrupt context
  2016-10-27 17:28 [PATCH net v2 1/2] ibmvnic: Fix releasing of sub-CRQ IRQs in interrupt context Thomas Falcon
  2016-10-27 17:28 ` [PATCH net v1 2/2] ibmvnic: Fix missing brackets in init_sub_crq_irqs Thomas Falcon
@ 2016-10-29 21:19 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-10-29 21:19 UTC (permalink / raw)
  To: tlfalcon; +Cc: netdev

From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Thu, 27 Oct 2016 12:28:51 -0500

> Schedule these XPORT event tasks in the shared workqueue
> so that IRQs are not freed in an interrupt context when
> sub-CRQs are released.
> 
> Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
> ---
> v2: correct warnings by kbuild bot

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net v1 2/2] ibmvnic: Fix missing brackets in init_sub_crq_irqs
  2016-10-27 17:28 ` [PATCH net v1 2/2] ibmvnic: Fix missing brackets in init_sub_crq_irqs Thomas Falcon
@ 2016-10-29 21:19   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-10-29 21:19 UTC (permalink / raw)
  To: tlfalcon; +Cc: netdev

From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Thu, 27 Oct 2016 12:28:52 -0500

> Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
> ---
> v1: caught by kbuild bot with -Wmisleading-indentation after
>     after submitting previous patch

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-29 21:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-27 17:28 [PATCH net v2 1/2] ibmvnic: Fix releasing of sub-CRQ IRQs in interrupt context Thomas Falcon
2016-10-27 17:28 ` [PATCH net v1 2/2] ibmvnic: Fix missing brackets in init_sub_crq_irqs Thomas Falcon
2016-10-29 21:19   ` David Miller
2016-10-29 21:19 ` [PATCH net v2 1/2] ibmvnic: Fix releasing of sub-CRQ IRQs in interrupt context David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).