diff mbox series

PM/sleep: Instrument start of filesystems sync

Message ID 20231024180718.626055-1-kaleshsingh@google.com (mailing list archive)
State New
Headers show
Series PM/sleep: Instrument start of filesystems sync | expand

Commit Message

Kalesh Singh Oct. 24, 2023, 6:07 p.m. UTC
Systems, such as Android, that implement opportunistic sleep from
a userspace power manager service need to guard the acquisition of
new wakelocks (incrementing a counter in userspace) while attempting
a suspend (write to /sys/power/state).

While attempting to suspend, processes attempting to acquire a
userspace wakelock are also blocked. If the suspend is blocked for
too long it can cause a watchdog bite in android.

Some device vendors reported this issue in cases where the filesystem
sync is not fast enough (sometimes > 100s):

[ 2742.247785] [07-10 15:08:02.247] Filesystems sync: 107.127 seconds

Commit b5dee3130bb4 ("PM / sleep: Refactor filesystems sync to reduce
duplication") introduced ksys_sync_helper() which logged both the start
and end of the filesystems sync.

Commit c64546b17bc9 ("PM / sleep: Measure the time of filesystems syncing")
improved on this by adding the elapsed time, but also removed instrumentation
indicating the start of filesystems sync.

Re-add the log indicating the start of filesystem sync. This helps to
identify when the above scenario has occurred in production devices in
the field.

Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: Harry Pan <harry.pan@intel.com>
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
---
 kernel/power/main.c | 1 +
 1 file changed, 1 insertion(+)


base-commit: 05d3ef8bba77c1b5f98d941d8b2d4aeab8118ef1
diff mbox series

Patch

diff --git a/kernel/power/main.c b/kernel/power/main.c
index f6425ae3e8b0..b6a88b43b6da 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -87,6 +87,7 @@  void ksys_sync_helper(void)
 	ktime_t start;
 	long elapsed_msecs;
 
+	pr_info("Syncing filesystems ... ");
 	start = ktime_get();
 	ksys_sync();
 	elapsed_msecs = ktime_to_ms(ktime_sub(ktime_get(), start));