All of lore.kernel.org
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Ingo Oeser <ioe-lkml@rameria.de>
Cc: Tomas Janousek <tjanouse@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, tsmetana@redhat.com,
	riel@redhat.com
Subject: Re: [PATCH] Introduce boot based time
Date: Thu, 10 May 2007 13:02:56 -0700	[thread overview]
Message-ID: <1178827376.6011.11.camel@localhost.localdomain> (raw)
In-Reply-To: <200705102149.01714.ioe-lkml@rameria.de>

On Thu, 2007-05-10 at 21:48 +0200, Ingo Oeser wrote:
> Hi Tomas,
> 
> On Thursday 10 May 2007, Tomas Janousek wrote:
> > diff --git a/include/linux/time.h b/include/linux/time.h
> > index 8997b61..06f3eaf 100644
> > --- a/include/linux/time.h
> > +++ b/include/linux/time.h
> > @@ -116,6 +116,8 @@ extern int do_setitimer(int which, struct itimerval *value,
> >  extern unsigned int alarm_setitimer(unsigned int seconds);
> >  extern int do_getitimer(int which, struct itimerval *value);
> >  extern void getnstimeofday(struct timespec *tv);
> > +extern void getboottime(struct timespec *ts);
> > +extern void monotonic_to_bootbased(struct timespec *ts);
> >  
> >  extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
> >  extern int timekeeping_is_continuous(void);
> > diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> > index f9217bf..dd9647a 100644
> > --- a/kernel/time/timekeeping.c
> > +++ b/kernel/time/timekeeping.c
> > @@ -36,9 +36,17 @@ EXPORT_SYMBOL(xtime_lock);
> >   * at zero at system boot time, so wall_to_monotonic will be negative,
> >   * however, we will ALWAYS keep the tv_nsec part positive so we can use
> >   * the usual normalization.
> > + *
> > + * wall_to_monotonic is moved after resume from suspend for the monotonic
> > + * time not to jump. We need to add total_sleep_time to wall_to_monotonic
> > + * to get the real boot based time offset.
> > + *
> > + * - wall_to_monotonic is no longer the boot time, getboottime must be
> > + * used instead.
> >   */
> >  struct timespec xtime __attribute__ ((aligned (16)));
> >  struct timespec wall_to_monotonic __attribute__ ((aligned (16)));
> > +static unsigned long total_sleep_time;
> 
> Could you make that a ktime_t (or struct ktime)?
> There are machines, which sleep more than they are awake. 
> Just imagine a surveillance camera triggered by door entrance.
> 
> Yes, these things might run Linux (e.g. on "cris" architecture).
> 
> Or your VCR.
> Yes, these devices might sleep more than they are awake, 
> if you are not a TV junkie :-)

I'm not sure I follow this. 

total_sleep_time stores seconds. So on 32bit systems that's 130some
years, so it shouldn't be an issue.

Is the reason you want it to be a ktime is because you want a way to
keep sub-second sleep granularity?

thanks
-john


  parent reply	other threads:[~2007-05-10 20:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-03 15:03 Broken process startup times after suspend (regression) Tomas Janousek
2007-05-03 19:59 ` john stultz
2007-05-04 16:13   ` Tomas Janousek
2007-05-04 18:18     ` john stultz
2007-05-04 19:09       ` Tomas Janousek
2007-05-10 17:10       ` [PATCH] Introduce boot based time Tomas Janousek
2007-05-10 17:10         ` [PATCH] Use boot based time for process start time and boot time in /proc Tomas Janousek
2007-05-10 18:44           ` john stultz
2007-05-10 23:40           ` Andrew Morton
2007-05-11  8:45             ` Tomas Janousek
2007-05-11 19:51               ` Andrew Morton
2007-05-11 23:37                 ` Tomas Janousek
2007-05-11  8:46             ` Tomas Janousek
2007-05-10 17:10         ` [PATCH] Use boot based time for uptime " Tomas Janousek
2007-05-10 18:47           ` john stultz
2007-05-10 18:42         ` [PATCH] Introduce boot based time john stultz
2007-05-10 19:48         ` Ingo Oeser
2007-05-10 20:00           ` Tomas Janousek
2007-05-10 20:02           ` john stultz [this message]
2007-05-10 22:22             ` Ingo Oeser
2007-05-10 23:40         ` Andrew Morton

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=1178827376.6011.11.camel@localhost.localdomain \
    --to=johnstul@us.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=ioe-lkml@rameria.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@redhat.com \
    --cc=tjanouse@redhat.com \
    --cc=tsmetana@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.