[go: up one dir, main page]

|
|
Log in / Subscribe / Register

Implementing virtual system calls

Implementing virtual system calls

Posted Oct 16, 2014 16:03 UTC (Thu) by ntl (subscriber, #40518)
Parent article: Implementing virtual system calls

Some info worth adding here...

vDSO implementations of the APIs for sampling high resolution timestamps (gettimeofday and clock_gettime w/CLOCK_REALTIME, CLOCK_MONOTONIC) depend on user space access to a high resolution counter (e.g. TSC). This is used to calculate the time elapsed since the last time the kernel updated the data page, and mirrors what the kernel does internally to service system calls.

You wouldn't want to have a situation where

syscall(SYS_gettimeofday, ...); /* serviced by kernel */
gettimeofday(...);              /* serviced by vDSO */

returns timestamps that aren't monotonically increasing (leaving aside system time adjustments).


to post comments

Implementing virtual system calls

Posted Oct 17, 2014 5:04 UTC (Fri) by kjp (guest, #39639) [Link] (1 responses)

I was just going to ask that. jiffies is obviously not high resolution enough for gettimeofday. can multiple cpus still cause issues with rdtsc? or is the monotonic guarantee single cpu only?

TSC and multiple CPUs

Posted Oct 17, 2014 15:49 UTC (Fri) by ntl (subscriber, #40518) [Link]

I think some older CPUs have issues with TSC sync, which the kernel detects and works around by using a different clocksource like HPET (and the vDSO on x86 has different routines for different clocksources).


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds