[PATCH 1/1] remove low_latency assignment in u_serial.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks,

At David Brownell's off-list suggestion, I removed the
tty->low_latency=1 assignment in u_serial.c to fix an intermittent
slow mutex lock traceback with the g_serial ACM gadget interface.  In
the off chance that someone out there really does want to keep
low_latency enabled, a new config flag has been introduced to Kconfig
(CONFIG_USB_G_SERIAL_LOW_LATENCY) to allow the user to selectively
enable/disable this behavior at compile-time.

I've tested this on an Atmel AT91 ARM platform and the traceback has
disappeared.

At this point, I'd appreciate your feedback (code review and testing
results on other platforms).

Thanks,
Chris

P.S.  If tty->low_latency=1 is no longer required for any platform, I
urge someone with this knowledge to submit a corrected patch.

---
 drivers/usb/gadget/Kconfig    |   14 ++++++++++++++
 drivers/usb/gadget/u_serial.c |    2 ++
 2 files changed, 16 insertions(+), 0 deletions(-)

Signed-off-by: Chris Verges <chrisv@xxxxxxxxxxxxxxxxxx>

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 591ae9f..e8c264c 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -807,6 +807,20 @@ config USB_G_SERIAL
 	  which includes instructions and a "driver info file" needed to
 	  make MS-Windows work with CDC ACM.
 
+config USB_G_SERIAL_LOW_LATENCY
+	bool "Use Low Latency TTY for Serial Gadget"
+	depends on USB_G_SERIAL
+	default y
+	help
+	  The Serial Gadget was originally written to use the kernel's
+	  TTY low latency scheme.  This can cause nuisance tracebacks in
+	  newer versions of the kernel, so the user can enable/disable
+	  this feature dynamically now.
+
+	  Saying "y" sets tty->low_latency to 1 (legacy behavior).
+
+	  If in doubt, say "y".
+
 config USB_MIDI_GADGET
 	tristate "MIDI Gadget (EXPERIMENTAL)"
 	depends on SND && EXPERIMENTAL
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index 16bdf77..bfe9576 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -784,10 +784,12 @@ static int gs_open(struct tty_struct *tty, struct file *file)
 	port->open_count = 1;
 	port->openclose = false;
 
+#if defined(USB_G_SERIAL_LOW_LATENCY)
 	/* low_latency means ldiscs work in tasklet context, without
 	 * needing a workqueue schedule ... easier to keep up.
 	 */
 	tty->low_latency = 1;
+#endif
 
 	/* if connected, start the I/O stream */
 	if (port->port_usb) {
-- 
1.6.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux