From: trimarchi@gandalf.sssup.it (Michael Trimarchi)
To: linux-arm-kernel@lists.infradead.org
Subject: [BUG] pxa27x_udc: possible recursive locking detected in pxa_ep_queue
Date: Tue, 30 Mar 2010 23:26:12 +0200 [thread overview]
Message-ID: <4BB26C74.8010104@gandalf.sssup.it> (raw)
In-Reply-To: <87vdfqx2xw.fsf@free.fr>
Hi,
Robert Jarzmik wrote:
> Antonio Ospite <ospite@studenti.unina.it> writes:
>
>
>> With your latest patch on top of 2.6.32 I get the "possible recursive
>> locking" message at the *first* cable unplug/plug cycle, I am appending
>> it here, the log is partial because I dumped it from RAM and something
>> was lost.
>>
>
> Thanks.
> Now, lets have another try. This patch is a bit saner, and though I got the
> "locking detected" you noticed without it, I didn't manage to get it with this
> patch applied.
>
> As your test platform is far better than mine, would you mind a bit of testing
> ... again. This patch applies on top of v2.6.32.
>
> Cheers.
>
> --
> Robert
>
> >From 3ca70f842651f607790a2ff94f2b3a7ec223196d Mon Sep 17 00:00:00 2001
> From: Robert Jarzmik <robert.jarzmik@free.fr>
> Date: Sat, 12 Dec 2009 15:13:24 +0100
> Subject: [PATCH] pxa27x_udc: Fix deadlocks on request queueing
>
> As reported by Antonio, there are cases where the ep->lock
> can be taken twice, triggering a deadlock.
> The typical sequence is :
> irq_handler
> \
> -> gadget.complete()
> \
> -> pxa27x_udc.pxa_ep_queue() : ep->lock is taken
> \
> -> gadget.complete()
> \
> -> pxa27x_udc.pxa_ep_queue() : ep->lock is taken
> ==> *deadlock*
> The patch fixes this by :
> - releasing the lock each time gadget.complete() is called
> - adding a check in handle_ep() to detect a recursive call,
> in which case the function becomes on no-op.
>
> The patch is still not good enough for ep0. For this unique
> endpoint, another well thought over patch will be needed.
>
> Reported-by: Antonio Ospite <ospite@studenti.unina.it>
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---
> drivers/usb/gadget/pxa27x_udc.c | 114 +++++++++++++++++++++++++++------------
> drivers/usb/gadget/pxa27x_udc.h | 6 ++
> 2 files changed, 85 insertions(+), 35 deletions(-)
>
+ /* don't modify queue heads during completion callback */
+ if (spin_is_locked(&ep->lock)) {
+ spin_unlock(&ep->lock);
+ req->req.complete(&req->udc_usb_ep->usb_ep, &req->req);
+ spin_lock(&ep->lock);
+ } else
+ req->req.complete(&req->udc_usb_ep->usb_ep, &req->req);
}
I have fixed in the same way without pass the flag
Michael
prev parent reply other threads:[~2010-03-30 21:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-05 10:57 [BUG] pxa27x_udc: possible recursive locking detected in pxa_ep_queue Antonio Ospite
2009-12-06 18:34 ` Robert Jarzmik
2009-12-06 20:01 ` Alan Stern
2009-12-06 20:23 ` David Brownell
2009-12-10 17:58 ` Robert Jarzmik
2009-12-10 21:01 ` David Brownell
2009-12-06 20:13 ` David Brownell
2009-12-10 17:49 ` Robert Jarzmik
2009-12-12 14:28 ` Robert Jarzmik
2009-12-12 16:31 ` Antonio Ospite
2009-12-20 18:36 ` Robert Jarzmik
2009-12-22 23:53 ` Antonio Ospite
2009-12-28 20:23 ` Robert Jarzmik
2009-12-28 23:03 ` Antonio Ospite
2010-01-17 12:41 ` Antonio Ospite
2010-01-17 19:33 ` Robert Jarzmik
2010-03-30 21:26 ` Michael Trimarchi [this message]
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=4BB26C74.8010104@gandalf.sssup.it \
--to=trimarchi@gandalf.sssup.it \
--cc=linux-arm-kernel@lists.infradead.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).