Re: [PATCH 34/34] KVM: selftests: Add a memory region subtest to validate invalid flags

2023-11-08 Thread Anish Moorthy
Applying [1] and [2] reveals that this also breaks non-x86 builds- the
MEM_REGION_GPA/SLOT definitions are guarded behind an #ifdef
__x86_64__, while the usages introduced here aren't.

Should

On Sun, Nov 5, 2023 at 8:35 AM Paolo Bonzini  wrote:
>
> +   test_invalid_memory_region_flags();

be #ifdef'd, perhaps? I'm not quite sure what the intent is.

Side note: I wasn't able to get [2] to apply by copy-pasting the diff
and trying "git apply", and that was after checking out the relevant
commit. Eventually I just did it manually. If anyone can successfully
apply it, please let me know what you did so I can see what I was
doing wrong :)

[1] https://lore.kernel.org/kvm/20231108233723.3380042-1-amoor...@google.com/
[2] https://lore.kernel.org/kvm/affca7a8-116e-4b0f-9edf-6cdc05ba6...@redhat.com/


Re: [PATCH 27/34] KVM: selftests: Introduce VM "shape" to allow tests to specify the VM type

2023-11-08 Thread Anish Moorthy
On Wed, Nov 8, 2023 at 9:00 AM Anish Moorthy  wrote:
>
> This commit breaks the arm64 selftests build btw: looks like a simple 
> oversight?

Yup, fix is a one-liner. Posted below.

diff --git a/tools/testing/selftests/kvm/aarch64/page_fault_test.c 
b/tools/testing/selftests/kvm/aarch64/page_fault_test.c
index eb4217b7c768..08a5ca5bed56 100644
--- a/tools/testing/selftests/kvm/aarch64/page_fault_test.c
+++ b/tools/testing/selftests/kvm/aarch64/page_fault_test.c
@@ -705,7 +705,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)
 
print_test_banner(mode, p);
 
-   vm = vm_create(mode);
+   vm = vm_create(VM_SHAPE(mode));
setup_memslots(vm, p);
kvm_vm_elf_load(vm, program_invocation_name);
setup_ucall(vm);


Re: [PATCH 27/34] KVM: selftests: Introduce VM "shape" to allow tests to specify the VM type

2023-11-08 Thread Anish Moorthy
This commit breaks the arm64 selftests build btw: looks like a simple oversight?

$ cd ${LINUX_ROOT}/tools/testing/selftests/kvm
$ CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 make
# ...
aarch64/page_fault_test.c: In function ‘run_test’:
aarch64/page_fault_test.c:708:28: error: incompatible type for
argument 1 of ‘vm_create’
  708 | vm = vm_create(mode);
 |^~~~
 ||
 |enum vm_guest_mode
In file included from include/kvm_util.h:10,
 from aarch64/page_fault_test.c:14:
include/kvm_util_base.h:806:46: note: expected ‘struct vm_shape’ but
argument is of type ‘enum vm_guest_mode’
  806 | struct kvm_vm *vm_create(struct vm_shape shape);