From: Stephen Hemminger <stephen@networkplumber.org>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
David Miller <davem@davemloft.net>,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
intel-wired-lan <intel-wired-lan@lists.osuosl.org>
Subject: Re: [PATCH net] igb: fix deadlock caused by taking RTNL in RPM resume path
Date: Mon, 29 Nov 2021 15:09:20 -0800 [thread overview]
Message-ID: <20211129150920.4a400828@hermes.local> (raw)
In-Reply-To: <6bb28d2f-4884-7696-0582-c26c35534bae@gmail.com>
On Mon, 29 Nov 2021 22:14:06 +0100
Heiner Kallweit <hkallweit1@gmail.com> wrote:
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index dd208930f..8073cce73 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -9254,7 +9254,7 @@ static int __maybe_unused igb_suspend(struct device *dev)
> return __igb_shutdown(to_pci_dev(dev), NULL, 0);
> }
>
> -static int __maybe_unused igb_resume(struct device *dev)
> +static int __maybe_unused __igb_resume(struct device *dev, bool rpm)
> {
> struct pci_dev *pdev = to_pci_dev(dev);
> struct net_device *netdev = pci_get_drvdata(pdev);
> @@ -9297,17 +9297,24 @@ static int __maybe_unused igb_resume(struct device *dev)
>
> wr32(E1000_WUS, ~0);
>
> - rtnl_lock();
> + if (!rpm)
> + rtnl_lock();
> if (!err && netif_running(netdev))
> err = __igb_open(netdev, true);
>
> if (!err)
> netif_device_attach(netdev);
> - rtnl_unlock();
> + if (!rpm)
> + rtnl_unlock();
>
> return err;
> }
>
> +static int __maybe_unused igb_resume(struct device *dev)
> +{
> + return __igb_resume(dev, false);
> +}
> +
> static int __maybe_unused igb_runtime_idle(struct device *dev)
> {
> struct net_device *netdev = dev_get_drvdata(dev);
> @@ -9326,7 +9333,7 @@ static int __maybe_unused igb_runtime_suspend(struct device *dev)
>
> static int __maybe_unused igb_runtime_resume(struct device *dev)
> {
> - return igb_resume(dev);
> + return __igb_resume(dev, true);
> }
Rather than conditional locking which is one of the seven deadly sins of SMP,
why not just have __igb_resume() be the locked version where lock is held by caller?
next prev parent reply other threads:[~2021-11-29 23:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-29 21:14 [PATCH net] igb: fix deadlock caused by taking RTNL in RPM resume path Heiner Kallweit
2021-11-29 23:09 ` Stephen Hemminger [this message]
2021-11-30 6:33 ` Heiner Kallweit
2021-11-30 1:17 ` Jakub Kicinski
2021-11-30 6:46 ` Heiner Kallweit
2021-11-30 17:12 ` Jakub Kicinski
2021-11-30 21:35 ` Heiner Kallweit
2021-12-01 0:51 ` Jakub Kicinski
2021-12-19 8:31 ` Thorsten Leemhuis
2021-12-20 19:56 ` Nguyen, Anthony L
2021-12-22 5:17 ` Thorsten Leemhuis
2021-12-22 12:50 ` Thorsten Leemhuis
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=20211129150920.4a400828@hermes.local \
--to=stephen@networkplumber.org \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).