All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Antti Palosaari <crope@iki.fi>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 6/6] v4l: disable lockdep on vb2_fop_mmap()
Date: Fri, 17 Jan 2014 11:04:02 +0100	[thread overview]
Message-ID: <52D90012.6080608@xs4all.nl> (raw)
In-Reply-To: <1388292700-18369-7-git-send-email-crope@iki.fi>

Hi Antti,

Is this still needed after this commit was merged?

http://git.linuxtv.org/media_tree.git/commit/b18a8ff29d80b132018d33479e86ab8ecaee6b46

Regards,

	Hans

On 12/29/2013 05:51 AM, Antti Palosaari wrote:
> Avoid that lockdep warning:
> 
> [ INFO: possible circular locking dependency detected ]
> 3.13.0-rc1+ #77 Tainted: G         C O
> -------------------------------------------------------
> video_source:sr/32072 is trying to acquire lock:
>  (&dev->mutex#2){+.+.+.}, at: [<ffffffffa073fde3>] vb2_fop_mmap+0x33/0x90 [videobuf2_core]
> 
>                                                 but task is already holding lock:
>  (&mm->mmap_sem){++++++}, at: [<ffffffff8117825f>] vm_mmap_pgoff+0x6f/0xc0
> 
>  Possible unsafe locking scenario:
>        CPU0                    CPU1
>        ----                    ----
>   lock(&mm->mmap_sem);
>                                lock(&dev->mutex#2);
>                                lock(&mm->mmap_sem);
>   lock(&dev->mutex#2);
>                                                  *** DEADLOCK ***
> 
> Signed-off-by: Antti Palosaari <crope@iki.fi>
> ---
>  drivers/media/v4l2-core/videobuf2-core.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
> index 12df9fd..2a74295 100644
> --- a/drivers/media/v4l2-core/videobuf2-core.c
> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> @@ -2641,12 +2641,24 @@ int vb2_fop_mmap(struct file *file, struct vm_area_struct *vma)
>  	struct video_device *vdev = video_devdata(file);
>  	struct mutex *lock = vdev->queue->lock ? vdev->queue->lock : vdev->lock;
>  	int err;
> +	/*
> +	 * FIXME: Ugly hack. Disable possible lockdep as it detects possible
> +	 * deadlock. "INFO: possible circular locking dependency detected"
> +	 */
> +	lockdep_off();
>  
> -	if (lock && mutex_lock_interruptible(lock))
> +	if (lock && mutex_lock_interruptible(lock)) {
> +		lockdep_on();
>  		return -ERESTARTSYS;
> +	}
> +
>  	err = vb2_mmap(vdev->queue, vma);
> +
>  	if (lock)
>  		mutex_unlock(lock);
> +
> +	lockdep_on();
> +
>  	return err;
>  }
>  EXPORT_SYMBOL_GPL(vb2_fop_mmap);
> 


  reply	other threads:[~2014-01-17 10:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-29  4:51 [PATCH 0/6] convert drivers to SDR API Antti Palosaari
2013-12-29  4:51 ` [PATCH 1/6] rtl2832_sdr: convert " Antti Palosaari
2013-12-29  4:51 ` [PATCH 2/6] msi3101: " Antti Palosaari
2013-12-29  4:51 ` [PATCH 3/6] msi3101: add u8 sample format Antti Palosaari
2014-01-05 12:14   ` Hans Verkuil
2014-01-14  1:46     ` Antti Palosaari
2013-12-29  4:51 ` [PATCH 4/6] msi3101: add u16 LE " Antti Palosaari
2013-12-29  4:51 ` [PATCH 5/6] msi3101: tons of small changes Antti Palosaari
2013-12-29  4:51 ` [PATCH 6/6] v4l: disable lockdep on vb2_fop_mmap() Antti Palosaari
2014-01-17 10:04   ` Hans Verkuil [this message]
2014-01-17 15:14     ` Antti Palosaari

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=52D90012.6080608@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=crope@iki.fi \
    --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 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.