linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Hans Petter Selasky <hselasky@c2i.net>, linux-media@vger.kernel.org
Subject: Re: Question about V4L2_MEMORY_USERPTR
Date: Mon, 02 Jul 2012 11:24:15 +0200	[thread overview]
Message-ID: <1507857.9YMcHMaQav@avalon> (raw)
In-Reply-To: <20120701140058.GB20344@valkosipuli.retiisi.org.uk>

On Sunday 01 July 2012 17:00:58 Sakari Ailus wrote:
> On Fri, Mar 23, 2012 at 08:19:45AM +0100, Hans Petter Selasky wrote:
> > Hi,
> > 
> > I have a question about V4L2_MEMORY_USERPTR:
> > 
> > From which context are the kernel's "copy_to_user()" functions called in
> > relation to V4L2_MEMORY_USERPTR ? Can this be a USB callback function or
> > is it only syscalls, like read/write/ioctl that are allowed to call
> > "copy_to_user()" ?
> > 
> > The reason for asking is that I am maintaining a userland port of the
> > media tree's USB drivers for FreeBSD. At the present moment it is not
> > allowed to call copy_to_user() or copy_from_user() unless the backtrace
> > shows a syscall, so the V4L2_MEMORY_USERPTR feature is simply removed and
> > disabled. I'm currently thinking how I can enable this feature.
> 
> I hope this is still relevant --- I just read your message the first time.
> 
> I don't know how V4L2 is being used in FreeBSD userland, but the intent of
> copy_to_user() function is to copy the contents of kernel memory to
> somewhere the user space has a mapping to (and the other way around for
> copy_from_user()).

copy_(to|from)_user(), by definition, require a userspace memory context to 
perform the copy operation. They can't be called from interrupt context, 
kernel threads, or any other context where no userspace memory context is 
present.

> Are your video buffers allocated by the kernel or not? How is USB accessed
> when you don't have the Linux kernel USB framework around?

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2012-07-02  9:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-23  7:19 Question about V4L2_MEMORY_USERPTR Hans Petter Selasky
2012-07-01 14:00 ` Sakari Ailus
2012-07-02  9:24   ` Laurent Pinchart [this message]
2012-07-02 19:07     ` Hans Petter Selasky
2012-07-05 17:24       ` Laurent Pinchart

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=1507857.9YMcHMaQav@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hselasky@c2i.net \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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).