Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3132017ybi; Thu, 18 Jul 2019 21:39:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtJpYpgz0z3j3I/qnzf8oAJmf31ewm3lPN0ebTFqNh6HFIIpUZo0G1UOF3FWCDvly6+TE8 X-Received: by 2002:a17:90a:fa07:: with SMTP id cm7mr53833729pjb.138.1563511158500; Thu, 18 Jul 2019 21:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563511158; cv=none; d=google.com; s=arc-20160816; b=aPRvPRVBM+F3m6aUO/lPmR9NddW1LSHZjyDk5L3c6DLF1NXN4UKNSNmYgoHBi96SPA akstzq6SSr+5nGEV6zHC29/gDfTYUEjsZjLH/Rz/mJ+gefqkziM6xn9urT6C+Ajvcsxx 9MaBjQT5i5m82F7k2JRzphuQV4OGvbzkFfLTBP9Yy1ObR37M43i+roWdVXvRdxFRql3H kPItJJSfoSYWStzJm1lbcRmrd750cMVzYpPmirzLVbqESFbXltY7lpeouRza3ibRjN/d QhnUWLU03v8nBVneaT276QXGbVXKqvD1FTyWx33cNuqV4AsmZmVmfTJXjiDs2hEH46/y kNWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QquVRE9YyuYePwM/1M4AzVCOLlahDrnlAH2mgIxlqvU=; b=O2MuXku4oeIPdtgLEe5v8uapKVttZrExLjyNWxBsGQLPq/wPsqj7gGjiYeg26EnG3N TAziYKU0GIdHXevDxf9ZwYWHdS1gOpsYlO3I16iMJnlZP6IbaQUOTMNbA8cEyPPtIPM6 9HJS3T9D4MvEqu3lRPpfY+5nib18JCIC6TKqBx6Ywt9njcIlBI6BHdrXVH1J+VBXfcXj D2wlyrBIDDkufWgQM3u8v6rhbY3WY3p4rETuLliRj9Tx/s8wTurgM8GEO4FHephMzhIt Dh3Z7rRyGhN+UesUEpVm/YD8rMRSFRBpfCjVc7dxCzURNpOov4q8Jc7yJh3Du4b8f6bi gM2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RW+ZnqV3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d18si107447pfn.202.2019.07.18.21.39.03; Thu, 18 Jul 2019 21:39:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RW+ZnqV3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728790AbfGSD7h (ORCPT + 99 others); Thu, 18 Jul 2019 23:59:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:59214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727552AbfGSD7e (ORCPT ); Thu, 18 Jul 2019 23:59:34 -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 6B81D218A6; Fri, 19 Jul 2019 03:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508773; bh=NYLQY7CIaREfcBXHdDoypSwOWFVeme//3LD3XmnDecE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RW+ZnqV3ax8KxK/d4eqen+3jTsW4PZwAXv7QnJ/Sr7i5yv71VOHuzDaC0Yaak4GTq UKRFkxG6f0qYSyPiar8OoSDbQFeOcfnw60X6hXuWs69P8Hk8l6RXvfV20hKS/PHeqM lqGEj1HGoF78AK1DHSQqZOIBZFnKgSIslYhvNgB4= 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 5.2 082/171] PCI: sysfs: Ignore lockdep for remove attribute Date: Thu, 18 Jul 2019 23:55:13 -0400 Message-Id: <20190719035643.14300-82-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 6d27475e39b2..4e83c347de5d 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -477,7 +477,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