From: Alex Williamson <alex.williamson@redhat.com>
To: alex.williamson@redhat.com
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
peterx@redhat.com, mitchell.augustin@canonical.com,
clg@redhat.com, akpm@linux-foundation.org, linux-mm@kvack.org,
David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH 4/5] mm: Provide page mask in struct follow_pfnmap_args
Date: Fri, 14 Feb 2025 10:17:35 -0700 [thread overview]
Message-ID: <20250214101735.4b180123.alex.williamson@redhat.com> (raw)
In-Reply-To: <20250205231728.2527186-5-alex.williamson@redhat.com>
Nudge. Peter Xu provided an R-b for the series. Would any other mm
folks like to chime in here to provide objection or approval for this
change and merging it through the vfio tree? Series[1]. Thanks!
Alex
[1]https://lore.kernel.org/all/20250205231728.2527186-1-alex.williamson@redhat.com/
On Wed, 5 Feb 2025 16:17:20 -0700
Alex Williamson <alex.williamson@redhat.com> wrote:
> follow_pfnmap_start() walks the page table for a given address and
> fills out the struct follow_pfnmap_args in pfnmap_args_setup().
> The page mask of the page table level is already provided to this
> latter function for calculating the pfn. This page mask can also be
> useful for the caller to determine the extent of the contiguous
> mapping.
>
> For example, vfio-pci now supports huge_fault for pfnmaps and is able
> to insert pud and pmd mappings. When we DMA map these pfnmaps, ex.
> PCI MMIO BARs, we iterate follow_pfnmap_start() to get each pfn to test
> for a contiguous pfn range. Providing the mapping page mask allows us
> to skip the extent of the mapping level. Assuming a 1GB pud level and
> 4KB page size, iterations are reduced by a factor of 256K. In wall
> clock time, mapping a 32GB PCI BAR is reduced from ~1s to <1ms.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
> include/linux/mm.h | 2 ++
> mm/memory.c | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index b1c3db9cf355..0ef7e7a0b4eb 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2416,11 +2416,13 @@ struct follow_pfnmap_args {
> * Outputs:
> *
> * @pfn: the PFN of the address
> + * @pgmask: page mask covering pfn
> * @pgprot: the pgprot_t of the mapping
> * @writable: whether the mapping is writable
> * @special: whether the mapping is a special mapping (real PFN maps)
> */
> unsigned long pfn;
> + unsigned long pgmask;
> pgprot_t pgprot;
> bool writable;
> bool special;
> diff --git a/mm/memory.c b/mm/memory.c
> index 398c031be9ba..97ccd43761b2 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -6388,6 +6388,7 @@ static inline void pfnmap_args_setup(struct follow_pfnmap_args *args,
> args->lock = lock;
> args->ptep = ptep;
> args->pfn = pfn_base + ((args->address & ~addr_mask) >> PAGE_SHIFT);
> + args->pgmask = addr_mask;
> args->pgprot = pgprot;
> args->writable = writable;
> args->special = special;
next prev parent reply other threads:[~2025-02-14 17:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-05 23:17 [PATCH 0/5] vfio: Improve DMA mapping performance for huge pfnmaps Alex Williamson
2025-02-05 23:17 ` [PATCH 4/5] mm: Provide page mask in struct follow_pfnmap_args Alex Williamson
2025-02-07 1:38 ` Mitchell Augustin
2025-02-14 17:17 ` Alex Williamson [this message]
2025-02-14 21:39 ` David Hildenbrand
2025-02-17 21:56 ` Alex Williamson
2025-02-14 19:14 ` Jason Gunthorpe
2025-02-05 23:17 ` [PATCH 5/5] vfio/type1: Use mapping page mask for pfnmaps Alex Williamson
2025-02-07 1:39 ` Mitchell Augustin
2025-02-14 19:27 ` Jason Gunthorpe
2025-02-17 21:52 ` Alex Williamson
2025-02-14 19:46 ` Matthew Wilcox
2025-02-17 19:33 ` Alex Williamson
2025-02-06 19:14 ` [PATCH 0/5] vfio: Improve DMA mapping performance for huge pfnmaps Peter Xu
2025-02-07 1:39 ` Mitchell Augustin
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=20250214101735.4b180123.alex.williamson@redhat.com \
--to=alex.williamson@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=clg@redhat.com \
--cc=david@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mitchell.augustin@canonical.com \
--cc=peterx@redhat.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;
as well as URLs for NNTP newsgroup(s).