From: Carlos O'Donell <carlos@baldric.uwo.ca>
To: Richard Hirst <rhirst@linuxcare.com>
Cc: Matthew Wilcox <willy@debian.org>,
Grant Grundler <grundler@parisc-linux.org>,
parisc-linux@parisc-linux.org
Subject: Re: [parisc-linux] Generic light-weight syscall.
Date: Tue, 29 Jul 2003 13:50:58 -0400 [thread overview]
Message-ID: <20030729175057.GA17107@systemhalted> (raw)
In-Reply-To: <20030728211012.GC6706@sleepie.demon.co.uk>
> > We discussed this in the Black Thorn ... record what value you last
> > returned to the user and never return less than that.
>
> Not very nice if the difference between CPUs is significant. You could
> find yourself checking time on CPU A, doing some work, getting moved to
> CPU B, checking time, and finding you apparently did all that in 0ns.
Willy and myself talked about this, you just return 1ns in the case
where you know that _something_ must have taken _some_ amount of time
(e.g. the insns that make up fast gettimeofday) so you couldn't have done
it in zero time :)
I also just noticed (thanks to jejb) that cr16 is readable from
userspace since we leave PSW-S cleared. So the following works:
unsigned long cr16;
asm("mfctl %%cr16, %0" : "=r" (cr16) : );
printf("cr16=%lu\n",cr16);
---
carlos@firin:~$ ./test_cr16_read
cr16=3544734914
carlos@firin:~$ ./test_cr16_read
cr16=4230470557
carlos@firin:~$ ./test_cr16_read
cr16=2337868642
carlos@firin:~$
---
It overlaps pretty fast though. Userspace could do the translation and
hold on to a 'last_tick' value and then return a really small value if
we get scheduled onto a negatively-drifted CPU? Do all CPU's update cr16?
Willy, I just realized that the following trail of function calls
doesn't really work under smp:
glibc ->
gettimeofday ->
syscall + syscall table lookup ->
sys32_gettimeofday ->
do_gettimeofday ->
gettimeoffset ( returns 0 in smp)
With the comment I don't quite understand:
linux-2.4/arch/parisc/kernel/time.c
/*
* FIXME: This won't work on smp because jiffies are updated by cpu
* 0.
* Once parisc-linux learns the cr16 difference between
* processors,
* this could be made to work.
*/
Does that mean that our time granularity drops drastically in the SMP
case? We loose usec! (2.4 and 2.5 kernels)
c.
next prev parent reply other threads:[~2003-07-29 17:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-25 6:37 [parisc-linux] Generic light-weight syscall Carlos O'Donell
2003-07-25 11:37 ` Matthew Wilcox
2003-07-26 17:48 ` Carlos O'Donell
2003-07-26 18:00 ` Carlos O'Donell
2003-07-27 12:27 ` Grant Grundler
2003-07-28 15:57 ` Carlos O'Donell
2003-07-28 17:45 ` Matthew Wilcox
2003-07-28 19:04 ` Carlos O'Donell
2003-07-28 19:14 ` Matthew Wilcox
2003-07-28 21:10 ` Richard Hirst
2003-07-29 17:50 ` Carlos O'Donell [this message]
2003-07-29 18:55 ` Grant Grundler
2003-07-29 21:06 ` Richard Hirst
2003-07-29 23:36 ` Carlos O'Donell
2003-07-30 16:37 ` Thibaut VARENE
2003-07-29 23:38 ` Carlos O'Donell
2003-07-29 18:51 ` Grant Grundler
2003-07-27 20:43 ` Michael S.Zick
2003-07-28 20:30 ` Randolph Chung
2003-07-28 20:37 ` Matthew Wilcox
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=20030729175057.GA17107@systemhalted \
--to=carlos@baldric.uwo.ca \
--cc=grundler@parisc-linux.org \
--cc=parisc-linux@parisc-linux.org \
--cc=rhirst@linuxcare.com \
--cc=willy@debian.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