[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YhQNkQDwqUag1UmA@lunn.ch>
Date: Mon, 21 Feb 2022 23:09:21 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Heyi Guo <guoheyi@...ux.alibaba.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Joel Stanley <joel@....id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Dylan Hung <dylan_hung@...eedtech.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [Issue report] drivers/ftgmac100: DHCP occasionally fails during
boot up or link down/up
> [ 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
Powered by blists - more mailing lists