<div dir="ltr"><div>Hi Romain,</div><div><br></div><div dir="ltr">On Sun, Mar 31, 2024 at 4:35 PM Romain Gantois <<a href="mailto:romain.gantois@bootlin.com">romain.gantois@bootlin.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello Cathy,<br>
<br>
On Wed, 27 Mar 2024, Cathy Cai wrote:<br>
<br>
> Tx queue time out then reset adapter. When reset the adapter, stmmac driver<br>
> sets the state to STMMAC_DOWN and calls dev_close() function. If an interrupt<br>
> is triggered at this instant after setting state to STMMAC_DOWN, before the<br>
> dev_close() call.<br>
> <br>
...<br>
> - set_bit(STMMAC_DOWN, &priv->state);<br>
> dev_close(priv->dev);<br>
> + set_bit(STMMAC_DOWN, &priv->state);<br>
> dev_open(priv->dev, NULL);<br>
> clear_bit(STMMAC_DOWN, &priv->state);<br>
> clear_bit(STMMAC_RESETING, &priv->state);<br>
<br>
If this IRQ issue can happen whenever STMMAC_DOWN is set while the net device is <br>
open, then it could also happen between the dev_open() and <br>
clear_bit(STMMAC_DOWN) calls right? So you'd have to clear STMMAC_DOWN before <br>
calling dev_open() but then I don't see the usefulness of setting STMMAC_DOWN <br>
and clearing it immediately. Maybe closing and opening the net device should be <br>
enough?<br>
<br></blockquote><div> Yes. It could also happen between the dev_open() and clear_bit(STMMAC_DOWN) calls.</div><div>Although we did not reproduce this scenario, it should have happened if we had increased</div><div>the number of test samples. In addition, I found that other people had similar problems before.</div><div>The link is:</div><a href="https://lore.kernel.org/all/20210208140820.10410-11-Sergey.Semin@baikalelectronics.ru/">https://lore.kernel.org/all/20210208140820.10410-11-Sergey.Semin@baikalelectronics.ru/</a><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Moreover, it seems strange to me that stmmac_interrupt() unconditionnally <br>
ignores interrupts when the driver is in STMMAC_DOWN state. This seems like <br>
dangerous behaviour, since it could cause IRQ storm issues whenever something <br>
in the driver sets this state. I'm not too familiar with the interrupt handling <br>
in this driver, but maybe stmmac_interrupt() could clear interrupts <br>
unconditionnally in the STMMAC_DOWN state?<br>
<br></blockquote>Clear interrupts unconditionally in the STMMAC_DOWN state directly certainly won't cause this problem. <br><div>This may be too rough, maybe this design has other considerations. </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Best Regards,<br>
<br>
-- <br>
Romain Gantois, Bootlin<br>
Embedded Linux and Kernel engineering<br>
<a href="https://bootlin.com" rel="noreferrer" target="_blank">https://bootlin.com</a></blockquote><div><br></div><div> Best Regards,</div>Cathy</div></div>