[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZGbqiTWN+7LualJ/@yzhao56-desk.sh.intel.com>
Date: Fri, 19 May 2023 11:18:33 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
CC: Paolo Bonzini <pbonzini@...hat.com>,
Zhenyu Wang <zhenyuw@...ux.intel.com>,
Zhi Wang <zhi.a.wang@...el.com>, <kvm@...r.kernel.org>,
<intel-gvt-dev@...ts.freedesktop.org>,
<intel-gfx@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
Ben Gardon <bgardon@...gle.com>
Subject: Re: [PATCH v3 03/28] drm/i915/gvt: Verify hugepages are contiguous
in physical address space
On Thu, May 18, 2023 at 11:04:46AM -0700, Sean Christopherson wrote:
> On Thu, May 18, 2023, Yan Zhao wrote:
> > On Wed, May 17, 2023 at 07:50:26AM -0700, Sean Christopherson wrote:
> > > On Tue, May 16, 2023, Yan Zhao wrote:
> > > > hi Sean
> > > >
> > > > Do you think it's necessary to double check that struct page pointers
> > > > are also contiguous?
> > >
> > > No, the virtual address space should be irrelevant. The only way it would be
> > > problematic is if something in dma_map_page() expected to be able to access the
> > > entire chunk of memory by getting the virtual address of only the first page,
> > > but I can't imagine that code is reading or writing memory, let alone doing so
> > > across a huge range of memory.
> > Yes, I do find arm_iommu version of dma_map_page() access the memory by getting
> > virtual address of pages passed in, but it's implemented as page by page, not only
> > from the first page.
> >
> > dma_map_page
> > dma_map_page_attrs
> > ops->map_page
> > arm_iommu_map_page
>
> Heh, thankfully this is ARM specific, which presumably doesn't collide with KVMGT.
Actually, this is fine with KVMGT (owning to page by page access), isn't it?
:)
>
> > __dma_page_cpu_to_dev
> > dma_cache_maint_page
> >
> > Just a little worried about the condition of PFNs are contiguous
> > while they belong to different backends, e.g. one from system memory and
> > one from MMIO.
> > But I don't know how to avoid this without complicated checks.
> > And this condition might not happen in practice.
>
> IMO, assuming that contiguous pfns are vritually contiguous is wrong, i.e. would
> be a bug in the other code. The above dma_cache_maint_page() get's this right,
> and even has a well written comment to boot.
Right.
Powered by blists - more mailing lists