All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wainer dos Santos Moschetta <wainersm@redhat.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>
Cc: David Hildenbrand <david@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Peter Xu <peterx@redhat.com>, Andrew Jones <drjones@redhat.com>
Subject: Re: [PATCH 09/10] KVM: selftests: Make set_memory_region_test common to all architectures
Date: Tue, 14 Apr 2020 11:43:09 -0300	[thread overview]
Message-ID: <6a58ddfc-2d1d-63fb-9910-0ba4a6a81862@redhat.com> (raw)
In-Reply-To: <20200410231707.7128-10-sean.j.christopherson@intel.com>

Hi Sean,

On 4/10/20 8:17 PM, Sean Christopherson wrote:
> Make set_memory_region_test available on all architectures by wrapping
> the bits that are x86-specific in ifdefs.  All architectures can do
> no-harm testing of running with zero memslots, and a future testcase
> to create the maximum number of memslots will also be architecture
> agnostic.

I got this series successfully compiled in aarch64 and s390x. However 
the zero memslot test fails on both arches on vcpu_run().

The machines I borrowed got RHEL-8.1.0 installed (kernel 4.18.0-147). 
Perhaps I am using a too old kernel? Anyway, trying to get at least an 
aarch64 box with newer kernel to double check.

The error on aarch64:

Testing KVM_RUN with zero added memory regions
==== Test Assertion Failure ====
   lib/kvm_util.c:1179: ret == 0
   pid=83625 tid=83625 - Exec format error
      1    0x000000000040114f: test_zero_memory_regions at 
set_memory_region_test.c:313
      2     (inlined by) main at set_memory_region_test.c:383
      3    0x0000ffff92e70d63: ?? ??:0
      4    0x0000000000401367: _start at :?
   KVM_RUN IOCTL failed, rc: -1 errno: 8

And on s390x:

Testing KVM_RUN with zero added memory regions
==== Test Assertion Failure ====
   lib/kvm_util.c:1179: ret == 0
   pid=41263 tid=-1 - Invalid argument
      1    0x00000000010029b5: vcpu_run at kvm_util.c:1178
      2    0x0000000001001563: test_zero_memory_regions at 
set_memory_region_test.c:313
      3     (inlined by) main at set_memory_region_test.c:383
      4    0x000003ffb80a3611: ?? ??:0
      5    0x00000000010017bd: .annobin_init.c.hot at crt1.o:?
      6    0xffffffffffffffff: ?? ??:0
   KVM_RUN IOCTL failed, rc: -1 errno: 14

Thanks,

Wainer

>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>   tools/testing/selftests/kvm/.gitignore              |  2 +-
>   tools/testing/selftests/kvm/Makefile                |  4 +++-
>   .../kvm/{x86_64 => }/set_memory_region_test.c       | 13 ++++++++++++-
>   3 files changed, 16 insertions(+), 3 deletions(-)
>   rename tools/testing/selftests/kvm/{x86_64 => }/set_memory_region_test.c (97%)
>
> diff --git a/tools/testing/selftests/kvm/.gitignore b/tools/testing/selftests/kvm/.gitignore
> index 16877c3daabf..5947cc119abc 100644
> --- a/tools/testing/selftests/kvm/.gitignore
> +++ b/tools/testing/selftests/kvm/.gitignore
> @@ -6,7 +6,6 @@
>   /x86_64/hyperv_cpuid
>   /x86_64/mmio_warning_test
>   /x86_64/platform_info_test
> -/x86_64/set_memory_region_test
>   /x86_64/set_sregs_test
>   /x86_64/smm_test
>   /x86_64/state_test
> @@ -21,4 +20,5 @@
>   /demand_paging_test
>   /dirty_log_test
>   /kvm_create_max_vcpus
> +/set_memory_region_test
>   /steal_time
> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
> index 712a2ddd2a27..7af62030c12f 100644
> --- a/tools/testing/selftests/kvm/Makefile
> +++ b/tools/testing/selftests/kvm/Makefile
> @@ -17,7 +17,6 @@ TEST_GEN_PROGS_x86_64 += x86_64/evmcs_test
>   TEST_GEN_PROGS_x86_64 += x86_64/hyperv_cpuid
>   TEST_GEN_PROGS_x86_64 += x86_64/mmio_warning_test
>   TEST_GEN_PROGS_x86_64 += x86_64/platform_info_test
> -TEST_GEN_PROGS_x86_64 += x86_64/set_memory_region_test
>   TEST_GEN_PROGS_x86_64 += x86_64/set_sregs_test
>   TEST_GEN_PROGS_x86_64 += x86_64/smm_test
>   TEST_GEN_PROGS_x86_64 += x86_64/state_test
> @@ -32,12 +31,14 @@ TEST_GEN_PROGS_x86_64 += clear_dirty_log_test
>   TEST_GEN_PROGS_x86_64 += demand_paging_test
>   TEST_GEN_PROGS_x86_64 += dirty_log_test
>   TEST_GEN_PROGS_x86_64 += kvm_create_max_vcpus
> +TEST_GEN_PROGS_x86_64 += set_memory_region_test
>   TEST_GEN_PROGS_x86_64 += steal_time
>   
>   TEST_GEN_PROGS_aarch64 += clear_dirty_log_test
>   TEST_GEN_PROGS_aarch64 += demand_paging_test
>   TEST_GEN_PROGS_aarch64 += dirty_log_test
>   TEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus
> +TEST_GEN_PROGS_aarch64 += set_memory_region_test
>   TEST_GEN_PROGS_aarch64 += steal_time
>   
>   TEST_GEN_PROGS_s390x = s390x/memop
> @@ -46,6 +47,7 @@ TEST_GEN_PROGS_s390x += s390x/sync_regs_test
>   TEST_GEN_PROGS_s390x += demand_paging_test
>   TEST_GEN_PROGS_s390x += dirty_log_test
>   TEST_GEN_PROGS_s390x += kvm_create_max_vcpus
> +TEST_GEN_PROGS_s390x += set_memory_region_test
>   
>   TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M))
>   LIBKVM += $(LIBKVM_$(UNAME_M))
> diff --git a/tools/testing/selftests/kvm/x86_64/set_memory_region_test.c b/tools/testing/selftests/kvm/set_memory_region_test.c
> similarity index 97%
> rename from tools/testing/selftests/kvm/x86_64/set_memory_region_test.c
> rename to tools/testing/selftests/kvm/set_memory_region_test.c
> index c274ce6b4ba2..0f36941ebb96 100644
> --- a/tools/testing/selftests/kvm/x86_64/set_memory_region_test.c
> +++ b/tools/testing/selftests/kvm/set_memory_region_test.c
> @@ -18,6 +18,7 @@
>   
>   #define VCPU_ID 0
>   
> +#ifdef __x86_64__
>   /*
>    * Somewhat arbitrary location and slot, intended to not overlap anything.  The
>    * location and size are specifically 2mb sized/aligned so that the initial
> @@ -288,6 +289,7 @@ static void test_delete_memory_region(void)
>   
>   	kvm_vm_free(vm);
>   }
> +#endif /* __x86_64__ */
>   
>   static void test_zero_memory_regions(void)
>   {
> @@ -299,13 +301,18 @@ static void test_zero_memory_regions(void)
>   	vm = vm_create(VM_MODE_DEFAULT, 0, O_RDWR);
>   	vm_vcpu_add(vm, VCPU_ID);
>   
> +#ifdef __x86_64__
>   	TEST_ASSERT(!ioctl(vm_get_fd(vm), KVM_SET_NR_MMU_PAGES, 64),
>   		    "KVM_SET_NR_MMU_PAGES failed, errno = %d\n", errno);
> -
> +#endif
>   	vcpu_run(vm, VCPU_ID);
>   
>   	run = vcpu_state(vm, VCPU_ID);
> +#ifdef __x86_64__
>   	TEST_ASSERT(run->exit_reason == KVM_EXIT_INTERNAL_ERROR,
> +#else
> +	TEST_ASSERT(run->exit_reason != KVM_EXIT_UNKNOWN,
> +#endif
>   		    "Unexpected exit_reason = %u\n", run->exit_reason);
>   
>   	kvm_vm_free(vm);
> @@ -313,13 +320,16 @@ static void test_zero_memory_regions(void)
>   
>   int main(int argc, char *argv[])
>   {
> +#ifdef __x86_64__
>   	int i, loops;
> +#endif
>   
>   	/* Tell stdout not to buffer its content */
>   	setbuf(stdout, NULL);
>   
>   	test_zero_memory_regions();
>   
> +#ifdef __x86_64__
>   	if (argc > 1)
>   		loops = atoi(argv[1]);
>   	else
> @@ -332,6 +342,7 @@ int main(int argc, char *argv[])
>   	pr_info("Testing DELETE of in-use region, %d loops\n", loops);
>   	for (i = 0; i < loops; i++)
>   		test_delete_memory_region();
> +#endif
>   
>   	return 0;
>   }


  reply	other threads:[~2020-04-14 14:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-10 23:16 [PATCH 00/10] KVM: selftests: Add KVM_SET_MEMORY_REGION tests Sean Christopherson
2020-04-10 23:16 ` [PATCH 01/10] KVM: selftests: Take vcpu pointer instead of id in vm_vcpu_rm() Sean Christopherson
2020-04-13 18:26   ` Wainer dos Santos Moschetta
2020-04-13 21:26     ` Sean Christopherson
2020-04-14  8:25       ` Andrew Jones
2020-04-14 13:02         ` Wainer dos Santos Moschetta
2020-04-15 15:11       ` Paolo Bonzini
2020-04-14 16:02   ` Andrew Jones
2020-04-10 23:16 ` [PATCH 02/10] KVM: selftests: Use kernel's list instead of homebrewed replacement Sean Christopherson
2020-04-14 16:03   ` Andrew Jones
2020-04-10 23:17 ` [PATCH 03/10] KVM: selftests: Add util to delete memory region Sean Christopherson
2020-04-13 18:52   ` Wainer dos Santos Moschetta
2020-04-14 16:04   ` Andrew Jones
2020-04-10 23:17 ` [PATCH 04/10] KVM: selftests: Add GUEST_ASSERT variants to pass values to host Sean Christopherson
2020-04-14 16:02   ` Andrew Jones
2020-04-10 23:17 ` [PATCH 05/10] KVM: sefltests: Add explicit synchronization to move mem region test Sean Christopherson
2020-04-10 23:17 ` [PATCH 06/10] KVM: selftests: Add "delete" testcase to set_memory_region_test Sean Christopherson
2020-04-14 16:19   ` Andrew Jones
2020-04-14 16:29     ` Andrew Jones
2020-04-10 23:17 ` [PATCH 07/10] selftests: kvm: Add vm_get_fd() in kvm_util Sean Christopherson
2020-04-10 23:17 ` [PATCH 08/10] KVM: selftests: Add "zero" testcase to set_memory_region_test Sean Christopherson
2020-04-10 23:17 ` [PATCH 09/10] KVM: selftests: Make set_memory_region_test common to all architectures Sean Christopherson
2020-04-14 14:43   ` Wainer dos Santos Moschetta [this message]
2020-04-10 23:17 ` [PATCH 10/10] selftests: kvm: Add testcase for creating max number of memslots Sean Christopherson
2020-04-13 13:22   ` Wainer dos Santos Moschetta
2020-04-15 15:40 ` [PATCH 00/10] KVM: selftests: Add KVM_SET_MEMORY_REGION tests Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a58ddfc-2d1d-63fb-9910-0ba4a6a81862@redhat.com \
    --to=wainersm@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=drjones@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.