Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1311031pxk; Mon, 31 Aug 2020 16:03:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSPGIEpejg+O4MNvZedyHbdVfnQCJljgNBi7DHGtqPVXf/lg9wStXpZ2WleSvfvzhJ0vpQ X-Received: by 2002:a05:6402:1694:: with SMTP id a20mr3084983edv.286.1598915030756; Mon, 31 Aug 2020 16:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598915030; cv=none; d=google.com; s=arc-20160816; b=aUxHXk7+9W/50ChZvXOvVVmS33kabljSXvhgEbfvE0/+DPuqu4tRtIklzELmCWyklg /Z0z859MfDsI8DUWpSIAil5kfGkeC3FDlrMQwmg6gSJ3xfIntW8Rt3kpZhLKfaSjpMzU tWSZWcY5pq/tw0c4IB0t6NheqOJ2PY+gIyeUUb6UuPxR6av7FhCUKoXndmiRSPva64Zy vW32AnYLwkSj6HClS3gY5wCPA5ia9a1EKMlCFVbT72/cwYg7zKzNXzdZH3M04Uf2njut J0Myq9u8veZdnSsHnunF/Ohrx80VtmoFqVMcKwVetd1b5Jsx5Ew/I6lGNoSmh/Wa3TGG 7wvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=7PRLbHKUvs0I2F8OqSSyY/je3WABZbVxz3sgvDxCiaE=; b=KO0oOhfOh2Sf7Mx9AC7cRzyQQ56CZ/tmwpvA/m1B8rNaonJyolAQTMWBUbPr1F2hyK EL7nT5/7j/ZUa8owlKV/arJDKkMfpkmOmYX1NmS08EL9e+KkywlAWl9QswdGONlmPy/W v0QXJck3Oy/9cFSinm3XsAYSYpP4uJfVE86JDZik/N+0gKkRkg8gA+55scewdhA/bkB8 Q0fcB5tFfFbrHxBzL86x0NxCSYN33iTspJ3vsZjtpGEf+2CdzUGPnNog6MmWjhA9kOGc +idThjodQtef4tTTPST66VJcJ9W0AxjHozAAYl8cPGiT4yHHzNOQ3uA8dtmvG7UbGcLR G1xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gmHLOChA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t22si6199669ejy.466.2020.08.31.16.03.27; Mon, 31 Aug 2020 16:03:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gmHLOChA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727950AbgHaWPl (ORCPT + 99 others); Mon, 31 Aug 2020 18:15:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726044AbgHaWPk (ORCPT ); Mon, 31 Aug 2020 18:15:40 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B95A1C061573 for ; Mon, 31 Aug 2020 15:15:40 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id bh1so3896983plb.12 for ; Mon, 31 Aug 2020 15:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7PRLbHKUvs0I2F8OqSSyY/je3WABZbVxz3sgvDxCiaE=; b=gmHLOChAjhuiG4feYUyWIPaLsJlwLy9HM7atWQo0zZTU44Y0uB6PeNWXtOHcSE0h0v QOH3EK952sdHvEMBfMIq0jjsFlJeUh2St+lgKD3G+GLX3MNOIjXGkCrAQL2si6UCKBZP sAdVlMW4IyWlcxAuPknYUabsDuct6U3Y6ft2SyB3lN9zrNjBSAfizW9YE07FbDZX2DDU W8wZgheUbKFqchzIKEtCbfmpvZ/kQ+DWL8A8m5AcQeL9OjCHGvCTvypTpp3fpFVZsgRU +M0RMuo48C7dktSL+E46ZTCCSPMIrv6kuqc3F99ZdblyHNeCDfYMRV+ciJfoSuyIiJce Sfcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7PRLbHKUvs0I2F8OqSSyY/je3WABZbVxz3sgvDxCiaE=; b=e1CTxOGVLtuKFXzaA2VajJy53mEND1xvkTeygHOpbeqb5/34jdC/PAFhGEgSm1XVAL qJ27HzPH44rGB4g+p8iouDyR1ec2jrHr5h+VIAxMKCQiIkGGh3uak6CEsIHHQqAM/IAm ZQh6W7mFClXTFgubQHEJgW87AKbzM4TvG4dTi6ooG9o1jJMya8F25Jwy2AD/keerMuXm +pu/qnEy9Wu2d4uUwsNFYnGqQoGCFtqsWmHB5eARhi1kUQ3rvlXuSZej2WS2QA19GW7L YrEpWPSWxp5B8Bns8NE7WtoorgGMPc+b4Zfz1+W2hko019kOCvcQA6u54OsdblJuORgk u6UQ== X-Gm-Message-State: AOAM530oZMu2yqyzXXPhEJYLJsGsF8fr+FcdFLMHJ9cdDaNn8hmwNRiz 6d052HsTe+LMDQrKzXCE4Ql6rNNqc8SbBnAu6kq2Ig== X-Received: by 2002:a17:90b:384b:: with SMTP id nl11mr1258486pjb.91.1598912138963; Mon, 31 Aug 2020 15:15:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Saravana Kannan Date: Mon, 31 Aug 2020 15:15:03 -0700 Message-ID: Subject: Re: Lockdep warning caused by "driver core: Fix sleeping in invalid context during device link deletion" To: Dong Aisheng Cc: open list , Guenter Roeck , gregkh , Marek Szyprowski , Naresh Kamboju , dl-linux-imx , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Dong Aisheng , Shawn Guo , Sascha Hauer Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 26, 2020 at 10:17 PM Saravana Kannan wrote: > > On Thu, Aug 20, 2020 at 8:50 PM Dong Aisheng wrote: > > > > Hi ALL, > > > > We met the below WARNING during system suspend on an iMX6Q SDB board > > with the latest linus/master branch (v5.9-rc1+) and next-20200820. > > v5.8 kernel is ok. So i did bisect and finally found it's caused by > > the patch below. > > Reverting it can get rid of the warning, but I wonder if there may be > > other potential issues. > > Any ideas? > > > > Defconfig used is: imx_v6_v7_defconfig > > > > ----- 8< ----- Snipped text that was a bit misleading > > > > > Error log: > > # echo mem > /sys/power/state > > [ 39.111865] PM: suspend entry (deep) > > [ 39.148650] Filesystems sync: 0.032 seconds > > [ 39.154034] > > [ 39.155537] ====================================================== > > [ 39.161723] WARNING: possible circular locking dependency detected > > [ 39.167911] 5.9.0-rc1-00103-g7eac66d0456f #37 Not tainted > > [ 39.173315] ------------------------------------------------------ > > [ 39.179500] sh/647 is trying to acquire lock: > > [ 39.183862] c15a310c (dpm_list_mtx){+.+.}-{3:3}, at: > > dpm_for_each_dev+0x20/0x5c > > [ 39.191200] > > [ 39.191200] but task is already holding lock: > > [ 39.197036] c15a37e4 (fw_lock){+.+.}-{3:3}, at: fw_pm_notify+0x90/0xd4 > > [ 39.203582] > > [ 39.203582] which lock already depends on the new lock. > > [ 39.203582] > > [ 39.211763] > > [ 39.211763] the existing dependency chain (in reverse order) is: > > [ 39.219249] > > [ 39.219249] -> #2 (fw_lock){+.+.}-{3:3}: > > [ 39.224673] mutex_lock_nested+0x1c/0x24 > > [ 39.229126] firmware_uevent+0x18/0xa0 > > [ 39.233411] dev_uevent+0xc4/0x1f8 > > [ 39.237343] uevent_show+0x98/0x114 > > [ 39.241362] dev_attr_show+0x18/0x48 > > [ 39.245472] sysfs_kf_seq_show+0x84/0xec > > [ 39.249927] seq_read+0x138/0x550 > > [ 39.253774] vfs_read+0x94/0x164 > > [ 39.257529] ksys_read+0x60/0xe8 > > [ 39.261288] ret_fast_syscall+0x0/0x28 > > [ 39.265564] 0xbed7c808 > > [ 39.268538] > > [ 39.268538] -> #1 (kn->active#3){++++}-{0:0}: > > [ 39.274391] kernfs_remove_by_name_ns+0x40/0x94 > > [ 39.279450] device_del+0x144/0x3fc > > Rafael/Greg, > > I'm not very familiar with the #0 and #2 calls stacks. But poking > around a bit, they are NOT due to the device-link-device. But the new > stuff is the above two lines that are deleting the device-link-device > (that's used to expose device link details in sysfs) when the device > link is deleted. > > Kicking off a workqueue to break this cycle is easy, but the problem > is that if I queue a work to delete the device, then the sysfs folder > won't get removed immediately. And if the same link is created again > before the work is completed, then there'll be a sysfs name collision > and warning. > > So, I'm kinda stuck here. Open to suggestions. Hoping you'll have > better ideas for breaking the cycle. Or point out how I'm > misunderstanding the cycle here. > Aisheng, Sent out a fix that I think should work. https://lore.kernel.org/lkml/20200831221007.1506441-1-saravanak@google.com/T/#u I wasn't able to reproduce it in my hardware. So, if you can test that patch (and respond to that thread), that'd be great. -Saravana