sched_clock and device suspend/resume
A message that is not in the archive (sent off-list or not yet received): [email protected]
[ Resending as your Cc was screwed up and caused my reply to mess up
the Cc list ]
Quoted 4 lines · On Wed, 10 Jul 2019 08:20:37 -0700 Sodagudi Prasad <[email protected]>…
Another option is printing the epoch/cycles information in every print statement similar to thread id or processor id added
recently(CONFIG_PRINTK_CALLER). This can be avoided if we start accounting suspend time insched_clock.
Or another option is add a new clock that printk and tracing can use. tracing already can switch between clocks trivially.
sched_clock_continuous() ? (I know, horrible name), that simply keeps track of the time delta at suspend and returns:
sched_clock() + delta;
This will prevent other issues happening by modifying sched_clock(), specifically, screwing up the scheduler (what sched_clock()'s main purpose is for). We don't want the scheduler to think that a process was running for hours when it has spent most of that time in the suspend state. Which is probably your answer to why it was designed that way.
-- Steve
Quoted 12 lines · Steven Rostedt
[ Resending as your Cc was screwed up and caused my reply to mess up
the Cc list ]Quoted 4 lines · On Wed, 10 Jul 2019 08:20:37 -0700 Sodagudi Prasad <[email protected]>…
Another option is printing the epoch/cycles information in every print statement similar to thread id or processor id added
recently(CONFIG_PRINTK_CALLER). This can be avoided if we start accounting suspend time insched_clock.
Quoted 7 lines
Or another option is add a new clock that printk and tracing can use. tracing already can switch between clocks trivially.
sched_clock_continuous()? (I know, horrible name), that simply keeps track of the time delta at suspend and returns:sched_clock() + delta;
Which you get already when you do
# echo boot > /sys/kernel/debug/tracing/trace_clock
Thanks,
tglx
Quoted 17 lines · On Wed, 10 Jul 2019 20:35:32 +0200 (CEST) Thomas Gleixner <[email protected]>…
Quoted 15 lines · Steven Rostedt
[ Resending as your Cc was screwed up and caused my reply to mess up
the Cc list ]Quoted 4 lines · On Wed, 10 Jul 2019 08:20:37 -0700 Sodagudi Prasad <[email protected]>…
Another option is printing the epoch/cycles information in every print statement similar to thread id or processor id added
recently(CONFIG_PRINTK_CALLER). This can be avoided if we start accounting suspend time insched_clock.Or another option is add a new clock that printk and tracing can use. tracing already can switch between clocks trivially.
Quoted 9 lines
Quoted 4 lines
sched_clock_continuous()? (I know, horrible name), that simply keeps track of the time delta at suspend and returns:sched_clock() + delta;Which you get already when you do
# echo boot > /sys/kernel/debug/tracing/trace_clock
So basically the answer here is to change printk to use ktime_get_boot_fast_ns() instead of local_clock()?
-- Steve
Quoted 25 lines · Steven Rostedt
Quoted 22 lines · On Wed, 10 Jul 2019 20:35:32 +0200 (CEST) Thomas Gleixner <[email protected]>…
Quoted 19 lines · Steven Rostedt
[ Resending as your Cc was screwed up and caused my reply to mess up
the Cc list ]Quoted 4 lines · On Wed, 10 Jul 2019 08:20:37 -0700 Sodagudi Prasad <[email protected]>…
Another option is printing the epoch/cycles information in every print statement similar to thread id or processor id added
recently(CONFIG_PRINTK_CALLER). This can be avoided if we start accounting suspend time insched_clock.Or another option is add a new clock that printk and tracing can use. tracing already can switch between clocks trivially.
sched_clock_continuous()? (I know, horrible name), that simply keeps track of the time delta at suspend and returns:sched_clock() + delta;
Quoted 7 lines
Quoted 4 lines
Which you get already when you do
# echo boot > /sys/kernel/debug/tracing/trace_clockSo basically the answer here is to change printk to use
ktime_get_boot_fast_ns()instead oflocal_clock()?
Aargh. That was tracing.
There was a patchset floating around which actually implemented that clock choice for sched_clock as well. Don't know why that was never merged.
Thanks,
tglx
[ Removed the two emails that were bouncing ]
Quoted 10 lines · On Wed, 10 Jul 2019 21:06:57 +0200 (CEST) Thomas Gleixner <[email protected]>…
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
sched_clock_continuous()? (I know, horrible name), that simply keeps track of the time delta at suspend and returns:sched_clock() + delta;Which you get already when you do
# echo boot > /sys/kernel/debug/tracing/trace_clock
Quoted 7 lines
Quoted 2 lines
So basically the answer here is to change printk to use
ktime_get_boot_fast_ns()instead oflocal_clock()?Aargh. That was tracing.
There was a patchset floating around which actually implemented that clock choice for
sched_clockas well. Don't know why that was never merged.
Will it cause issues with the scheduler though. If it doesn't stop during suspend, can't that make the scheduler think that processes were using the CPU during the entire suspend and screw up the accounting?
-- Steve
Quoted 19 lines · Steven Rostedt
[ Removed the two emails that were bouncing ]
Quoted 13 lines · On Wed, 10 Jul 2019 21:06:57 +0200 (CEST) Thomas Gleixner <[email protected]>…
Quoted 12 lines
Quoted 9 lines
Quoted 4 lines
sched_clock_continuous()? (I know, horrible name), that simply keeps track of the time delta at suspend and returns:sched_clock() + delta;Which you get already when you do
# echo boot > /sys/kernel/debug/tracing/trace_clockSo basically the answer here is to change printk to use
ktime_get_boot_fast_ns()instead oflocal_clock()?
Quoted 8 lines
Quoted 4 lines
Aargh. That was tracing.
There was a patchset floating around which actually implemented that clock choice for
sched_clockas well. Don't know why that was never merged.Will it cause issues with the scheduler though. If it doesn't stop during suspend, can't that make the scheduler think that processes were using the CPU during the entire suspend and screw up the accounting?
Duh. My brain is not working.
Not sched_clock, the patches were for printk so you could select a printk clock. Can't find them right now.
Thanks,
tglx
Quoted 25 lines · Thomas Gleixner
Quoted 24 lines · Steven Rostedt
[ Removed the two emails that were bouncing ]
Quoted 17 lines · On Wed, 10 Jul 2019 21:06:57 +0200 (CEST) Thomas Gleixner <[email protected]>…
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
sched_clock_continuous()? (I know, horrible name), that simply keeps track of the time delta at suspend and returns:sched_clock() + delta;Quoted 7 lines
Quoted 4 lines
Which you get already when you do
# echo boot > /sys/kernel/debug/tracing/trace_clockSo basically the answer here is to change printk to use
ktime_get_boot_fast_ns()instead oflocal_clock()?Aargh. That was tracing.
There was a patchset floating around which actually implemented that clock choice for
sched_clockas well. Don't know why that was never merged.
Quoted 8 lines
Quoted 3 lines
Will it cause issues with the scheduler though. If it doesn't stop during suspend, can't that make the scheduler think that processes were using the CPU during the entire suspend and screw up the accounting?
Duh. My brain is not working.
Not
sched_clock, the patches were for printk so you could select a printk clock. Can't find them right now.
Ah, we actually tried to merge them. Here is the full story:
https://lore.kernel.org/lkml/alpine.DEB.2.20.1711131023170.1851@nanos/
Thanks,
tglx