From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 14/21] MIPS: KVM: Add nanosecond count bias KVM register Date: Mon, 28 Apr 2014 14:01:20 +0200 Message-ID: <535E4310.10308@redhat.com> References: <1398439204-26171-1-git-send-email-james.hogan@imgtec.com> <1398439204-26171-15-git-send-email-james.hogan@imgtec.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: Gleb Natapov , kvm@vger.kernel.org, Ralf Baechle , linux-mips@linux-mips.org, David Daney , Sanjay Lal To: James Hogan Return-path: Received: from mx1.redhat.com ([209.132.183.28]:38391 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754408AbaD1Mhs (ORCPT ); Mon, 28 Apr 2014 08:37:48 -0400 In-Reply-To: <1398439204-26171-15-git-send-email-james.hogan@imgtec.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 25/04/2014 17:19, James Hogan ha scritto: > Expose the KVM guest CP0_Count bias (from the monotonic kernel time) to > userland in nanosecond units via a new KVM_REG_MIPS_COUNT_BIAS register > accessible with the KVM_{GET,SET}_ONE_REG ioctls. This gives userland > control of the bias so that it can exactly match its own monotonic time. > > The nanosecond bias is stored separately from the raw bias used > internally (since nanoseconds isn't a convenient or efficient unit for > various timer calculations), and is recalculated each time the raw count > bias is altered. The raw count bias used in CP0_Count determination is > recalculated when the nanosecond bias is altered via the KVM_SET_ONE_REG > ioctl. > > Signed-off-by: James Hogan > Cc: Paolo Bonzini > Cc: Gleb Natapov > Cc: kvm@vger.kernel.org > Cc: Ralf Baechle > Cc: linux-mips@linux-mips.org > Cc: David Daney > Cc: Sanjay Lal If it is possible and not too hairy to use a raw value in userspace (together with KVM_REG_MIPS_COUNT_HZ), please do it---my suggestions were just that, a suggestion. Otherwise, the patch looks good. Paolo