From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Oliver Neukum <oliver@neukum.org>,
Alan Cox <alan@linux.intel.com>, <greg@kroah.com>,
<linux-kernel@vger.kernel.org>, <linux-usb@vger.kernel.org>
Subject: Re: [PATCH 4/5] usb_serial: Kill port mutex
Date: Wed, 7 Oct 2009 17:46:11 +0100 [thread overview]
Message-ID: <20091007174611.439a7a5a@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0910071157390.2762-100000@iolanthe.rowland.org>
On Wed, 7 Oct 2009 12:03:08 -0400 (EDT)
Alan Stern <stern@rowland.harvard.edu> wrote:
> On Wed, 7 Oct 2009, Oliver Neukum wrote:
>
> > We will need some generic way to autoresume from open.
> > Resume will need to lock against open() and need to be called
> > from within open(). Any ideas for an unugly interface?
>
> It's not quite that bad. Resume doesn't need to lock against open.
> If open is called while resume is running then when it tries to do its
> own resume, it will either block (waiting for the pm_mutex) or return
> immediately (if it sees the device is already resumed).
It would probably be cleaner if they could lock against each other
> A more interesting question is how to synchronize both open/close and
> suspend/resume against throttle/unthrottle.
throttle and unthrottle can sleep and obviously have to as they do a fair
bit of work sometimes (xon/xoff, mode line waggling etc)
The current ordering here is quite ugly because we open the ldisc before
the tty which means the ldisc sometimes calls unthrottle before the tty
is opened which is not nice. On the close side we have the same thing via
tty_ldisc_release.
We can take the port->mutex lock in the throttle/unthrottle methods as
far as I can see - there are no obvious problem cases. We do call
->throttle and ->unthrottle from the ldisc open but this occurs outside
of any call to the tty driver open/close method so I don't see any
deadlock.
It adds an ordering of termios lock before port mutex when taking both
but that's not a problem and really implicit in the structure of the code
anyway.
Alan
next prev parent reply other threads:[~2009-10-07 16:45 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-06 15:05 [PATCH 0/5] tty_port_open Alan Cox
2009-10-06 15:06 ` [PATCH 1/5] tty_port: add "tty_port_open" helper Alan Cox
2009-10-06 15:06 ` [PATCH 2/5] tty_port: coding style cleaning pass Alan Cox
2009-10-06 15:06 ` [PATCH 3/5] usb_serial: Use the shutdown() operation Alan Cox
2009-10-06 15:06 ` [PATCH 4/5] usb_serial: Kill port mutex Alan Cox
2009-10-07 5:02 ` Oliver Neukum
2009-10-07 16:03 ` Alan Stern
2009-10-07 16:10 ` Oliver Neukum
2009-10-07 16:34 ` Alan Stern
2009-10-07 16:46 ` Alan Cox [this message]
2009-10-07 17:23 ` Alan Stern
2009-10-07 18:25 ` Alan Cox
2009-10-07 18:52 ` Alan Stern
2009-10-07 20:56 ` Oliver Neukum
2009-10-07 21:02 ` Alan Cox
2009-10-07 21:34 ` Alan Stern
2009-10-08 13:43 ` Oliver Neukum
2009-10-08 14:58 ` Alan Stern
2009-10-08 15:27 ` Oliver Neukum
2009-10-08 16:58 ` Alan Stern
2009-10-08 20:06 ` Alan Stern
2009-10-08 20:40 ` Oliver Neukum
2009-10-08 21:19 ` Alan Cox
2009-10-08 21:31 ` Alan Stern
2009-10-08 22:31 ` Alan Cox
2009-10-08 11:37 ` Oliver Neukum
2009-10-06 15:06 ` [PATCH 5/5] opticon: Fix resume logic Alan Cox
2009-10-06 21:12 ` Oliver Neukum
2009-10-06 22:23 ` Alan Cox
2009-10-07 15:56 ` Johan Hovold
2009-10-07 16:01 ` Oliver Neukum
2009-10-07 15:56 ` Alan Stern
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=20091007174611.439a7a5a@lxorguk.ukuu.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=alan@linux.intel.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