[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7a56f2ad-4b3e-e861-5dc5-23e0efa47540@oracle.com>
Date: Fri, 12 Apr 2024 01:19:13 -0700
From: Dongli Zhang <dongli.zhang@...cle.com>
To: Jack Allister <jalliste@...zon.com>
Cc: bp@...en8.de, corbet@....net, dave.hansen@...ux.intel.com,
dwmw2@...radead.org, hpa@...or.com, kvm@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
mingo@...hat.com, paul@....org, pbonzini@...hat.com, seanjc@...gle.com,
tglx@...utronix.de, x86@...nel.org
Subject: Re: [PATCH v2 2/2] KVM: selftests: Add KVM/PV clock selftest to prove
timer correction
On 4/10/24 02:52, Jack Allister wrote:
> A VM's KVM/PV clock has an inherent relationship to it's TSC (guest). When
> either the host system live-updates or the VM is live-migrated this pairing
> of the two clock sources should stay the same.
>
[snip]
> +
> +int main(int argc, char *argv[])
> +{
> + struct kvm_vcpu *vcpu;
> + struct kvm_vm *vm;
> + bool scale_tsc;
> +
> + scale_tsc = argc > 1 && (!strncmp(argv[1], "-s", 3) ||
> + !strncmp(argv[1], "--scale-tsc", 10));
> +
> + TEST_REQUIRE(sys_clocksource_is_based_on_tsc());
> +
> + vm = vm_create_with_one_vcpu(&vcpu, guest_code);
> +
> + configure_pvclock(vm, vcpu);
> +
> + if (scale_tsc)
> + configure_scaled_tsc(vcpu);
> +
> + run_test(vm, vcpu);
> +
> + return 0;
> +}
David suggested make the scale_tsc automatically based on the availability of
the feature.
Therefore, if there is going to be v3, I suggest add kvm_vm_free() explicitly
(similar to close(fd)).
Thank you very much!
Dongli Zhang
Powered by blists - more mailing lists