On Wed, Aug 4, 2021 at 4:05 AM Oliver Upton wrote:
>
> On Wed, Aug 4, 2021 at 1:58 AM Oliver Upton wrote:
> >
> > KVM's current means of saving/restoring system counters is plagued with
> > temporal issues. At least on ARM64 and x86, we migrate the guest's
> > s
On Wed, Aug 4, 2021 at 1:58 AM Oliver Upton wrote:
>
> KVM's current means of saving/restoring system counters is plagued with
> temporal issues. At least on ARM64 and x86, we migrate the guest's
> system counter by-value through the respective guest system register
> values (cntvc
On Wed, Aug 4, 2021 at 3:17 AM Andrew Jones wrote:
> > diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c
> > index a8815b09da3e..f15058612994 100644
> > --- a/arch/arm64/kvm/arch_timer.c
> > +++ b/arch/arm64/kvm/arch_timer.c
> > @@ -85,11 +85,15 @@ u64 timer_get_cval(struct
Introduce a KVM selftest to verify that userspace manipulation of the
TSC (via the new vCPU attribute) results in the correct behavior within
the guest.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm/.gitignore| 1 +
tools/testing/selftests/kvm
vCPU file descriptors are abstracted away from test code in KVM
selftests, meaning that tests cannot directly access a vCPU's device
attributes. Add helpers that tests can use to get at vCPU device
attributes.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
.../testing/selftests/kvm
on ECV systems as ECV is required for hardware offsetting
of the physical counter-timer.
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/devices/vcpu.rst | 28 ++
arch/arm64/include/asm/kvm_asm.h| 2 +
arch/arm64/include/asm/sysreg.h | 2 +
arch/arm64/include/uapi
Introduce a new cpucap to indicate if the system supports full enhanced
counter virtualization (i.e. ID_AA64MMFR0_EL1.ECV==0x2).
Signed-off-by: Oliver Upton
---
arch/arm64/include/asm/sysreg.h | 2 ++
arch/arm64/kernel/cpufeature.c | 10 ++
arch/arm64/tools/cpucaps| 1 +
3
Make the implementation of update_vtimer_cntvoff() generic w.r.t. guest
timer context and spin off into a new helper method for later use.
Require callers of this new helper method to grab the kvm lock
beforehand.
No functional change intended.
Signed-off-by: Oliver Upton
---
arch/arm64/kvm
the elapsed cycles to a direct read of the hardware
register.
Reviewed-by: Ricardo Koller
Signed-off-by: Oliver Upton
Reviewed-by: Andrew Jones
---
tools/testing/selftests/kvm/.gitignore| 1 +
tools/testing/selftests/kvm/Makefile | 1 +
.../kvm/aarch64
counter in the fast exit path.
Signed-off-by: Oliver Upton
---
arch/arm64/include/asm/sysreg.h | 1 +
arch/arm64/kvm/arch_timer.c | 53 +++--
arch/arm64/kvm/hyp/include/hyp/switch.h | 29 ++
arch/arm64/kvm/hyp/nvhe/timer-sr.c | 11 -
4
The KVM_CREATE_DEVICE and KVM_{GET,SET}_DEVICE_ATTR ioctls are defined
to return a value of zero on success. As such, tighten the assertions in
the helper functions to only pass if the return code is zero.
Suggested-by: Andrew Jones
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
A later change requires that the pvclock sync lock be taken while
holding the tsc_write_lock. Change the locking in kvm_synchronize_tsc()
to align with the requirement to isolate the locking change to its own
commit.
Cc: Sean Christopherson
Signed-off-by: Oliver Upton
---
Documentation/virt
KVM/arm64 now allows userspace to adjust the guest virtual counter-timer
via a vCPU register. Test that changes to the virtual counter-timer
offset result in the correct view being presented to the guest.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm
In preparation for emulated physical counter-timer offsetting, configure
traps on every vcpu_load() for VHE systems. As before, these trap
settings do not affect host userspace, and are only active for the
guest.
Suggested-by: Marc Zyngier
Signed-off-by: Oliver Upton
---
arch/arm64/kvm
Add a selftest for the new KVM clock UAPI that was introduced. Ensure
that the KVM clock is consistent between userspace and the guest, and
that the difference in realtime will only ever cause the KVM clock to
advance forward.
Cc: Andrew Jones
Signed-off-by: Oliver Upton
---
tools/testing
offset register writes from the hardware values utilized
by KVM.
Signed-off-by: Oliver Upton
---
arch/arm64/kvm/arch_timer.c | 48
include/kvm/arm_arch_timer.h | 3 +++
2 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/kvm/arch_timer.c
sted-by: Paolo Bonzini
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/api.rst | 42 ---
arch/x86/include/asm/kvm_host.h | 3 +
arch/x86/kvm/x86.c | 127 ++--
include/uapi/linux/kvm.h| 7 +-
4 files changed, 112 insertions(+)
Refactor kvm_synchronize_tsc to make a new function that allows callers
to specify TSC parameters (offset, value, nanoseconds, etc.) explicitly
for the sake of participating in TSC synchronization.
Signed-off-by: Oliver Upton
---
arch/x86/kvm/x86.c | 105
Test that userspace adjustment of the guest physical counter-timer
results in the correct view within the guest.
Cc: Andrew Jones
Signed-off-by: Oliver Upton
---
.../selftests/kvm/include/aarch64/processor.h | 12 +++
.../kvm/system_counter_offset_test.c | 31
the pvclock_gtod_sync_lock.
Suggested-by: Sean Christopherson
Signed-off-by: Oliver Upton
---
arch/x86/kvm/x86.c | 39 ---
1 file changed, 28 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8cdf4ac6990b..34287c522f4e 100644
3: https://lore.kernel.org/r/20210719184949.1385910-1-oup...@google.com
v4: https://lore.kernel.org/r/20210729001012.70394-1-oup...@google.com
v5: https://lore.kernel.org/r/20210729173300.181775-1-oup...@google.com
Oliver Upton (21):
KVM: x86: Fix potential race in KVM_GET_CLOCK
KVM: x86: Report
The KVM_GET_REG_LIST vCPU ioctl returns a list of supported registers
for a given vCPU. Add a helper to check if a register exists in the list
of supported registers.
Signed-off-by: Oliver Upton
---
.../testing/selftests/kvm/include/kvm_util.h | 2 ++
tools/testing/selftests/kvm/lib
Copy over approximately clean versions of the pvclock headers into
tools. Reconcile headers/symbols missing in tools that are unneeded.
Signed-off-by: Oliver Upton
---
tools/arch/x86/include/asm/pvclock-abi.h | 48 +++
tools/arch/x86/include/asm/pvclock.h | 103
-by: Oliver Upton
---
Documentation/virt/kvm/api.rst| 10 ++
arch/arm64/include/uapi/asm/kvm.h | 1 +
arch/arm64/kvm/arch_timer.c | 11 +++
arch/arm64/kvm/guest.c| 6 +-
include/kvm/arm_arch_timer.h | 1 +
5 files changed, 28 insertions(+), 1 deletion
to capture a (realtime, host_tsc) pair at the instant when
the guest is paused.
Cc: David Matlack
Cc: Sean Christopherson
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/devices/vcpu.rst | 57 +
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/include/uapi/asm/kvm.h
Hi Marc,
On Fri, Jul 30, 2021 at 9:48 AM Oliver Upton wrote:
>
> On Fri, Jul 30, 2021 at 9:18 AM Marc Zyngier wrote:
> > You want the ARM FVP model, or maybe even the Foundation model. It has
> > support all the way to ARMv8.7 apparently. I personally use the FVP,
> &
On Fri, Jul 30, 2021 at 11:08 AM Sean Christopherson wrote:
>
> On Thu, Jul 29, 2021, Oliver Upton wrote:
> > Refactor kvm_synchronize_tsc to make a new function that allows callers
> > to specify TSC parameters (offset, value, nanoseconds, etc.) explicitly
> > for t
On Fri, Jul 30, 2021 at 3:12 AM Marc Zyngier wrote:
>
> On Thu, 29 Jul 2021 18:32:56 +0100,
> Oliver Upton wrote:
> >
> > Add a new vCPU attribute that allows userspace to directly manipulate
> > the virtual counter-timer offset. Exposing such an interface allows fo
by tightening up the
include list. No functional change intended.
Signed-off-by: Oliver Upton
---
include/linux/entry-kvm.h | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/linux/entry-kvm.h b/include/linux/entry-kvm.h
index 136b8d97d8c0..0d7865a0731c 100644
tag
v2 -> v3:
- Roll all exit conditions into kvm_vcpu_exit_request() (Marc)
- Avoid needlessly checking for work twice (Marc)
v1: http://lore.kernel.org/r/20210729195632.489978-1-oup...@google.com
v2: http://lore.kernel.org/r/20210729220916.1672875-1-oup...@google.com
Oliver Upton (3):
KV
Most other architectures that implement KVM record a statistic
indicating the number of times a vCPU has exited due to a pending
signal. Add support for that stat to arm64.
Reviewed-by: Jing Zhang
Signed-off-by: Oliver Upton
---
arch/arm64/include/asm/kvm_host.h | 1 +
arch/arm64/kvm/arm.c
Clean up handling of checks for pending work by switching to the generic
infrastructure to do so.
We pick up handling for TIF_NOTIFY_RESUME from this switch, meaning that
task work will be correctly handled.
Signed-off-by: Oliver Upton
---
arch/arm64/kvm/Kconfig | 1 +
arch/arm64/kvm/arm.c
On Fri, Jul 30, 2021 at 10:48 AM Sean Christopherson wrote:
>
> On Thu, Jul 29, 2021, Oliver Upton wrote:
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index 916c976e99ab..e052c7afaac4 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/
On Fri, Jul 30, 2021 at 9:56 AM Sean Christopherson wrote:
>
> On Fri, Jul 30, 2021, Oliver Upton wrote:
> >
> > On Fri, Jul 30, 2021 at 2:41 AM Marc Zyngier wrote:
> > >
> > > On Thu, 29 Jul 2021 23:09:16 +0100, Oliver Upton
> > > wr
On Fri, Jul 30, 2021 at 9:18 AM Marc Zyngier wrote:
> You want the ARM FVP model, or maybe even the Foundation model. It has
> support all the way to ARMv8.7 apparently. I personally use the FVP,
> get in touch offline and I'll help you with the setup.
>
> In general, I tend to trust the ARM
On Fri, Jul 30, 2021 at 4:08 AM Marc Zyngier wrote:
> > FEAT_ECV provides a guest physical counter-timer offset register
> > (CNTPOFF_EL2), but ECV-enabled hardware is nonexistent at the time of
> > writing so support for it was elided for the sake of the author :)
>
> You seem to have done most
Marc,
On Fri, Jul 30, 2021 at 2:41 AM Marc Zyngier wrote:
>
> Hi Oliver,
>
> On Thu, 29 Jul 2021 23:09:16 +0100,
> Oliver Upton wrote:
> >
> > Clean up handling of checks for pending work by switching to the generic
> > infrastructure to do so.
> >
> &
by tightening up the
include list. No functional change intended.
Signed-off-by: Oliver Upton
---
include/linux/entry-kvm.h | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/linux/entry-kvm.h b/include/linux/entry-kvm.h
index 136b8d97d8c0..0d7865a0731c 100644
Clean up handling of checks for pending work by switching to the generic
infrastructure to do so.
We pick up handling for TIF_NOTIFY_RESUME from this switch, meaning that
task work will be correctly handled.
Signed-off-by: Oliver Upton
---
arch/arm64/kvm/Kconfig | 1 +
arch/arm64/kvm/arm.c
Most other architectures that implement KVM record a statistic
indicating the number of times a vCPU has exited due to a pending
signal. Add support for that stat to arm64.
Reviewed-by: Jing Zhang
Signed-off-by: Oliver Upton
---
arch/arm64/include/asm/kvm_host.h | 1 +
arch/arm64/kvm/arm.c
tag
v1: http://lore.kernel.org/r/20210729195632.489978-1-oup...@google.com
Oliver Upton (3):
KVM: arm64: Record number of signal exits as a vCPU stat
entry: KVM: Allow use of generic KVM entry w/o full generic support
KVM: arm64: Use generic KVM xfer to guest work function
arch/arm6
On Thu, Jul 29, 2021 at 1:07 PM Jing Zhang wrote:
>
> On Thu, Jul 29, 2021 at 12:56 PM Oliver Upton wrote:
> >
> > Most other architectures that implement KVM record a statistic
> > indicating the number of times a vCPU has exited due to a pending
> > signal. Add
Clean up handling of checks for pending work by switching to the generic
infrastructure to do so.
We pick up handling for TIF_NOTIFY_RESUME from this switch, meaning that
task work will be correctly handled.
Signed-off-by: Oliver Upton
---
arch/arm64/kvm/Kconfig | 1 +
arch/arm64/kvm/arm.c
Most other architectures that implement KVM record a statistic
indicating the number of times a vCPU has exited due to a pending
signal. Add support for that stat to arm64.
Cc: Jing Zhang
Signed-off-by: Oliver Upton
---
arch/arm64/include/asm/kvm_host.h | 1 +
arch/arm64/kvm/arm.c
by tightening up the
include list. No functional change intended.
Signed-off-by: Oliver Upton
---
include/linux/entry-kvm.h | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/linux/entry-kvm.h b/include/linux/entry-kvm.h
index 136b8d97d8c0..0d7865a0731c 100644
applies to kvm/queue (note that this is deliberate as the
generic kvm stats patches have not yet propagated to kvm-arm/queue) at
the following commit:
8ad5e63649ff ("KVM: Don't take mmu_lock for range invalidation unless
necessary")
Oliver Upton (3):
KVM: arm64: Record number of si
the elapsed cycles to a direct read of the hardware
register.
Cc: Andrew Jones
Reviewed-by: Ricardo Koller
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm/.gitignore| 1 +
tools/testing/selftests/kvm/Makefile | 1 +
.../kvm/aarch64/counter_emulation_benchmark.c
interface, wherein a write to a single vCPU is broadcasted to all vCPUs
within a VM.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/devices/vcpu.rst | 22
arch/arm64/include/uapi/asm/kvm.h | 1 +
arch/arm64/kvm/arch_timer.c | 68
Add a selftest for the new KVM clock UAPI that was introduced. Ensure
that the KVM clock is consistent between userspace and the guest, and
that the difference in realtime will only ever cause the KVM clock to
advance forward.
Cc: Andrew Jones
Signed-off-by: Oliver Upton
---
tools/testing
Test that userpace adjustment of the guest physical counter-timer
results in the correct view of within the guest.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
.../selftests/kvm/include/aarch64/processor.h | 12
.../kvm/system_counter_offset_test.c | 29
KVM/arm64 now allows userspace to adjust the guest virtual counter-timer
via a vCPU device attribute. Test that changes to the virtual
counter-timer offset result in the correct view being presented to the
guest.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
tools/testing/selftests
sted-by: Paolo Bonzini
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/api.rst | 42 +++--
arch/x86/include/asm/kvm_host.h | 3 +
arch/x86/kvm/x86.c | 149
include/uapi/linux/kvm.h| 7 +-
4 files changed, 137 insertions(+)
Copy over approximately clean versions of the pvclock headers into
tools. Reconcile headers/symbols missing in tools that are unneeded.
Signed-off-by: Oliver Upton
---
tools/arch/x86/include/asm/pvclock-abi.h | 48 +++
tools/arch/x86/include/asm/pvclock.h | 103
vCPU file descriptors are abstracted away from test code in KVM
selftests, meaning that tests cannot directly access a vCPU's device
attributes. Add helpers that tests can use to get at vCPU device
attributes.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
.../testing/selftests/kvm
hardware is nonexistent at the time of
writing so support for it was elided for the sake of the author :)
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/devices/vcpu.rst | 22 +++
arch/arm64/include/asm/kvm_host.h | 1 +
arch/arm64/include/asm
gtod lock while holding the tsc write lock,
whereas before these locks were disjoint.
Reviewed-by: David Matlack
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/locking.rst | 11 +++
arch/x86/kvm/x86.c | 106 +
2 files changed, 74 insertions
The KVM_CREATE_DEVICE and KVM_{GET,SET}_DEVICE_ATTR ioctls are defined
to return a value of zero on success. As such, tighten the assertions in
the helper functions to only pass if the return code is zero.
Suggested-by: Andrew Jones
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
to capture a (realtime, host_tsc) pair at the instant when
the guest is paused.
Cc: David Matlack
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/devices/vcpu.rst | 57
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/include/uapi/asm/kvm.h | 4 +
arch/x86/kvm/x86.c
p...@google.com
v4: https://lore.kernel.org/r/20210729001012.70394-1-oup...@google.com
Oliver Upton (13):
KVM: x86: Report host tsc and realtime values in KVM_GET_CLOCK
KVM: x86: Refactor tsc synchronization code
KVM: x86: Expose TSC offset controls to userspace
tools: arch: x86: pull in pvclock
Introduce a KVM selftest to verify that userspace manipulation of the
TSC (via the new vCPU attribute) results in the correct behavior within
the guest.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm/.gitignore| 1 +
tools/testing/selftests/kvm
On Thu, Jul 29, 2021 at 9:56 AM Andrew Jones wrote:
>
> On Thu, Jul 29, 2021 at 12:10:12AM +, Oliver Upton wrote:
> > Add a test case for counter emulation on arm64. A side effect of how KVM
> > handles physical counter offsetting on non-ECV systems is that the
> > vir
the elapsed cycles to a direct read of the hardware
register.
Reviewed-by: Ricardo Koller
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm/.gitignore| 1 +
tools/testing/selftests/kvm/Makefile | 1 +
.../kvm/aarch64/counter_emulation_benchmark.c | 215
KVM/arm64 now allows userspace to adjust the guest virtual counter-timer
via a vCPU device attribute. Test that changes to the virtual
counter-timer offset result in the correct view being presented to the
guest.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
tools/testing/selftests
Introduce a KVM selftest to verify that userspace manipulation of the
TSC (via the new vCPU attribute) results in the correct behavior within
the guest.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm/.gitignore| 1 +
tools/testing/selftests/kvm
vCPU file descriptors are abstracted away from test code in KVM
selftests, meaning that tests cannot directly access a vCPU's device
attributes. Add helpers that tests can use to get at vCPU device
attributes.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
.../testing/selftests/kvm
Add a selftest for the new KVM clock UAPI that was introduced. Ensure
that the KVM clock is consistent between userspace and the guest, and
that the difference in realtime will only ever cause the KVM clock to
advance forward.
Cc: Andrew Jones
Signed-off-by: Oliver Upton
---
tools/testing
interface, wherein a write to a single vCPU is broadcasted to all vCPUs
within a VM.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/devices/vcpu.rst | 22
arch/arm64/include/uapi/asm/kvm.h | 1 +
arch/arm64/kvm/arch_timer.c | 68
hardware is nonexistent at the time of
writing so support for it was elided for the sake of the author :)
Cc: Andrew Jones
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/devices/vcpu.rst | 22 +++
arch/arm64/include/asm/kvm_host.h | 1 +
arch/arm64/include/asm/kvm_hyp.h
Copy over approximately clean versions of the pvclock headers into
tools. Reconcile headers/symbols missing in tools that are unneeded.
Signed-off-by: Oliver Upton
---
tools/arch/x86/include/asm/pvclock-abi.h | 48 +++
tools/arch/x86/include/asm/pvclock.h | 103
The KVM_CREATE_DEVICE and KVM_{GET,SET}_DEVICE_ATTR ioctls are defined
to return a value of zero on success. As such, tighten the assertions in
the helper functions to only pass if the return code is zero.
Suggested-by: Andrew Jones
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm
ps://lore.kernel.org/r/20210716212629.2232756-1-oup...@google.com
v3: https://lore/kernel.org/r/20210719184949.1385910-1-oup...@google.com
Oliver Upton (13):
KVM: x86: Report host tsc and realtime values in KVM_GET_CLOCK
KVM: x86: Refactor tsc synchronization code
KVM: x86: Expose TSC offset controls to usersp
-off-by: Oliver Upton
---
Documentation/virt/kvm/api.rst | 42 +++--
arch/x86/include/asm/kvm_host.h | 3 +
arch/x86/kvm/x86.c | 149
include/uapi/linux/kvm.h| 7 +-
4 files changed, 137 insertions(+), 64 deletions(-)
diff -
Test that userpace adjustment of the guest physical counter-timer
results in the correct view of within the guest.
Reviewed-by: Andrew Jones
Signed-off-by: Oliver Upton
---
.../selftests/kvm/include/aarch64/processor.h | 12
.../kvm/system_counter_offset_test.c | 29
gtod lock while holding the tsc write lock,
whereas before these locks were disjoint.
Reviewed-by: David Matlack
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/locking.rst | 11 +++
arch/x86/kvm/x86.c | 106 +
2 files changed, 74 insertions
to capture a (realtime, host_tsc) pair at the instant when
the guest is paused.
Cc: David Matlack
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/devices/vcpu.rst | 57
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/include/uapi/asm/kvm.h | 4 +
arch/x86/kvm/x86.c
ro.
>
> Signed-off-by: Paolo Bonzini
Reviewed-by: Oliver Upton
> ---
> arch/arm64/kvm/mmu.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index c10207fed2f3..6cf16b43bfcc 100644
> --- a/arch/arm64/kvm/mmu.c
On Wed, Jul 21, 2021 at 8:28 AM Andrew Jones wrote:
>
> On Fri, Jul 16, 2021 at 09:26:17PM +, Oliver Upton wrote:
> > KVM's current means of saving/restoring system counters is plagued with
> > temporal issues. At least on ARM64 and x86, we migrate the guest's
> >
On Mon, Jul 19, 2021 at 9:04 AM Fuad Tabba wrote:
>
> Protected KVM does not support protected AArch32 guests. However,
> it is possible for the guest to force run AArch32, potentially
> causing problems. Add an extra check so that if the hypervisor
> catches the guest doing that, it can prevent
On Mon, Jul 19, 2021 at 11:02 AM Jean-Philippe Brucker
wrote:
> We forward the whole PSCI function range, so it's either KVM or userspace.
> If KVM manages PSCI and the guest calls an unimplemented function, that
> returns directly to the guest without going to userspace.
>
> The concern is valid
Test that userpace adjustment of the guest physical counter-timer
results in the correct view of within the guest.
Signed-off-by: Oliver Upton
---
.../selftests/kvm/include/aarch64/processor.h | 12
.../kvm/system_counter_offset_test.c | 29 ---
2 files changed
hardware is nonexistent at the time of
writing so support for it was elided for the sake of the author :)
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/devices/vcpu.rst | 22 ++
arch/arm64/include/asm/kvm_host.h | 1 +
arch/arm64/include/asm/kvm_hyp.h | 2
Introduce a KVM selftest to verify that userspace manipulation of the
TSC (via the new vCPU attribute) results in the correct behavior within
the guest.
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm/.gitignore| 1 +
tools/testing/selftests/kvm/Makefile | 1
interface, wherein a write to a single vCPU is broadcasted to all vCPUs
within a VM.
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/devices/vcpu.rst | 22
arch/arm64/include/uapi/asm/kvm.h | 1 +
arch/arm64/kvm/arch_timer.c | 68 -
3
KVM/arm64 now allows userspace to adjust the guest virtual counter-timer
via a vCPU device attribute. Test that changes to the virtual
counter-timer offset result in the correct view being presented to the
guest.
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm/Makefile | 1
the elapsed cycles to a direct read of the hardware
register.
Reviewed-by: Ricardo Koller
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm/.gitignore| 1 +
tools/testing/selftests/kvm/Makefile | 1 +
.../kvm/aarch64/counter_emulation_benchmark.c | 215
gtod lock while holding the tsc write lock,
whereas before these locks were disjoint.
Reviewed-by: David Matlack
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/locking.rst | 11 +++
arch/x86/kvm/x86.c | 106 +
2 files changed, 74 insertions
Add a selftest for the new KVM clock UAPI that was introduced. Ensure
that the KVM clock is consistent between userspace and the guest, and
that the difference in realtime will only ever cause the KVM clock to
advance forward.
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm
vCPU file descriptors are abstracted away from test code in KVM
selftests, meaning that tests cannot directly access a vCPU's device
attributes. Add helpers that tests can use to get at vCPU device
attributes.
Signed-off-by: Oliver Upton
---
.../testing/selftests/kvm/include/kvm_util.h | 9
Copy over approximately clean versions of the pvclock headers into
tools. Reconcile headers/symbols missing in tools that are unneeded.
Signed-off-by: Oliver Upton
---
tools/arch/x86/include/asm/pvclock-abi.h | 48 +++
tools/arch/x86/include/asm/pvclock.h | 103
to capture a (realtime, host_tsc) pair at the instant when
the guest is paused.
Cc: David Matlack
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/devices/vcpu.rst | 57
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/include/uapi/asm/kvm.h | 4 +
arch/x86/kvm/x86.c
-off-by: Oliver Upton
---
Documentation/virt/kvm/api.rst | 42 +++--
arch/x86/include/asm/kvm_host.h | 3 +
arch/x86/kvm/x86.c | 149
include/uapi/linux/kvm.h| 7 +-
4 files changed, 137 insertions(+), 64 deletions(-)
diff -
hroughout series
- Rename KVM_CLOCK_REAL_TIME -> KVM_CLOCK_REALTIME
v1: https://lore.kernel.org/kvm/20210608214742.1897483-1-oup...@google.com/
v2: https://lore.kernel.org/r/20210716212629.2232756-1-oup...@google.com
Oliver Upton (12):
KVM: x86: Report host tsc and realtime values in KVM_G
On Fri, Jul 16, 2021 at 2:26 PM Oliver Upton wrote:
>
> KVM's current means of saving/restoring system counters is plagued with
> temporal issues. At least on ARM64 and x86, we migrate the guest's
> system counter by-value through the respective guest system register
> val
Test that userpace adjustment of the guest physical counter-timer
results in the correct view of within the guest.
Signed-off-by: Oliver Upton
---
.../selftests/kvm/include/aarch64/processor.h | 12
.../kvm/system_counter_offset_test.c | 29 ---
2 files changed
the elapsed cycles to a direct read of the hardware
register.
Reviewed-by: Ricardo Koller
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm/.gitignore| 1 +
tools/testing/selftests/kvm/Makefile | 1 +
.../kvm/aarch64/counter_emulation_benchmark.c | 215
Introduce a KVM selftest to verify that userspace manipulation of the
TSC (via the new vCPU attribute) results in the correct behavior within
the guest.
Signed-off-by: Oliver Upton
---
tools/testing/selftests/kvm/.gitignore| 1 +
tools/testing/selftests/kvm/Makefile | 1
to capture a (realtime, host_tsc) pair at the instant when
the guest is paused.
Cc: David Matlack
Signed-off-by: Oliver Upton
---
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/include/uapi/asm/kvm.h | 4 +
arch/x86/kvm/x86.c | 166
3 files changed
gtod lock while holding the tsc write lock,
whereas before these locks were disjoint.
Reviewed-by: David Matlack
Signed-off-by: Oliver Upton
---
Documentation/virt/kvm/locking.rst | 11 +++
arch/x86/kvm/x86.c | 106 +
2 files changed, 74 insertions
interface, wherein a write to a single vCPU is broadcasted to all vCPUs
within a VM.
Signed-off-by: Oliver Upton
---
arch/arm64/include/uapi/asm/kvm.h | 1 +
arch/arm64/kvm/arch_timer.c | 68 ++-
2 files changed, 67 insertions(+), 2 deletions(-)
diff --git
Copy over approximately clean versions of the pvclock headers into
tools. Reconcile headers/symbols missing in tools that are unneeded.
Signed-off-by: Oliver Upton
---
tools/arch/x86/include/asm/pvclock-abi.h | 48 +++
tools/arch/x86/include/asm/pvclock.h | 103
501 - 600 of 621 matches
Mail list logo