All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] TTY: serial, remove BTM from wait_until_sent
@ 2011-07-12 20:43 Jiri Slaby
  2011-07-12 20:43 ` [PATCH 2/3] TTY: msm_serial, remove unneeded console set Jiri Slaby
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jiri Slaby @ 2011-07-12 20:43 UTC (permalink / raw)
  To: gregkh
  Cc: linux-serial, linux-kernel, jirislaby, Alan Cox, Arnd Bergmann,
	Andreas Bombe

During the BKL removal process, the BKL was switched to tty_lock
(BTM). Now we should start pruning the BTM further. Let's start with
wait_until_sent of the serial layer. This will allow us to switch to
the tty port helpers and thus clean it up much.

In wait_until_sent there are some uport members accessed, but neither
of them is protected by BTM at the location they are set ('=>' means
function call):
* uport->fifosize (set in tty_ioctl => uart_ioctl => uart_set_info)
* uport->type (set in add_one_port prior to tty_register_device)
* uport->timeout (set usually in tty_ioctl => tty_mode_ioctl =>
  tty_set_termios => uart_set_termios => uart_change_speed =>
  uport->ops->set_termios => uart_update_timeout)
* call to uport->ops->tx_empty()

If the tx_empty hook needs some lock to protect accesses to registers,
it should take &uport->lock spinlock like 8250 does. Otherwise there
still might be races e.g. with ISRs.

This should also fix the issue Andreas is seeing (BTM in comparison to
BKL doesn't have any hidden functionality like unlocking during
sleeping).

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
References: https://lkml.org/lkml/2011/5/25/562
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andreas Bombe <aeb@debian.org>
---
 drivers/tty/serial/serial_core.c |   30 +++++++-----------------------
 1 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index db7912c..2cbf1bd 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -57,7 +57,7 @@ static struct lock_class_key port_lock_key;
 
 static void uart_change_speed(struct tty_struct *tty, struct uart_state *state,
 					struct ktermios *old_termios);
-static void __uart_wait_until_sent(struct uart_port *port, int timeout);
+static void uart_wait_until_sent(struct tty_struct *tty, int timeout);
 static void uart_change_pm(struct uart_state *state, int pm_state);
 
 /*
@@ -1304,16 +1304,8 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
 	tty->closing = 1;
 	spin_unlock_irqrestore(&port->lock, flags);
 
-	if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) {
-		/*
-		 * hack: open-coded tty_wait_until_sent to avoid
-		 * recursive tty_lock
-		 */
-		long timeout = msecs_to_jiffies(port->closing_wait);
-		if (wait_event_interruptible_timeout(tty->write_wait,
-				!tty_chars_in_buffer(tty), timeout) >= 0)
-			__uart_wait_until_sent(uport, timeout);
-	}
+	if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
+		tty_wait_until_sent(tty, msecs_to_jiffies(port->closing_wait));
 
 	/*
 	 * At this point, we stop accepting input.  To do this, we
@@ -1329,7 +1321,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
 		 * has completely drained; this is especially
 		 * important if there is a transmit FIFO!
 		 */
-		__uart_wait_until_sent(uport, uport->timeout);
+		uart_wait_until_sent(tty, uport->timeout);
 	}
 
 	uart_shutdown(tty, state);
@@ -1363,8 +1355,10 @@ done:
 	mutex_unlock(&port->mutex);
 }
 
-static void __uart_wait_until_sent(struct uart_port *port, int timeout)
+static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
 {
+	struct uart_state *state = tty->driver_data;
+	struct uart_port *port = state->uart_port;
 	unsigned long char_time, expire;
 
 	if (port->type == PORT_UNKNOWN || port->fifosize == 0)
@@ -1416,16 +1410,6 @@ static void __uart_wait_until_sent(struct uart_port *port, int timeout)
 	}
 }
 
-static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
-{
-	struct uart_state *state = tty->driver_data;
-	struct uart_port *port = state->uart_port;
-
-	tty_lock();
-	__uart_wait_until_sent(port, timeout);
-	tty_unlock();
-}
-
 /*
  * This is called with the BKL held in
  *  linux/drivers/char/tty_io.c:do_tty_hangup()
-- 
1.7.6



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/3] TTY: msm_serial, remove unneeded console set
  2011-07-12 20:43 [PATCH 1/3] TTY: serial, remove BTM from wait_until_sent Jiri Slaby
@ 2011-07-12 20:43 ` Jiri Slaby
  2011-07-12 20:43 ` [PATCH 3/3] TTY: serial, remove tasklet for tty_wakeup Jiri Slaby
  2011-07-12 21:25 ` [PATCH 1/3] TTY: serial, remove BTM from wait_until_sent Arnd Bergmann
  2 siblings, 0 replies; 11+ messages in thread
From: Jiri Slaby @ 2011-07-12 20:43 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, linux-kernel, jirislaby, Alan Cox

It doesn't make sense to set console to uart_port in console->setup.
At that time the console is set by uart_add_one_port already.

The call chain looked like:
uart_add_one_port()
  uport->cons = drv->cons;   <= once
  uart_configure_port()
    register_console()
     console->setup()
       port->cons = co;      <= second time

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Cox <alan@linux.intel.com>
---
 drivers/tty/serial/msm_serial.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index e6ba838..29cbfd8 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -804,8 +804,6 @@ static int __init msm_console_setup(struct console *co, char *options)
 	if (unlikely(!port->membase))
 		return -ENXIO;
 
-	port->cons = co;
-
 	msm_init_clock(port);
 
 	if (options)
-- 
1.7.6



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/3] TTY: serial, remove tasklet for tty_wakeup
  2011-07-12 20:43 [PATCH 1/3] TTY: serial, remove BTM from wait_until_sent Jiri Slaby
  2011-07-12 20:43 ` [PATCH 2/3] TTY: msm_serial, remove unneeded console set Jiri Slaby
@ 2011-07-12 20:43 ` Jiri Slaby
  2011-07-12 21:08   ` Arnd Bergmann
  2011-07-12 21:25 ` [PATCH 1/3] TTY: serial, remove BTM from wait_until_sent Arnd Bergmann
  2 siblings, 1 reply; 11+ messages in thread
From: Jiri Slaby @ 2011-07-12 20:43 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, linux-kernel, jirislaby, Alan Cox

tty_wakeup can be called from any context. So there is no need to have
an extra tasklet for calling that. Hence save some space and remove
the tasklet completely.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Cox <alan@linux.intel.com>
---
 drivers/tty/serial/serial_core.c |   20 +-------------------
 include/linux/serial_core.h      |    1 -
 2 files changed, 1 insertions(+), 20 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 2cbf1bd..4786232 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -72,7 +72,7 @@ void uart_write_wakeup(struct uart_port *port)
 	 * closed.  No cookie for you.
 	 */
 	BUG_ON(!state);
-	tasklet_schedule(&state->tlet);
+	tty_wakeup(state->port.tty);
 }
 
 static void uart_stop(struct tty_struct *tty)
@@ -107,12 +107,6 @@ static void uart_start(struct tty_struct *tty)
 	spin_unlock_irqrestore(&port->lock, flags);
 }
 
-static void uart_tasklet_action(unsigned long data)
-{
-	struct uart_state *state = (struct uart_state *)data;
-	tty_wakeup(state->port.tty);
-}
-
 static inline void
 uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear)
 {
@@ -250,11 +244,6 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
 	}
 
 	/*
-	 * kill off our tasklet
-	 */
-	tasklet_kill(&state->tlet);
-
-	/*
 	 * Free the transmit buffer page.
 	 */
 	if (state->xmit.buf) {
@@ -2277,8 +2266,6 @@ int uart_register_driver(struct uart_driver *drv)
 		port->ops = &uart_port_ops;
 		port->close_delay     = 500;	/* .5 seconds */
 		port->closing_wait    = 30000;	/* 30 seconds */
-		tasklet_init(&state->tlet, uart_tasklet_action,
-			     (unsigned long)state);
 	}
 
 	retval = tty_register_driver(normal);
@@ -2439,11 +2426,6 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
 	 */
 	uport->type = PORT_UNKNOWN;
 
-	/*
-	 * Kill the tasklet, and free resources.
-	 */
-	tasklet_kill(&state->tlet);
-
 	state->uart_port = NULL;
 	mutex_unlock(&port_mutex);
 
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index a5c3114..76e1103 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -384,7 +384,6 @@ struct uart_state {
 	int			pm_state;
 	struct circ_buf		xmit;
 
-	struct tasklet_struct	tlet;
 	struct uart_port	*uart_port;
 };
 
-- 
1.7.6



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] TTY: serial, remove tasklet for tty_wakeup
  2011-07-12 20:43 ` [PATCH 3/3] TTY: serial, remove tasklet for tty_wakeup Jiri Slaby
@ 2011-07-12 21:08   ` Arnd Bergmann
  0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2011-07-12 21:08 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, linux-serial, linux-kernel, jirislaby, Alan Cox

On Tuesday 12 July 2011 22:43:20 Jiri Slaby wrote:
> tty_wakeup can be called from any context. So there is no need to have
> an extra tasklet for calling that. Hence save some space and remove
> the tasklet completely.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Cc: Alan Cox <alan@linux.intel.com>

This is probably ok, but strictly speaking, we we cannot call 
tty_wakeup from any context: not while holding the ldisc_mutex,
i.e. from  ld->ops->{open,close}.

I don't see a reason why we would ever do that, but it's the
only explanation I have why the tasklet was introduced intially.

	Arnd

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] TTY: serial, remove BTM from wait_until_sent
  2011-07-12 20:43 [PATCH 1/3] TTY: serial, remove BTM from wait_until_sent Jiri Slaby
  2011-07-12 20:43 ` [PATCH 2/3] TTY: msm_serial, remove unneeded console set Jiri Slaby
  2011-07-12 20:43 ` [PATCH 3/3] TTY: serial, remove tasklet for tty_wakeup Jiri Slaby
@ 2011-07-12 21:25 ` Arnd Bergmann
  2011-07-13 10:31   ` [PATCH 1/2] TTY: ami_serial, " Jiri Slaby
  2 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2011-07-12 21:25 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: gregkh, linux-serial, linux-kernel, jirislaby, Alan Cox, Andreas Bombe

On Tuesday 12 July 2011 22:43:18 Jiri Slaby wrote:
> During the BKL removal process, the BKL was switched to tty_lock
> (BTM). Now we should start pruning the BTM further. Let's start with
> wait_until_sent of the serial layer. This will allow us to switch to
> the tty port helpers and thus clean it up much.
> 
> In wait_until_sent there are some uport members accessed, but neither
> of them is protected by BTM at the location they are set ('=>' means
> function call):
> * uport->fifosize (set in tty_ioctl => uart_ioctl => uart_set_info)
> * uport->type (set in add_one_port prior to tty_register_device)
> * uport->timeout (set usually in tty_ioctl => tty_mode_ioctl =>
>   tty_set_termios => uart_set_termios => uart_change_speed =>
>   uport->ops->set_termios => uart_update_timeout)
> * call to uport->ops->tx_empty()
> 
> If the tx_empty hook needs some lock to protect accesses to registers,
> it should take &uport->lock spinlock like 8250 does. Otherwise there
> still might be races e.g. with ISRs.
> 
> This should also fix the issue Andreas is seeing (BTM in comparison to
> BKL doesn't have any hidden functionality like unlocking during
> sleeping).

Looks good to me. I would suggest also cleaning up the amiserial.c
driver, which uses a different approach to do the same, by effectively
implementing its own recursive lock.

If uart_wait_until_sent doesn't need the BTM, then amiserial also
shouldn't need it. It does an MMIO access, but it doesn't look like
that needs to be protected. After that is done, we should be able
to kill tty_locked() and __big_tty_mutex_owner as well.

	Arnd

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] TTY: ami_serial, remove BTM from wait_until_sent
  2011-07-12 21:25 ` [PATCH 1/3] TTY: serial, remove BTM from wait_until_sent Arnd Bergmann
@ 2011-07-13 10:31   ` Jiri Slaby
  2011-07-13 10:31     ` [PATCH 2/2] TTY: remove tty_locked Jiri Slaby
  2011-07-13 12:56     ` [PATCH 1/2] TTY: ami_serial, remove BTM from wait_until_sent Arnd Bergmann
  0 siblings, 2 replies; 11+ messages in thread
From: Jiri Slaby @ 2011-07-13 10:31 UTC (permalink / raw)
  To: gregkh
  Cc: jirislaby, linux-serial, linux-kernel, Jiri Slaby, Arnd Bergmann,
	Alan Cox, Andreas Bombe

The same as in "TTY: serial, remove BTM from wait_until_sent" we don't
need to take BTM in wait_until_sent of ami_serial. Exactly the same
as serial, ami_serial accesses some "info" members (xmit_fifo_size,
timeout), but their assignment on other places in the code is not
protected by BTM anyway.

So the BTM protects nothing here. This removal helps us to get rid of
tty_locked() and __big_tty_mutex_owner in the following patch. This
was suggested by Arnd.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Andreas Bombe <aeb@debian.org>
---
 drivers/tty/amiserial.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 2205795..6d43f55 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1529,7 +1529,6 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
 {
 	struct async_struct * info = tty->driver_data;
 	unsigned long orig_jiffies, char_time;
-	int tty_was_locked = tty_locked();
 	int lsr;
 
 	if (serial_paranoia_check(info, tty->name, "rs_wait_until_sent"))
@@ -1541,12 +1540,6 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
 	orig_jiffies = jiffies;
 
 	/*
-	 * tty_wait_until_sent is called from lots of places,
-	 * with or without the BTM.
-	 */
-	if (!tty_was_locked)
-		tty_lock();
-	/*
 	 * Set the check interval to be 1/5 of the estimated time to
 	 * send a single character, and make it at least 1.  The check
 	 * interval should also be less than the timeout.
@@ -1586,8 +1579,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
 			break;
 	}
 	__set_current_state(TASK_RUNNING);
-	if (!tty_was_locked)
-		tty_unlock();
+
 #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
 	printk("lsr = %d (jiff=%lu)...done\n", lsr, jiffies);
 #endif
-- 
1.7.6



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/2] TTY: remove tty_locked
  2011-07-13 10:31   ` [PATCH 1/2] TTY: ami_serial, " Jiri Slaby
@ 2011-07-13 10:31     ` Jiri Slaby
  2011-07-13 12:56       ` Arnd Bergmann
  2011-07-14 12:18         ` Jiri Slaby
  2011-07-13 12:56     ` [PATCH 1/2] TTY: ami_serial, remove BTM from wait_until_sent Arnd Bergmann
  1 sibling, 2 replies; 11+ messages in thread
From: Jiri Slaby @ 2011-07-13 10:31 UTC (permalink / raw)
  To: gregkh
  Cc: jirislaby, linux-serial, linux-kernel, Jiri Slaby, Arnd Bergmann,
	Alan Cox

We used it really only serial and ami_serial. The rest of the
callsites were BUG/WARN_ONs to check if BTM is held. Now that we
pruned tty_locked from both of the real users, we can get rid of
tty_lock along with __big_tty_mutex_owner.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Cox <alan@linux.intel.com>
---
 drivers/tty/serial/serial_core.c |    4 ----
 drivers/tty/tty_ldisc.c          |    1 -
 drivers/tty/tty_mutex.c          |    8 --------
 drivers/tty/vt/selection.c       |    4 ++--
 include/linux/tty.h              |    2 --
 5 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 9df1664..af805d6 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1246,8 +1246,6 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
 	struct uart_port *uport;
 	unsigned long flags;
 
-	BUG_ON(!tty_locked());
-
 	if (!state)
 		return;
 
@@ -1379,7 +1377,6 @@ static void uart_hangup(struct tty_struct *tty)
 	struct tty_port *port = &state->port;
 	unsigned long flags;
 
-	BUG_ON(!tty_locked());
 	pr_debug("uart_hangup(%d)\n", state->uart_port->line);
 
 	mutex_lock(&port->mutex);
@@ -1466,7 +1463,6 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
 	struct tty_port *port;
 	int retval, line = tty->index;
 
-	BUG_ON(!tty_locked());
 	pr_debug("uart_open(%d) called\n", line);
 
 	/*
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index ef925d5..512c49f 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -450,7 +450,6 @@ static int tty_ldisc_open(struct tty_struct *tty, struct tty_ldisc *ld)
 	if (ld->ops->open) {
 		int ret;
                 /* BTM here locks versus a hangup event */
-		WARN_ON(!tty_locked());
 		ret = ld->ops->open(tty);
 		if (ret)
 			clear_bit(TTY_LDISC_OPEN, &tty->flags);
diff --git a/drivers/tty/tty_mutex.c b/drivers/tty/tty_mutex.c
index 3b2bb77..7feada7 100644
--- a/drivers/tty/tty_mutex.c
+++ b/drivers/tty/tty_mutex.c
@@ -15,8 +15,6 @@
  * Don't use in new code.
  */
 static DEFINE_MUTEX(big_tty_mutex);
-struct task_struct *__big_tty_mutex_owner;
-EXPORT_SYMBOL_GPL(__big_tty_mutex_owner);
 
 /*
  * Getting the big tty mutex.
@@ -25,10 +23,7 @@ void __lockfunc tty_lock(void)
 {
 	struct task_struct *task = current;
 
-	WARN_ON(__big_tty_mutex_owner == task);
-
 	mutex_lock(&big_tty_mutex);
-	__big_tty_mutex_owner = task;
 }
 EXPORT_SYMBOL(tty_lock);
 
@@ -36,9 +31,6 @@ void __lockfunc tty_unlock(void)
 {
 	struct task_struct *task = current;
 
-	WARN_ON(__big_tty_mutex_owner != task);
-	__big_tty_mutex_owner = NULL;
-
 	mutex_unlock(&big_tty_mutex);
 }
 EXPORT_SYMBOL(tty_unlock);
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index fb864e7..7a0a12a 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -301,6 +301,8 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t
 /* Insert the contents of the selection buffer into the
  * queue of the tty associated with the current console.
  * Invoked by ioctl().
+ *
+ * Locking: always called with BTM from vt_ioctl
  */
 int paste_selection(struct tty_struct *tty)
 {
@@ -310,8 +312,6 @@ int paste_selection(struct tty_struct *tty)
 	struct  tty_ldisc *ld;
 	DECLARE_WAITQUEUE(wait, current);
 
-	/* always called with BTM from vt_ioctl */
-	WARN_ON(!tty_locked());
 
 	console_lock();
 	poke_blanked_console();
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 44bc0c5..6d5eceb 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -600,8 +600,6 @@ extern long vt_compat_ioctl(struct tty_struct *tty,
 /* functions for preparation of BKL removal */
 extern void __lockfunc tty_lock(void) __acquires(tty_lock);
 extern void __lockfunc tty_unlock(void) __releases(tty_lock);
-extern struct task_struct *__big_tty_mutex_owner;
-#define tty_locked()		(current == __big_tty_mutex_owner)
 
 /*
  * wait_event_interruptible_tty -- wait for a condition with the tty lock held
-- 
1.7.6



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] TTY: ami_serial, remove BTM from wait_until_sent
  2011-07-13 10:31   ` [PATCH 1/2] TTY: ami_serial, " Jiri Slaby
  2011-07-13 10:31     ` [PATCH 2/2] TTY: remove tty_locked Jiri Slaby
@ 2011-07-13 12:56     ` Arnd Bergmann
  1 sibling, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2011-07-13 12:56 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: gregkh, jirislaby, linux-serial, linux-kernel, Alan Cox, Andreas Bombe

On Wednesday 13 July 2011, Jiri Slaby wrote:
> The same as in "TTY: serial, remove BTM from wait_until_sent" we don't
> need to take BTM in wait_until_sent of ami_serial. Exactly the same
> as serial, ami_serial accesses some "info" members (xmit_fifo_size,
> timeout), but their assignment on other places in the code is not
> protected by BTM anyway.
> 
> So the BTM protects nothing here. This removal helps us to get rid of
> tty_locked() and __big_tty_mutex_owner in the following patch. This
> was suggested by Arnd.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Cc: Alan Cox <alan@linux.intel.com>
> Cc: Andreas Bombe <aeb@debian.org>

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] TTY: remove tty_locked
  2011-07-13 10:31     ` [PATCH 2/2] TTY: remove tty_locked Jiri Slaby
@ 2011-07-13 12:56       ` Arnd Bergmann
  2011-07-14 12:18         ` Jiri Slaby
  1 sibling, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2011-07-13 12:56 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, jirislaby, linux-serial, linux-kernel, Alan Cox

On Wednesday 13 July 2011, Jiri Slaby wrote:
> We used it really only serial and ami_serial. The rest of the
> callsites were BUG/WARN_ONs to check if BTM is held. Now that we
> pruned tty_locked from both of the real users, we can get rid of
> tty_lock along with __big_tty_mutex_owner.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Cc: Alan Cox <alan@linux.intel.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] TTY: remove tty_locked
  2011-07-13 10:31     ` [PATCH 2/2] TTY: remove tty_locked Jiri Slaby
@ 2011-07-14 12:18         ` Jiri Slaby
  2011-07-14 12:18         ` Jiri Slaby
  1 sibling, 0 replies; 11+ messages in thread
From: Jiri Slaby @ 2011-07-14 12:18 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, linux-serial, linux-kernel, Arnd Bergmann, Alan Cox

On 07/13/2011 12:31 PM, Jiri Slaby wrote:
> --- a/drivers/tty/tty_mutex.c
> +++ b/drivers/tty/tty_mutex.c
...
> @@ -25,10 +23,7 @@ void __lockfunc tty_lock(void)
>  {
>  	struct task_struct *task = current;

Hmm I overlooked it generates a warning:
drivers/tty/tty_mutex.c: In function ‘tty_lock’:
drivers/tty/tty_mutex.c:24:22: warning: unused variable ‘task’
drivers/tty/tty_mutex.c: In function ‘tty_unlock’:
drivers/tty/tty_mutex.c:32:22: warning: unused variable ‘task’

> -	WARN_ON(__big_tty_mutex_owner == task);
> -
>  	mutex_lock(&big_tty_mutex);
> -	__big_tty_mutex_owner = task;
>  }

I will send whole series as v2 since it is confusing enough.

thanks,
-- 
js

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] TTY: remove tty_locked
@ 2011-07-14 12:18         ` Jiri Slaby
  0 siblings, 0 replies; 11+ messages in thread
From: Jiri Slaby @ 2011-07-14 12:18 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, linux-serial, linux-kernel, Arnd Bergmann, Alan Cox

On 07/13/2011 12:31 PM, Jiri Slaby wrote:
> --- a/drivers/tty/tty_mutex.c
> +++ b/drivers/tty/tty_mutex.c
...
> @@ -25,10 +23,7 @@ void __lockfunc tty_lock(void)
>  {
>  	struct task_struct *task = current;

Hmm I overlooked it generates a warning:
drivers/tty/tty_mutex.c: In function ‘tty_lock’:
drivers/tty/tty_mutex.c:24:22: warning: unused variable ‘task’
drivers/tty/tty_mutex.c: In function ‘tty_unlock’:
drivers/tty/tty_mutex.c:32:22: warning: unused variable ‘task’

> -	WARN_ON(__big_tty_mutex_owner == task);
> -
>  	mutex_lock(&big_tty_mutex);
> -	__big_tty_mutex_owner = task;
>  }

I will send whole series as v2 since it is confusing enough.

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-07-14 12:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-12 20:43 [PATCH 1/3] TTY: serial, remove BTM from wait_until_sent Jiri Slaby
2011-07-12 20:43 ` [PATCH 2/3] TTY: msm_serial, remove unneeded console set Jiri Slaby
2011-07-12 20:43 ` [PATCH 3/3] TTY: serial, remove tasklet for tty_wakeup Jiri Slaby
2011-07-12 21:08   ` Arnd Bergmann
2011-07-12 21:25 ` [PATCH 1/3] TTY: serial, remove BTM from wait_until_sent Arnd Bergmann
2011-07-13 10:31   ` [PATCH 1/2] TTY: ami_serial, " Jiri Slaby
2011-07-13 10:31     ` [PATCH 2/2] TTY: remove tty_locked Jiri Slaby
2011-07-13 12:56       ` Arnd Bergmann
2011-07-14 12:18       ` Jiri Slaby
2011-07-14 12:18         ` Jiri Slaby
2011-07-13 12:56     ` [PATCH 1/2] TTY: ami_serial, remove BTM from wait_until_sent Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.