[PATCH] drm/vma-manager: Don't unmap COW'd pages when zapping bo ptes

David Herrmann dh.herrmann at gmail.com
Wed Nov 20 02:14:23 PST 2013


Hi

On Wed, Nov 20, 2013 at 10:55 AM, Thomas Hellstrom
<thellstrom at vmware.com> wrote:
> Not sure if there are any user-space users of private bo mappings, but
> if there are, or will be, zapping the COW'd pages when, for example,
> moving a bo would confuse the user immensely since the net effect for the
> user would be that pages written to would lose their contents.

You're only talking about moving bos, but what happens when you evict
a bo? You *must* clear COW mappings, too. Otherwise, they might still
get read-access to the evicted bo.

Note that we currently cause SIGBUS on access to mmap'd bos if they
are evicted and cannot be restored (think: user-space mapped the
VESA-FB but a real driver took over). So maybe we want two independent
helpers here?

Thanks
David

> Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
> ---
>  include/drm/drm_vma_manager.h |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h
> index c18a593..347077d 100644
> --- a/include/drm/drm_vma_manager.h
> +++ b/include/drm/drm_vma_manager.h
> @@ -231,9 +231,9 @@ static inline void drm_vma_node_unmap(struct drm_vma_offset_node *node,
>                                       struct address_space *file_mapping)
>  {
>         if (file_mapping && drm_vma_node_has_offset(node))
> -               unmap_mapping_range(file_mapping,
> -                                   drm_vma_node_offset_addr(node),
> -                                   drm_vma_node_size(node) << PAGE_SHIFT, 1);
> +               unmap_shared_mapping_range
> +                       (file_mapping, drm_vma_node_offset_addr(node),
> +                        drm_vma_node_size(node) << PAGE_SHIFT);
>  }
>
>  /**
> --
> 1.7.10.4


More information about the dri-devel mailing list