[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 2 Feb 2021 08:51:14 +0000
From: Christoph Hellwig <hch@...radead.org>
To: Suren Baghdasaryan <surenb@...gle.com>
Cc: Christoph Hellwig <hch@...radead.org>,
Minchan Kim <minchan@...nel.org>,
Sumit Semwal <sumit.semwal@...aro.org>,
"(Exiting) Benjamin Gaignard" <benjamin.gaignard@...aro.org>,
Liam Mark <lmark@...eaurora.org>, labbott@...hat.com,
Brian Starkey <Brian.Starkey@....com>,
John Stultz <john.stultz@...aro.org>,
Christian K??nig <christian.koenig@....com>,
Chris Goldsworthy <cgoldswo@...eaurora.org>,
??rjan Eide <orjan.eide@....com>,
Robin Murphy <robin.murphy@....com>,
James Jones <jajones@...dia.com>,
Hridya Valsaraju <hridya@...gle.com>,
Sandeep Patil <sspatil@...gle.com>,
linux-media <linux-media@...r.kernel.org>,
DRI mailing list <dri-devel@...ts.freedesktop.org>,
"moderated list:DMA BUFFER SHARING FRAMEWORK"
<linaro-mm-sig@...ts.linaro.org>,
LKML <linux-kernel@...r.kernel.org>,
kernel-team <kernel-team@...roid.com>
Subject: Re: [PATCH 1/1] dma-buf: heaps: Map system heap pages as managed by
linux vm
On Tue, Feb 02, 2021 at 12:44:44AM -0800, Suren Baghdasaryan wrote:
> On Mon, Feb 1, 2021 at 11:03 PM Christoph Hellwig <hch@...radead.org> wrote:
> >
> > IMHO the
> >
> > BUG_ON(vma->vm_flags & VM_PFNMAP);
> >
> > in vm_insert_page should just become a WARN_ON_ONCE with an error
> > return, and then we just need to gradually fix up the callers that
> > trigger it instead of coming up with workarounds like this.
>
> For the existing vm_insert_page users this should be fine since
> BUG_ON() guarantees that none of them sets VM_PFNMAP.
Even for them WARN_ON_ONCE plus an actual error return is a way
better assert that is much developer friendly.
> However, for the
> system_heap_mmap I have one concern. When vm_insert_page returns an
> error due to VM_PFNMAP flag, the whole mmap operation should fail
> (system_heap_mmap returning an error leading to dma_buf_mmap failure).
> Could there be cases when a heap user (DRM driver for example) would
> be expected to work with a heap which requires VM_PFNMAP and at the
> same time with another heap which requires !VM_PFNMAP? IOW, this
> introduces a dependency between the heap and its
> user. The user would have to know expectations of the heap it uses and
> can't work with another heap that has the opposite expectation. This
> usecase is purely theoretical and maybe I should not worry about it
> for now?
If such a case ever arises we can look into it.
Powered by blists - more mailing lists