From: Hikaru Nishida <hikalium@chromium.org>
To: linux-kernel@vger.kernel.org, dme@dme.org, tglx@linutronix.de,
mlevitsk@redhat.com, linux@roeck-us.net, pbonzini@redhat.com,
vkuznets@redhat.com, maz@kernel.org, will@kernel.org
Cc: suleiman@google.com, senozhatsky@google.com,
kvmarm@lists.cs.columbia.edu,
linux-arm-kernel@lists.infradead.org,
Hikaru Nishida <hikalium@chromium.org>,
Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
Ingo Molnar <mingo@redhat.com>, Jim Mattson <jmattson@google.com>,
Joerg Roedel <joro@8bytes.org>, Jonathan Corbet <corbet@lwn.net>,
Sean Christopherson <seanjc@google.com>,
Wanpeng Li <wanpengli@tencent.com>,
kvm@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org
Subject: [RFC PATCH v3 3/5] kvm/x86: virtual suspend time injection: Add common definitions
Date: Wed, 20 Oct 2021 21:04:28 +0900 [thread overview]
Message-ID: <20211020210348.RFC.v3.3.I6e8f979820f45e38370aa19180a33a8c046d0fa9@changeid> (raw)
In-Reply-To: <20211020120431.776494-1-hikalium@chromium.org>
Add definitions of MSR, KVM_FEATURE bit and a structure called
kvm_suspend_time that are used by later patches to support the
virtual suspend time injection mechanism.
Also add documentations for them.
Signed-off-by: Hikaru Nishida <hikalium@chromium.org>
---
Changes in v3:
- Moved the definition of struct kvm_suspend_time into this patch.
Documentation/virt/kvm/cpuid.rst | 3 +++
Documentation/virt/kvm/msr.rst | 30 ++++++++++++++++++++++++++++
arch/x86/include/uapi/asm/kvm_para.h | 6 ++++++
3 files changed, 39 insertions(+)
diff --git a/Documentation/virt/kvm/cpuid.rst b/Documentation/virt/kvm/cpuid.rst
index bda3e3e737d7..f17b95b0d943 100644
--- a/Documentation/virt/kvm/cpuid.rst
+++ b/Documentation/virt/kvm/cpuid.rst
@@ -103,6 +103,9 @@ KVM_FEATURE_HC_MAP_GPA_RANGE 16 guest checks this feature bit bef
KVM_FEATURE_MIGRATION_CONTROL 17 guest checks this feature bit before
using MSR_KVM_MIGRATION_CONTROL
+KVM_FEATURE_HOST_SUSPEND_TIME 18 host suspend time information
+ is available at msr 0x4b564d09.
+
KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24 host will warn if no guest-side
per-cpu warps are expected in
kvmclock
diff --git a/Documentation/virt/kvm/msr.rst b/Documentation/virt/kvm/msr.rst
index 9315fc385fb0..40ec0fd263ac 100644
--- a/Documentation/virt/kvm/msr.rst
+++ b/Documentation/virt/kvm/msr.rst
@@ -389,3 +389,33 @@ data:
guest is communicating page encryption status to the host using the
``KVM_HC_MAP_GPA_RANGE`` hypercall, it can set bit 0 in this MSR to
allow live migration of the guest.
+
+MSR_KVM_HOST_SUSPEND_TIME:
+ 0x4b564d09
+
+data:
+ 8-byte alignment physical address of a memory area which must be
+ in guest RAM, plus an enable bit in bit 0. This memory is expected to
+ hold a copy of the following structure::
+
+ struct kvm_suspend_time {
+ __u64 suspend_time_ns;
+ };
+
+ whose data will be filled in by the hypervisor.
+ If the guest register this structure through the MSR write, the host
+ will stop all the clocks visible to the guest (including TSCs) during
+ the host's suspension and report the duration of suspend through this
+ structure. The update will be notified through
+ HYPERVISOR_CALLBACK_VECTOR IRQ. Fields have the following meanings:
+
+ suspend_time_ns:
+ Total number of nanoseconds passed during the host's suspend
+ while the VM is running. This value will be increasing
+ monotonically and cumulative.
+
+ Note that although MSRs are per-CPU entities, the effect of this
+ particular MSR is global.
+
+ Availability of this MSR must be checked via bit 18 in 0x4000001 cpuid
+ leaf prior to usage.
diff --git a/arch/x86/include/uapi/asm/kvm_para.h b/arch/x86/include/uapi/asm/kvm_para.h
index 5146bbab84d4..ccea4e344f46 100644
--- a/arch/x86/include/uapi/asm/kvm_para.h
+++ b/arch/x86/include/uapi/asm/kvm_para.h
@@ -35,6 +35,7 @@
#define KVM_FEATURE_MSI_EXT_DEST_ID 15
#define KVM_FEATURE_HC_MAP_GPA_RANGE 16
#define KVM_FEATURE_MIGRATION_CONTROL 17
+#define KVM_FEATURE_HOST_SUSPEND_TIME 18
#define KVM_HINTS_REALTIME 0
@@ -57,6 +58,7 @@
#define MSR_KVM_ASYNC_PF_INT 0x4b564d06
#define MSR_KVM_ASYNC_PF_ACK 0x4b564d07
#define MSR_KVM_MIGRATION_CONTROL 0x4b564d08
+#define MSR_KVM_HOST_SUSPEND_TIME 0x4b564d09
struct kvm_steal_time {
__u64 steal;
@@ -79,6 +81,10 @@ struct kvm_clock_pairing {
__u32 pad[9];
};
+struct kvm_suspend_time {
+ __u64 suspend_time_ns;
+};
+
#define KVM_STEAL_ALIGNMENT_BITS 5
#define KVM_STEAL_VALID_BITS ((-1ULL << (KVM_STEAL_ALIGNMENT_BITS + 1)))
#define KVM_STEAL_RESERVED_MASK (((1 << KVM_STEAL_ALIGNMENT_BITS) - 1 ) << 1)
--
2.33.0.1079.g6e70778dc9-goog
WARNING: multiple messages have this Message-ID (diff)
From: Hikaru Nishida <hikalium@chromium.org>
To: linux-kernel@vger.kernel.org, dme@dme.org, tglx@linutronix.de,
mlevitsk@redhat.com, linux@roeck-us.net, pbonzini@redhat.com,
vkuznets@redhat.com, maz@kernel.org, will@kernel.org
Cc: suleiman@google.com, senozhatsky@google.com,
kvmarm@lists.cs.columbia.edu,
linux-arm-kernel@lists.infradead.org,
Hikaru Nishida <hikalium@chromium.org>,
Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
Ingo Molnar <mingo@redhat.com>, Jim Mattson <jmattson@google.com>,
Joerg Roedel <joro@8bytes.org>, Jonathan Corbet <corbet@lwn.net>,
Sean Christopherson <seanjc@google.com>,
Wanpeng Li <wanpengli@tencent.com>,
kvm@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org
Subject: [RFC PATCH v3 3/5] kvm/x86: virtual suspend time injection: Add common definitions
Date: Wed, 20 Oct 2021 21:04:28 +0900 [thread overview]
Message-ID: <20211020210348.RFC.v3.3.I6e8f979820f45e38370aa19180a33a8c046d0fa9@changeid> (raw)
In-Reply-To: <20211020120431.776494-1-hikalium@chromium.org>
Add definitions of MSR, KVM_FEATURE bit and a structure called
kvm_suspend_time that are used by later patches to support the
virtual suspend time injection mechanism.
Also add documentations for them.
Signed-off-by: Hikaru Nishida <hikalium@chromium.org>
---
Changes in v3:
- Moved the definition of struct kvm_suspend_time into this patch.
Documentation/virt/kvm/cpuid.rst | 3 +++
Documentation/virt/kvm/msr.rst | 30 ++++++++++++++++++++++++++++
arch/x86/include/uapi/asm/kvm_para.h | 6 ++++++
3 files changed, 39 insertions(+)
diff --git a/Documentation/virt/kvm/cpuid.rst b/Documentation/virt/kvm/cpuid.rst
index bda3e3e737d7..f17b95b0d943 100644
--- a/Documentation/virt/kvm/cpuid.rst
+++ b/Documentation/virt/kvm/cpuid.rst
@@ -103,6 +103,9 @@ KVM_FEATURE_HC_MAP_GPA_RANGE 16 guest checks this feature bit bef
KVM_FEATURE_MIGRATION_CONTROL 17 guest checks this feature bit before
using MSR_KVM_MIGRATION_CONTROL
+KVM_FEATURE_HOST_SUSPEND_TIME 18 host suspend time information
+ is available at msr 0x4b564d09.
+
KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24 host will warn if no guest-side
per-cpu warps are expected in
kvmclock
diff --git a/Documentation/virt/kvm/msr.rst b/Documentation/virt/kvm/msr.rst
index 9315fc385fb0..40ec0fd263ac 100644
--- a/Documentation/virt/kvm/msr.rst
+++ b/Documentation/virt/kvm/msr.rst
@@ -389,3 +389,33 @@ data:
guest is communicating page encryption status to the host using the
``KVM_HC_MAP_GPA_RANGE`` hypercall, it can set bit 0 in this MSR to
allow live migration of the guest.
+
+MSR_KVM_HOST_SUSPEND_TIME:
+ 0x4b564d09
+
+data:
+ 8-byte alignment physical address of a memory area which must be
+ in guest RAM, plus an enable bit in bit 0. This memory is expected to
+ hold a copy of the following structure::
+
+ struct kvm_suspend_time {
+ __u64 suspend_time_ns;
+ };
+
+ whose data will be filled in by the hypervisor.
+ If the guest register this structure through the MSR write, the host
+ will stop all the clocks visible to the guest (including TSCs) during
+ the host's suspension and report the duration of suspend through this
+ structure. The update will be notified through
+ HYPERVISOR_CALLBACK_VECTOR IRQ. Fields have the following meanings:
+
+ suspend_time_ns:
+ Total number of nanoseconds passed during the host's suspend
+ while the VM is running. This value will be increasing
+ monotonically and cumulative.
+
+ Note that although MSRs are per-CPU entities, the effect of this
+ particular MSR is global.
+
+ Availability of this MSR must be checked via bit 18 in 0x4000001 cpuid
+ leaf prior to usage.
diff --git a/arch/x86/include/uapi/asm/kvm_para.h b/arch/x86/include/uapi/asm/kvm_para.h
index 5146bbab84d4..ccea4e344f46 100644
--- a/arch/x86/include/uapi/asm/kvm_para.h
+++ b/arch/x86/include/uapi/asm/kvm_para.h
@@ -35,6 +35,7 @@
#define KVM_FEATURE_MSI_EXT_DEST_ID 15
#define KVM_FEATURE_HC_MAP_GPA_RANGE 16
#define KVM_FEATURE_MIGRATION_CONTROL 17
+#define KVM_FEATURE_HOST_SUSPEND_TIME 18
#define KVM_HINTS_REALTIME 0
@@ -57,6 +58,7 @@
#define MSR_KVM_ASYNC_PF_INT 0x4b564d06
#define MSR_KVM_ASYNC_PF_ACK 0x4b564d07
#define MSR_KVM_MIGRATION_CONTROL 0x4b564d08
+#define MSR_KVM_HOST_SUSPEND_TIME 0x4b564d09
struct kvm_steal_time {
__u64 steal;
@@ -79,6 +81,10 @@ struct kvm_clock_pairing {
__u32 pad[9];
};
+struct kvm_suspend_time {
+ __u64 suspend_time_ns;
+};
+
#define KVM_STEAL_ALIGNMENT_BITS 5
#define KVM_STEAL_VALID_BITS ((-1ULL << (KVM_STEAL_ALIGNMENT_BITS + 1)))
#define KVM_STEAL_RESERVED_MASK (((1 << KVM_STEAL_ALIGNMENT_BITS) - 1 ) << 1)
--
2.33.0.1079.g6e70778dc9-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Hikaru Nishida <hikalium@chromium.org>
To: linux-kernel@vger.kernel.org, dme@dme.org, tglx@linutronix.de,
mlevitsk@redhat.com, linux@roeck-us.net, pbonzini@redhat.com,
vkuznets@redhat.com, maz@kernel.org, will@kernel.org
Cc: x86@kernel.org, Wanpeng Li <wanpengli@tencent.com>,
kvm@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
Joerg Roedel <joro@8bytes.org>,
linux-doc@vger.kernel.org, Hikaru Nishida <hikalium@chromium.org>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
suleiman@google.com, senozhatsky@google.com,
kvmarm@lists.cs.columbia.edu,
linux-arm-kernel@lists.infradead.org,
Jim Mattson <jmattson@google.com>
Subject: [RFC PATCH v3 3/5] kvm/x86: virtual suspend time injection: Add common definitions
Date: Wed, 20 Oct 2021 21:04:28 +0900 [thread overview]
Message-ID: <20211020210348.RFC.v3.3.I6e8f979820f45e38370aa19180a33a8c046d0fa9@changeid> (raw)
In-Reply-To: <20211020120431.776494-1-hikalium@chromium.org>
Add definitions of MSR, KVM_FEATURE bit and a structure called
kvm_suspend_time that are used by later patches to support the
virtual suspend time injection mechanism.
Also add documentations for them.
Signed-off-by: Hikaru Nishida <hikalium@chromium.org>
---
Changes in v3:
- Moved the definition of struct kvm_suspend_time into this patch.
Documentation/virt/kvm/cpuid.rst | 3 +++
Documentation/virt/kvm/msr.rst | 30 ++++++++++++++++++++++++++++
arch/x86/include/uapi/asm/kvm_para.h | 6 ++++++
3 files changed, 39 insertions(+)
diff --git a/Documentation/virt/kvm/cpuid.rst b/Documentation/virt/kvm/cpuid.rst
index bda3e3e737d7..f17b95b0d943 100644
--- a/Documentation/virt/kvm/cpuid.rst
+++ b/Documentation/virt/kvm/cpuid.rst
@@ -103,6 +103,9 @@ KVM_FEATURE_HC_MAP_GPA_RANGE 16 guest checks this feature bit bef
KVM_FEATURE_MIGRATION_CONTROL 17 guest checks this feature bit before
using MSR_KVM_MIGRATION_CONTROL
+KVM_FEATURE_HOST_SUSPEND_TIME 18 host suspend time information
+ is available at msr 0x4b564d09.
+
KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24 host will warn if no guest-side
per-cpu warps are expected in
kvmclock
diff --git a/Documentation/virt/kvm/msr.rst b/Documentation/virt/kvm/msr.rst
index 9315fc385fb0..40ec0fd263ac 100644
--- a/Documentation/virt/kvm/msr.rst
+++ b/Documentation/virt/kvm/msr.rst
@@ -389,3 +389,33 @@ data:
guest is communicating page encryption status to the host using the
``KVM_HC_MAP_GPA_RANGE`` hypercall, it can set bit 0 in this MSR to
allow live migration of the guest.
+
+MSR_KVM_HOST_SUSPEND_TIME:
+ 0x4b564d09
+
+data:
+ 8-byte alignment physical address of a memory area which must be
+ in guest RAM, plus an enable bit in bit 0. This memory is expected to
+ hold a copy of the following structure::
+
+ struct kvm_suspend_time {
+ __u64 suspend_time_ns;
+ };
+
+ whose data will be filled in by the hypervisor.
+ If the guest register this structure through the MSR write, the host
+ will stop all the clocks visible to the guest (including TSCs) during
+ the host's suspension and report the duration of suspend through this
+ structure. The update will be notified through
+ HYPERVISOR_CALLBACK_VECTOR IRQ. Fields have the following meanings:
+
+ suspend_time_ns:
+ Total number of nanoseconds passed during the host's suspend
+ while the VM is running. This value will be increasing
+ monotonically and cumulative.
+
+ Note that although MSRs are per-CPU entities, the effect of this
+ particular MSR is global.
+
+ Availability of this MSR must be checked via bit 18 in 0x4000001 cpuid
+ leaf prior to usage.
diff --git a/arch/x86/include/uapi/asm/kvm_para.h b/arch/x86/include/uapi/asm/kvm_para.h
index 5146bbab84d4..ccea4e344f46 100644
--- a/arch/x86/include/uapi/asm/kvm_para.h
+++ b/arch/x86/include/uapi/asm/kvm_para.h
@@ -35,6 +35,7 @@
#define KVM_FEATURE_MSI_EXT_DEST_ID 15
#define KVM_FEATURE_HC_MAP_GPA_RANGE 16
#define KVM_FEATURE_MIGRATION_CONTROL 17
+#define KVM_FEATURE_HOST_SUSPEND_TIME 18
#define KVM_HINTS_REALTIME 0
@@ -57,6 +58,7 @@
#define MSR_KVM_ASYNC_PF_INT 0x4b564d06
#define MSR_KVM_ASYNC_PF_ACK 0x4b564d07
#define MSR_KVM_MIGRATION_CONTROL 0x4b564d08
+#define MSR_KVM_HOST_SUSPEND_TIME 0x4b564d09
struct kvm_steal_time {
__u64 steal;
@@ -79,6 +81,10 @@ struct kvm_clock_pairing {
__u32 pad[9];
};
+struct kvm_suspend_time {
+ __u64 suspend_time_ns;
+};
+
#define KVM_STEAL_ALIGNMENT_BITS 5
#define KVM_STEAL_VALID_BITS ((-1ULL << (KVM_STEAL_ALIGNMENT_BITS + 1)))
#define KVM_STEAL_RESERVED_MASK (((1 << KVM_STEAL_ALIGNMENT_BITS) - 1 ) << 1)
--
2.33.0.1079.g6e70778dc9-goog
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next prev parent reply other threads:[~2021-10-20 12:05 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-20 12:04 [RFC PATCH v3 0/5] x86/kvm: Virtual suspend time injection support Hikaru Nishida
2021-10-20 12:04 ` Hikaru Nishida
2021-10-20 12:04 ` Hikaru Nishida
2021-10-20 12:04 ` [RFC PATCH v3 1/5] timekeeping: Expose tk->offs_boot via ktime_get_offs_boot_ns Hikaru Nishida
2021-10-20 12:04 ` Hikaru Nishida
2021-10-20 12:04 ` Hikaru Nishida
2021-10-20 12:04 ` [RFC PATCH v3 2/5] kvm/x86: Include asm/pvclock.h in asm/kvmclock.h Hikaru Nishida
2021-10-20 12:04 ` Hikaru Nishida
2021-10-20 12:04 ` Hikaru Nishida
2021-10-20 12:04 ` Hikaru Nishida [this message]
2021-10-20 12:04 ` [RFC PATCH v3 3/5] kvm/x86: virtual suspend time injection: Add common definitions Hikaru Nishida
2021-10-20 12:04 ` Hikaru Nishida
2021-10-20 12:04 ` [RFC PATCH v3 4/5] kvm/x86: virtual suspend time injection: Implement host side Hikaru Nishida
2021-10-20 12:04 ` Hikaru Nishida
2021-10-20 12:04 ` Hikaru Nishida
2021-10-20 12:04 ` [RFC PATCH v3 5/5] kvm/x86: virtual suspend time injection: Implement guest side Hikaru Nishida
2021-10-20 12:04 ` Hikaru Nishida
2021-10-20 12:04 ` Hikaru Nishida
2021-10-20 13:52 ` [RFC PATCH v3 0/5] x86/kvm: Virtual suspend time injection support Marc Zyngier
2021-10-20 13:52 ` Marc Zyngier
2021-10-20 13:52 ` Marc Zyngier
2021-11-04 9:10 ` Hikaru Nishida
2021-11-04 9:10 ` Hikaru Nishida
2021-11-04 9:10 ` Hikaru Nishida
2021-12-04 17:30 ` Marc Zyngier
2021-12-04 17:30 ` Marc Zyngier
2021-12-04 17:30 ` Marc Zyngier
2022-04-06 3:48 ` Hikaru Nishida
2022-04-06 3:48 ` Hikaru Nishida
2022-04-06 3:48 ` Hikaru Nishida
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211020210348.RFC.v3.3.I6e8f979820f45e38370aa19180a33a8c046d0fa9@changeid \
--to=hikalium@chromium.org \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=dme@dme.org \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=maz@kernel.org \
--cc=mingo@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=senozhatsky@google.com \
--cc=suleiman@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.