linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: selftests: fix hyperv_clock test
@ 2021-08-04 11:20 Maxim Levitsky
  2021-08-04 12:24 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Maxim Levitsky @ 2021-08-04 11:20 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Sean Christopherson, Shuah Khan, Vitaly Kuznetsov,
	Maxim Levitsky, linux-kernel,
	open list:KERNEL SELFTEST FRAMEWORK

The test was mistakenly using addr_gpa2hva on a gva
and that happened to work accidentally.

commit 106a2e766eae ("KVM: selftests:
Lower the min virtual address for misc page allocations")
revealed this bug.

Fixes: 106a2e766eae ("KVM: selftests: Lower the min virtual address for misc page allocations")

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 tools/testing/selftests/kvm/x86_64/hyperv_clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_clock.c b/tools/testing/selftests/kvm/x86_64/hyperv_clock.c
index bab10ae787b6..e0b2bb1339b1 100644
--- a/tools/testing/selftests/kvm/x86_64/hyperv_clock.c
+++ b/tools/testing/selftests/kvm/x86_64/hyperv_clock.c
@@ -215,7 +215,7 @@ int main(void)
 	vcpu_set_hv_cpuid(vm, VCPU_ID);
 
 	tsc_page_gva = vm_vaddr_alloc_page(vm);
-	memset(addr_gpa2hva(vm, tsc_page_gva), 0x0, getpagesize());
+	memset(addr_gva2hva(vm, tsc_page_gva), 0x0, getpagesize());
 	TEST_ASSERT((addr_gva2gpa(vm, tsc_page_gva) & (getpagesize() - 1)) == 0,
 		"TSC page has to be page aligned\n");
 	vcpu_args_set(vm, VCPU_ID, 2, tsc_page_gva, addr_gva2gpa(vm, tsc_page_gva));
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: selftests: fix hyperv_clock test
  2021-08-04 11:20 [PATCH] KVM: selftests: fix hyperv_clock test Maxim Levitsky
@ 2021-08-04 12:24 ` Paolo Bonzini
  2021-08-04 13:02   ` Maxim Levitsky
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2021-08-04 12:24 UTC (permalink / raw)
  To: Maxim Levitsky, kvm
  Cc: Sean Christopherson, Shuah Khan, Vitaly Kuznetsov, linux-kernel,
	open list:KERNEL SELFTEST FRAMEWORK

On 04/08/21 13:20, Maxim Levitsky wrote:
> The test was mistakenly using addr_gpa2hva on a gva
> and that happened to work accidentally.
> 
> commit 106a2e766eae ("KVM: selftests:
> Lower the min virtual address for misc page allocations")
> revealed this bug.
> 
> Fixes: 106a2e766eae ("KVM: selftests: Lower the min virtual address for misc page allocations")

The right "Fixes" is 2c7f76b4c42b ("selftests: kvm: Add basic Hyper-V 
clocksources tests", 2021-03-18).

Paolo

> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
>   tools/testing/selftests/kvm/x86_64/hyperv_clock.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_clock.c b/tools/testing/selftests/kvm/x86_64/hyperv_clock.c
> index bab10ae787b6..e0b2bb1339b1 100644
> --- a/tools/testing/selftests/kvm/x86_64/hyperv_clock.c
> +++ b/tools/testing/selftests/kvm/x86_64/hyperv_clock.c
> @@ -215,7 +215,7 @@ int main(void)
>   	vcpu_set_hv_cpuid(vm, VCPU_ID);
>   
>   	tsc_page_gva = vm_vaddr_alloc_page(vm);
> -	memset(addr_gpa2hva(vm, tsc_page_gva), 0x0, getpagesize());
> +	memset(addr_gva2hva(vm, tsc_page_gva), 0x0, getpagesize());
>   	TEST_ASSERT((addr_gva2gpa(vm, tsc_page_gva) & (getpagesize() - 1)) == 0,
>   		"TSC page has to be page aligned\n");
>   	vcpu_args_set(vm, VCPU_ID, 2, tsc_page_gva, addr_gva2gpa(vm, tsc_page_gva));
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: selftests: fix hyperv_clock test
  2021-08-04 12:24 ` Paolo Bonzini
@ 2021-08-04 13:02   ` Maxim Levitsky
  0 siblings, 0 replies; 3+ messages in thread
From: Maxim Levitsky @ 2021-08-04 13:02 UTC (permalink / raw)
  To: Paolo Bonzini, kvm
  Cc: Sean Christopherson, Shuah Khan, Vitaly Kuznetsov, linux-kernel,
	open list:KERNEL SELFTEST FRAMEWORK

On Wed, 2021-08-04 at 14:24 +0200, Paolo Bonzini wrote:
> On 04/08/21 13:20, Maxim Levitsky wrote:
> > The test was mistakenly using addr_gpa2hva on a gva
> > and that happened to work accidentally.
> > 
> > commit 106a2e766eae ("KVM: selftests:
> > Lower the min virtual address for misc page allocations")
> > revealed this bug.
> > 
> > Fixes: 106a2e766eae ("KVM: selftests: Lower the min virtual address for misc page allocations")
> 
> The right "Fixes" is 2c7f76b4c42b ("selftests: kvm: Add basic Hyper-V 
> clocksources tests", 2021-03-18).

Makes sense. I wasn't sure about which commit to blame here.
I'll resend the patch.

Best regards,
	Maxim Levitsky
> 
> Paolo
> 
> > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> > ---
> >   tools/testing/selftests/kvm/x86_64/hyperv_clock.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_clock.c b/tools/testing/selftests/kvm/x86_64/hyperv_clock.c
> > index bab10ae787b6..e0b2bb1339b1 100644
> > --- a/tools/testing/selftests/kvm/x86_64/hyperv_clock.c
> > +++ b/tools/testing/selftests/kvm/x86_64/hyperv_clock.c
> > @@ -215,7 +215,7 @@ int main(void)
> >   	vcpu_set_hv_cpuid(vm, VCPU_ID);
> >   
> >   	tsc_page_gva = vm_vaddr_alloc_page(vm);
> > -	memset(addr_gpa2hva(vm, tsc_page_gva), 0x0, getpagesize());
> > +	memset(addr_gva2hva(vm, tsc_page_gva), 0x0, getpagesize());
> >   	TEST_ASSERT((addr_gva2gpa(vm, tsc_page_gva) & (getpagesize() - 1)) == 0,
> >   		"TSC page has to be page aligned\n");
> >   	vcpu_args_set(vm, VCPU_ID, 2, tsc_page_gva, addr_gva2gpa(vm, tsc_page_gva));
> > 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-04 13:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 11:20 [PATCH] KVM: selftests: fix hyperv_clock test Maxim Levitsky
2021-08-04 12:24 ` Paolo Bonzini
2021-08-04 13:02   ` Maxim Levitsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).