From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
Johannes Berg <johannes@sipsolutions.net>,
netdev@vger.kernel.org, Johannes Berg <johannes.berg@intel.com>,
Marc MERLIN <marc@merlins.org>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: Re: [PATCH net v3] net: ethtool: do runtime PM outside RTNL
Date: Fri, 5 Jan 2024 11:34:28 +0100 [thread overview]
Message-ID: <ZZfbNIuyEiS+m7Ih@linux.intel.com> (raw)
In-Reply-To: <9bcfb259-1249-4efc-b581-056fb0a1c144@gmail.com>
On Thu, Jan 04, 2024 at 10:05:12AM +0100, Heiner Kallweit wrote:
> On 04.01.2024 09:25, Stanislaw Gruszka wrote:
> For me the main question is the following. In igc_resume() you have
>
> rtnl_lock();
> if (!err && netif_running(netdev))
> err = __igc_open(netdev, true);
>
> if (!err)
> netif_device_attach(netdev);
> rtnl_unlock();
>
> Why is the global rtnl_lock() needed here? The netdev is in detached
> state what protects from e.g. userspace activity, see all the
> netif_device_present() checks in net core.
Good question. Initially I thought that the lock can be removed
for the exact reason you wrote. I.e. the analogus change as you
did for igb could de done ( ac8c58f5b535 ).
But after more detailed examination I can see the need for lock.
__igc_open() calls at least one function that require rtnl_lock:
netif_set_real_num_rx_queues().
Despite using netif_device_attach() without the rtnl_lock at
various places it's not safe. After:
if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) &&
netif_running(dev)) {
the full link down can be performed without rtnl_lock, so we can do
netif_tx_wake_all_queues(dev);
__netdev_watchdog_up(dev);
during closing or after device is closed.
Just found those two. I think there could be more reasons.
Regards
Stanislaw
prev parent reply other threads:[~2024-01-05 10:34 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-06 10:39 [PATCH net v3] net: ethtool: do runtime PM outside RTNL Johannes Berg
2023-12-06 16:44 ` Jakub Kicinski
2023-12-06 16:46 ` Johannes Berg
2023-12-06 21:39 ` Marc MERLIN
2023-12-07 10:16 ` [Intel-wired-lan] " Przemek Kitszel
2023-12-07 10:16 ` Przemek Kitszel
2023-12-07 17:40 ` [Intel-wired-lan] " Jakub Kicinski
2023-12-07 17:40 ` Jakub Kicinski
2023-12-11 4:52 ` [Intel-wired-lan] " Marc MERLIN
2023-12-11 4:52 ` Marc MERLIN
2023-12-15 13:42 ` [Intel-wired-lan] " Heiner Kallweit
2023-12-15 13:42 ` Heiner Kallweit
2023-12-15 17:46 ` [Intel-wired-lan] " Marc MERLIN
2023-12-15 17:46 ` Marc MERLIN
2023-12-24 16:30 ` [Intel-wired-lan] " Marc MERLIN
2023-12-24 16:30 ` Marc MERLIN
2023-12-24 23:12 ` [Intel-wired-lan] " Heiner Kallweit
2023-12-24 23:12 ` Heiner Kallweit
2023-12-25 8:03 ` [Intel-wired-lan] " Sasha Neftin
2023-12-25 8:03 ` Sasha Neftin
2023-12-25 11:21 ` Marc MERLIN
2023-12-25 11:21 ` Marc MERLIN
2024-01-03 10:30 ` Stanislaw Gruszka
2024-01-03 11:24 ` Heiner Kallweit
2024-01-03 12:15 ` Stanislaw Gruszka
2024-01-03 23:34 ` Jakub Kicinski
2024-01-04 8:25 ` Stanislaw Gruszka
2024-01-04 9:05 ` Heiner Kallweit
2024-01-04 16:16 ` Jakub Kicinski
2024-01-05 11:53 ` Stanislaw Gruszka
2024-01-05 15:30 ` Jakub Kicinski
2024-01-05 16:29 ` Stanislaw Gruszka
2024-01-06 3:02 ` Jakub Kicinski
2024-01-08 11:18 ` Stanislaw Gruszka
2024-01-05 10:34 ` Stanislaw Gruszka [this message]
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=ZZfbNIuyEiS+m7Ih@linux.intel.com \
--to=stanislaw.gruszka@linux.intel.com \
--cc=hkallweit1@gmail.com \
--cc=johannes.berg@intel.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=marc@merlins.org \
--cc=netdev@vger.kernel.org \
--cc=przemyslaw.kitszel@intel.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.