public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Jiri Slaby <jslaby@suse.cz>
Cc: gregkh@suse.de, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, jirislaby@gmail.com,
	Alan Cox <alan@linux.intel.com>, Andreas Bombe <aeb@debian.org>
Subject: Re: [PATCH 1/3] TTY: serial, remove BTM from wait_until_sent
Date: Tue, 12 Jul 2011 23:25:34 +0200	[thread overview]
Message-ID: <201107122325.35013.arnd@arndb.de> (raw)
In-Reply-To: <1310503400-28447-1-git-send-email-jslaby@suse.cz>

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

  parent reply	other threads:[~2011-07-12 21:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Arnd Bergmann [this message]
2011-07-13 10:31   ` [PATCH 1/2] TTY: ami_serial, remove BTM from wait_until_sent 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-13 12:56     ` [PATCH 1/2] TTY: ami_serial, remove BTM from wait_until_sent Arnd Bergmann

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=201107122325.35013.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=aeb@debian.org \
    --cc=alan@linux.intel.com \
    --cc=gregkh@suse.de \
    --cc=jirislaby@gmail.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /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