All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Cc: laurent.pinchart@ideasonboard.com, linux-media@vger.kernel.org,
	mchehab@osg.samsung.com, linux-usb@vger.kernel.org
Subject: Re: [PATCH v1] media: uvcvideo: handle urb completion in a work queue
Date: Tue, 08 Sep 2015 10:58:04 +0200	[thread overview]
Message-ID: <1441702684.26994.34.camel@suse.com> (raw)
In-Reply-To: <1441643029-25341-1-git-send-email-yousaf.kaukab@intel.com>

On Mon, 2015-09-07 at 18:23 +0200, Mian Yousaf Kaukab wrote:
> urb completion callback is executed in host controllers interrupt
> context. To keep preempt disable time short, add urbs to a list on
> completion and schedule work to process the list.
> 
> Moreover, save timestamp and sof number in the urb completion callback
> to avoid any delays.
> 
> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
> ---
> History:
> v1:
>  - Use global work queue instead of creating ordered queue.

1. using a common queue for real-time work is probably not nice for
picture quality
2. it will deadlock under some conditions

The explanation is a bit long

Suppose we have a device with a camera and a storage device,
like an ordinary camera you can use as a video device which also
exports its memory card.

Now we assume that the storage part is suspended.

CPU A					CPU B
					work item scheduled
entering uvc_uninit_video()
					work item executed
					work item allocates memory
					write to storage interface
					storage interface being resumed
flush_work() - waiting for CPU B
					DEADLOCK


If you want to use flush_work() you must use a dedicated queue.

	Regards
		Oliver



  reply	other threads:[~2015-09-08  8:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-07 16:23 [PATCH v1] media: uvcvideo: handle urb completion in a work queue Mian Yousaf Kaukab
2015-09-08  8:58 ` Oliver Neukum [this message]
2015-09-08 12:53 ` Hans de Goede
2015-09-08 14:36   ` Alan Stern
2015-09-09  8:30     ` Hans de Goede
2015-09-09  8:43       ` Laurent Pinchart
2015-09-09 15:14         ` Alan Stern
2015-09-09 16:02           ` Laurent Pinchart
2015-09-09 16:29             ` Alan Stern
2015-09-10  8:00               ` Kaukab, Yousaf
2015-09-09 14:42       ` Alan Stern

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=1441702684.26994.34.camel@suse.com \
    --to=oneukum@suse.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=yousaf.kaukab@intel.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.