* [PATCH] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine
@ 2012-03-22 4:50 Bhupesh Sharma
2012-03-22 12:35 ` Sergei Shtylyov
2012-03-22 14:40 ` Greg KH
0 siblings, 2 replies; 7+ messages in thread
From: Bhupesh Sharma @ 2012-03-22 4:50 UTC (permalink / raw)
To: gregkh, linux-usb
Cc: laurent.pinchart, spear-devel, linux-media, Bhupesh Sharma
This patch removes the non-required spinlock acquire/release calls on
'queue_irqlock' from 'uvc_queue_next_buffer' routine.
This routine is called from 'video->encode' function (which translates to either
'uvc_video_encode_bulk' or 'uvc_video_encode_isoc') in 'uvc_video.c'.
As, the 'video->encode' routines are called with 'queue_irqlock' already held,
so acquiring a 'queue_irqlock' again in 'uvc_queue_next_buffer' routine causes
a spin lock recursion.
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/usb/gadget/uvc_queue.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c
index d776adb..104ae9c 100644
--- a/drivers/usb/gadget/uvc_queue.c
+++ b/drivers/usb/gadget/uvc_queue.c
@@ -543,11 +543,11 @@ done:
return ret;
}
+/* called with &queue_irqlock held.. */
static struct uvc_buffer *
uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
{
struct uvc_buffer *nextbuf;
- unsigned long flags;
if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) &&
buf->buf.length != buf->buf.bytesused) {
@@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
return buf;
}
- spin_lock_irqsave(&queue->irqlock, flags);
list_del(&buf->queue);
if (!list_empty(&queue->irqqueue))
nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
queue);
else
nextbuf = NULL;
- spin_unlock_irqrestore(&queue->irqlock, flags);
buf->buf.sequence = queue->sequence++;
do_gettimeofday(&buf->buf.timestamp);
--
1.7.2.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine
2012-03-22 4:50 [PATCH] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine Bhupesh Sharma
@ 2012-03-22 12:35 ` Sergei Shtylyov
2012-03-22 14:40 ` Greg KH
1 sibling, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2012-03-22 12:35 UTC (permalink / raw)
To: Bhupesh Sharma
Cc: gregkh, linux-usb, laurent.pinchart, spear-devel, linux-media
Hello.
On 22-03-2012 8:50, Bhupesh Sharma wrote:
> This patch removes the non-required spinlock acquire/release calls on
> 'queue_irqlock' from 'uvc_queue_next_buffer' routine.
'queue->irqlock' maybe?
> This routine is called from 'video->encode' function (which translates to either
> 'uvc_video_encode_bulk' or 'uvc_video_encode_isoc') in 'uvc_video.c'.
> As, the 'video->encode' routines are called with 'queue_irqlock' already held,
> so acquiring a 'queue_irqlock' again in 'uvc_queue_next_buffer' routine causes
> a spin lock recursion.
> Signed-off-by: Bhupesh Sharma<bhupesh.sharma@st.com>
> Acked-by: Laurent Pinchart<laurent.pinchart@ideasonboard.com>
> ---
> drivers/usb/gadget/uvc_queue.c | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c
> index d776adb..104ae9c 100644
> --- a/drivers/usb/gadget/uvc_queue.c
> +++ b/drivers/usb/gadget/uvc_queue.c
> @@ -543,11 +543,11 @@ done:
> return ret;
> }
>
> +/* called with &queue_irqlock held.. */
'queue->irqlock' maybe?
> @@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
> return buf;
> }
>
> - spin_lock_irqsave(&queue->irqlock, flags);
> list_del(&buf->queue);
> if (!list_empty(&queue->irqqueue))
> nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
> queue);
> else
> nextbuf = NULL;
> - spin_unlock_irqrestore(&queue->irqlock, flags);
>
> buf->buf.sequence = queue->sequence++;
> do_gettimeofday(&buf->buf.timestamp);
WBR, Sergei
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine
2012-03-22 4:50 [PATCH] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine Bhupesh Sharma
2012-03-22 12:35 ` Sergei Shtylyov
@ 2012-03-22 14:40 ` Greg KH
2012-03-23 9:31 ` Bhupesh SHARMA
1 sibling, 1 reply; 7+ messages in thread
From: Greg KH @ 2012-03-22 14:40 UTC (permalink / raw)
To: Bhupesh Sharma; +Cc: linux-usb, laurent.pinchart, spear-devel, linux-media
On Thu, Mar 22, 2012 at 10:20:37AM +0530, Bhupesh Sharma wrote:
> This patch removes the non-required spinlock acquire/release calls on
> 'queue_irqlock' from 'uvc_queue_next_buffer' routine.
>
> This routine is called from 'video->encode' function (which translates to either
> 'uvc_video_encode_bulk' or 'uvc_video_encode_isoc') in 'uvc_video.c'.
> As, the 'video->encode' routines are called with 'queue_irqlock' already held,
> so acquiring a 'queue_irqlock' again in 'uvc_queue_next_buffer' routine causes
> a spin lock recursion.
>
> Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/usb/gadget/uvc_queue.c | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
Please use scripts/get_maintainer.pl to determine who to send this to
(hint, it's not me...)
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine
2012-03-22 14:40 ` Greg KH
@ 2012-03-23 9:31 ` Bhupesh SHARMA
2012-03-23 10:00 ` Laurent Pinchart
2012-03-23 14:57 ` Greg KH
0 siblings, 2 replies; 7+ messages in thread
From: Bhupesh SHARMA @ 2012-03-23 9:31 UTC (permalink / raw)
To: balbi@ti.com
Cc: linux-usb@vger.kernel.org, laurent.pinchart@ideasonboard.com,
spear-devel, linux-media@vger.kernel.org, Greg KH
Hi Felipe,
> -----Original Message-----
> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Sent: Thursday, March 22, 2012 8:11 PM
> To: Bhupesh SHARMA
> Cc: linux-usb@vger.kernel.org; laurent.pinchart@ideasonboard.com;
> spear-devel; linux-media@vger.kernel.org
> Subject: Re: [PATCH] usb: gadget/uvc: Remove non-required locking from
> 'uvc_queue_next_buffer' routine
>
> On Thu, Mar 22, 2012 at 10:20:37AM +0530, Bhupesh Sharma wrote:
> > This patch removes the non-required spinlock acquire/release calls on
> > 'queue_irqlock' from 'uvc_queue_next_buffer' routine.
> >
> > This routine is called from 'video->encode' function (which
> translates to either
> > 'uvc_video_encode_bulk' or 'uvc_video_encode_isoc') in 'uvc_video.c'.
> > As, the 'video->encode' routines are called with 'queue_irqlock'
> already held,
> > so acquiring a 'queue_irqlock' again in 'uvc_queue_next_buffer'
> routine causes
> > a spin lock recursion.
> >
> > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
> > Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> > drivers/usb/gadget/uvc_queue.c | 4 +---
> > 1 files changed, 1 insertions(+), 3 deletions(-)
>
> Please use scripts/get_maintainer.pl to determine who to send this to
> (hint, it's not me...)
>
Can you please pick this USB webcam gadget/peripheral specific patch
in your tree?
Regards,
Bhupesh
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine
2012-03-23 9:31 ` Bhupesh SHARMA
@ 2012-03-23 10:00 ` Laurent Pinchart
2012-03-23 11:16 ` Bhupesh SHARMA
2012-03-23 14:57 ` Greg KH
1 sibling, 1 reply; 7+ messages in thread
From: Laurent Pinchart @ 2012-03-23 10:00 UTC (permalink / raw)
To: Bhupesh SHARMA
Cc: balbi@ti.com, linux-usb@vger.kernel.org, spear-devel,
linux-media@vger.kernel.org, Greg KH
Hi Bhupesh,
On Friday 23 March 2012 17:31:19 Bhupesh SHARMA wrote:
> On Thursday, March 22, 2012 8:11 PM Gregg KH wrote:
> > On Thu, Mar 22, 2012 at 10:20:37AM +0530, Bhupesh Sharma wrote:
> > > This patch removes the non-required spinlock acquire/release calls on
> > > 'queue_irqlock' from 'uvc_queue_next_buffer' routine.
> > >
> > > This routine is called from 'video->encode' function (which translates
> > > to either 'uvc_video_encode_bulk' or 'uvc_video_encode_isoc') in
> > > 'uvc_video.c'. As, the 'video->encode' routines are called with
> > > 'queue_irqlock' already held, so acquiring a 'queue_irqlock' again in
> > > 'uvc_queue_next_buffer' routine causes a spin lock recursion.
> > >
> > > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
> > > Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > ---
> > >
> > > drivers/usb/gadget/uvc_queue.c | 4 +---
> > > 1 files changed, 1 insertions(+), 3 deletions(-)
> >
> > Please use scripts/get_maintainer.pl to determine who to send this to
> > (hint, it's not me...)
>
> Can you please pick this USB webcam gadget/peripheral specific patch
> in your tree?
Could you please first resubmit with the comments fix as asked by Sergei
Shtylyov ? (s/queue_irqlock/queue->irqlock/)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine
2012-03-23 10:00 ` Laurent Pinchart
@ 2012-03-23 11:16 ` Bhupesh SHARMA
0 siblings, 0 replies; 7+ messages in thread
From: Bhupesh SHARMA @ 2012-03-23 11:16 UTC (permalink / raw)
To: Laurent Pinchart
Cc: balbi@ti.com, linux-usb@vger.kernel.org, spear-devel,
linux-media@vger.kernel.org, Greg KH, sshtylyov@mvista.com
Hi Laurent,
> -----Original Message-----
> From: Laurent Pinchart [mailto:laurent.pinchart@ideasonboard.com]
> Sent: Friday, March 23, 2012 3:30 PM
> To: Bhupesh SHARMA
> Cc: balbi@ti.com; linux-usb@vger.kernel.org; spear-devel; linux-
> media@vger.kernel.org; Greg KH
> Subject: Re: [PATCH] usb: gadget/uvc: Remove non-required locking from
> 'uvc_queue_next_buffer' routine
>
> Hi Bhupesh,
>
> On Friday 23 March 2012 17:31:19 Bhupesh SHARMA wrote:
> > On Thursday, March 22, 2012 8:11 PM Gregg KH wrote:
> > > On Thu, Mar 22, 2012 at 10:20:37AM +0530, Bhupesh Sharma wrote:
> > > > This patch removes the non-required spinlock acquire/release
> calls on
> > > > 'queue_irqlock' from 'uvc_queue_next_buffer' routine.
> > > >
> > > > This routine is called from 'video->encode' function (which
> translates
> > > > to either 'uvc_video_encode_bulk' or 'uvc_video_encode_isoc') in
> > > > 'uvc_video.c'. As, the 'video->encode' routines are called with
> > > > 'queue_irqlock' already held, so acquiring a 'queue_irqlock'
> again in
> > > > 'uvc_queue_next_buffer' routine causes a spin lock recursion.
> > > >
> > > > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
> > > > Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > > ---
> > > >
> > > > drivers/usb/gadget/uvc_queue.c | 4 +---
> > > > 1 files changed, 1 insertions(+), 3 deletions(-)
> > >
> > > Please use scripts/get_maintainer.pl to determine who to send this
> to
> > > (hint, it's not me...)
> >
> > Can you please pick this USB webcam gadget/peripheral specific patch
> > in your tree?
>
> Could you please first resubmit with the comments fix as asked by
> Sergei
> Shtylyov ? (s/queue_irqlock/queue->irqlock/)
>
Ok. I will make the changes as suggested by Sergei and then resubmit
the patch..
Regards,
Bhupesh
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine
2012-03-23 9:31 ` Bhupesh SHARMA
2012-03-23 10:00 ` Laurent Pinchart
@ 2012-03-23 14:57 ` Greg KH
1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2012-03-23 14:57 UTC (permalink / raw)
To: Bhupesh SHARMA
Cc: balbi@ti.com, linux-usb@vger.kernel.org,
laurent.pinchart@ideasonboard.com, spear-devel,
linux-media@vger.kernel.org
On Fri, Mar 23, 2012 at 05:31:19PM +0800, Bhupesh SHARMA wrote:
> Hi Felipe,
>
> > -----Original Message-----
> > From: Greg KH [mailto:gregkh@linuxfoundation.org]
> > Sent: Thursday, March 22, 2012 8:11 PM
> > To: Bhupesh SHARMA
> > Cc: linux-usb@vger.kernel.org; laurent.pinchart@ideasonboard.com;
> > spear-devel; linux-media@vger.kernel.org
> > Subject: Re: [PATCH] usb: gadget/uvc: Remove non-required locking from
> > 'uvc_queue_next_buffer' routine
> >
> > On Thu, Mar 22, 2012 at 10:20:37AM +0530, Bhupesh Sharma wrote:
> > > This patch removes the non-required spinlock acquire/release calls on
> > > 'queue_irqlock' from 'uvc_queue_next_buffer' routine.
> > >
> > > This routine is called from 'video->encode' function (which
> > translates to either
> > > 'uvc_video_encode_bulk' or 'uvc_video_encode_isoc') in 'uvc_video.c'.
> > > As, the 'video->encode' routines are called with 'queue_irqlock'
> > already held,
> > > so acquiring a 'queue_irqlock' again in 'uvc_queue_next_buffer'
> > routine causes
> > > a spin lock recursion.
> > >
> > > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
> > > Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > ---
> > > drivers/usb/gadget/uvc_queue.c | 4 +---
> > > 1 files changed, 1 insertions(+), 3 deletions(-)
> >
> > Please use scripts/get_maintainer.pl to determine who to send this to
> > (hint, it's not me...)
> >
>
> Can you please pick this USB webcam gadget/peripheral specific patch
> in your tree?
You didn't put the patch in your request. Hint, just resend it with the
proper information, digging patches out of old email threads is a major
pain when you are dealing with the patch load kernel maintainers do.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-03-23 14:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 4:50 [PATCH] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine Bhupesh Sharma
2012-03-22 12:35 ` Sergei Shtylyov
2012-03-22 14:40 ` Greg KH
2012-03-23 9:31 ` Bhupesh SHARMA
2012-03-23 10:00 ` Laurent Pinchart
2012-03-23 11:16 ` Bhupesh SHARMA
2012-03-23 14:57 ` Greg KH
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).