diff options
author | Glauber Costa <glommer@redhat.com> | 2009-10-16 15:28:36 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-12-03 02:32:19 -0500 |
commit | afbcf7ab8d1bc8c2d04792f6d9e786e0adeb328d (patch) | |
tree | 14320a1c768562139a550fd0c576d6d52829d9ec /Documentation/kvm/api.txt | |
parent | cd5a2685de4a642fd0bd763e8c19711ef08dbe27 (diff) |
KVM: allow userspace to adjust kvmclock offset
When we migrate a kvm guest that uses pvclock between two hosts, we may
suffer a large skew. This is because there can be significant differences
between the monotonic clock of the hosts involved. When a new host with
a much larger monotonic time starts running the guest, the view of time
will be significantly impacted.
Situation is much worse when we do the opposite, and migrate to a host with
a smaller monotonic clock.
This proposed ioctl will allow userspace to inform us what is the monotonic
clock value in the source host, so we can keep the time skew short, and
more importantly, never goes backwards. Userspace may also need to trigger
the current data, since from the first migration onwards, it won't be
reflected by a simple call to clock_gettime() anymore.
[marcelo: future-proof abi with a flags field]
[jan: fix KVM_GET_CLOCK by clearing flags field instead of checking it]
Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'Documentation/kvm/api.txt')
-rw-r--r-- | Documentation/kvm/api.txt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt index 3e8684e48506..36594ba57723 100644 --- a/Documentation/kvm/api.txt +++ b/Documentation/kvm/api.txt | |||
@@ -617,6 +617,42 @@ struct kvm_xen_hvm_config { | |||
617 | __u8 pad2[30]; | 617 | __u8 pad2[30]; |
618 | }; | 618 | }; |
619 | 619 | ||
620 | 4.27 KVM_GET_CLOCK | ||
621 | |||
622 | Capability: KVM_CAP_ADJUST_CLOCK | ||
623 | Architectures: x86 | ||
624 | Type: vm ioctl | ||
625 | Parameters: struct kvm_clock_data (out) | ||
626 | Returns: 0 on success, -1 on error | ||
627 | |||
628 | Gets the current timestamp of kvmclock as seen by the current guest. In | ||
629 | conjunction with KVM_SET_CLOCK, it is used to ensure monotonicity on scenarios | ||
630 | such as migration. | ||
631 | |||
632 | struct kvm_clock_data { | ||
633 | __u64 clock; /* kvmclock current value */ | ||
634 | __u32 flags; | ||
635 | __u32 pad[9]; | ||
636 | }; | ||
637 | |||
638 | 4.28 KVM_SET_CLOCK | ||
639 | |||
640 | Capability: KVM_CAP_ADJUST_CLOCK | ||
641 | Architectures: x86 | ||
642 | Type: vm ioctl | ||
643 | Parameters: struct kvm_clock_data (in) | ||
644 | Returns: 0 on success, -1 on error | ||
645 | |||
646 | Sets the current timestamp of kvmclock to the valued specific in its parameter. | ||
647 | In conjunction with KVM_GET_CLOCK, it is used to ensure monotonicity on scenarios | ||
648 | such as migration. | ||
649 | |||
650 | struct kvm_clock_data { | ||
651 | __u64 clock; /* kvmclock current value */ | ||
652 | __u32 flags; | ||
653 | __u32 pad[9]; | ||
654 | }; | ||
655 | |||
620 | 5. The kvm_run structure | 656 | 5. The kvm_run structure |
621 | 657 | ||
622 | Application code obtains a pointer to the kvm_run structure by | 658 | Application code obtains a pointer to the kvm_run structure by |