All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5 net-next v2] ibmvnic: LPM bug fixes
@ 2017-06-15  4:50 Thomas Falcon
  2017-06-15  4:50 ` [PATCH 1/5 net-next v2] ibmvnic: Activate disabled RX buffer pools on reset Thomas Falcon
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Thomas Falcon @ 2017-06-15  4:50 UTC (permalink / raw)
  To: netdev; +Cc: nfont, jallen, davem, Thomas Falcon

This series of small patches is meant to resolve a number of
bugs, mostly occurring during an ibmvnic driver reset when
recovering from a logical partition migration (LPM).

The first patch ensures that RX buffer pools are properly
activated following an adapter reset by setting the proper
flag in the pool data structure.

The second patch uses netif_tx_disable to stop TX queues when
closing the device during a reset.

Third, fixup a typo that resulted in partial sanitization of
TX/RX descriptor queues following a device reset.

Fourth, remove an ambiguous conditional check that was resulting
in a kernel panic as null RX/TX completion descriptors were being
processed during napi polling while the device is closing.

Finally, fix a condition where the napi polling routine exits
before it has completed its work budget without notifying the
upper network layers. This omission could result in the
napi_disable function sleeping indefinitely under certain conditions.

v2: Attempt to provide a proper cover letter

Thomas Falcon (5):
  ibmvnic: Activate disabled RX buffer pools on reset
  ibmvnic: Ensure that TX queues are disabled in __ibmvnic_close
  ibmvnic: Sanitize entire SCRQ buffer on reset
  ibmvnic: Remove VNIC_CLOSING check from pending_scrq
  ibmvnic: Exit polling routine correctly during adapter reset

 drivers/net/ethernet/ibm/ibmvnic.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

-- 
1.8.3.1

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

* [PATCH 1/5 net-next v2] ibmvnic: Activate disabled RX buffer pools on reset
  2017-06-15  4:50 [PATCH 0/5 net-next v2] ibmvnic: LPM bug fixes Thomas Falcon
@ 2017-06-15  4:50 ` Thomas Falcon
  2017-06-15  4:50 ` [PATCH 2/5 net-next v2] ibmvnic: Ensure that TX queues are disabled in __ibmvnic_close Thomas Falcon
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Falcon @ 2017-06-15  4:50 UTC (permalink / raw)
  To: netdev; +Cc: nfont, jallen, davem, Thomas Falcon

RX buffer pools are disabled while awaiting a device
reset if firmware indicates that the resource is closed.

This patch fixes a bug where pools were not being 
subsequently enabled after the device reset, causing
the device to become inoperable.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>

---
 drivers/net/ethernet/ibm/ibmvnic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 7e585fd..000cd15 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -383,6 +383,7 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter)
 		atomic_set(&rx_pool->available, 0);
 		rx_pool->next_alloc = 0;
 		rx_pool->next_free = 0;
+		rx_pool->active = 1;
 	}
 
 	return 0;
-- 
1.8.5.6

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

* [PATCH 2/5 net-next v2] ibmvnic: Ensure that TX queues are disabled in __ibmvnic_close
  2017-06-15  4:50 [PATCH 0/5 net-next v2] ibmvnic: LPM bug fixes Thomas Falcon
  2017-06-15  4:50 ` [PATCH 1/5 net-next v2] ibmvnic: Activate disabled RX buffer pools on reset Thomas Falcon
@ 2017-06-15  4:50 ` Thomas Falcon
  2017-06-15  4:50 ` [PATCH 3/5 net-next v2] ibmvnic: Sanitize entire SCRQ buffer on reset Thomas Falcon
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Falcon @ 2017-06-15  4:50 UTC (permalink / raw)
  To: netdev; +Cc: nfont, jallen, davem, Thomas Falcon

Use netif_tx_disable to guarantee that TX queues are disabled 
when __ibmvnic_close is called by the device reset routine.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 000cd15..d5fbf45 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -886,7 +886,13 @@ static int __ibmvnic_close(struct net_device *netdev)
 	int i;
 
 	adapter->state = VNIC_CLOSING;
-	netif_tx_stop_all_queues(netdev);
+
+	/* ensure that transmissions are stopped if called by do_reset */
+	if (adapter->resetting)
+		netif_tx_disable(netdev);
+	else
+		netif_tx_stop_all_queues(netdev);
+
 	ibmvnic_napi_disable(adapter);
 
 	if (adapter->tx_scrq) {
-- 
1.8.5.6

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

* [PATCH 3/5 net-next v2] ibmvnic: Sanitize entire SCRQ buffer on reset
  2017-06-15  4:50 [PATCH 0/5 net-next v2] ibmvnic: LPM bug fixes Thomas Falcon
  2017-06-15  4:50 ` [PATCH 1/5 net-next v2] ibmvnic: Activate disabled RX buffer pools on reset Thomas Falcon
  2017-06-15  4:50 ` [PATCH 2/5 net-next v2] ibmvnic: Ensure that TX queues are disabled in __ibmvnic_close Thomas Falcon
@ 2017-06-15  4:50 ` Thomas Falcon
  2017-06-15  4:50 ` [PATCH 4/5 net-next v2] ibmvnic: Remove VNIC_CLOSING check from pending_scrq Thomas Falcon
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Falcon @ 2017-06-15  4:50 UTC (permalink / raw)
  To: netdev; +Cc: nfont, jallen, davem, Thomas Falcon

Fixup a typo so that the entire SCRQ buffer is cleaned.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index d5fbf45..167b47b 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1745,7 +1745,7 @@ static int reset_one_sub_crq_queue(struct ibmvnic_adapter *adapter,
 		scrq->irq = 0;
 	}
 
-	memset(scrq->msgs, 0, 2 * PAGE_SIZE);
+	memset(scrq->msgs, 0, 4 * PAGE_SIZE);
 	scrq->cur = 0;
 
 	rc = h_reg_sub_crq(adapter->vdev->unit_address, scrq->msg_token,
-- 
1.8.5.6

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

* [PATCH 4/5 net-next v2] ibmvnic: Remove VNIC_CLOSING check from pending_scrq
  2017-06-15  4:50 [PATCH 0/5 net-next v2] ibmvnic: LPM bug fixes Thomas Falcon
                   ` (2 preceding siblings ...)
  2017-06-15  4:50 ` [PATCH 3/5 net-next v2] ibmvnic: Sanitize entire SCRQ buffer on reset Thomas Falcon
@ 2017-06-15  4:50 ` Thomas Falcon
  2017-06-15  4:50 ` [PATCH 5/5 net-next v2] ibmvnic: Exit polling routine correctly during adapter reset Thomas Falcon
  2017-06-15 18:31 ` [PATCH 0/5 net-next v2] ibmvnic: LPM bug fixes David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Falcon @ 2017-06-15  4:50 UTC (permalink / raw)
  To: netdev; +Cc: nfont, jallen, davem, Thomas Falcon

Fix a kernel panic resulting from data access of a NULL
pointer during device close. The pending_scrq routine is
meant to determine whether there is a valid sub-CRQ message
awaiting processing. When the device is closing, however,
there is a possibility that NULL messages can be processed
because pending_scrq will always return 1 even if there
no valid message in the queue.

It's not clear what this closing state check was originally
meant to accomplish, so just remove it.  

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 167b47b..5378b21 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -2268,8 +2268,7 @@ static int pending_scrq(struct ibmvnic_adapter *adapter,
 {
 	union sub_crq *entry = &scrq->msgs[scrq->cur];
 
-	if (entry->generic.first & IBMVNIC_CRQ_CMD_RSP ||
-	    adapter->state == VNIC_CLOSING)
+	if (entry->generic.first & IBMVNIC_CRQ_CMD_RSP)
 		return 1;
 	else
 		return 0;
-- 
1.8.5.6

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

* [PATCH 5/5 net-next v2] ibmvnic: Exit polling routine correctly during adapter reset
  2017-06-15  4:50 [PATCH 0/5 net-next v2] ibmvnic: LPM bug fixes Thomas Falcon
                   ` (3 preceding siblings ...)
  2017-06-15  4:50 ` [PATCH 4/5 net-next v2] ibmvnic: Remove VNIC_CLOSING check from pending_scrq Thomas Falcon
@ 2017-06-15  4:50 ` Thomas Falcon
  2017-06-15 18:31 ` [PATCH 0/5 net-next v2] ibmvnic: LPM bug fixes David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Falcon @ 2017-06-15  4:50 UTC (permalink / raw)
  To: netdev; +Cc: nfont, jallen, davem, Thomas Falcon

This patch fixes a bug where, in the case of a device reset,
the polling routine will never complete, causing napi_disable
to sleep indefinitely when attempting to close the device. 

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 5378b21..ba4c79d 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1504,9 +1504,6 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget)
 	int scrq_num = (int)(napi - adapter->napi);
 	int frames_processed = 0;
 
-	if (adapter->resetting)
-		return 0;
-
 restart_poll:
 	while (frames_processed < budget) {
 		struct sk_buff *skb;
@@ -1516,6 +1513,12 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget)
 		u16 offset;
 		u8 flags = 0;
 
+		if (unlikely(adapter->resetting)) {
+			enable_scrq_irq(adapter, adapter->rx_scrq[scrq_num]);
+			napi_complete_done(napi, frames_processed);
+			return frames_processed;
+		}
+
 		if (!pending_scrq(adapter, adapter->rx_scrq[scrq_num]))
 			break;
 		next = ibmvnic_next_scrq(adapter, adapter->rx_scrq[scrq_num]);
-- 
1.8.5.6

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

* Re: [PATCH 0/5 net-next v2] ibmvnic: LPM bug fixes
  2017-06-15  4:50 [PATCH 0/5 net-next v2] ibmvnic: LPM bug fixes Thomas Falcon
                   ` (4 preceding siblings ...)
  2017-06-15  4:50 ` [PATCH 5/5 net-next v2] ibmvnic: Exit polling routine correctly during adapter reset Thomas Falcon
@ 2017-06-15 18:31 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2017-06-15 18:31 UTC (permalink / raw)
  To: tlfalcon; +Cc: netdev, nfont, jallen

From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Wed, 14 Jun 2017 23:50:04 -0500

> This series of small patches is meant to resolve a number of
> bugs, mostly occurring during an ibmvnic driver reset when
> recovering from a logical partition migration (LPM).
> 
> The first patch ensures that RX buffer pools are properly
> activated following an adapter reset by setting the proper
> flag in the pool data structure.
> 
> The second patch uses netif_tx_disable to stop TX queues when
> closing the device during a reset.
> 
> Third, fixup a typo that resulted in partial sanitization of
> TX/RX descriptor queues following a device reset.
> 
> Fourth, remove an ambiguous conditional check that was resulting
> in a kernel panic as null RX/TX completion descriptors were being
> processed during napi polling while the device is closing.
> 
> Finally, fix a condition where the napi polling routine exits
> before it has completed its work budget without notifying the
> upper network layers. This omission could result in the
> napi_disable function sleeping indefinitely under certain conditions.
> 
> v2: Attempt to provide a proper cover letter

Series applied, thank you.

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

end of thread, other threads:[~2017-06-15 18:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15  4:50 [PATCH 0/5 net-next v2] ibmvnic: LPM bug fixes Thomas Falcon
2017-06-15  4:50 ` [PATCH 1/5 net-next v2] ibmvnic: Activate disabled RX buffer pools on reset Thomas Falcon
2017-06-15  4:50 ` [PATCH 2/5 net-next v2] ibmvnic: Ensure that TX queues are disabled in __ibmvnic_close Thomas Falcon
2017-06-15  4:50 ` [PATCH 3/5 net-next v2] ibmvnic: Sanitize entire SCRQ buffer on reset Thomas Falcon
2017-06-15  4:50 ` [PATCH 4/5 net-next v2] ibmvnic: Remove VNIC_CLOSING check from pending_scrq Thomas Falcon
2017-06-15  4:50 ` [PATCH 5/5 net-next v2] ibmvnic: Exit polling routine correctly during adapter reset Thomas Falcon
2017-06-15 18:31 ` [PATCH 0/5 net-next v2] ibmvnic: LPM bug fixes David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.