linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Inki Dae <inki.dae@samsung.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>, Jan Kara <jack@suse.com>,
	linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	linux-samsung-soc@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Jan Kara <jack@suse.cz>,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH 9/9] drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames()
Date: Mon, 20 Jul 2015 10:03:35 +0200	[thread overview]
Message-ID: <20150720080335.GB3131@quack.suse.cz> (raw)
In-Reply-To: <55A9C484.2090707@samsung.com>

[-- Attachment #1: Type: text/plain, Size: 2255 bytes --]

On Sat 18-07-15 12:14:12, Inki Dae wrote:
> On 2015e?? 07i?? 17i? 1/4  19:31, Hans Verkuil wrote:
> > On 07/17/2015 12:29 PM, Inki Dae wrote:
> >> On 2015e?? 07i?? 17i? 1/4  19:20, Hans Verkuil wrote:
> >>> On 07/13/2015 04:55 PM, Jan Kara wrote:
> >>>> From: Jan Kara <jack@suse.cz>
> >>>>
> >>>> Convert g2d_userptr_get_dma_addr() to pin pages using get_vaddr_frames().
> >>>> This removes the knowledge about vmas and mmap_sem locking from exynos
> >>>> driver. Also it fixes a problem that the function has been mapping user
> >>>> provided address without holding mmap_sem.
> >>>
> >>> I'd like to see an Ack from one of the exynos drm driver maintainers before
> >>> I merge this.
> >>>
> >>> Inki, Marek?
> >>
> >> I already gave Ack but it seems that Jan missed it while updating.
> >>
> >> Anyway,
> >> Acked-by: Inki Dae <inki.dae@samsung.com>
> > 
> > Thanks!
> 
> Oops, sorry. This patch would incur a build warning. Below is my comment.
> 
> >>>> @@ -456,65 +455,38 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev,
> >>>>  		return ERR_PTR(-ENOMEM);
> >>>>  
> >>>>  	atomic_set(&g2d_userptr->refcount, 1);
> >>>> +	g2d_userptr->size = size;
> >>>>  
> >>>>  	start = userptr & PAGE_MASK;
> >>>>  	offset = userptr & ~PAGE_MASK;
> >>>>  	end = PAGE_ALIGN(userptr + size);
> >>>>  	npages = (end - start) >> PAGE_SHIFT;
> >>>> -	g2d_userptr->npages = npages;
> >>>> -
> >>>> -	pages = drm_calloc_large(npages, sizeof(struct page *));
> >>>> -	if (!pages) {
> >>>> -		DRM_ERROR("failed to allocate pages.\n");
> >>>> -		ret = -ENOMEM;
> >>>> +	g2d_userptr->vec = frame_vector_create(npages);
> >>>> +	if (!g2d_userptr->vec)
> 
> You would need ret = -EFAULT here. And below is a patch posted already,
> 	http://www.spinics.net/lists/dri-devel/msg85321.html

The error should IMHO be -ENOMEM because frame_vector_create() fails only
if we fail to allocate the structure. Attached is the updated version of
the patch. Hans, can you please pick this one?
 
> ps. please, ignore the codes related to build error in the patch.
> 
> With the change, Acked-by: Inki Dae <inki.dae@samsung.com>

Thanks and sorry for making so many stupid mistakes in the Exynos driver.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

[-- Attachment #2: 0009-drm-exynos-Convert-g2d_userptr_get_dma_addr-to-use-g.patch --]
[-- Type: text/x-patch, Size: 0 bytes --]



  reply	other threads:[~2015-07-21 20:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13 14:55 [PATCH 0/9 v7] Helper to abstract vma handling in media layer Jan Kara
2015-07-13 14:55 ` [PATCH 1/9] [media] vb2: Push mmap_sem down to memops Jan Kara
2015-07-13 14:55 ` [PATCH 2/9] mm: Provide new get_vaddr_frames() helper Jan Kara
2015-07-17 10:23   ` Hans Verkuil
2015-07-17 20:26     ` Andrew Morton
2015-07-13 14:55 ` [PATCH 3/9] media: omap_vout: Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns() Jan Kara
2015-07-13 14:55 ` [PATCH 4/9] vb2: Provide helpers for mapping virtual addresses Jan Kara
2015-07-13 14:55 ` [PATCH 5/9] media: vb2: Convert vb2_dma_sg_get_userptr() to use frame vector Jan Kara
2015-07-13 14:55 ` [PATCH 6/9] media: vb2: Convert vb2_vmalloc_get_userptr() " Jan Kara
2015-07-13 14:55 ` [PATCH 7/9] media: vb2: Convert vb2_dc_get_userptr() " Jan Kara
2015-07-13 14:55 ` [PATCH 8/9] media: vb2: Remove unused functions Jan Kara
2015-07-13 14:55 ` [PATCH 9/9] drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames() Jan Kara
2015-07-17 10:20   ` Hans Verkuil
2015-07-17 10:29     ` Inki Dae
2015-07-17 10:31       ` Hans Verkuil
2015-07-18  3:14         ` Inki Dae
2015-07-20  8:03           ` Jan Kara [this message]
2015-07-13 14:59 ` [PATCH 0/9 v7] Helper to abstract vma handling in media layer Hans Verkuil
2015-07-17 12:08 ` Hans Verkuil
  -- strict thread matches above, loose matches on Subject: below --
2015-05-13 13:08 [PATCH 0/9 v5] " Jan Kara
2015-05-13 13:08 ` [PATCH 9/9] drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames() Jan Kara
2015-05-14 10:51   ` Inki Dae
2015-05-14 11:39     ` Jan Kara
2015-06-10  9:07   ` Hans Verkuil
2015-05-06  7:28 [PATCH 0/9 v4] Helper to abstract vma handling in media layer Jan Kara
2015-05-06  7:28 ` [PATCH 9/9] drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames() Jan Kara
2015-05-06 10:47   ` Vlastimil Babka
2015-05-06 15:02     ` Jan Kara
2015-05-05 16:01 [PATCH 0/9 v3] Helper to abstract vma handling in media layer Jan Kara
2015-05-05 16:01 ` [PATCH 9/9] drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames() Jan Kara

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=20150720080335.GB3131@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=hverkuil@xs4all.nl \
    --cc=inki.dae@samsung.com \
    --cc=jack@suse.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@osg.samsung.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;
as well as URLs for NNTP newsgroup(s).