[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e69cac02-87e0-e477-46cd-e94cacb1f5dc@redhat.com>
Date: Fri, 15 Oct 2021 18:20:06 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Ben Gardon <bgardon@...gle.com>, Mingwei Zhang <mizhang@...gle.com>
Cc: kvm <kvm@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
Sean Christopherson <seanjc@...gle.com>,
David Matlack <dmatlack@...gle.com>,
Jing Zhang <jingzhangos@...gle.com>,
Peter Xu <peterx@...hat.com>, Ben Gardon <bgorden@...gle.com>
Subject: Re: [PATCH] selftests: KVM: use dirty logging to check if page stats
work correctly
On 23/08/21 23:36, Ben Gardon wrote:
>> +#ifdef __x86_64__
>> + TEST_ASSERT(get_page_stats(X86_PAGE_SIZE_4K) != 0,
>> + "4K page is zero");
>> + if (p->backing_src == VM_MEM_SRC_ANONYMOUS_THP)
>> + TEST_ASSERT(get_page_stats(X86_PAGE_SIZE_2M) != 0,
>> + "2M page is zero");
>> + if (p->backing_src == VM_MEM_SRC_ANONYMOUS_HUGETLB_1GB)
>> + TEST_ASSERT(get_page_stats(X86_PAGE_SIZE_1G) != 0,
>> + "1G page is zero");
>> +#endif
> This check is correct, but it misses some cases. It'd be worth going
> back to ensure that all relevant backing src types are handled here.
> For example, this misses VM_MEM_SRC_ANONYMOUS_HUGETLB_2MB.
>
> We could also be more precise by asserting that the counts are at
> least some value or total to some value. THP introduces some flakiness
> but one way or another the mapping counts at this point should total
> up to account for the expected size of guest memory.
>
I am worried about flakiness here. I would prefer to have just a check
that _some_ pagesize is nonzero.
Also even for 1GB hugetlbfs not all processors support gigabyte pages,
so for those the stat would be 0.
Finally, please use the binary statistics interface, so that the test
does not require root.
Paolo
Powered by blists - more mailing lists