[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4oueGEDLzZLXdd_Pt+tK=CpkMM7uE9ubVL9i6wTO7VkzccA@mail.gmail.com>
Date: Tue, 18 Oct 2022 08:15:38 +0200
From: Íñigo Huguet <ihuguet@...hat.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Andrew Lunn <andrew@...n.ch>, irusskikh@...vell.com,
dbogdanov@...vell.com, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, netdev@...r.kernel.org,
Li Liang <liali@...hat.com>
Subject: Re: [PATCH net] atlantic: fix deadlock at aq_nic_stop
On Tue, Oct 18, 2022 at 4:44 AM Jakub Kicinski <kuba@...nel.org> wrote:
> FWIW the work APIs return a boolean to tell you if the work was
> actually scheduled / canceled, and you can pair that with a reference
> count of the netdev to avoid the typical _sync issues.
>
> trigger()
> ASSERT_RTNL();
> if (schedule_work(netdev_priv->bla))
> netdev_hold();
>
> work()
> rtnl_lock();
> if (netif_running())
> do_ya_thing();
> netdev_put();
> rtnl_unlock();
>
> stop()
> ASSERT_RTNL();
> if (cancel_work(bla))
> netdev_put();
>
> I think.
>
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.
--
Íñigo Huguet
Powered by blists - more mailing lists