From: David Matlack <dmatlack@google.com>
To: David Hildenbrand <david@redhat.com>
Cc: kvm@vger.kernel.org, Ben Gardon <bgardon@google.com>,
Joerg Roedel <joro@8bytes.org>, Jim Mattson <jmattson@google.com>,
Wanpeng Li <wanpengli@tencent.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Junaid Shahid <junaids@google.com>,
Andrew Jones <drjones@redhat.com>,
Matthew Wilcox <willy@infradead.org>, Yu Zhao <yuzhao@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2 0/6] KVM: x86/mmu: Fast page fault support for the TDP MMU
Date: Thu, 1 Jul 2021 22:11:15 +0000 [thread overview]
Message-ID: <YN49g7nW4pDUMiE8@google.com> (raw)
In-Reply-To: <3568552b-f72d-b158-dc49-3721375c18d5@redhat.com>
On Thu, Jul 01, 2021 at 07:00:51PM +0200, David Hildenbrand wrote:
> On 30.06.21 23:47, David Matlack wrote:
> > This patch series adds support for the TDP MMU in the fast_page_fault
> > path, which enables certain write-protection and access tracking faults
> > to be handled without taking the KVM MMU lock. This series brings the
> > performance of these faults up to par with the legacy MMU.
> >
> > Since there is not currently any KVM test coverage for access tracking
> > faults, this series introduces a new KVM selftest,
> > access_tracking_perf_test. Note that this test relies on page_idle to
> > enable access tracking from userspace (since it is the only available
> > usersapce API to do so) and page_idle is being considered for removal
> > from Linux
> > (https://lore.kernel.org/linux-mm/20210612000714.775825-1-willy@infradead.org/).
>
> Well, at least a new selftest that implicitly tests a part of page_idle --
> nice :)
>
> Haven't looked into the details, but if you can live with page tables
> starting unpopulated and only monitoring what gets populated on r/w access,
> you might be able to achieve something similar using /proc/self/pagemap and
> softdirty handling.
>
> Unpopulated page (e.g., via MADV_DISCARD) -> trigger read or write access ->
> sense if page populated in pagemap
> Populated page-> clear all softdirty bits -> trigger write access -> sense
> if page is softdirty in pagemap
Thanks for the suggestion. I modified by test to write 4 to
/proc/self/clear_refs rather than marking pages in page_idle. However,
by doing so I was no longer able to exercise KVM's fast_page_fault
handler [1].
It looks like the reason why is that clear_refs issues the
invalidate_range mmu notifiers, which will cause KVM to fully refault
the page from the host MM upon subsequent guest memory accesses. In
contrast, page_idle uses clear_young which KVM can handle with
fast_page_fault.
Let me know if I misunderstood your suggestion though.
[1] https://www.kernel.org/doc/html/latest/virt/kvm/locking.html#exception
>
> See https://lkml.kernel.org/r/20210419135443.12822-6-david@redhat.com for an
> example.
>
> But I'm actually fairly happy to see page_idel getting used. Maybe you could
> extend that test using pagemap, if it's applicable to your test setup.
>
> --
> Thanks,
>
> David / dhildenb
>
next prev parent reply other threads:[~2021-07-01 22:11 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-30 21:47 [PATCH v2 0/6] KVM: x86/mmu: Fast page fault support for the TDP MMU David Matlack
2021-06-30 21:47 ` [PATCH v2 1/6] KVM: x86/mmu: Rename cr2_or_gpa to gpa in fast_page_fault David Matlack
2021-07-12 20:01 ` Sean Christopherson
2021-06-30 21:47 ` [PATCH v2 2/6] KVM: x86/mmu: Fix use of enums in trace_fast_page_fault David Matlack
2021-07-12 16:14 ` Ben Gardon
2021-07-12 18:11 ` David Matlack
2021-07-12 19:53 ` Sean Christopherson
2021-07-12 20:38 ` David Matlack
2021-06-30 21:47 ` [PATCH v2 3/6] KVM: x86/mmu: Make walk_shadow_page_lockless_{begin,end} interoperate with the TDP MMU David Matlack
2021-07-12 17:02 ` Ben Gardon
2021-07-12 18:11 ` David Matlack
2021-07-12 20:20 ` Sean Christopherson
2021-07-12 20:23 ` Sean Christopherson
2021-06-30 21:48 ` [PATCH v2 4/6] KVM: x86/mmu: fast_page_fault support for " David Matlack
2021-07-01 2:54 ` kernel test robot
2021-07-01 2:54 ` kernel test robot
2021-07-01 4:27 ` kernel test robot
2021-07-01 4:27 ` kernel test robot
2021-07-01 18:27 ` David Matlack
2021-07-01 18:27 ` David Matlack
2021-07-09 18:45 ` David Matlack
2021-07-12 17:49 ` Ben Gardon
2021-07-12 18:20 ` David Matlack
2021-07-12 21:03 ` Sean Christopherson
2021-07-12 21:24 ` David Matlack
2021-06-30 21:48 ` [PATCH v2 5/6] KVM: selftests: Fix missing break in dirty_log_perf_test arg parsing David Matlack
2021-06-30 21:48 ` [PATCH v2 6/6] KVM: selftests: Introduce access_tracking_perf_test David Matlack
2021-07-01 1:15 ` [PATCH v2 0/6] KVM: x86/mmu: Fast page fault support for the TDP MMU Matthew Wilcox
[not found] ` <CABgObfZUFWCAvKoxDzGjmksFnwZgbnpX9GuC+nhiVLa-Fhwj6A@mail.gmail.com>
2021-07-01 12:08 ` Matthew Wilcox
2021-07-01 16:50 ` David Matlack
2021-07-01 17:00 ` David Hildenbrand
2021-07-01 22:11 ` David Matlack [this message]
2021-07-02 7:53 ` David Hildenbrand
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=YN49g7nW4pDUMiE8@google.com \
--to=dmatlack@google.com \
--cc=akpm@linux-foundation.org \
--cc=bgardon@google.com \
--cc=david@redhat.com \
--cc=drjones@redhat.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=junaids@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=willy@infradead.org \
--cc=yuzhao@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.