From: Jason Wessel <jason.wessel@windriver.com>
To: greg@kroah.com
Cc: linux-usb@vger.kernel.org, oliver@neukum.org,
stern@rowland.harvard.edu, linux-kernel@vger.kernel.org,
Jason Wessel <jason.wessel@windriver.com>
Subject: [PATCH 2/2] usb_serial: Run the sysrq handler in a tasklet
Date: Tue, 12 May 2009 17:32:20 -0500 [thread overview]
Message-ID: <1242167540-23585-3-git-send-email-jason.wessel@windriver.com> (raw)
In-Reply-To: <1242167540-23585-2-git-send-email-jason.wessel@windriver.com>
If a sysrq is processed on the while holding the usb hcd lock, it is
impossible to drain the queue of urbs via the polling interface and
all the printk output is lost.
Using a tasklet to schedule the sysrq allows the hcd device lock to
free up.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
drivers/usb/serial/generic.c | 33 ++++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index df56ed3..7554d71 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -527,11 +527,42 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty)
}
}
+#ifdef CONFIG_MAGIC_SYSRQ
+/* The sysrq tasklet is used to make the sysrq request not occur with
+ * the hcd device lock held.
+ */
+static struct usb_sysrq_data {
+ struct tty_struct *tty;
+ unsigned int ch;
+ int pending;
+} priv_usb_sysrq;
+
+static void usb_sysrq_task(unsigned long args)
+{
+ handle_sysrq(priv_usb_sysrq.ch, priv_usb_sysrq.tty);
+ priv_usb_sysrq.pending = 0;
+}
+static DECLARE_TASKLET(usb_sysrq_tasklet, usb_sysrq_task, 0);
+
+void usb_serial_generic_sysrq_invoke(struct usb_serial_port *port,
+ unsigned int ch)
+{
+ if (priv_usb_sysrq.pending)
+ return;
+ priv_usb_sysrq.pending = 1;
+ priv_usb_sysrq.ch = ch;
+ priv_usb_sysrq.tty = tty_port_tty_get(&port->port);
+ tasklet_schedule(&usb_sysrq_tasklet);
+}
+#else
+static void usb_serial_generic_sysrq_invoke() {}
+#endif /* CONFIG_SYSRQ */
+
int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch)
{
if (port->sysrq) {
if (ch && time_before(jiffies, port->sysrq)) {
- handle_sysrq(ch, tty_port_tty_get(&port->port));
+ usb_serial_generic_sysrq_invoke(port, ch);
port->sysrq = 0;
return 1;
}
--
1.6.3.9.g6345d
next prev parent reply other threads:[~2009-05-12 22:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-12 22:32 [PATCH 0/2] usb hcd console polling and sysrq tasklet Jason Wessel
2009-05-12 22:32 ` [PATCH 1/2] usb hcd: poll hcd device to force writes Jason Wessel
2009-05-12 22:32 ` Jason Wessel [this message]
2009-05-13 2:25 ` Alan Stern
2009-05-13 11:39 ` Jason Wessel
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=1242167540-23585-3-git-send-email-jason.wessel@windriver.com \
--to=jason.wessel@windriver.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oliver@neukum.org \
--cc=stern@rowland.harvard.edu \
/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
all inboxes | Powered by JetHome®