[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240814132036.GL2032816@nvidia.com>
Date: Wed, 14 Aug 2024 10:20:36 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Peter Xu <peterx@...hat.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Sean Christopherson <seanjc@...gle.com>,
Oscar Salvador <osalvador@...e.de>,
Axel Rasmussen <axelrasmussen@...gle.com>,
linux-arm-kernel@...ts.infradead.org, x86@...nel.org,
Will Deacon <will@...nel.org>, Gavin Shan <gshan@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>, Zi Yan <ziy@...dia.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Catalin Marinas <catalin.marinas@....com>,
Ingo Molnar <mingo@...hat.com>,
Alistair Popple <apopple@...dia.com>,
Borislav Petkov <bp@...en8.de>,
David Hildenbrand <david@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>, kvm@...r.kernel.org,
Dave Hansen <dave.hansen@...ux.intel.com>,
Alex Williamson <alex.williamson@...hat.com>,
Yan Zhao <yan.y.zhao@...el.com>
Subject: Re: [PATCH 13/19] vfio: Use the new follow_pfnmap API
On Fri, Aug 09, 2024 at 12:09:03PM -0400, Peter Xu wrote:
> Use the new API that can understand huge pfn mappings.
>
> Cc: Alex Williamson <alex.williamson@...hat.com>
> Cc: Jason Gunthorpe <jgg@...dia.com>
> Signed-off-by: Peter Xu <peterx@...hat.com>
> ---
> drivers/vfio/vfio_iommu_type1.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> index 0960699e7554..bf391b40e576 100644
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -513,12 +513,10 @@ static int follow_fault_pfn(struct vm_area_struct *vma, struct mm_struct *mm,
> unsigned long vaddr, unsigned long *pfn,
> bool write_fault)
> {
> - pte_t *ptep;
> - pte_t pte;
> - spinlock_t *ptl;
> + struct follow_pfnmap_args args = { .vma = vma, .address = vaddr };
> int ret;
>
> - ret = follow_pte(vma, vaddr, &ptep, &ptl);
> + ret = follow_pfnmap_start(&args);
Let's add a comment here that this is not locked properly to
discourage anyone from copying it.
Jason
Powered by blists - more mailing lists