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 X-Spam-Level: X-Spam-Status: No, score=-4.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B0A8C433B4 for ; Thu, 22 Apr 2021 07:09:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 138DB613CB for ; Thu, 22 Apr 2021 07:09:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235009AbhDVHKT (ORCPT ); Thu, 22 Apr 2021 03:10:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229655AbhDVHKR (ORCPT ); Thu, 22 Apr 2021 03:10:17 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D75F7C06174A; Thu, 22 Apr 2021 00:09:42 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id g5so60461047ejx.0; Thu, 22 Apr 2021 00:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=X338HNooootoGgLp4Uh2rRwvRKYDOVvH5vsvPe4Uc28=; b=A4XeclTyEu5VZVCgWBT7mGSoaa+ezp2msSvlhn3okMVtX8kfU5RTlI0DB9GK8Bfy1c YsZ+tEqCWOg/FfoWRnk+uwU/bW9ynDbdPAkNUDc0judgL9b//hLi8sw8YrJuYAKoQTdQ bBthX0C89A7XDfJ9/XCmHFiPk/EzStAMu0BW8+KCped+pUq/lRJFX2xrZJ4MyzgfSZPW ySCMEbY9lqECYczEpDOPc+5XgQIvvxg3t7czWVhDnsOTV5BUCfPfHcDEh+jLu6wTU66U hh4kHAmtWM5ElPVOxLmhQK0SF1nDcAeXn5gc7/l85MyXFa+X3m77+OmxcJFzMkeRG1BF Ijjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=X338HNooootoGgLp4Uh2rRwvRKYDOVvH5vsvPe4Uc28=; b=ZV605v+x2dc0fLSwirbcouzlOZoduPuTZaPEuNLte3tk79+tdAtNW8W9OPTHVkODPR ac8CmFqXC8707ccmTpjuWkgqlVs5zhZfGaYzAbud3oLUGqFq/m8W8Dy8vxwScnX/l1dF aFkrkmFkC5mthatHRG6CRqzMHv6l9KFr2iciUkZc0pR/IO2wGQJ5EvDsOwqbp2SWJWgK 11L8+LmnzQB1Bvspc0hXgqF01DinCWSu2GuFZJFUgYWXskskeLUf7HOJ0idWw4rEBwaN 60pVPujkiGMKiZy0nX3MOoz7jhQO5guIrwdVBV7D2nIrGRAPhqVS7AI4jbe2Pg8B39Mi 0mEg== X-Gm-Message-State: AOAM5329uQIz6xSgEq4vcJVcg/RlcTQj4AU5h0DbfBqrTkmQpF2mAb1L b9VvFrmH1nSBuNA0ROtocmG0h5StPH6h7w== X-Google-Smtp-Source: ABdhPJw7AiSOCXLuAM3X1uaXnIrKWtUTvd48Dx8U7MRWPzUfhI1/uIkMX6vMkTzWuyMk2zTsy38yhw== X-Received: by 2002:a17:906:b01:: with SMTP id u1mr1875232ejg.310.1619075381367; Thu, 22 Apr 2021 00:09:41 -0700 (PDT) Received: from ?IPv6:2003:ea:8f38:4600:bdfe:7c1a:e805:a0da? (p200300ea8f384600bdfe7c1ae805a0da.dip0.t-ipconnect.de. [2003:ea:8f38:4600:bdfe:7c1a:e805:a0da]) by smtp.googlemail.com with ESMTPSA id s8sm1258056edj.25.2021.04.22.00.09.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Apr 2021 00:09:40 -0700 (PDT) Subject: Re: [PATCH] net: called rtnl_unlock() before runpm resumes devices To: AceLan Kao , Jakub Kicinski Cc: Eric Dumazet , "David S. Miller" , Alexei Starovoitov , Andrii Nakryiko , Wei Wang , Cong Wang , Taehee Yoo , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , netdev , LKML References: <20210420075406.64105-1-acelan.kao@canonical.com> <20210420122715.2066b537@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: Heiner Kallweit Message-ID: Date: Thu, 22 Apr 2021 09:09:20 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 22.04.2021 08:30, AceLan Kao wrote: > Yes, should add > > Fixes: 9474933caf21 ("igb: close/suspend race in netif_device_detach") > and also > Fixes: 9513d2a5dc7f ("igc: Add legacy power management support") > Please don't top-post. Apart from that: If the issue was introduced with driver changes, then adding a workaround in net core may not be the right approach. > Jakub Kicinski 於 2021年4月21日 週三 上午3:27寫道: >> >> On Tue, 20 Apr 2021 10:34:17 +0200 Eric Dumazet wrote: >>> On Tue, Apr 20, 2021 at 9:54 AM AceLan Kao wrote: >>>> >>>> From: "Chia-Lin Kao (AceLan)" >>>> >>>> The rtnl_lock() has been called in rtnetlink_rcv_msg(), and then in >>>> __dev_open() it calls pm_runtime_resume() to resume devices, and in >>>> some devices' resume function(igb_resum,igc_resume) they calls rtnl_lock() >>>> again. That leads to a recursive lock. >>>> >>>> It should leave the devices' resume function to decide if they need to >>>> call rtnl_lock()/rtnl_unlock(), so call rtnl_unlock() before calling >>>> pm_runtime_resume() and then call rtnl_lock() after it in __dev_open(). >>>> >>>> >>> >>> Hi Acelan >>> >>> When was the bugg added ? >>> Please add a Fixes: tag >> >> For immediate cause probably: >> >> Fixes: 9474933caf21 ("igb: close/suspend race in netif_device_detach") >> >>> By doing so, you give more chances for reviewers to understand why the >>> fix is not risky, >>> and help stable teams work. >> >> IMO the driver lacks internal locking. Taking rtnl from resume is just >> one example, git history shows many more places that lacked locking and >> got papered over with rtnl here.