lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4569EF9D.7010802@saville.com>
Date:	Sun, 26 Nov 2006 11:48:45 -0800
From:	Wink Saville <wink@...ille.com>
To:	Arjan van de Ven <arjan@...radead.org>
CC:	Robert Hancock <hancockr@...w.ca>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [patch] x86: unify/rewrite SMP TSC sync code

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@...kc2d1:~/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


Download attachment "rdtsc-pref.tgz" of type "application/octet-stream" (9522 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ