Re: [PATCH 14/21] MIPS: KVM: Add nanosecond count bias KVM register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/25/2014 08:19 AM, James Hogan wrote:
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.


Is this really necessary?

The architecture has CP0_COUNT. How does the concept of this noew synthetic bias value interact with the architecture's CP0_COUNT?

It seems like by adding this you new have two ways to access and manipulate the same thing.

1) The architecturally specified CP0_COUNT.
2) This new bias thing.

What if we just let userspace directly manipulate the CP0_COUNT, and if necessary only maintain a bias as an internal implementation detail?

David Daney.

Signed-off-by: James Hogan <james.hogan@xxxxxxxxxx>
Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Cc: Gleb Natapov <gleb@xxxxxxxxxx>
Cc: kvm@xxxxxxxxxxxxxxx
Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
Cc: linux-mips@xxxxxxxxxxxxxx
Cc: David Daney <david.daney@xxxxxxxxxx>
Cc: Sanjay Lal <sanjayl@xxxxxxxxxxx>
---
  arch/mips/include/asm/kvm_host.h |  3 +++
  arch/mips/include/uapi/asm/kvm.h |  9 ++++++++
  arch/mips/kvm/kvm_mips.c         |  3 +++
  arch/mips/kvm/kvm_mips_emul.c    | 46 ++++++++++++++++++++++++++++++++++++++++
  arch/mips/kvm/kvm_trap_emul.c    |  6 ++++++
  5 files changed, 67 insertions(+)




[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux