lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 2 Aug 2023 12:30:43 -0700
From:   Sean Christopherson <seanjc@...gle.com>
To:     Bibo Mao <maobibo@...ngson.cn>
Cc:     Paolo Bonzini <pbonzini@...hat.com>, Shuah Khan <shuah@...nel.org>,
        kvm@...r.kernel.org, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org, Oliver Upton <oliver.upton@...ux.dev>
Subject: Re: [PATCH] KVM: selftests: use unified time type for comparison

+Oliver to get input on something beyond non-x86, and because I hate anything
clock related :-)

On Mon, Jul 31, 2023, Bibo Mao wrote:
> With test case kvm_page_table_test, start time is acquired with
> time type CLOCK_MONOTONIC_RAW, however end time in function timespec_elapsed
> is acquired with time type CLOCK_MONOTONIC. This will cause
> inaccurate elapsed time calculation on some platform such as LoongArch.
> 
> This patch modified test case kvm_page_table_test, and uses unified
> time type CLOCK_MONOTONIC for start time.

AFAICT, there's zero reason to use CLOCK_MONOTONIC_RAW instead of CLOCK_MONOTONIC.
If there are no objections, I'll take this through kvm-x86/selftests for 6.6.

> Signed-off-by: Bibo Mao <maobibo@...ngson.cn>
> ---
>  tools/testing/selftests/kvm/kvm_page_table_test.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/kvm_page_table_test.c b/tools/testing/selftests/kvm/kvm_page_table_test.c
> index b3b00be1ef82..69f26d80c821 100644
> --- a/tools/testing/selftests/kvm/kvm_page_table_test.c
> +++ b/tools/testing/selftests/kvm/kvm_page_table_test.c
> @@ -200,7 +200,7 @@ static void *vcpu_worker(void *data)
>  		if (READ_ONCE(host_quit))
>  			return NULL;
>  
> -		clock_gettime(CLOCK_MONOTONIC_RAW, &start);
> +		clock_gettime(CLOCK_MONOTONIC, &start);
>  		ret = _vcpu_run(vcpu);
>  		ts_diff = timespec_elapsed(start);
>  
> @@ -367,7 +367,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)
>  	/* Test the stage of KVM creating mappings */
>  	*current_stage = KVM_CREATE_MAPPINGS;
>  
> -	clock_gettime(CLOCK_MONOTONIC_RAW, &start);
> +	clock_gettime(CLOCK_MONOTONIC, &start);
>  	vcpus_complete_new_stage(*current_stage);
>  	ts_diff = timespec_elapsed(start);
>  
> @@ -380,7 +380,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)
>  
>  	*current_stage = KVM_UPDATE_MAPPINGS;
>  
> -	clock_gettime(CLOCK_MONOTONIC_RAW, &start);
> +	clock_gettime(CLOCK_MONOTONIC, &start);
>  	vcpus_complete_new_stage(*current_stage);
>  	ts_diff = timespec_elapsed(start);
>  
> @@ -392,7 +392,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)
>  
>  	*current_stage = KVM_ADJUST_MAPPINGS;
>  
> -	clock_gettime(CLOCK_MONOTONIC_RAW, &start);
> +	clock_gettime(CLOCK_MONOTONIC, &start);
>  	vcpus_complete_new_stage(*current_stage);
>  	ts_diff = timespec_elapsed(start);
>  
> -- 
> 2.27.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ