[PATCH 0/6] KVM: selftests: memslot_perf_test: aarch64 cleanup/fixes

2022-10-14 Thread Gavin Shan
kvm/selftests/memslots_perf_test doesn't work with 64KB-page-size-host and 4KB-page-size-guest on aarch64. In the implementation, the host and guest page size have been hardcoded to 4KB. It's ovbiously not working on aarch64 which supports 4KB, 16KB, 64KB individually on host and guest. This serie

[PATCH 1/6] KVM: selftests: memslot_perf_test: Use data->nslots in prepare_vm()

2022-10-14 Thread Gavin Shan
In prepare_vm(), 'data->nslots' is assigned with 'max_mem_slots - 1' at the beginning, meaning they are interchangeable. Use 'data->nslots' isntead of 'max_mem_slots - 1'. With this, it becomes easier to move the logic of probing number of slots into upper layer in subsequent patches. No function

[PATCH 2/6] KVM: selftests: memslot_perf_test: Consolidate loop conditions in prepare_vm()

2022-10-14 Thread Gavin Shan
There are two loops in prepare_vm(), which have different conditions. 'slot' is treated as meory slot index in the first loop, but index of the host virtual address array in the second loop. It makes it a bit hard to understand the code. Change the usage of 'slot' in the second loop, to treat it a

[PATCH 5/6] KVM: selftests: memslot_perf_test: Consolidate memory sizes

2022-10-14 Thread Gavin Shan
The addresses and sizes passed to madvise() and vm_userspace_mem_region_add() should be aligned to host page size, which can be 64KB on aarch64. So it's wrong by passing additional fixed 4KB memory area to various tests. Fix it by passing additional fixed 64KB memory area to various tests. After i

[PATCH 3/6] KVM: selftests: memslot_perf_test: Probe memory slots for once

2022-10-14 Thread Gavin Shan
prepare_vm() is called in every iteration and run. The allowed memory slots (KVM_CAP_NR_MEMSLOTS) are probed for multiple times. It's not free and unnecessary. Move the probing logic for the allowed memory slots to parse_args() for once, which is upper layer of prepare_vm(). No functional change

[PATCH 4/6] KVM: selftests: memslot_perf_test: Support variable guest page size

2022-10-14 Thread Gavin Shan
The test case is obviously broken on aarch64 because non-4KB guest page size is supported. The guest page size on aarch64 could be 4KB, 16KB or 64KB. This supports variable guest page size, mostly for aarch64. - The host determines the guest page size when virtual machine is created. The va

[PATCH 6/6] KVM: selftests: memslot_perf_test: Report optimal memory slots

2022-10-14 Thread Gavin Shan
The memory area in each slot should be aligned to host page size. Otherwise, the test will failure. For example, the following command fails with the following messages with 64KB-page-size-host and 4KB-pae-size-guest. It's not user friendly. Lets do something to report the optimal memory slots, ins

Re: [REPOST][URGENT] kvmarm mailing list migration

2022-10-14 Thread Mark Rutland
On Thu, Oct 13, 2022 at 04:09:20PM +0100, Marc Zyngier wrote: > [Reposting this, as it has been almost two weeks since the initial > announcement and we're still at sub-10% of the users having > subscribed to the new list] FWIW, I didn't subscribe until just now because there weren't clear instr

Re: [PATCH] KVM: arm64: vgic: fix wrong loop condition in scan_its_table()

2022-10-14 Thread Marc Zyngier
On Thu, 13 Oct 2022 17:42:31 +0100, Eric Auger wrote: > > Hi Eric, > > On 10/12/22 20:33, Marc Zyngier wrote: > > Hi Eric, > > > > Before I comment on this patch, a couple of things that need > > addressing: > > > >> "Cc: marc.zyng...@arm.com, cd...@linaro.org" > > > > None of these two addre

Re: [PATCH v5 3/7] KVM: x86: Allow to use bitmap in ring-based dirty page tracking

2022-10-14 Thread Peter Xu
On Tue, Oct 11, 2022 at 01:12:43AM +, Oliver Upton wrote: > The VMM must know something about the architecture it is running on, as > it calls KVM_DEV_ARM_ITS_SAVE_TABLES after all... IIUC this is still a kernel impl detail to flush data into guest pages within this ioctl, or am I wrong? For

[PATCH v3] KVM: arm64: nvhe: Fix build with profile optimization

2022-10-14 Thread Denis Nikitin
Kernel build with clang and KCFLAGS=-fprofile-sample-use= fails with: error: arch/arm64/kvm/hyp/nvhe/kvm_nvhe.tmp.o: Unexpected SHT_REL section ".rel.llvm.call-graph-profile" Starting from 13.0.0 llvm can generate SHT_REL section, see https://reviews.llvm.org/rGca3bdb57fa1ac98b711a735de048c12b5fd

Re: [PATCH v9 01/14] KVM: selftests: Add a userfaultfd library

2022-10-14 Thread Sean Christopherson
On Tue, Oct 11, 2022, Ricardo Koller wrote: > +struct uffd_desc *uffd_setup_demand_paging(int uffd_mode, > + useconds_t uffd_delay, void *hva, uint64_t len, > + uffd_handler_t handler) s/uffd_delay/delay, and then this prototype is easier to align. Keeping the uffd_ prefix

Re: [PATCH v9 10/14] KVM: selftests: aarch64: Add aarch64/page_fault_test

2022-10-14 Thread Sean Christopherson
On Tue, Oct 11, 2022, Ricardo Koller wrote: > +/* Returns true to continue the test, and false if it should be skipped. */ > +static bool punch_hole_in_backing_store(struct kvm_vm *vm, > + struct userspace_mem_region *region) > +{ > + void *hva = (void *)regi

Re: [PATCH v9 11/14] KVM: selftests: aarch64: Add userfaultfd tests into page_fault_test

2022-10-14 Thread Sean Christopherson
On Tue, Oct 11, 2022, Ricardo Koller wrote: > /* Returns true to continue the test, and false if it should be skipped. */ > +static int uffd_generic_handler(int uffd_mode, int uffd, > + struct uffd_msg *msg, struct uffd_args *args, > + bool expect_write) Align. static int

Re: [PATCH v9 12/14] KVM: selftests: aarch64: Add dirty logging tests into page_fault_test

2022-10-14 Thread Sean Christopherson
On Tue, Oct 11, 2022, Ricardo Koller wrote: > @@ -395,6 +415,21 @@ static bool punch_hole_in_backing_store(struct kvm_vm > *vm, > return true; > } > > +static bool check_write_in_dirty_log(struct kvm_vm *vm, > + struct userspace_mem_region *region, uint64_t host_pg_nr) static

Re: [PATCH v9 00/14] KVM: selftests: Add aarch64/page_fault_test

2022-10-14 Thread Sean Christopherson
On Tue, Oct 11, 2022, Ricardo Koller wrote: > Ricardo Koller (14): > KVM: selftests: Add a userfaultfd library > KVM: selftests: aarch64: Add virt_get_pte_hva() library function > KVM: selftests: Add missing close and munmap in > __vm_mem_region_delete() > KVM: selftests: aarch64: Const

Re: [PATCH v9 00/14] KVM: selftests: Add aarch64/page_fault_test

2022-10-14 Thread Ricardo Koller
On Fri, Oct 14, 2022 at 09:30:10PM +, Sean Christopherson wrote: > On Tue, Oct 11, 2022, Ricardo Koller wrote: > > Ricardo Koller (14): > > KVM: selftests: Add a userfaultfd library > > KVM: selftests: aarch64: Add virt_get_pte_hva() library function > > KVM: selftests: Add missing close