From: Marc Kleine-Budde <mkl@pengutronix.de>
To: 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>, Paolo Abeni <pabeni@redhat.com>,
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: Wed, 11 Oct 2023 08:43:31 +0200 [thread overview]
Message-ID: <20231011-said-hemlock-834e5698a7a3-mkl@pengutronix.de> (raw)
In-Reply-To: <20231010222131.GA3324403@electric-eye.fr.zoreil.com>
[-- Attachment #1: Type: text/plain, Size: 1717 bytes --]
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.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-10-11 6:43 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 [this message]
2023-10-12 8:20 ` Paolo Abeni
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=20231011-said-hemlock-834e5698a7a3-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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).