Questions about TTM buffer object maping

Daniel Vetter daniel at ffwll.ch
Wed Jul 10 23:24:19 PDT 2013


On Wed, Jul 10, 2013 at 09:00:33PM -0400, Jerome Glisse wrote:
> On Wed, Jul 10, 2013 at 8:27 PM, Jean-Sébastien Pédron
> <jean-sebastien.pedron at dumbbell.fr> wrote:
> > Hello,
> >
> > I'm trying to understand how TTM buffer object mapping works on Linux, to
> > make this behave properly on FreeBSD.
> >
> > Here's what I think I understand:
> >
> > When a buffer object is mmap()'d, ttm_bo_vm_open() is called. When there's a
> > page fault, the page is looked up and inserted in the VMA using
> > vm_insert_mixed(). When a buffer object is munmap()'d, ttm_bo_vm_close() is
> > called, which drops a reference. When the last reference is dropped, the
> > buffer object is destroyed.
> >
> > What's still not clear to me is how munmap() works here. After talking about
> > this on IRC with some people, I think that unmap_mapping_range() (called by
> > ttm_bo_unmap_virtual_locked()) is equivalent to calling munmap() from
> > userland. Is that true?
> 
> Yes that's true.

Afaik unmap_mapping_range only kills the ptes and doesn't remove the vma.
So not equivalent to a munmap from userspace. It simply allows us to
intercept the next access in the page fault handler and move the buffer
back into place.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list