public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Albert Cahalan <albert@users.sf.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Arjan van de Ven <arjanv@redhat.com>,
	Albert Cahalan <albert@users.sourceforge.net>,
	linux-kernel mailing list <linux-kernel@vger.kernel.org>,
	george@galis.org
Subject: Re: SATA_SIL works with 2.6.7-bk8 seagate drive, but oops
Date: 26 Jun 2004 13:17:08 -0400	[thread overview]
Message-ID: <1088270227.8188.1465.camel@cube> (raw)
In-Reply-To: <Pine.LNX.4.58.0406260855080.14449@ppc970.osdl.org>

On Sat, 2004-06-26 at 12:00, Linus Torvalds wrote:
> On Sat, 26 Jun 2004, Arjan van de Ven wrote:
> > 
> > well.... this value is *passed to userspace* via the AT_ attributes ....
> > glibc probably nicely exports this info via sysconf(). I guess/hope your
> > tools are now using that ?
> 
> Even then, it's a bug in my opinion. Yes, procps should be able to just 
> use sysconf(_SC_CLK_TCK), but the fact is, using CLK_TCK and HZ is 
> traditional unix behaviour, and we should just support it.

It's not working right now, likely due to non-integer HZ.
Here's a bug report.......


Even with the 2.6.7 kernel, I'm still getting reports of process
start times wandering. Here is an example:

   "About 12 hours since reboot to 2.6.7 there was already a
   difference of about 7 seconds between the real start time
   and the start time reported by ps. Now, 24 hours since reboot
   the difference is 10 seconds."

The calculation used is:

   now - uptime + process_run_time

The code shown below works great on a 2.4.xx or earlier kernel.
It generally relys on USER_HZ, which is supposedly in our ABI.

I have a feeling we'll forever be chasing bugs related to not
using a PLL to drive the clock tick at exactly HZ ticks per second.
Perhaps the DragonflyBSD code could be stolen. Anyway, the code:

///////////////////////////////////////////////////////////////////////////
unsigned long seconds_since_1970 = time(NULL);
unsigned long seconds_since_boot = uptime(0,0);
unsigned long time_of_boot       = seconds_since_1970 - seconds_since_boot;
int pr_stime(char *restrict const outbuf, const proc_t *restrict const pp){
  struct tm *proc_time;
  struct tm *our_time;
  time_t t;
  const char *fmt;
  int tm_year;
  int tm_yday;
  our_time = localtime(&seconds_since_1970);   /* not reentrant */
  tm_year = our_time->tm_year;
  tm_yday = our_time->tm_yday;
  t = time_of_boot + pp->start_time / Hertz;
  proc_time = localtime(&t); /* not reentrant, this corrupts our_time */
  fmt = "%H:%M";                                   /* 03:02 23:59 */
  if(tm_yday != proc_time->tm_yday) fmt = "%b%d";  /* Jun06 Aug27 */
  if(tm_year != proc_time->tm_year) fmt = "%Y";    /* 1991 2001 */
  return strftime(outbuf, 42, fmt, proc_time);
}
///////////////////////////////////////////////////////////////////////////



  parent reply	other threads:[~2004-06-26 19:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-26 12:37 SATA_SIL works with 2.6.7-bk8 seagate drive, but oops Albert Cahalan
2004-06-26 15:12 ` Arjan van de Ven
2004-06-26 16:00   ` Linus Torvalds
2004-06-26 16:14     ` Arjan van de Ven
2004-06-26 17:17     ` Albert Cahalan [this message]
2004-06-26 17:13   ` Albert Cahalan
2004-06-26 15:54 ` Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2004-06-24 15:59 SATA_SIL fails with 2.6.7-bk6 seagate drive George Georgalis
2004-06-24 18:46 ` Ricky Beam
2004-06-25 21:34   ` SATA_SIL works with 2.6.7-bk8 seagate drive, but oops George Georgalis
2004-06-25 23:16     ` Linus Torvalds
2004-06-28  2:12       ` George Georgalis
2004-06-29  8:46     ` Sebastian Slota
2004-06-30  4:43       ` George Georgalis
2004-06-30  6:16         ` Jeff Garzik
2004-07-02 23:01           ` George Georgalis

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=1088270227.8188.1465.camel@cube \
    --to=albert@users.sf.net \
    --cc=albert@users.sourceforge.net \
    --cc=arjanv@redhat.com \
    --cc=george@galis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox