From: Paolo Abeni <pabeni@redhat.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
Francois Romieu <romieu@fr.zoreil.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Kalle Valo <kvalo@kernel.org>,
Wei Fang <wei.fang@nxp.com>,
kernel@pengutronix.de, stable@vger.kernel.org
Subject: Re: [PATCH net] net: davicom: dm9000: dm9000_phy_write(): fix deadlock during netdev watchdog handling
Date: Thu, 12 Oct 2023 10:20:11 +0200 [thread overview]
Message-ID: <438bdacdfe2b50534d30d5d51660c4a7c3ba4f66.camel@redhat.com> (raw)
In-Reply-To: <20231011-said-hemlock-834e5698a7a3-mkl@pengutronix.de>
On Wed, 2023-10-11 at 08:43 +0200, Marc Kleine-Budde wrote:
> On 11.10.2023 00:21:31, Francois Romieu wrote:
> > Marc Kleine-Budde <mkl@pengutronix.de> :
> > > The dm9000 takes the db->lock spin lock in dm9000_timeout() and calls
> > > into dm9000_init_dm9000(). For the DM9000B the PHY is reset with
> > > dm9000_phy_write(). That function again takes the db->lock spin lock,
> > > which results in a deadlock. For reference the backtrace:
> > [...]
> > > To workaround similar problem (take mutex inside spin lock ) , a
> > > "in_timeout" variable was added in 582379839bbd ("dm9000: avoid
> > > sleeping in dm9000_timeout callback"). Use this variable and not take
> > > the spin lock inside dm9000_phy_write() if in_timeout is true.
> > >
> > > Cc: stable@vger.kernel.org
> > > Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> > > ---
> > > During the netdev watchdog handling the dm9000 driver takes the same
> > > spin lock twice. Avoid this by extending an existing workaround.
> > > ---
> >
> > I can review it but I can't really endorse it. :o)
> >
> > Extending ugly workaround in pre-2000 style device drivers...
> > I'd rather see the thing fixed if there is some real use for it.
>
> There definitely are still users of this drivers on modern kernels out
> there.
>
> I too don't like the feeling of wrapping more and more duct tape
> around existing drivers. How about moving the functionality to
> dm9000_phy_write_locked() and leave the locking in dm9000_phy_write().
> I will prepare a patch.
If you have the H/W handy to try some more invasive change, I'm
wondering if you could schedule a work from dm9000_timeout() and there
acquire all the needed locks.
Cheers,
Paolo
prev parent reply other threads:[~2023-10-12 8:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 7:35 [PATCH net] net: davicom: dm9000: dm9000_phy_write(): fix deadlock during netdev watchdog handling Marc Kleine-Budde
2023-10-10 7:42 ` Marc Kleine-Budde
2023-10-10 22:21 ` Francois Romieu
2023-10-11 6:43 ` Marc Kleine-Budde
2023-10-12 8:20 ` Paolo Abeni [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=438bdacdfe2b50534d30d5d51660c4a7c3ba4f66.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.com \
--cc=stable@vger.kernel.org \
--cc=wei.fang@nxp.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).