From: Paolo Bonzini <pbonzini@redhat.com>
To: Ben Gardon <bgardon@google.com>, Mingwei Zhang <mizhang@google.com>
Cc: kvm <kvm@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Sean Christopherson <seanjc@google.com>,
David Matlack <dmatlack@google.com>,
Jing Zhang <jingzhangos@google.com>, Peter Xu <peterx@redhat.com>,
Ben Gardon <bgorden@google.com>
Subject: Re: [PATCH] selftests: KVM: use dirty logging to check if page stats work correctly
Date: Fri, 15 Oct 2021 18:20:06 +0200 [thread overview]
Message-ID: <e69cac02-87e0-e477-46cd-e94cacb1f5dc@redhat.com> (raw)
In-Reply-To: <CANgfPd9RR+a675MgLuyy6g-Ab-4jSHVV+mwxJnwOHCiC6KgAhA@mail.gmail.com>
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
prev parent reply other threads:[~2021-10-15 16:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 5:16 [PATCH] selftests: KVM: use dirty logging to check if page stats work correctly Mingwei Zhang
2021-08-23 21:36 ` Ben Gardon
2021-10-15 16:20 ` Paolo Bonzini [this message]
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=e69cac02-87e0-e477-46cd-e94cacb1f5dc@redhat.com \
--to=pbonzini@redhat.com \
--cc=bgardon@google.com \
--cc=bgorden@google.com \
--cc=dmatlack@google.com \
--cc=jingzhangos@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mizhang@google.com \
--cc=peterx@redhat.com \
--cc=seanjc@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox