mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
KVM: selftests: Use generic sys_clocksource_is_tsc() in vmx_nested_tsc_scaling_test
Despite its name, system_has_stable_tsc() just checks that system clocksource is 'tsc'; this can now be done with generic sys_clocksource_is_tsc(). No functional change intended. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Link: https://lore.kernel.org/r/20240109141121.1619463-3-vkuznets@redhat.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
e440c5f2e3
commit
410cb01ead
@ -116,23 +116,6 @@ static void l1_guest_code(struct vmx_pages *vmx_pages)
|
||||
GUEST_DONE();
|
||||
}
|
||||
|
||||
static bool system_has_stable_tsc(void)
|
||||
{
|
||||
bool tsc_is_stable;
|
||||
FILE *fp;
|
||||
char buf[4];
|
||||
|
||||
fp = fopen("/sys/devices/system/clocksource/clocksource0/current_clocksource", "r");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
|
||||
tsc_is_stable = fgets(buf, sizeof(buf), fp) &&
|
||||
!strncmp(buf, "tsc", sizeof(buf));
|
||||
|
||||
fclose(fp);
|
||||
return tsc_is_stable;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct kvm_vcpu *vcpu;
|
||||
@ -148,7 +131,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_VMX));
|
||||
TEST_REQUIRE(kvm_has_cap(KVM_CAP_TSC_CONTROL));
|
||||
TEST_REQUIRE(system_has_stable_tsc());
|
||||
TEST_REQUIRE(sys_clocksource_is_tsc());
|
||||
|
||||
/*
|
||||
* We set L1's scale factor to be a random number from 2 to 10.
|
||||
|
Loading…
Reference in New Issue
Block a user