From de2adf4656f177a08555a0930638d024047572ed Mon Sep 17 00:00:00 2001 From: Murali Nalajala Date: Sun, 8 Nov 2020 19:43:56 -0800 Subject: [PATCH 1/3] Kconfig: print epoch values in system suspend and resume cycles Print epoch values when the device is enter and exit out of suspend and resume. These epoch values are useful to know how long the device is in suspend state. These values can be used to synchronize various subsystem timestamps and have an unique timestamp to correlate between various subsystems. Change-Id: Ibe04b914649db1f2ee0ae748f3950ca646323ef1 Signed-off-by: Murali Nalajala --- kernel/time/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig index fcc42353f125..a6c391cd97c8 100644 --- a/kernel/time/Kconfig +++ b/kernel/time/Kconfig @@ -52,6 +52,16 @@ config GENERIC_CLOCKEVENTS_MIN_ADJUST config GENERIC_CMOS_UPDATE bool +config PRINT_SUSPEND_EPOCH_QGKI + bool "Print epoch values in suspend resume cycles" + depends on QGKI + help + Print epoch values when device enter and exit out of suspend + and resume. These epoch values are useful to know how long + the device is in suspend state. These values can be used to + synchronize various subsystem timestamps and have an unique + timestamp to correlate between various subsystems. + if GENERIC_CLOCKEVENTS menu "Timers subsystem" From f121a71abbd1a46924a5cc33549f2d51bd743619 Mon Sep 17 00:00:00 2001 From: Srinivas Ramana Date: Wed, 23 Nov 2016 16:43:42 +0530 Subject: [PATCH 2/3] time: sched_clock: record cycle count in suspend and resume Record cycle count and kernel time in ns while entering suspend and while resuming. This will help in matching up the kernel time with external subsystems and in recording suspend time in cycles. Change-Id: If22d9880103c7d54087d0faf4c992259e6b97f08 Signed-off-by: Srinivas Ramana Signed-off-by: Elliot Berman Signed-off-by: Murali Nalajala --- kernel/time/sched_clock.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index a5538dd76a81..d85f4706a5da 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -71,6 +71,12 @@ struct clock_data { static struct hrtimer sched_clock_timer; static int irqtime = -1; +#ifdef CONFIG_PRINT_SUSPEND_EPOCH_QGKI +static u64 suspend_ns; +static u64 suspend_cycles; +static u64 resume_cycles; +#endif + core_param(irqtime, irqtime, int, 0400); static u64 notrace jiffy_sched_clock_read(void) @@ -280,6 +286,13 @@ int sched_clock_suspend(void) struct clock_read_data *rd = &cd.read_data[0]; update_sched_clock(); + +#ifdef CONFIG_PRINT_SUSPEND_EPOCH_QGKI + suspend_ns = rd->epoch_ns; + suspend_cycles = rd->epoch_cyc; + pr_info("suspend ns:%17llu suspend cycles:%17llu\n", + rd->epoch_ns, rd->epoch_cyc); +#endif hrtimer_cancel(&sched_clock_timer); rd->read_sched_clock = suspended_sched_clock_read; @@ -292,6 +305,10 @@ void sched_clock_resume(void) rd->epoch_cyc = cd.actual_read_sched_clock(); hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL_HARD); +#ifdef CONFIG_PRINT_SUSPEND_EPOCH_QGKI + resume_cycles = rd->epoch_cyc; + pr_info("resume cycles:%17llu\n", rd->epoch_cyc); +#endif rd->read_sched_clock = cd.actual_read_sched_clock; } From 2917f5e88b56fcad5503bbb1ac784f5b21354f7f Mon Sep 17 00:00:00 2001 From: Murali Nalajala Date: Mon, 14 Dec 2020 12:35:02 -0800 Subject: [PATCH 3/3] arm64: defconfig: enable CONFIG_PRINT_SUSPEND_EPOCH_QGKI Enable CONFIG_PRINT_SUSPEND_EPOCH_QGKI to print epoch values when the device enter into suspend and resume. Change-Id: Ia2d54874405cf88f9283cdb1699f67078aa3fcbc Signed-off-by: Murali Nalajala --- arch/arm64/configs/vendor/lahaina_QGKI.config | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/vendor/lahaina_QGKI.config b/arch/arm64/configs/vendor/lahaina_QGKI.config index 8509cf56b00e..c338fccad3f8 100644 --- a/arch/arm64/configs/vendor/lahaina_QGKI.config +++ b/arch/arm64/configs/vendor/lahaina_QGKI.config @@ -253,3 +253,4 @@ CONFIG_QTI_HW_MEMLAT_SCMI_CLIENT=y CONFIG_QTI_HW_MEMLAT_LOG=y CONFIG_SRAM=y CONFIG_CRYPTO_SHA1_ARM64_CE=y +CONFIG_PRINT_SUSPEND_EPOCH_QGKI=y