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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 6441CC76188 for ; Fri, 19 Jul 2019 04:21:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36B4A2082F for ; Fri, 19 Jul 2019 04:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563510087; bh=tGjESBeDYN43XYR3+Lpn7FySCqjRCcufydLk9+TMPUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BznCdYRFdx9cz+KmHV/s42wQvVmjtPeHar4EYrsGSCDMFzOt8EHr7E1TO2b44dF5F O2DSFdOLS56DSUF916ez9rUy506CWMbooXiH3AcM+gum8ZzexzmmzcQnmDSN/UFI5P 9PyMpnmUSEajoRjK+YEopHP5RupB1+1Cjdh73C4A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729738AbfGSEV0 (ORCPT ); Fri, 19 Jul 2019 00:21:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:47102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732715AbfGSEL5 (ORCPT ); Fri, 19 Jul 2019 00:11:57 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D758A21873; Fri, 19 Jul 2019 04:11:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563509517; bh=tGjESBeDYN43XYR3+Lpn7FySCqjRCcufydLk9+TMPUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i2cC29GOaLv8fwDICPtmH7MavleQB2pUC9xraHfof8sQkpnHsH1c9K9yK+sJbYLs6 DuenCsEzYEviGkQaVb2YEF3leOQGUnkM8ygt7zk1Hfb+eqyx4eUbg6KWJQpK4VYH6k +zrfu5MwMwPbMp0BwSYNMbkFyvCk5DYRCJh+Umqw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Marek Vasut , Bjorn Helgaas , Geert Uytterhoeven , Phil Edworthy , Simon Horman , Tejun Heo , Wolfram Sang , Sasha Levin , linux-pci@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 26/60] PCI: sysfs: Ignore lockdep for remove attribute Date: Fri, 19 Jul 2019 00:10:35 -0400 Message-Id: <20190719041109.18262-26-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719041109.18262-1-sashal@kernel.org> References: <20190719041109.18262-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Marek Vasut [ Upstream commit dc6b698a86fe40a50525433eb8e92a267847f6f9 ] With CONFIG_PROVE_LOCKING=y, using sysfs to remove a bridge with a device below it causes a lockdep warning, e.g., # echo 1 > /sys/class/pci_bus/0000:00/device/0000:00:00.0/remove ============================================ WARNING: possible recursive locking detected ... pci_bus 0000:01: busn_res: [bus 01] is released The remove recursively removes the subtree below the bridge. Each call uses a different lock so there's no deadlock, but the locks were all created with the same lockdep key so the lockdep checker can't tell them apart. Mark the "remove" sysfs attribute with __ATTR_IGNORE_LOCKDEP() as it is safe to ignore the lockdep check between different "remove" kernfs instances. There's discussion about a similar issue in USB at [1], which resulted in 356c05d58af0 ("sysfs: get rid of some lockdep false positives") and e9b526fe7048 ("i2c: suppress lockdep warning on delete_device"), which do basically the same thing for USB "remove" and i2c "delete_device" files. [1] https://lore.kernel.org/r/Pine.LNX.4.44L0.1204251436140.1206-100000@iolanthe.rowland.org Link: https://lore.kernel.org/r/20190526225151.3865-1-marek.vasut@gmail.com Signed-off-by: Marek Vasut [bhelgaas: trim commit log, details at above links] Signed-off-by: Bjorn Helgaas Cc: Geert Uytterhoeven Cc: Phil Edworthy Cc: Simon Horman Cc: Tejun Heo Cc: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/pci/pci-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index c3f0473d1afa..ee7dccab771d 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -496,7 +496,7 @@ static ssize_t remove_store(struct device *dev, struct device_attribute *attr, pci_stop_and_remove_bus_device_locked(to_pci_dev(dev)); return count; } -static struct device_attribute dev_remove_attr = __ATTR(remove, +static struct device_attribute dev_remove_attr = __ATTR_IGNORE_LOCKDEP(remove, (S_IWUSR|S_IWGRP), NULL, remove_store); -- 2.20.1