From: Marek Szyprowski <m.szyprowski@samsung.com>
To: "Matthias Wächter" <matthias.waechter@tttech.com>,
"Ricardo Ribalda Delgado" <ricardo.ribalda@gmail.com>,
"Pawel Osciak" <pawel@osciak.com>,
"Kyungmin Park" <kyungmin.park@samsung.com>,
"Mauro Carvalho Chehab" <m.chehab@samsung.com>,
"open list:VIDEOBUF2 FRAMEWORK" <linux-media@vger.kernel.org>,
"sylvester.nawrocki@gmail.com" <sylvester.nawrocki@gmail.com>
Subject: Re: [PATCH] videobuf2-dma-sg: Support io userptr operations on io memory
Date: Mon, 25 Nov 2013 16:41:43 +0100 [thread overview]
Message-ID: <52936FB7.9030307@samsung.com> (raw)
In-Reply-To: <3377d5e29bf6444086575515325b3555@TTTEX01.ds1.internal>
Hello,
On 2013-11-11 12:36, Matthias Wächter wrote:
> > @@ -180,7 +186,26 @@ static void *vb2_dma_sg_get_userptr(void
> > *alloc_ctx, unsigned long vaddr,
> > if (!buf->pages)
> > return NULL;
> >
> > - num_pages_from_user = get_user_pages(current, current->mm,
> > + buf->vma = find_vma(current->mm, vaddr);
> > + if (!buf->vma) {
> > + dprintk(1, "no vma for address %lu\n", vaddr);
> > + return NULL;
> > + }
> > +
> > + if (vma_is_io(buf->vma)) {
> > + for (num_pages_from_user = 0;
> > + num_pages_from_user < buf->num_pages;
> > + ++num_pages_from_user, vaddr += PAGE_SIZE) {
> > + unsigned long pfn;
> > +
> > + if (follow_pfn(buf->vma, vaddr, &pfn)) {
> > + dprintk(1, "no page for address %lu\n", vaddr);
> > + break;
> > + }
> > + buf->pages[num_pages_from_user] = pfn_to_page(pfn);
> > + }
> > + } else
> > + num_pages_from_user = get_user_pages(current, current->mm,
> > vaddr & PAGE_MASK,
> > buf->num_pages,
> > write,
>
> Can you safely assume that your userptr will cover only one vma? At least, get_user_pages (calling __get_user_pages) does not assume that and calls find_vma() whenever vma->vm_end is reached.
We care only about io mappings which cover only one vma. Such mappings
are created by other device drivers and can be used mainly for
zero-copy buffer sharing between multimedia devices. Although it is
technically possible to provide code for multiple vma, there will be
no real use case for it.
Best regards
--
Marek Szyprowski
Samsung R&D Institute Poland
next prev parent reply other threads:[~2013-11-25 15:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 19:48 [PATCH] videobuf2-dma-sg: Support io userptr operations on io memory Ricardo Ribalda Delgado
2013-11-11 11:36 ` Matthias Wächter
2013-11-25 8:59 ` Ricardo Ribalda Delgado
2013-11-25 15:41 ` Marek Szyprowski [this message]
2013-11-25 16:22 ` Ricardo Ribalda Delgado
2013-11-26 11:20 ` Marek Szyprowski
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=52936FB7.9030307@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
--cc=matthias.waechter@tttech.com \
--cc=pawel@osciak.com \
--cc=ricardo.ribalda@gmail.com \
--cc=sylvester.nawrocki@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.