From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [patch 08/16] KVM: x86: introduce facility to support vsyscall pvclock, via MSR Date: Thu, 1 Nov 2012 19:39:24 -0200 Message-ID: <20121101213924.GB19712@amt.cnet> References: <20121031224656.417434866@redhat.com> <20121031224824.199331603@redhat.com> <5092870F.5010805@parallels.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, johnstul@us.ibm.com, jeremy@goop.org, zamsden@gmail.com, gleb@redhat.com, avi@redhat.com, pbonzini@redhat.com To: Glauber Costa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:41263 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759573Ab2KAWmM (ORCPT ); Thu, 1 Nov 2012 18:42:12 -0400 Content-Disposition: inline In-Reply-To: <5092870F.5010805@parallels.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Nov 01, 2012 at 06:28:31PM +0400, Glauber Costa wrote: > On 11/01/2012 02:47 AM, Marcelo Tosatti wrote: > > Allow a guest to register a second location for the VCPU time info > > > > structure for each vcpu (as described by MSR_KVM_SYSTEM_TIME_NEW). > > This is intended to allow the guest kernel to map this information > > into a usermode accessible page, so that usermode can efficiently > > calculate system time from the TSC without having to make a syscall. > > > > Signed-off-by: Marcelo Tosatti > > > > Changelog doesn't make a lot of sense. (specially from first line to the > second). Please add in here the reasons why we can't (or decided not to) > use the same page. The info in the last mail thread is good enough, just > put it here. Fixed. > > Index: vsyscall/arch/x86/include/asm/kvm_para.h > > =================================================================== > > --- vsyscall.orig/arch/x86/include/asm/kvm_para.h > > +++ vsyscall/arch/x86/include/asm/kvm_para.h > > @@ -23,6 +23,7 @@ > > #define KVM_FEATURE_ASYNC_PF 4 > > #define KVM_FEATURE_STEAL_TIME 5 > > #define KVM_FEATURE_PV_EOI 6 > > +#define KVM_FEATURE_USERSPACE_CLOCKSOURCE 7 > > > > /* The last 8 bits are used to indicate how to interpret the flags field > > * in pvclock structure. If no bits are set, all flags are ignored. > > @@ -39,6 +40,7 @@ > > #define MSR_KVM_ASYNC_PF_EN 0x4b564d02 > > #define MSR_KVM_STEAL_TIME 0x4b564d03 > > #define MSR_KVM_PV_EOI_EN 0x4b564d04 > > +#define MSR_KVM_USERSPACE_TIME 0x4b564d05 > > > > I accept that it is possible that we may be better off with the page > mapped twice. > > But why do we need an extra MSR? When, and why, would you enable the > kernel-based pvclock, but disabled the userspace pvclock? Because there is no stable TSC available, for example (which cannot be used to measure passage of time). > I believe only the existing MSRs should be used for this. If you write > to it, and the host is capable of exporting userspace pvclock > information, then it does. If it isn't, then it doesn't. > > No reason for the extra setup that is only likely to bring more headache. It is necessary.