lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240902054959.28073-1-00107082@163.com>
Date: Mon,  2 Sep 2024 13:49:59 +0800
From: David Wang <00107082@....com>
To: rafael@...nel.org,
	len.brown@...el.com,
	pavel@....cz,
	gregkh@...uxfoundation.org
Cc: linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	David Wang <00107082@....com>
Subject: [PATCH] PM: add: move warn message out of mutex lock.

dpm_list_mtx does not protect any data used by
dev_warn for checking parent's power, move
dev_warn out of mutex lock block make the
lock more efficient, especially when the warn
is triggered. This can happen on some HW when
resume from suspend with USB camera opened:
 >usb 3-1.1: reset high-speed USB device number 4 using xhci_hcd
 >..
 >ep_81: PM: parent 3-1.1:1.1 should not be sleeping

Signed-off-by: David Wang <00107082@....com>
---
 drivers/base/power/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 4a67e83300e1..934e5bb61f13 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -134,10 +134,10 @@ void device_pm_add(struct device *dev)
 	pr_debug("Adding info for %s:%s\n",
 		 dev->bus ? dev->bus->name : "No Bus", dev_name(dev));
 	device_pm_check_callbacks(dev);
-	mutex_lock(&dpm_list_mtx);
 	if (dev->parent && dev->parent->power.is_prepared)
 		dev_warn(dev, "parent %s should not be sleeping\n",
 			dev_name(dev->parent));
+	mutex_lock(&dpm_list_mtx);
 	list_add_tail(&dev->power.entry, &dpm_list);
 	dev->power.in_dpm_list = true;
 	mutex_unlock(&dpm_list_mtx);
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ