mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: "Tu, Xiaobing" <xiaobing.tu@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"Zhang, Yanmin" <yanmin.zhang@intel.com>,
	"Du, Alek" <alek.du@intel.com>, "Zuo, Jiao" <jiao.zuo@intel.com>
Subject: Re: [PATCH] tty: hold lock across tty buffer finding and buffer filling
Date: Thu, 15 Mar 2012 10:08:12 +0000	[thread overview]
Message-ID: <20120315100812.6cda2ef9@pyramind.ukuu.org.uk> (raw)
In-Reply-To: <EE928378561BF1449699C96571234A740FCC580F@SHSMSX102.ccr.corp.intel.com>

On Thu, 15 Mar 2012 02:06:43 +0000
"Tu, Xiaobing" <xiaobing.tu@intel.com> wrote:

> From: Xiaobing Tu <xiaobing.tu@intel.com>
> 
> tty_buffer_request_room is well protected, but while after it returns,
>  it releases the port->lock. tty->buf.tail might be modified

This can only occur in a way that matters if you have multiple writers to
the tty buffer. 

It is a design requirement of the tty layer that your input is single
threaded paths and this is true for existing drivers. There is a good
reason it is true as well - ordering of bytes is defined for serial data,
any parallel writer breaks that ordering even if you have locks in
tty_insert_flip_*.

In practice that means that the tail pointer has a single incrementer and
the reader is the ldisc processing queue. 

So NAK pending a lot more explanation and an actual case where you can
show it is required.

Under what situations with what in tree driver do you see a problem ?


Alan

  reply	other threads:[~2012-03-15 10:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-15  2:06 Tu, Xiaobing
2012-03-15 10:08 ` Alan Cox [this message]
2012-03-15 10:14   ` Du, Alek
2012-03-15 15:40     ` Alan Cox
2012-03-16  9:43     ` Jiri Slaby
2012-03-16  9:49       ` Du, Alek
2012-03-16  9:57         ` Jiri Slaby
2012-03-16 10:01           ` Du, Alek
2012-03-16 10:04             ` Jiri Slaby
2012-03-16 10:08               ` Du, Alek
2012-03-16 10:22                 ` Jiri Slaby
2012-03-16 11:33                   ` Du, Alek
2012-03-16 12:03                     ` Jiri Slaby
2012-03-16 13:50                       ` Du, Alek
2012-03-16 20:53                         ` Jiri Slaby
2012-03-17  1:05                           ` Alek Du
2012-03-16 23:07                       ` Alan Cox
2012-03-15 20:26 ` gregkh

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=20120315100812.6cda2ef9@pyramind.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=alek.du@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jiao.zuo@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiaobing.tu@intel.com \
    --cc=yanmin.zhang@intel.com \
    /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

Powered by JetHome