From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C866C433F5 for ; Tue, 22 Feb 2022 03:09:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239322AbiBVDJk (ORCPT ); Mon, 21 Feb 2022 22:09:40 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231496AbiBVDJj (ORCPT ); Mon, 21 Feb 2022 22:09:39 -0500 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4FBAB851; Mon, 21 Feb 2022 19:09:14 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R231e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=alimailimapcm10staff010182156082;MF=guoheyi@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0V5AaMP-_1645499350; Received: from 30.225.140.29(mailfrom:guoheyi@linux.alibaba.com fp:SMTPD_---0V5AaMP-_1645499350) by smtp.aliyun-inc.com(127.0.0.1); Tue, 22 Feb 2022 11:09:11 +0800 Message-ID: <51f5b7a7-330f-6b3c-253d-10e45cdb6805@linux.alibaba.com> Date: Tue, 22 Feb 2022 11:09:10 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [Issue report] drivers/ftgmac100: DHCP occasionally fails during boot up or link down/up Content-Language: en-US To: Andrew Lunn Cc: "David S. Miller" , Jakub Kicinski , Joel Stanley , Benjamin Herrenschmidt , Dylan Hung , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <0e456c4d-aa22-4e7f-9b2c-3059fe840cb9@linux.alibaba.com> <4964f8c3-8349-4fad-e176-8c26840d1a08@linux.alibaba.com> <1a7e74b4-8827-c14b-7371-9656a643d03c@linux.alibaba.com> From: Heyi Guo In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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