dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: David Herrmann <dh.herrmann@gmail.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/gem: fix mmap vma size calculations
Date: Fri, 26 Jul 2013 22:15:27 +0200	[thread overview]
Message-ID: <20130726201527.GP6084@phenom.ffwll.local> (raw)
In-Reply-To: <1374833372-21926-1-git-send-email-dh.herrmann@gmail.com>

On Fri, Jul 26, 2013 at 12:09:32PM +0200, David Herrmann wrote:
> The VMA manager is page-size based so drm_vma_node_size() returns the size
> in pages. However, drm_gem_mmap_obj() requires the size in bytes. Apply
> PAGE_SHIFT so we no longer get EINVAL during mmaps due to too small
> buffers.
> 
> This bug was introduced in commit:
>   0de23977cfeb5b357ec884ba15417ae118ff9e9b
>   "drm/gem: convert to new unified vma manager"
> 
> Fixes i915 gtt mmap failure reported by Sedat Dilek in:
>   Re: linux-next: Tree for Jul 25 [ call-trace: drm | drm-intel related? ]
> 
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>

I remember that I even checked whether v4 was consistent with pages vs.
bytes ;-) So

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

on this little fixup.
-Daniel

> ---
>  drivers/gpu/drm/drm_gem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 3613b50..1f76572 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -666,7 +666,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
>  	}
>  
>  	obj = container_of(node, struct drm_gem_object, vma_node);
> -	ret = drm_gem_mmap_obj(obj, drm_vma_node_size(node), vma);
> +	ret = drm_gem_mmap_obj(obj, drm_vma_node_size(node) << PAGE_SHIFT, vma);
>  
>  	mutex_unlock(&dev->struct_mutex);
>  
> -- 
> 1.8.3.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2013-07-26 20:15 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25  8:54 linux-next: Tree for Jul 25 [ call-trace: drm | drm-intel related? ] Sedat Dilek
2013-07-25  9:44 ` [Intel-gfx] " Jani Nikula
2013-07-25 10:02   ` Sedat Dilek
2013-07-25 10:05     ` Sedat Dilek
2013-07-25 10:21       ` Jani Nikula
2013-07-25 10:37         ` Sedat Dilek
2013-07-25 13:36           ` [Intel-gfx] " Daniel Vetter
2013-07-25 14:23             ` Sedat Dilek
2013-07-25 14:27               ` Daniel Vetter
2013-07-25 15:03                 ` Sedat Dilek
2013-07-25 15:05                   ` Daniel Vetter
2013-07-25 15:34                     ` Sedat Dilek
2013-07-25 16:11                       ` Sedat Dilek
2013-07-25 16:31                         ` Chris Wilson
2013-07-25 16:35                           ` Sedat Dilek
2013-07-25 17:01                             ` [Intel-gfx] " Chris Wilson
2013-07-25 17:15                               ` Sedat Dilek
2013-07-25 17:26                                 ` [Intel-gfx] " Chris Wilson
2013-07-25 17:52                                   ` Sedat Dilek
2013-07-25 17:55                                     ` Sedat Dilek
2013-07-25 18:03                                       ` Sedat Dilek
2013-07-25 18:45                                         ` [Intel-gfx] " Chris Wilson
2013-07-25 18:50                                           ` Sedat Dilek
2013-07-25 19:00                                             ` Chris Wilson
2013-07-25 19:12                                               ` Sedat Dilek
2013-07-25 19:22                                                 ` Chris Wilson
2013-07-25 19:32                                                   ` Sedat Dilek
2013-07-25 20:07                                                     ` Sedat Dilek
2013-07-25 21:52                                                       ` Chris Wilson
2013-07-25 23:21                                                         ` Sedat Dilek
2013-07-25 23:25                                                           ` Chris Wilson
2013-07-26  7:15                                                             ` Sedat Dilek
2013-07-26  7:26                                                               ` Chris Wilson
2013-07-26  8:25                                                                 ` Sedat Dilek
2013-07-26  8:27                                                                   ` [Intel-gfx] " Sedat Dilek
2013-07-26  8:50                                                                     ` Chris Wilson
2013-07-26  8:52                                                                       ` Daniel Vetter
2013-07-26  9:02                                                                         ` Sedat Dilek
2013-07-26  9:11                                                                           ` Sedat Dilek
2013-07-26  9:16                                                                             ` Daniel Vetter
2013-07-26  9:24                                                                               ` [PATCH] drm/gem: fix mmap vma size calculations David Herrmann
2013-07-26 10:09                                                                                 ` [PATCH v2] " David Herrmann
2013-07-26 20:15                                                                                   ` Daniel Vetter [this message]
2013-07-30  7:41                                                                                     ` Sedat Dilek
2013-07-30  7:52                                                                                       ` Sedat Dilek
2013-07-31 16:46                                                                                         ` David Herrmann
2013-07-31 17:13                                                                                           ` Sedat Dilek
2013-07-26  9:32                                                                               ` [Intel-gfx] linux-next: Tree for Jul 25 [ call-trace: drm | drm-intel related? ] Sedat Dilek
2013-07-26 10:34                                                                                 ` Sedat Dilek
2013-07-25 18:03                                     ` Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130726201527.GP6084@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dh.herrmann@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sedat.dilek@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox