Re: sched_clock and device suspend/resume
From: Thomas Gleixner
Date: Wed Jul 10 2019 - 15:22:53 EST
On Wed, 10 Jul 2019, Thomas Gleixner wrote:
> On Wed, 10 Jul 2019, Steven Rostedt wrote:
> >
> > [ Removed the two emails that were bouncing ]
> >
> > On Wed, 10 Jul 2019 21:06:57 +0200 (CEST)
> > Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> >
> > > > > > 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()?
> > >
> > > 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.
> >
> > 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