All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Revert "net: stmmac: re-init rx buffers when mac resume back"
@ 2021-04-14 15:10 Thierry Reding
  2021-04-14 21:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2021-04-14 15:10 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Joakim Zhang,
	Jon Hunter, netdev, linux-tegra

From: Thierry Reding <treding@nvidia.com>

This reverts commit 9c63faaa931e443e7abbbee9de0169f1d4710546, which
introduces a suspend/resume regression on Jetson TX2 boards that can be
reproduced every time. Given that the issue that this was supposed to
fix only occurs very sporadically the safest course of action is to
revert before v5.12 and then we can have another go at fixing the more
rare issue in the next release (and perhaps backport it if necessary).

The root cause of the observed problem seems to be that when the system
is suspended, some packets are still in transit. When the descriptors
for these buffers are cleared on resume, the descriptors become invalid
and cause a fatal bus error.

Link: https://lore.kernel.org/r/708edb92-a5df-ecc4-3126-5ab36707e275@nvidia.com/
Reported-by: Jonathan Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
David, Jakub,

I noticed that a couple of patches got merged on top of this in
net-next, so the revert is going to cause conflicts. However, I've based
this revert on v5.12-rc7 because it targets v5.12. Let me know if I can
help resolve the conflict with net-next.

Thierry

 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 84 +------------------
 1 file changed, 1 insertion(+), 83 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 208cae344ffa..4749bd0af160 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1379,88 +1379,6 @@ static void stmmac_free_tx_buffer(struct stmmac_priv *priv, u32 queue, int i)
 	}
 }
 
-/**
- * stmmac_reinit_rx_buffers - reinit the RX descriptor buffer.
- * @priv: driver private structure
- * Description: this function is called to re-allocate a receive buffer, perform
- * the DMA mapping and init the descriptor.
- */
-static void stmmac_reinit_rx_buffers(struct stmmac_priv *priv)
-{
-	u32 rx_count = priv->plat->rx_queues_to_use;
-	u32 queue;
-	int i;
-
-	for (queue = 0; queue < rx_count; queue++) {
-		struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
-
-		for (i = 0; i < priv->dma_rx_size; i++) {
-			struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
-
-			if (buf->page) {
-				page_pool_recycle_direct(rx_q->page_pool, buf->page);
-				buf->page = NULL;
-			}
-
-			if (priv->sph && buf->sec_page) {
-				page_pool_recycle_direct(rx_q->page_pool, buf->sec_page);
-				buf->sec_page = NULL;
-			}
-		}
-	}
-
-	for (queue = 0; queue < rx_count; queue++) {
-		struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
-
-		for (i = 0; i < priv->dma_rx_size; i++) {
-			struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
-			struct dma_desc *p;
-
-			if (priv->extend_desc)
-				p = &((rx_q->dma_erx + i)->basic);
-			else
-				p = rx_q->dma_rx + i;
-
-			if (!buf->page) {
-				buf->page = page_pool_dev_alloc_pages(rx_q->page_pool);
-				if (!buf->page)
-					goto err_reinit_rx_buffers;
-
-				buf->addr = page_pool_get_dma_addr(buf->page);
-			}
-
-			if (priv->sph && !buf->sec_page) {
-				buf->sec_page = page_pool_dev_alloc_pages(rx_q->page_pool);
-				if (!buf->sec_page)
-					goto err_reinit_rx_buffers;
-
-				buf->sec_addr = page_pool_get_dma_addr(buf->sec_page);
-			}
-
-			stmmac_set_desc_addr(priv, p, buf->addr);
-			if (priv->sph)
-				stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true);
-			else
-				stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false);
-			if (priv->dma_buf_sz == BUF_SIZE_16KiB)
-				stmmac_init_desc3(priv, p);
-		}
-	}
-
-	return;
-
-err_reinit_rx_buffers:
-	do {
-		while (--i >= 0)
-			stmmac_free_rx_buffer(priv, queue, i);
-
-		if (queue == 0)
-			break;
-
-		i = priv->dma_rx_size;
-	} while (queue-- > 0);
-}
-
 /**
  * init_dma_rx_desc_rings - init the RX descriptor rings
  * @dev: net device structure
@@ -5428,7 +5346,7 @@ int stmmac_resume(struct device *dev)
 	mutex_lock(&priv->lock);
 
 	stmmac_reset_queues_param(priv);
-	stmmac_reinit_rx_buffers(priv);
+
 	stmmac_free_tx_skbufs(priv);
 	stmmac_clear_descriptors(priv);
 
-- 
2.30.2


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

* Re: [PATCH] Revert "net: stmmac: re-init rx buffers when mac resume back"
  2021-04-14 15:10 [PATCH] Revert "net: stmmac: re-init rx buffers when mac resume back" Thierry Reding
@ 2021-04-14 21:10 ` patchwork-bot+netdevbpf
  2021-04-22 12:48   ` Jon Hunter
  0 siblings, 1 reply; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-14 21:10 UTC (permalink / raw)
  To: Thierry Reding
  Cc: davem, kuba, peppe.cavallaro, alexandre.torgue, joabreu,
	qiangqing.zhang, jonathanh, netdev, linux-tegra

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Wed, 14 Apr 2021 17:10:07 +0200 you wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> This reverts commit 9c63faaa931e443e7abbbee9de0169f1d4710546, which
> introduces a suspend/resume regression on Jetson TX2 boards that can be
> reproduced every time. Given that the issue that this was supposed to
> fix only occurs very sporadically the safest course of action is to
> revert before v5.12 and then we can have another go at fixing the more
> rare issue in the next release (and perhaps backport it if necessary).
> 
> [...]

Here is the summary with links:
  - Revert "net: stmmac: re-init rx buffers when mac resume back"
    https://git.kernel.org/netdev/net/c/00423969d806

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH] Revert "net: stmmac: re-init rx buffers when mac resume back"
  2021-04-14 21:10 ` patchwork-bot+netdevbpf
@ 2021-04-22 12:48   ` Jon Hunter
  2021-04-23 12:33     ` Jon Hunter
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Hunter @ 2021-04-22 12:48 UTC (permalink / raw)
  To: Thierry Reding, davem, kuba
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, qiangqing.zhang,
	netdev, linux-tegra

Hi David, Jakub,

On 14/04/2021 22:10, patchwork-bot+netdevbpf@kernel.org wrote:
> Hello:
> 
> This patch was applied to netdev/net.git (refs/heads/master):
> 
> On Wed, 14 Apr 2021 17:10:07 +0200 you wrote:
>> From: Thierry Reding <treding@nvidia.com>
>>
>> This reverts commit 9c63faaa931e443e7abbbee9de0169f1d4710546, which
>> introduces a suspend/resume regression on Jetson TX2 boards that can be
>> reproduced every time. Given that the issue that this was supposed to
>> fix only occurs very sporadically the safest course of action is to
>> revert before v5.12 and then we can have another go at fixing the more
>> rare issue in the next release (and perhaps backport it if necessary).
>>
>> [...]
> 
> Here is the summary with links:
>   - Revert "net: stmmac: re-init rx buffers when mac resume back"
>     https://git.kernel.org/netdev/net/c/00423969d806


This revert is needed for v5.12. I was just checking to see if this
would be merged this week?

Thanks!
Jon

-- 
nvpublic

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

* Re: [PATCH] Revert "net: stmmac: re-init rx buffers when mac resume back"
  2021-04-22 12:48   ` Jon Hunter
@ 2021-04-23 12:33     ` Jon Hunter
  0 siblings, 0 replies; 4+ messages in thread
From: Jon Hunter @ 2021-04-23 12:33 UTC (permalink / raw)
  To: Thierry Reding, davem, kuba
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, qiangqing.zhang,
	netdev, linux-tegra


On 22/04/2021 13:48, Jon Hunter wrote:
> Hi David, Jakub,
> 
> On 14/04/2021 22:10, patchwork-bot+netdevbpf@kernel.org wrote:
>> Hello:
>>
>> This patch was applied to netdev/net.git (refs/heads/master):
>>
>> On Wed, 14 Apr 2021 17:10:07 +0200 you wrote:
>>> From: Thierry Reding <treding@nvidia.com>
>>>
>>> This reverts commit 9c63faaa931e443e7abbbee9de0169f1d4710546, which
>>> introduces a suspend/resume regression on Jetson TX2 boards that can be
>>> reproduced every time. Given that the issue that this was supposed to
>>> fix only occurs very sporadically the safest course of action is to
>>> revert before v5.12 and then we can have another go at fixing the more
>>> rare issue in the next release (and perhaps backport it if necessary).
>>>
>>> [...]
>>
>> Here is the summary with links:
>>   - Revert "net: stmmac: re-init rx buffers when mac resume back"
>>     https://git.kernel.org/netdev/net/c/00423969d806
> 
> 
> This revert is needed for v5.12. I was just checking to see if this
> would be merged this week?

I see this is already merged! Sorry for the noise. It is a different fix
that we are still missing for v5.12 which is not related to networking.

Jon

-- 
nvpublic

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

end of thread, other threads:[~2021-04-23 12:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14 15:10 [PATCH] Revert "net: stmmac: re-init rx buffers when mac resume back" Thierry Reding
2021-04-14 21:10 ` patchwork-bot+netdevbpf
2021-04-22 12:48   ` Jon Hunter
2021-04-23 12:33     ` Jon Hunter

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.