[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250704134307.GD1410929@nvidia.com>
Date: Fri, 4 Jul 2025 10:43:07 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: ankita@...dia.com
Cc: maz@...nel.org, oliver.upton@...ux.dev, joey.gouly@....com,
suzuki.poulose@....com, yuzenghui@...wei.com,
catalin.marinas@....com, will@...nel.org, ryan.roberts@....com,
shahuang@...hat.com, lpieralisi@...nel.org, david@...hat.com,
ddutile@...hat.com, seanjc@...gle.com, aniketa@...dia.com,
cjia@...dia.com, kwankhede@...dia.com, kjaju@...dia.com,
targupta@...dia.com, vsethi@...dia.com, acurrid@...dia.com,
apopple@...dia.com, jhubbard@...dia.com, danw@...dia.com,
zhiw@...dia.com, mochs@...dia.com, udhoke@...dia.com,
dnigam@...dia.com, alex.williamson@...hat.com,
sebastianene@...gle.com, coltonlewis@...gle.com,
kevin.tian@...el.com, yi.l.liu@...el.com, ardb@...nel.org,
akpm@...ux-foundation.org, gshan@...hat.com, linux-mm@...ck.org,
tabba@...gle.com, qperret@...gle.com, kvmarm@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
maobibo@...ngson.cn
Subject: Re: [PATCH v9 2/6] KVM: arm64: Update the check to detect device
memory
On Sat, Jun 21, 2025 at 04:21:07AM +0000, ankita@...dia.com wrote:
> From: Ankit Agrawal <ankita@...dia.com>
>
> Currently, the kvm_is_device_pfn() detects if the memory is kernel
> mapped through pfn_is_map_memory. It thus implies whether KVM can
> use Cache Maintenance Operations (CMOs) on that PFN. It is a bit
> of a misnomer as it does not necessarily detect whether a PFN
> is for a device memory. Moreover, the function is only used at
> one place.
>
> It would be better to directly call pfn_is_map_memory. Moreover
> we should restrict this call to VM_PFNMAP or VM_MIXEDMAP. Otherwise
> the VMA has struct pages in it and mapped in the kernel VA.
>
> Suggested-by: Jason Gunthorpe <jgg@...dia.com>
> Signed-off-by: Ankit Agrawal <ankita@...dia.com>
> ---
> arch/arm64/kvm/mmu.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
Non PFMAP or MIXEDMAP VMA's must always contain normal pages which are
struct page backed, have KVA's and are cachable.
So we should always be able to go from phys to KVA to do a CMO.
Jason
Powered by blists - more mailing lists