Re: [PATCH 2/2] KVM: selftests: Add KVM/PV clock selftest to prove timer drift correction

2024-04-08 Thread Dongli Zhang
ferror(fp)); > + goto out; > + } > + > + TEST_ASSERT(!strncmp(clk_name, "tsc\n", st.st_size), > + "clocksource not supported: %s", clk_name); > +out: > + fclose(fp); > +} > + > +static void configure_pvclock(

Re: [PATCH v2 3/3] KVM: selftests: Add a test case for KVM_X86_DISABLE_EXITS_HLT

2024-04-01 Thread Dongli Zhang
ad_t task_thread, vcpu_thread; > + > +static void guest_code(uint64_t *is_hlt_exec) > +{ > + while (!READ_ONCE(*is_hlt_exec)) > + ; > + > + safe_halt(); May I confirm if this selftest works on nested L1 VM as a hypervisor? Thank you very much! Dongli Zhang

[PATCH 1/1] KVM: selftests: close the memfd in some gmem tests

2024-02-26 Thread Dongli Zhang
Add the missing close(fd) in guest_memfd_test.c and private_mem_conversions_test.c. Signed-off-by: Dongli Zhang --- tools/testing/selftests/kvm/guest_memfd_test.c | 3 +++ .../selftests/kvm/x86_64/private_mem_conversions_test.c| 2 ++ 2 files changed, 5 insertions

Re: [PATCH 1/1] KVM: selftests: add kvmclock drift test

2024-01-29 Thread Dongli Zhang
! Dongli Zhang On 1/6/24 00:33, Dongli Zhang wrote: > There is kvmclock drift issue during the vCPU hotplug. It has been fixed by > the commit c52ffadc65e2 ("KVM: x86: Don't unnecessarily force masterclock > update on vCPU hotplug"). > > This is to add the test to verify

[PATCH 1/1] KVM: selftests: add kvmclock drift test

2024-01-06 Thread Dongli Zhang
ock_drift.c:216: clock_old == clock_new pid=14257 tid=14257 errno=4 - Interrupted system call 1 0x0040277b: main at kvm_clock_drift.c:216 2 0x7f7766fa7e44: ?? ??:0 3 0x0040286d: _start at ??:? kvmclock drift detected, old=5012221999, new=501411 Signed-off-b

Re: [PATCH 1/1] selftests: KVM: add test to print boottime wallclock

2023-10-20 Thread Dongli Zhang
Hi Sean and Andrew, On 10/18/23 23:51, Andrew Jones wrote: > On Wed, Oct 18, 2023 at 12:51:55PM -0700, Sean Christopherson wrote: >> On Fri, Oct 06, 2023, Dongli Zhang wrote: >>> As inspired by the discussion in [1], the boottime wallclock may drift due >>> to the fa

Re: [PATCH 1/1] selftests: KVM: add test to print boottime wallclock

2023-10-10 Thread Dongli Zhang
Hi Maxim, On 10/10/23 09:13, Maxim Levitsky wrote: > У пт, 2023-10-06 у 10:57 -0700, Dongli Zhang пише: >> As inspired by the discussion in [1], the boottime wallclock may drift due >> to the fact that the masterclock (or host monotonic clock) and kvmclock are >> ca

[PATCH 1/1] selftests: KVM: add test to print boottime wallclock

2023-10-06 Thread Dongli Zhang
diagnose the wallclock drift issue in the future. The idea is to wrmsr the MSR_KVM_WALL_CLOCK_NEW, and read the boottime wallclock nanoseconds immediately. References: [1] https://lore.kernel.org/all/2023100313.77586-1-nsa...@amazon.com Cc: David Woodhouse Signed-off-by: Dongli Zhang --- tools