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@xxxxxxxxxxxxx/).
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
See https://lkml.kernel.org/r/20210419135443.12822-6-david@xxxxxxxxxx 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