On Tue, Jan 24, 2023 at 2:13 PM Michael Chan wrote: > > On Mon, Jan 23, 2023 at 11:25 PM Pavan Chebbi wrote: > > > > On Tue, Jan 24, 2023 at 6:01 AM David Christensen > > wrote: > > > > > > > > > diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c > > > index 59debdc344a5..ee4604e6900e 100644 > > > --- a/drivers/net/ethernet/broadcom/tg3.c > > > +++ b/drivers/net/ethernet/broadcom/tg3.c > > > @@ -11166,7 +11166,8 @@ static void tg3_reset_task(struct work_struct *work) > > > rtnl_lock(); > > > tg3_full_lock(tp, 0); > > > > > > - if (!netif_running(tp->dev)) { > > > + // Skip reset task if no netdev or already in PCI recovery > > > + if (!tp->dev || tp->pcierr_recovery || !netif_running(tp->dev)) { > > > > Thanks for the patch. Can we not use netif_device_present() here? > > Take a look at the beginning of tg3_io_error_detected(). I think he > is trying to follow the same recipe there. Basically, if a PCIe AER > has already been detected, then let it finish and do nothing here. > Agree. Just that tg3_io_error_detected() will have done a netif_device_detach() earlier, I thought it may be a simpler check. Fine with this as well. The submitter may choose to re-spin to remove the tp->dev check otherwise looks good to me. Reviewed-by: Pavan Chebbi > I don't think the tp->dev check is needed though. We always call > tg3_reset_task_cancel() before we call unregister_netdev() and > free_netdev(). > > > > > > tg3_flag_clear(tp, RESET_TASK_PENDING); > > > tg3_full_unlock(tp); > > > rtnl_unlock(); > > > @@ -18101,6 +18102,9 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, > > > > > > netdev_info(netdev, "PCI I/O error detected\n"); > > > > > > + /* Want to make sure that the reset task doesn't run */ > > > + tg3_reset_task_cancel(tp); > > > + > > > rtnl_lock(); > > > > > > /* Could be second call or maybe we don't have netdev yet */ > > > @@ -18117,9 +18121,6 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, > > > > > > tg3_timer_stop(tp); > > > > > > - /* Want to make sure that the reset task doesn't run */ > > > - tg3_reset_task_cancel(tp); > > > - > > > netif_device_detach(netdev); > > > > > > /* Clean up software state, even if MMIO is blocked */ > > > -- > > > 2.31.1 > > >