On Fri, Aug 09, 2024 at 10:23:20AM -0700, Axel Rasmussen wrote: > On Fri, Aug 9, 2024 at 9:09 AM Peter Xu <peterx@xxxxxxxxxx> wrote: > > > > Use the new pfnmap API to allow huge MMIO mappings for VMs. The rest work > > is done perfectly on the other side (host_pfn_mapping_level()). > > I don't think it has to be done in this series, but a future > optimization to consider is having follow_pfnmap just tell the caller > about the mapping level directly. It already found this information as > part of its walk. I think there's a possibility to simplify KVM / > avoid it having to do its own walk again later. AFAIU pfnmap isn't special in this case, as we do the "walk pgtable twice" idea also to a generic page here, so probably not directly relevant to this patch alone. But I agree with you, sounds like something we can consider trying. I would be curious on whether the perf difference would be measurable in this specific case, though. I mean, this first walk will heat up all the things, so I'd expect the 2nd walk (which is lockless) later be pretty fast normally. Thanks, -- Peter Xu