All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: Pavan Chebbi <pavan.chebbi@broadcom.com>
Cc: David Christensen <drc@linux.vnet.ibm.com>,
	netdev@vger.kernel.org,
	Siva Reddy Kallam <siva.kallam@broadcom.com>,
	Prashant Sreedharan <prashant@broadcom.com>,
	Michael Chan <mchan@broadcom.com>
Subject: Re: [PATCH] net/tg3: resolve deadlock in tg3_reset_task() during EEH
Date: Tue, 24 Jan 2023 00:43:38 -0800	[thread overview]
Message-ID: <CACKFLikyHar-H46VvN1cgTubdw88nQyh7pJ=zUq0V=kWx8CoVg@mail.gmail.com> (raw)
In-Reply-To: <CALs4sv1OYthkDYBbj9i-jytWo7VZ2rL9VcHiWP55svVX8R20RQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2063 bytes --]

On Mon, Jan 23, 2023 at 11:25 PM Pavan Chebbi <pavan.chebbi@broadcom.com> wrote:
>
> On Tue, Jan 24, 2023 at 6:01 AM David Christensen
> <drc@linux.vnet.ibm.com> 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.

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
> >

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

  reply	other threads:[~2023-01-24  8:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24  0:31 [PATCH] net/tg3: resolve deadlock in tg3_reset_task() during EEH David Christensen
2023-01-24  7:25 ` Pavan Chebbi
2023-01-24  8:43   ` Michael Chan [this message]
2023-01-24  9:12     ` Pavan Chebbi
2023-01-24 18:53 ` [PATCH v2] " David Christensen
2023-01-25  8:33   ` Pavan Chebbi
2023-01-26  6:50   ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACKFLikyHar-H46VvN1cgTubdw88nQyh7pJ=zUq0V=kWx8CoVg@mail.gmail.com' \
    --to=michael.chan@broadcom.com \
    --cc=drc@linux.vnet.ibm.com \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pavan.chebbi@broadcom.com \
    --cc=prashant@broadcom.com \
    --cc=siva.kallam@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.