From: David Wang <00107082@163.com>
To: rafael@kernel.org, len.brown@intel.com, pavel@ucw.cz,
gregkh@linuxfoundation.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
David Wang <00107082@163.com>
Subject: [PATCH] PM: add: move warn message out of mutex lock.
Date: Mon, 2 Sep 2024 13:49:59 +0800 [thread overview]
Message-ID: <20240902054959.28073-1-00107082@163.com> (raw)
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@163.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
next reply other threads:[~2024-09-02 5:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-02 5:49 David Wang [this message]
2024-09-02 6:31 ` [PATCH] PM: add: move warn message out of mutex lock Greg KH
2024-09-02 6:47 ` David Wang
2024-09-03 13:01 ` Rafael J. Wysocki
2024-09-03 14:10 ` Rafael J. Wysocki
2024-09-03 16:16 ` David Wang
2024-09-03 16:23 ` Rafael J. Wysocki
2024-09-03 16:42 ` David Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240902054959.28073-1-00107082@163.com \
--to=00107082@163.com \
--cc=gregkh@linuxfoundation.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox