[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ac09476d-da8d-db0f-1af2-93dc41251bb0@redhat.com>
Date: Tue, 18 Oct 2022 09:13:16 +0800
From: Gavin Shan <gshan@...hat.com>
To: "Maciej S. Szmigiero" <mail@...iej.szmigiero.name>
Cc: kvmarm@...ts.cs.columbia.edu, kvmarm@...ts.linux.dev,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
ajones@...tanamicro.com, pbonzini@...hat.com, maz@...nel.org,
shuah@...nel.org, oliver.upton@...ux.dev, seanjc@...gle.com,
peterx@...hat.com, ricarkol@...gle.com, zhenyzha@...hat.com,
shan.gavin@...il.com
Subject: Re: [PATCH 5/6] KVM: selftests: memslot_perf_test: Consolidate memory
sizes
On 10/18/22 5:36 AM, Maciej S. Szmigiero wrote:
> On 14.10.2022 09:19, Gavin Shan wrote:
>> 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
>> it's applied, the following command works fine on 64KB-page-size-host and
>> 4KB-page-size-guest.
>>
>> # ./memslot_perf_test -v -s 512
>>
>> Signed-off-by: Gavin Shan <gshan@...hat.com>
>> ---
>> .../testing/selftests/kvm/memslot_perf_test.c | 18 ++++++++++--------
>> 1 file changed, 10 insertions(+), 8 deletions(-)
>>
>> diff --git a/tools/testing/selftests/kvm/memslot_perf_test.c b/tools/testing/selftests/kvm/memslot_perf_test.c
>> index d587bd952ff9..e6d34744b45d 100644
>> --- a/tools/testing/selftests/kvm/memslot_perf_test.c
>> +++ b/tools/testing/selftests/kvm/memslot_perf_test.c
>> @@ -25,12 +25,14 @@
>> #include <kvm_util.h>
>> #include <processor.h>
>> -#define MEM_SIZE ((512U << 20) + 4096)
>> -#define MEM_GPA 0x10000000UL
>> +#define MEM_EXTRA_SIZE 0x10000
>
> So the biggest page size supported right now is 64 KiB - it would be
> good to have an assert somewhere to explicitly check for this
> (regardless of implicit checks present in other calculations).
>
> Also, an expression like "(64 << 10)" is more readable than a "1"
> with a tail of zeroes (it's easy to add one zero too many or be one
> zero short).
>
Yes, it makes sense to me. Lets add check in check_memory_sizes(), which
was added in the previous patch, to fail early if host/guest page size
exceeds 64KB.
if (host_page_size > SIZE_64KiB || guest_page_size > SIZE_64KiB) {
pr_info("Unsupported page size on host (0x%x) or guest (0x%x)\n",
host_page_size, guest_page_size);
}
For the macros, I think all of us agree on KiB, MiB, GiB, TiB and
their variants :)
Thanks,
Gavin
Powered by blists - more mailing lists