From: Ezequiel Garcia <ezequiel@collabora.com>
To: Hans Verkuil <hverkuil@xs4all.nl>, linux-media@vger.kernel.org
Cc: Mike Isely <isely@pobox.com>, Hans Verkuil <hansverk@cisco.com>
Subject: Re: [RFC PATCH 2/6] v4l2-core: push taking ioctl mutex down to ioctl handler.
Date: Mon, 14 May 2018 18:02:45 -0300 [thread overview]
Message-ID: <484364ff89a20e55700eb8ff993c11e67b6f9c38.camel@collabora.com> (raw)
In-Reply-To: <20180514115602.9791-3-hverkuil@xs4all.nl>
On Mon, 2018-05-14 at 13:55 +0200, Hans Verkuil wrote:
> From: Hans Verkuil <hansverk@cisco.com>
>
> The ioctl serialization mutex (vdev->lock or q->lock for vb2 queues)
> was taken at the highest level in v4l2-dev.c. This prevents more
> fine-grained locking since at that level we cannot examine the ioctl
> arguments, we can only do that after video_usercopy is called.
>
> So push the locking down to __video_do_ioctl() and subdev_do_ioctl_lock().
>
> This also allows us to make a few functions in v4l2-ioctl.c static and
> video_usercopy() is no longer exported.
>
> The locking scheme is not changed by this patch, just pushed down.
>
> Signed-off-by: Hans Verkuil <hansverk@cisco.com>
> ---
> drivers/media/v4l2-core/v4l2-dev.c | 6 ------
> drivers/media/v4l2-core/v4l2-ioctl.c | 17 ++++++++++++++---
> drivers/media/v4l2-core/v4l2-subdev.c | 17 ++++++++++++++++-
> include/media/v4l2-dev.h | 9 ---------
> include/media/v4l2-ioctl.h | 12 ------------
> 5 files changed, 30 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
> index c4f4357e9ca4..4ffd7d60a901 100644
> --- a/drivers/media/v4l2-core/v4l2-dev.c
> +++ b/drivers/media/v4l2-core/v4l2-dev.c
> @@ -360,14 +360,8 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> int ret = -ENODEV;
>
> if (vdev->fops->unlocked_ioctl) {
> - struct mutex *lock = v4l2_ioctl_get_lock(vdev, cmd);
> -
> - if (lock && mutex_lock_interruptible(lock))
> - return -ERESTARTSYS;
> if (video_is_registered(vdev))
This is_registered check looks spurious.
Other than that, it looks good.
next prev parent reply other threads:[~2018-05-14 21:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-14 11:55 [RFC PATCH 0/6] v4l2 core: push ioctl lock down to ioctl handler Hans Verkuil
2018-05-14 11:55 ` [RFC PATCH 1/6] pvrusb2: replace pvr2_v4l2_ioctl by video_ioctl2 Hans Verkuil
2018-05-14 12:11 ` Hans Verkuil
2018-05-14 11:55 ` [RFC PATCH 2/6] v4l2-core: push taking ioctl mutex down to ioctl handler Hans Verkuil
2018-05-14 21:02 ` Ezequiel Garcia [this message]
2018-05-14 11:55 ` [RFC PATCH 3/6] v4l2-ioctl.c: use correct vb2_queue lock for m2m devices Hans Verkuil
2018-05-14 11:56 ` [RFC PATCH 4/6] videobuf2-core: require q->lock Hans Verkuil
2018-05-14 11:56 ` [RFC PATCH 5/6] videobuf2: assume q->lock is always set Hans Verkuil
2018-05-14 11:56 ` [RFC PATCH 6/6] v4l2-ioctl.c: assume queue->lock " Hans Verkuil
2018-05-14 12:09 ` [RFC PATCH 0/6] v4l2 core: push ioctl lock down to ioctl handler Hans Verkuil
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=484364ff89a20e55700eb8ff993c11e67b6f9c38.camel@collabora.com \
--to=ezequiel@collabora.com \
--cc=hansverk@cisco.com \
--cc=hverkuil@xs4all.nl \
--cc=isely@pobox.com \
--cc=linux-media@vger.kernel.org \
/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).