netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heyi Guo <guoheyi@linux.alibaba.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Joel Stanley <joel@jms.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Dylan Hung <dylan_hung@aspeedtech.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Issue report] drivers/ftgmac100: DHCP occasionally fails during boot up or link down/up
Date: Tue, 22 Feb 2022 11:09:10 +0800	[thread overview]
Message-ID: <51f5b7a7-330f-6b3c-253d-10e45cdb6805@linux.alibaba.com> (raw)
In-Reply-To: <YhQNkQDwqUag1UmA@lunn.ch>

Thanks for your advice. Let me take a try again :)

Heyi

在 2022/2/22 上午6:09, Andrew Lunn 写道:
>> [   16.872475]  Possible unsafe locking scenario:
>> [   16.872475]
>> [   16.872478]        CPU0                    CPU1
>> [   16.872482]        ----                    ----
>> [   16.872485]   lock(&dev->lock);
>> [   16.872495]                                lock(rtnl_mutex);
>> [   16.872505] lock(&dev->lock);
> It looks like the whitespace got messed up here, and it should
> actually be:
>> [   16.872505]                                lock(&dev->lock);
>> [   16.872513]   lock(rtnl_mutex);
> So if up calls open() which first takes rtnl and then the
> phydev->lock.
>
> adjust link is called with phydev->lock already held and it then takes
> the rtnl. Deadlock.
>
> During the adjust_list callback, the phydev lock is held so the
> contents of phydev are consistent. What you could do is make a copy of
> what you need and then release phydev lock. You can then take rtnl and
> do the reset. Once the reset is finished, program MAC with the copy
> you took from phydev. Then lock phydev again, and return.
>
>      Andrew

      reply	other threads:[~2022-02-22  3:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15  6:38 [Issue report] drivers/ftgmac100: DHCP occasionally fails during boot up or link down/up Heyi Guo
2022-02-15 20:50 ` Andrew Lunn
2022-02-17  1:38   ` Heyi Guo
2022-02-19 10:08   ` Heyi Guo
2022-02-19 18:28     ` Andrew Lunn
2022-02-20 12:26       ` Heyi Guo
2022-02-21 22:09         ` Andrew Lunn
2022-02-22  3:09           ` Heyi Guo [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=51f5b7a7-330f-6b3c-253d-10e45cdb6805@linux.alibaba.com \
    --to=guoheyi@linux.alibaba.com \
    --cc=andrew@lunn.ch \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=dylan_hung@aspeedtech.com \
    --cc=joel@jms.id.au \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).