lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1326928027-20610-2-git-send-email-sjg@chromium.org>
Date:	Wed, 18 Jan 2012 15:07:07 -0800
From:	Simon Glass <sjg@...omium.org>
To:	LKML <linux-kernel@...r.kernel.org>
Cc:	Greg Kroah-Hartman <gregkh@...e.de>, linux-serial@...r.kernel.org,
	Pavel Machek <pavel@....cz>, "Rafael J. Wysocki" <rjw@...k.pl>,
	Alan Cox <alan@...rguk.ukuu.org.uk>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Simon Glass <sjg@...omium.org>
Subject: [PATCH 2/2] serial: Use device_init_wakeup_flag() to make device wakeup-capable

We want the serial device to be wakeup-capable but not actually enable
the wakeup function. The original code results in making the serial
device wakeup-capable, then enabling and then immediately disabling
the actual wakeup feature on the device. This ends up in a
synchronise_rcu() in wakeup_source_remove() which can take some 15ms
to run, yet is entirely avoidable. The cost over 4 ports is about 600ms
on my Tegra2x system (with CONFIG_PREEMPT disabled).

Using the new function avoids this problem.

Signed-off-by: Simon Glass <sjg@...omium.org>
---
 drivers/tty/serial/serial_core.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index c7bf31a..a8b01db 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2348,11 +2348,11 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
 	 */
 	tty_dev = tty_register_device(drv->tty_driver, uport->line, uport->dev);
 	if (likely(!IS_ERR(tty_dev))) {
-		device_init_wakeup(tty_dev, 1);
-		device_set_wakeup_enable(tty_dev, 0);
-	} else
+		device_init_wakeup_flag(tty_dev, PM_WAKEUP_CAP);
+	} else {
 		printk(KERN_ERR "Cannot register tty device on line %d\n",
 		       uport->line);
+	}
 
 	/*
 	 * Ensure UPF_DEAD is not set.
-- 
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ