public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wink Saville <wink@saville.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Robert Hancock <hancockr@shaw.ca>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [patch] x86: unify/rewrite SMP TSC sync code
Date: Sun, 26 Nov 2006 11:48:45 -0800	[thread overview]
Message-ID: <4569EF9D.7010802@saville.com> (raw)
In-Reply-To: <1164529484.3147.68.camel@laptopd505.fenrus.org>

[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]

Arjan van de Ven wrote:
> it's the cost of a syscall (1000 cycles?) plus what it takes to get a
> reasonable time estimate. Assuming your kernel has enough time support
> AND your tsc is reasonably ok, it'll be using that. If it's NOT using
> that then that's a pretty good sign that you can't also use it in
> userspace....
> 

I wrote a quick and dirty program that I've attached to test the cost
difference between RDTSC and gettimeofday (gtod), the results:

wink@winkc2d1:~/linux/linux-2.6/test/rdtsc-pref$ time ./rdtsc-pref 100000000
rdtsc:   average ticks=  65
gtod:    average ticks= 222
gtod_us: average ticks= 232

real    0m36.002s
user    0m35.997s
sys     0m0.000s

About a 3.5x cost difference, still for most of my uses gtod was not as costly
as I had supposed.

But, there are other uses that it wouldn't be acceptable. For instance, I
have used a memory mapped time stamp counter in an embedded ARM based
system for instrumenting the interrupt service routine, syscalls
and task switches. For this type of instrumentation a gtod type call wouldn't
have been suitable.

Anyway for x86_64 systems, if I can use a memory mapped HPET counter, I might be
able to have my cake and eat it too. One counter that can be used inside and
outside the kernel that is cheap, precise and accurate, nirvana! We'll have to see.

BTW my system is a 2.4ghz Core 2 duo running 2.6.19-rc6 with HPET enabled,
in the attachment I've included my config file.

Cheers,

Wink


[-- Attachment #2: rdtsc-pref.tgz --]
[-- Type: application/octet-stream, Size: 9522 bytes --]

  reply	other threads:[~2006-11-26 19:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa./NRPJg+JjfSQLUVwnX1GpHGIojQ@ifi.uio.no>
     [not found] ` <fa.Y0RKABHd+7qnbGQYBAGPvlJ0Qic@ifi.uio.no>
     [not found]   ` <fa.fD3WSpNqEJ4736vYzEak5Gf3xTw@ifi.uio.no>
     [not found]     ` <fa.A+gkQAO1DLThaxJxPLPl3yE1CGo@ifi.uio.no>
     [not found]       ` <fa.INurNKWdUKAEULTHyfpSW65a/Ng@ifi.uio.no>
     [not found]         ` <fa.n9vySiI9RS2MCl0DZPDzxZEPiFw@ifi.uio.no>
2006-11-26  7:20           ` [patch] x86: unify/rewrite SMP TSC sync code Robert Hancock
2006-11-26  8:16             ` Wink Saville
2006-11-26  8:24               ` Arjan van de Ven
2006-11-26 19:48                 ` Wink Saville [this message]
2006-11-27  7:51                   ` Arjan van de Ven
2006-11-27  9:15                     ` Wink Saville
2006-11-27 17:23 Robert Crocombe
2006-11-27 18:41 ` Max Krasnyansky
  -- strict thread matches above, loose matches on Subject: below --
2006-11-24 17:02 Ingo Molnar
2006-11-24 17:13 ` Andi Kleen
2006-11-24 20:25   ` Ingo Molnar
2006-11-24 20:37     ` Andi Kleen
2006-11-24 20:46       ` Ingo Molnar
2006-11-24 21:06         ` Andi Kleen
2006-11-24 22:48     ` Ben Greear
2006-11-25  2:56     ` Wink Saville
2006-11-25  8:30       ` Arjan van de Ven
2006-11-25 16:58         ` Wink Saville
2006-11-25 17:41           ` Arjan van de Ven
2006-11-25 20:34             ` Wink Saville
2006-11-27 19:00   ` Christoph Lameter
2006-11-29  7:13 ` Ingo Molnar

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=4569EF9D.7010802@saville.com \
    --to=wink@saville.com \
    --cc=arjan@infradead.org \
    --cc=hancockr@shaw.ca \
    --cc=linux-kernel@vger.kernel.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