* [PATCH] USB: g_serial: fix deadlock with PREEMPT_RT enabled
@ 2011-10-28 12:16 Michael Thalmeier
2011-10-28 12:28 ` Michael Thalmeier
0 siblings, 1 reply; 2+ messages in thread
From: Michael Thalmeier @ 2011-10-28 12:16 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: rt, lkml, Michael Thalmeier
In commit 44a0c0190b500ee6bcfc0976fe540f65dee2cd67 unlocking of spin_locks has
been removed. This patch party restores this functionality.
Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
---
drivers/usb/gadget/u_serial.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index 40f7716..a925b9e 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -553,7 +553,16 @@ recycle:
* a workqueue, so we won't get callbacks and can hold port_lock
*/
if (tty && do_push) {
+ /*
+ * Drop the lock here since it might end up calling
+ * gs_flush_chars, which takes the lock.
+ */
+ spin_unlock_irq(&port->port_lock);
tty_flip_buffer_push(tty);
+ spin_lock_irq(&port->port_lock);
+
+ /* tty may have been closed */
+ tty = port->port_tty;
}
--
1.7.6.4
--
Scanned by MailScanner.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] USB: g_serial: fix deadlock with PREEMPT_RT enabled
2011-10-28 12:16 [PATCH] USB: g_serial: fix deadlock with PREEMPT_RT enabled Michael Thalmeier
@ 2011-10-28 12:28 ` Michael Thalmeier
0 siblings, 0 replies; 2+ messages in thread
From: Michael Thalmeier @ 2011-10-28 12:28 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: rt, lkml, Michael Thalmeier
On 2011-10-28 14:16, Michael Thalmeier wrote:
> In commit 44a0c0190b500ee6bcfc0976fe540f65dee2cd67 unlocking of spin_locks has
> been removed. This patch party restores this functionality.
>
> Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
> ---
> drivers/usb/gadget/u_serial.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
> index 40f7716..a925b9e 100644
> --- a/drivers/usb/gadget/u_serial.c
> +++ b/drivers/usb/gadget/u_serial.c
> @@ -553,7 +553,16 @@ recycle:
> * a workqueue, so we won't get callbacks and can hold port_lock
> */
> if (tty && do_push) {
> + /*
> + * Drop the lock here since it might end up calling
> + * gs_flush_chars, which takes the lock.
> + */
> + spin_unlock_irq(&port->port_lock);
> tty_flip_buffer_push(tty);
> + spin_lock_irq(&port->port_lock);
> +
> + /* tty may have been closed */
> + tty = port->port_tty;
> }
>
>
In the function tty_flip_buffer_push the PRREMPT_RT patch changes the
behaviour. Most serial drivers (those that don't set low_latency) assume
that work is only scheduled and not executed immediately in current context.
This patch only fixes this driver but other serial drivers likely have
similar problems.
Michael
--
Scanned by MailScanner.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-28 12:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 12:16 [PATCH] USB: g_serial: fix deadlock with PREEMPT_RT enabled Michael Thalmeier
2011-10-28 12:28 ` Michael Thalmeier
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).