lkml.org 
[lkml]   [2009]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Subject[PATCH RFC] Extending pvclock down to usermode for vsyscall
    Date
    This series implements the vread method for the clocksource, which allows
    it to be used directly from usermode via vsyscall.

    Most of the work is in the generic pvclock code, with a bit of
    hypervisor-specific code to set things up. Specifically, it sets up a
    page which is an array of pvclock_vcpu_time_info structures indexed by
    vcpu number. The usermode code gets the current (v)cpu via vgetcpu,
    gets the appropriate time info and computes system time from the tsc.
    After doing all that it rechecks the version number to make things
    happened consistently. The kernel also installs a preempt notifier to
    bump the version number so that usermode can tell it has had its cpu
    context switched under it.

    I've included the Xen implementation, but it should be simple to implement
    for KVM (especially since it already has the feature I had to add to
    Xen to implement this: the ability to place the pvclock_vcpu_time_info
    structure at an arbitrary address).

    With this in place, I can do a gettimeofday in about 100ns on a 2.4GHz
    Q6600. I'm sure this could be tuned a bit more, but it is already much
    better than a syscall.

    (There's also a couple of other little generic pvclock fixes I'll send
    separately.)

    Thanks,
    J

    arch/x86/Kconfig | 4 +
    arch/x86/include/asm/fixmap.h | 21 +++++
    arch/x86/include/asm/pvclock.h | 6 +
    arch/x86/include/asm/vsyscall.h | 3
    arch/x86/kernel/Makefile | 2
    arch/x86/kernel/pvclock.c | 156 ++++++++++++++++++++++++++++++++++++----
    arch/x86/xen/Kconfig | 6 +
    arch/x86/xen/mmu.c | 3
    arch/x86/xen/smp.c | 2
    arch/x86/xen/time.c | 52 +++++++++++++
    arch/x86/xen/xen-ops.h | 8 ++
    include/xen/interface/vcpu.h | 41 ++++++++++
    12 files changed, 291 insertions(+), 13 deletions(-)



    \
     
     \ /
      Last update: 2009-10-06 02:57    [W:4.100 / U:0.244 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site