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-next>] [day] [month] [year] [list]
Date:	Mon,  5 Oct 2009 17:50:06 -0700
From:	Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
To:	Xen-devel <xen-devel@...ts.xensource.com>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	kurt.hackel@...cle.com,
	Dan Magenheimer <dan.magenheimer@...cle.com>,
	Keir Fraser <keir.fraser@...citrix.com>,
	Glauber de Oliveira Costa <gcosta@...hat.com>,
	Avi Kivity <avi@...hat.com>,
	Zach Brown <zach.brown@...cle.com>,
	the arch/x86 maintainers <x86@...nel.org>,
	Chris Mason <chris.mason@...cle.com>
Subject: [PATCH RFC] Extending pvclock down to usermode for vsyscall

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ