netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "Íñigo Huguet" <ihuguet@redhat.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	irusskikh@marvell.com, dbogdanov@marvell.com,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	netdev@vger.kernel.org, Li Liang <liali@redhat.com>
Subject: Re: [PATCH net] atlantic: fix deadlock at aq_nic_stop
Date: Tue, 18 Oct 2022 08:59:06 -0700	[thread overview]
Message-ID: <20221018085906.76f70073@kernel.org> (raw)
In-Reply-To: <CACT4oueGEDLzZLXdd_Pt+tK=CpkMM7uE9ubVL9i6wTO7VkzccA@mail.gmail.com>

On Tue, 18 Oct 2022 08:15:38 +0200 Íñigo Huguet wrote:
> Interesting solution, I didn't even think of something like this.
> However, despite not being 100% sure, I think that it's not valid in
> this case because the work's task communicates with fw and uses
> resources that are deinitialized at ndo_stop. That's why I think that
> just holding a reference to the device is not enough.

You hold a reference to the netdev just to be able to take rtnl_lock()
and check if it's still running. If it is UP you're protected from it
going down due to rtnl_lock you took. If it's DOWN, as you say, it's not
safe to access all the bits so just unlock and return.

But because you're holding the reference it's safe to cancel_work()
without _sync on down, because the work itself will check if it should
have been canceled.

Dunno if that's a good explanation :S

  reply	other threads:[~2022-10-18 15:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 10:34 [PATCH net] atlantic: fix deadlock at aq_nic_stop Íñigo Huguet
2022-10-14 12:13 ` Andrew Lunn
2022-10-14 12:43   ` Íñigo Huguet
2022-10-14 13:35     ` Andrew Lunn
2022-10-14 13:44       ` Íñigo Huguet
2022-10-15 15:09         ` Andrew Lunn
2022-10-17  7:22           ` Íñigo Huguet
2022-10-18  0:27             ` Andrew Lunn
2022-10-18  2:44               ` Jakub Kicinski
2022-10-18  6:15                 ` Íñigo Huguet
2022-10-18 15:59                   ` Jakub Kicinski [this message]
2022-10-19  6:18                     ` Íñigo Huguet
2022-10-19 15:39                       ` Jakub Kicinski
2022-10-20  7:46                         ` Íñigo Huguet
2022-10-18  6:11               ` Íñigo Huguet
2022-10-20  7:53 ` [PATCH v2 " Íñigo Huguet
2022-10-20  8:55   ` Igor Russkikh
2022-10-20 16:17     ` Íñigo Huguet
2022-10-21 19:01     ` Íñigo Huguet
2022-10-24  9:30   ` 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=20221018085906.76f70073@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dbogdanov@marvell.com \
    --cc=edumazet@google.com \
    --cc=ihuguet@redhat.com \
    --cc=irusskikh@marvell.com \
    --cc=liali@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 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).