linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] Extending pvclock down to usermode for vsyscall
@ 2009-10-06  0:50 Jeremy Fitzhardinge
  2009-10-06  0:50 ` [PATCH 1/5] x86/pvclock: make sure rdtsc doesn't speculate out of region Jeremy Fitzhardinge
                   ` (4 more replies)
  0 siblings, 5 replies; 59+ messages in thread
From: Jeremy Fitzhardinge @ 2009-10-06  0:50 UTC (permalink / raw)
  To: Xen-devel
  Cc: Linux Kernel Mailing List, kurt.hackel, Dan Magenheimer,
	Keir Fraser, Glauber de Oliveira Costa, Avi Kivity, Zach Brown,
	the arch/x86 maintainers, Chris Mason

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(-)


^ permalink raw reply	[flat|nested] 59+ messages in thread

end of thread, other threads:[~2009-11-05 15:18 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-06  0:50 [PATCH RFC] Extending pvclock down to usermode for vsyscall Jeremy Fitzhardinge
2009-10-06  0:50 ` [PATCH 1/5] x86/pvclock: make sure rdtsc doesn't speculate out of region Jeremy Fitzhardinge
2009-10-06  0:50 ` [PATCH 2/5] x86/pvclock: no need to use strong read barriers in pvclock_get_time_values Jeremy Fitzhardinge
2009-10-06  0:50 ` [PATCH 3/5] x86/pvclock: add vsyscall implementation Jeremy Fitzhardinge
2009-10-06  9:04   ` Avi Kivity
2009-10-06 14:19     ` Dan Magenheimer
2009-10-06 15:11       ` Avi Kivity
2009-10-06 18:46     ` [Xen-devel] " Jeremy Fitzhardinge
2009-10-07 10:25       ` Avi Kivity
2009-10-07 19:29         ` Jeremy Fitzhardinge
2009-10-07 20:09           ` Avi Kivity
2009-10-07 21:19             ` Jeremy Fitzhardinge
2009-10-07 21:37               ` Avi Kivity
2009-10-07 21:51                 ` Jeremy Fitzhardinge
2009-10-07 21:53                   ` Avi Kivity
2009-10-07 20:48         ` Dan Magenheimer
2009-10-07 21:08           ` Avi Kivity
2009-10-07 22:36             ` Dan Magenheimer
2009-10-10  0:24         ` Jeremy Fitzhardinge
2009-10-10 18:10           ` Avi Kivity
2009-10-12 18:20             ` Jeremy Fitzhardinge
2009-10-12 18:29               ` Avi Kivity
2009-10-12 19:13                 ` Jeremy Fitzhardinge
2009-10-13  6:39                   ` Avi Kivity
2009-10-13 20:00                     ` Jeremy Fitzhardinge
2009-10-14 12:32                       ` Avi Kivity
2009-10-15 19:17                         ` Jeremy Fitzhardinge
2009-10-27 17:29                         ` Dan Magenheimer
2009-10-27 18:20                           ` Jeremy Fitzhardinge
2009-10-28  5:52                             ` Avi Kivity
2009-10-28  9:29                               ` Glauber Costa
2009-10-28  9:34                                 ` Avi Kivity
2009-10-28 17:47                                   ` Jeremy Fitzhardinge
2009-10-29 12:13                                     ` Avi Kivity
2009-10-29 13:03                                       ` Chris Mason
2009-10-29 14:46                                       ` Dan Magenheimer
2009-10-29 15:07                                         ` Avi Kivity
2009-10-29 15:55                                           ` Dan Magenheimer
2009-10-29 16:15                                             ` Dan Magenheimer
2009-11-01  9:28                                               ` Avi Kivity
2009-11-02 15:28                                                 ` Dan Magenheimer
2009-11-02 15:41                                                   ` Avi Kivity
2009-11-01  9:32                                             ` Avi Kivity
2009-11-02 15:46                                               ` Dan Magenheimer
2009-11-03  5:12                                                 ` Avi Kivity
2009-11-04 20:30                                                   ` Dan Magenheimer
2009-11-05  6:47                                                     ` Avi Kivity
2009-11-05 14:52                                                       ` Dan Magenheimer
2009-11-05 15:07                                                         ` Keir Fraser
2009-11-04 21:19                                           ` john stultz
2009-11-04 21:28                                             ` Dan Magenheimer
2009-11-05  0:02                                               ` john stultz
2009-11-05  0:45                                                 ` Dan Magenheimer
2009-10-06  0:50 ` [PATCH 4/5] x86/fixmap: add a predicate for usermode fixmaps Jeremy Fitzhardinge
2009-10-06 10:23   ` [Xen-devel] " Jan Beulich
2009-10-06 18:47     ` Jeremy Fitzhardinge
2009-10-06  0:50 ` [PATCH 5/5] xen/time: add pvclock_clocksource_vread support Jeremy Fitzhardinge
2009-10-06 10:28   ` [Xen-devel] " Jan Beulich
2009-10-06 18:48     ` Jeremy Fitzhardinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).