This patch set contains two fixes for problems I detected when ran the driver
in single queue mode.
Please test in your setups to check if you get better results.
Joao Pinto (2):
net: stmmac: fix netdev release
net: stmmac: fix number of tx queues in stmmac_poll
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
--
2.9.3
This patch fixes the kernel crash problem that happens when the driver
exits. The dma resouces must be freed after netdev resouces get freed and
in driver removed, multiple napi's should be deleted before removing
netdev resouces or it will hang.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
@@ -2659,9 +2659,6 @@ static int stmmac_release(struct net_device *dev)/* Stop TX/RX DMA and clear the descriptors */stmmac_stop_all_dma(priv);-/* Release and free the Rx/Tx resources */-free_dma_desc_resources(priv);-/* Disable the MAC Rx/Tx */stmmac_set_mac(priv->ioaddr,false);
@@ -4080,7 +4077,7 @@ int stmmac_dvr_probe(struct device *device,/* Init MAC and get the capabilities */ret=stmmac_hw_init(priv);if(ret)-gotoerror_hw_init;+returnret;/* Configure real RX and TX queues */ndev->real_num_rx_queues=priv->plat->rx_queues_to_use;
@@ -4207,9 +4204,8 @@ int stmmac_dvr_probe(struct device *device,netif_napi_del(&rx_q->napi);}init_dma_error:-free_dma_desc_resources(priv);-error_hw_init:free_netdev(ndev);+free_dma_desc_resources(priv);returnret;}
@@ -4225,6 +4221,7 @@ int stmmac_dvr_remove(struct device *dev){structnet_device*ndev=dev_get_drvdata(dev);structstmmac_priv*priv=netdev_priv(ndev);+u32queue=0;netdev_info(priv->dev,"%s: removing driver",__func__);
@@ -4241,7 +4238,15 @@ int stmmac_dvr_remove(struct device *dev)priv->hw->pcs!=STMMAC_PCS_TBI&&priv->hw->pcs!=STMMAC_PCS_RTBI)stmmac_mdio_unregister(ndev);++for(queue=0;queue<priv->plat->rx_queues_to_use;queue++){+structstmmac_rx_queue*rx_q=&priv->rx_queue[queue];++netif_napi_del(&rx_q->napi);+}+free_netdev(ndev);+free_dma_desc_resources(priv);return0;}
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted hunk
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
On Mon, Mar 27, 2017 at 10:04:57AM +0100, Joao Pinto wrote:
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Às 10:09 AM de 3/27/2017, Corentin Labbe escreveu:
On Mon, Mar 27, 2017 at 10:04:57AM +0100, Joao Pinto wrote:
quoted
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Às 10:09 AM de 3/27/2017, Corentin Labbe escreveu:
quoted
On Mon, Mar 27, 2017 at 10:04:57AM +0100, Joao Pinto wrote:
quoted
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -3429,7 +3429,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget)structstmmac_rx_queue*rx_q=container_of(napi,structstmmac_rx_queue,napi);structstmmac_priv*priv=rx_q->priv_data;-u32tx_count=priv->dma_cap.number_tx_queues;+u32tx_count=priv->plat->tx_queues_to_use;u32chan=rx_q->queue_index;u32work_done=0;u32queue=0;
--
2.9.3
This patch fix the performance issue on dwmac-sun8i only.
Ok, great!
Sorry, in the we, I see that my gigabit dwmac-sun8i didnt work... (but didnt have time to find why).
quoted
quoted
The dwmac-sunxi is still broken.
Ok, let's see what others report.
quoted
quoted
quoted
What is the difference between the setups?
dwmac-sun8i use chain mode, dwmac-sunxi use ring mode
@Thierry and Niklas: Hi! Your setup is working well with these 2 fix patches?
Hello Joao,
I have not tested these 2 patches.
Previously, when I tested next-20170321, artpec-6 SoC got TX queue timeouts.
When testing today's linux-next, next-20170327, things are working again :)
So I guess one of the following patches fixed our problem:
270c7759fbbc net: stmmac: add set_mac to the stmmac_ops
b4f0a6615556 net: stmmac: fix dma operation mode config for older versions
33e85b8dd69e net: stmmac: Restore DT backwards-compatibility
f39768744fd6 net: stmmac: Always enable MAC RX queues
abe80fdc6ee6 net: stmmac: RX queue routing configuration
a8f5102af2a7 net: stmmac: TX and RX queue priority configuration
aff3d9eff843 net: stmmac: enable multiple buffers
Regards,
Niklas
Às 10:09 AM de 3/27/2017, Corentin Labbe escreveu:
quoted
On Mon, Mar 27, 2017 at 10:04:57AM +0100, Joao Pinto wrote:
quoted
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -3429,7 +3429,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget)structstmmac_rx_queue*rx_q=container_of(napi,structstmmac_rx_queue,napi);structstmmac_priv*priv=rx_q->priv_data;-u32tx_count=priv->dma_cap.number_tx_queues;+u32tx_count=priv->plat->tx_queues_to_use;u32chan=rx_q->queue_index;u32work_done=0;u32queue=0;
--
2.9.3
This patch fix the performance issue on dwmac-sun8i only.
Ok, great!
Sorry, in the we, I see that my gigabit dwmac-sun8i didnt work... (but didnt have time to find why).
quoted
quoted
The dwmac-sunxi is still broken.
Ok, let's see what others report.
quoted
quoted
quoted
What is the difference between the setups?
dwmac-sun8i use chain mode, dwmac-sunxi use ring mode
@Thierry and Niklas: Hi! Your setup is working well with these 2 fix patches?
Hello Joao,
I have not tested these 2 patches.
Previously, when I tested next-20170321, artpec-6 SoC got TX queue timeouts.
When testing today's linux-next, next-20170327, things are working again :)
So I guess one of the following patches fixed our problem:
270c7759fbbc net: stmmac: add set_mac to the stmmac_ops
b4f0a6615556 net: stmmac: fix dma operation mode config for older versions
33e85b8dd69e net: stmmac: Restore DT backwards-compatibility
f39768744fd6 net: stmmac: Always enable MAC RX queues
abe80fdc6ee6 net: stmmac: RX queue routing configuration
a8f5102af2a7 net: stmmac: TX and RX queue priority configuration
aff3d9eff843 net: stmmac: enable multiple buffers
Hin Thierry,
Às 2:34 PM de 3/27/2017, Joao Pinto escreveu:
Às 2:28 PM de 3/27/2017, Niklas Cassel escreveu:
quoted
On 03/27/2017 11:12 AM, Joao Pinto wrote:
quoted
Às 10:09 AM de 3/27/2017, Corentin Labbe escreveu:
quoted
On Mon, Mar 27, 2017 at 10:04:57AM +0100, Joao Pinto wrote:
quoted
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -3429,7 +3429,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget)structstmmac_rx_queue*rx_q=container_of(napi,structstmmac_rx_queue,napi);structstmmac_priv*priv=rx_q->priv_data;-u32tx_count=priv->dma_cap.number_tx_queues;+u32tx_count=priv->plat->tx_queues_to_use;u32chan=rx_q->queue_index;u32work_done=0;u32queue=0;
--
2.9.3
This patch fix the performance issue on dwmac-sun8i only.
Ok, great!
Sorry, in the we, I see that my gigabit dwmac-sun8i didnt work... (but didnt have time to find why).
quoted
quoted
The dwmac-sunxi is still broken.
Ok, let's see what others report.
quoted
quoted
quoted
What is the difference between the setups?
dwmac-sun8i use chain mode, dwmac-sunxi use ring mode
@Thierry and Niklas: Hi! Your setup is working well with these 2 fix patches?
Hello Joao,
I have not tested these 2 patches.
Previously, when I tested next-20170321, artpec-6 SoC got TX queue timeouts.
When testing today's linux-next, next-20170327, things are working again :)
So I guess one of the following patches fixed our problem:
270c7759fbbc net: stmmac: add set_mac to the stmmac_ops
b4f0a6615556 net: stmmac: fix dma operation mode config for older versions
33e85b8dd69e net: stmmac: Restore DT backwards-compatibility
f39768744fd6 net: stmmac: Always enable MAC RX queues
abe80fdc6ee6 net: stmmac: RX queue routing configuration
a8f5102af2a7 net: stmmac: TX and RX queue priority configuration
aff3d9eff843 net: stmmac: enable multiple buffers
Yes for sure :) Great! Thanks.
Could you please confirm your setup works with these final 2 patches?
Thanks.
Hi David,
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
On Mon, Mar 27, 2017 at 04:26:48PM +0100, Joao Pinto wrote:
Hi David,
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
On Mon, Mar 27, 2017 at 04:26:48PM +0100, Joao Pinto wrote:
quoted
Hi David,
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
On Mon, Mar 27, 2017 at 06:06:05PM +0100, Joao Pinto wrote:
Às 6:00 PM de 3/27/2017, Corentin Labbe escreveu:
quoted
On Mon, Mar 27, 2017 at 04:26:48PM +0100, Joao Pinto wrote:
quoted
Hi David,
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
On Mon, Mar 27, 2017 at 04:26:48PM +0100, Joao Pinto wrote:
quoted
Hi David,
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
On Mon, Mar 27, 2017 at 04:26:48PM +0100, Joao Pinto wrote:
quoted
Hi David,
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -3429,7 +3429,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget)structstmmac_rx_queue*rx_q=container_of(napi,structstmmac_rx_queue,napi);structstmmac_priv*priv=rx_q->priv_data;-u32tx_count=priv->dma_cap.number_tx_queues;+u32tx_count=priv->plat->tx_queues_to_use;u32chan=rx_q->queue_index;u32work_done=0;u32queue=0;
--
2.9.3
This patch fix the performance issue on dwmac-sun8i only.
The dwmac-sunxi is still broken.
This patch series can be upstreamed please, since they make 2 fixes, one of them
solving the problem in dwmac-sun8i.
Thanks.
As I said in a previous answer, finaly dwmac-sun8i is still broken.
Adding thoses 2 patch will just made the revert harder.
I agree.
For what I am understanding, SoCs base on Core versions >= 4.00 are working
properly and for some reason SoCs based on older versions are not working.
This fix is necessary, since if you have a diferent configured tx_queues_to_use
in the driver and priv->dma_cap.number_tx_queues in the core, this can lead to
kernel crashes.
The other fix (netdev resources release) is also necessary, since when you
release the driver its crashes, because the rx queue struct is freed before
releasing the netdevs.
We can revert, but I think it might not solve the issue. We can break the
"multiple buffers" patch into "rx multilple buffers" and "tx multiple buffers",
but will that actually work? We can give it a try, I don't mind making a new
multiple buffers patch broken into 2, that can be tested by new cores and older
cores.
Joao
On Mon, Mar 27, 2017 at 04:26:48PM +0100, Joao Pinto wrote:
quoted
Hi David,
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -3429,7 +3429,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget)structstmmac_rx_queue*rx_q=container_of(napi,structstmmac_rx_queue,napi);structstmmac_priv*priv=rx_q->priv_data;-u32tx_count=priv->dma_cap.number_tx_queues;+u32tx_count=priv->plat->tx_queues_to_use;u32chan=rx_q->queue_index;u32work_done=0;u32queue=0;
--
2.9.3
This patch fix the performance issue on dwmac-sun8i only.
The dwmac-sunxi is still broken.
This patch series can be upstreamed please, since they make 2 fixes, one of them
solving the problem in dwmac-sun8i.
Thanks.
As I said in a previous answer, finaly dwmac-sun8i is still broken.
Adding thoses 2 patch will just made the revert harder.
I agree.
For what I am understanding, SoCs base on Core versions >= 4.00 are working
properly and for some reason SoCs based on older versions are not working.
This fix is necessary, since if you have a diferent configured tx_queues_to_use
in the driver and priv->dma_cap.number_tx_queues in the core, this can lead to
kernel crashes.
The other fix (netdev resources release) is also necessary, since when you
release the driver its crashes, because the rx queue struct is freed before
releasing the netdevs.
We can revert, but I think it might not solve the issue. We can break the
"multiple buffers" patch into "rx multilple buffers" and "tx multiple buffers",
but will that actually work? We can give it a try, I don't mind making a new
multiple buffers patch broken into 2, that can be tested by new cores and older
cores.
Reverting at least will bring back my archs to good status:)
Spliting will not solve magically the issue, but will permit to easily detect which part is faulty.
And I am sure that it is possible to split more than in 2.
The more small the patch will be, the easier it will.
Regards
For what I am understanding, SoCs base on Core versions >= 4.00 are working
properly and for some reason SoCs based on older versions are not working.
Please send me a revert, and work offline with these people to resolve
all of the regressions you introduced.
Once you resolved all of the regressions, we can put the changes back
in.
Thank you.
On Mon, Mar 27, 2017 at 04:26:48PM +0100, Joao Pinto wrote:
quoted
Hi David,
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -3429,7 +3429,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget)structstmmac_rx_queue*rx_q=container_of(napi,structstmmac_rx_queue,napi);structstmmac_priv*priv=rx_q->priv_data;-u32tx_count=priv->dma_cap.number_tx_queues;+u32tx_count=priv->plat->tx_queues_to_use;u32chan=rx_q->queue_index;u32work_done=0;u32queue=0;
--
2.9.3
This patch fix the performance issue on dwmac-sun8i only.
The dwmac-sunxi is still broken.
This patch series can be upstreamed please, since they make 2 fixes, one of them
solving the problem in dwmac-sun8i.
Thanks.
As I said in a previous answer, finaly dwmac-sun8i is still broken.
Adding thoses 2 patch will just made the revert harder.
I agree.
For what I am understanding, SoCs base on Core versions >= 4.00 are working
properly and for some reason SoCs based on older versions are not working.
This fix is necessary, since if you have a diferent configured tx_queues_to_use
in the driver and priv->dma_cap.number_tx_queues in the core, this can lead to
kernel crashes.
The other fix (netdev resources release) is also necessary, since when you
release the driver its crashes, because the rx queue struct is freed before
releasing the netdevs.
We can revert, but I think it might not solve the issue. We can break the
"multiple buffers" patch into "rx multilple buffers" and "tx multiple buffers",
but will that actually work? We can give it a try, I don't mind making a new
multiple buffers patch broken into 2, that can be tested by new cores and older
cores.
I've hit a bug on stmmac where RX is broken after boot.
Sometimes it works, and sometimes it doesn't.
I usually notice that DHCP never receives an offer,
but it's possible to reproduce the problem without DHCP,
where a simple ping will not work after setting an address manually.
I've bisected it to commit aff3d9eff843 ("net: stmmac: enable multiple buffers").
(Note that I had to cherry-pick 22446ad8e118 ("net: stmmac: Restore DT backwards-compatibility")
to avoid TX queue timeouts, and the patch included in the beginning of this
mail thread "net: stmmac: fix number of tx queues in stmmac_poll" to avoid
random crashes in stmmac_tx_clean.
Looking at wireshark I can see that we send out a DHCP discover,
so TX seems to be working.
A DHCP offer is sent out from the server, but it is never received.
Our setup has 1 RX queue and 2 TX queues.
According to the databook, the field Receive Queue Size in register
MTL_RxQ0_Operation_Mode is read-only when number of RX queues == 1,
so I guess the problem is not related to RX queue size.
It's quite annoying since it does not trigger every single boot.
Has anyone else noticed broken RX after boot since commit aff3d9eff843 and newer?
From: Thierry Reding <redacted>
Taking the address of an element within a non-NULL array will never be
zero. This condition isn't checked anywhere else, so drop it in these
two instances as well.
Signed-off-by: Thierry Reding <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ------
1 file changed, 6 deletions(-)
From: Thierry Reding <redacted>
Some of the data in the new queue structures seems to not be properly
initialized, causing undefined behaviour (networking will work about 2
out of 10 tries). kcalloc() will zero the allocated memory and results
in 10 out of 10 successful boots.
Signed-off-by: Thierry Reding <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 37 +++++++++++------------
1 file changed, 17 insertions(+), 20 deletions(-)
(resending mail without SPAM header)
Hi Thierry
Sorry that I missed your previous email,
for some reason it got stuck in the spam filter.
Really good catch. This patch fixes the random
RX brokenness for me. Thanks!
It would be nice with a Fixes tag though,
but lately there's been so many changes,
so it might be hard to point to a single commit.
Nevertheless:
Tested-by: Niklas Cassel <redacted>
On 03/28/2017 03:57 PM, Thierry Reding wrote:
quoted hunk
From: Thierry Reding <redacted>
Some of the data in the new queue structures seems to not be properly
initialized, causing undefined behaviour (networking will work about 2
out of 10 tries). kcalloc() will zero the allocated memory and results
in 10 out of 10 successful boots.
Signed-off-by: Thierry Reding <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 37 +++++++++++------------
1 file changed, 17 insertions(+), 20 deletions(-)
From: Thierry Reding <redacted>
Even if hardware supports multiple queues, software can choose to only
use a subset of them. Make sure we never try to access uninitialized
queues.
Signed-off-by: Thierry Reding <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Thierry Reding <redacted>
Even if hardware supports multiple queues, software can choose to only
use a subset of them. Make sure we never try to access uninitialized
queues.
Signed-off-by: Thierry Reding <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -3423,7 +3423,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget)structstmmac_rx_queue*rx_q=container_of(napi,structstmmac_rx_queue,napi);structstmmac_priv*priv=rx_q->priv_data;-u32tx_count=priv->dma_cap.number_tx_queues;+u32tx_count=priv->plat->tx_queues_to_use;u32chan=rx_q->queue_index;u32work_done=0;u32queue=0;
Thanks Thierry,
but this look like an equivalent patch to Joao's
"net: stmmac: fix number of tx queues in stmmac_poll"
which I already used during bisecting to avoid random
crashes in stmmac_tx_clean.
Have you noticed random RX brokenness after boot in
recent linux-next tags?
It feels like it might trigger more often after a
cold boot, but that could just be my brain seeing
patterns that aren't really there :)
On Tue, Mar 28, 2017 at 04:10:43PM +0200, Niklas Cassel wrote:
On 03/28/2017 03:57 PM, Thierry Reding wrote:
quoted
From: Thierry Reding <redacted>
Even if hardware supports multiple queues, software can choose to only
use a subset of them. Make sure we never try to access uninitialized
queues.
Signed-off-by: Thierry Reding <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -3423,7 +3423,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget)structstmmac_rx_queue*rx_q=container_of(napi,structstmmac_rx_queue,napi);structstmmac_priv*priv=rx_q->priv_data;-u32tx_count=priv->dma_cap.number_tx_queues;+u32tx_count=priv->plat->tx_queues_to_use;u32chan=rx_q->queue_index;u32work_done=0;u32queue=0;
Thanks Thierry,
but this look like an equivalent patch to Joao's
"net: stmmac: fix number of tx queues in stmmac_poll"
which I already used during bisecting to avoid random
crashes in stmmac_tx_clean.
Yeah, patch 3/3 is the important one in this batch. I just sent out the
complete set of 3 because it's what I use on top of linux-next to make
stmmac work again on my setup.
Have you noticed random RX brokenness after boot in
recent linux-next tags?
Yes, I was seeing about 8 in 10 bad boots and 2 in 10 good ones.
It feels like it might trigger more often after a
cold boot, but that could just be my brain seeing
patterns that aren't really there :)
It'd be good if you could try applying patch 3/3 since that got me back
to 10/10 successful boots. It's somewhat surprising because I had gone
through the code looking for uninitialized data that would explain why
kcalloc() instead of kmalloc_array() would fix things but didn't find
anything.
Still, that patch works for me, so maybe I was just overlooking
something.
Thierry
On Mon, Mar 27, 2017 at 04:26:48PM +0100, Joao Pinto wrote:
quoted
Hi David,
Às 7:26 AM de 3/25/2017, Corentin Labbe escreveu:
quoted
On Fri, Mar 24, 2017 at 05:16:45PM +0000, Joao Pinto wrote:
quoted
For cores that have more than 1 TX queue configured, the kernel would crash,
since only one TX queue is permitted by default.
Signed-off-by: Joao Pinto <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -3429,7 +3429,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget)structstmmac_rx_queue*rx_q=container_of(napi,structstmmac_rx_queue,napi);structstmmac_priv*priv=rx_q->priv_data;-u32tx_count=priv->dma_cap.number_tx_queues;+u32tx_count=priv->plat->tx_queues_to_use;u32chan=rx_q->queue_index;u32work_done=0;u32queue=0;
--
2.9.3
This patch fix the performance issue on dwmac-sun8i only.
The dwmac-sunxi is still broken.
This patch series can be upstreamed please, since they make 2 fixes, one of them
solving the problem in dwmac-sun8i.
Thanks.
As I said in a previous answer, finaly dwmac-sun8i is still broken.
Adding thoses 2 patch will just made the revert harder.
I agree.
For what I am understanding, SoCs base on Core versions >= 4.00 are working
properly and for some reason SoCs based on older versions are not working.
This fix is necessary, since if you have a diferent configured tx_queues_to_use
in the driver and priv->dma_cap.number_tx_queues in the core, this can lead to
kernel crashes.
The other fix (netdev resources release) is also necessary, since when you
release the driver its crashes, because the rx queue struct is freed before
releasing the netdevs.
We can revert, but I think it might not solve the issue. We can break the
"multiple buffers" patch into "rx multilple buffers" and "tx multiple buffers",
but will that actually work? We can give it a try, I don't mind making a new
multiple buffers patch broken into 2, that can be tested by new cores and older
cores.
I've hit a bug on stmmac where RX is broken after boot.
Sometimes it works, and sometimes it doesn't.
I usually notice that DHCP never receives an offer,
but it's possible to reproduce the problem without DHCP,
where a simple ping will not work after setting an address manually.
I've bisected it to commit aff3d9eff843 ("net: stmmac: enable multiple buffers").
(Note that I had to cherry-pick 22446ad8e118 ("net: stmmac: Restore DT backwards-compatibility")
to avoid TX queue timeouts, and the patch included in the beginning of this
mail thread "net: stmmac: fix number of tx queues in stmmac_poll" to avoid
random crashes in stmmac_tx_clean.
Looking at wireshark I can see that we send out a DHCP discover,
so TX seems to be working.
A DHCP offer is sent out from the server, but it is never received.
Our setup has 1 RX queue and 2 TX queues.
According to the databook, the field Receive Queue Size in register
MTL_RxQ0_Operation_Mode is read-only when number of RX queues == 1,
so I guess the problem is not related to RX queue size.
It's quite annoying since it does not trigger every single boot.
Has anyone else noticed broken RX after boot since commit aff3d9eff843 and newer?
Yeah, I've been hitting the same, or at least very similar, issue. I'm
going to attach my local stack of three patches, of which the first is
only cleanup, the second is the same as the one that Joao had sent out
earlier and patch three seems to be the one that gets things back on
track for me. I haven't quite figured out why yet, but it'd be
interesting to see if it fixes things for others.
Thierry
This patch set contains two fixes for problems I detected when ran the driver
in single queue mode.
Please test in your setups to check if you get better results.
Joao Pinto (2):
net: stmmac: fix netdev release
net: stmmac: fix number of tx queues in stmmac_poll
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
Hello Joao,
I think that it would be helpful if these commit messages were a
little more elaborate.
Both of these commit messages just say "fixes kernel crash".
Please include the relevant part of the stack trace so that others
will know if the bug you are fixing is the same as theirs.
Regards,
Niklas