All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Peter Hurley <peter@hurleysoftware.com>
Cc: Jiri Slaby <jslaby@suse.cz>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty: Add missing lock in n_tty_write()
Date: Fri, 17 May 2013 13:48:45 +0200	[thread overview]
Message-ID: <20130517114845.GA2602@8bytes.org> (raw)
In-Reply-To: <519415F3.6060103@hurleysoftware.com>

Hi Peter,

thanks for you explanations. They helped me to better understand what is
happening now.

On Wed, May 15, 2013 at 07:10:43PM -0400, Peter Hurley wrote:
> On 05/15/2013 03:48 PM, Joerg Roedel wrote:

> Agreed. Those functions look written for single-producer/single-consumer
> i/o model. (That's why I asked about CONFIG_CONSOLE_POLL=y as well because
> that doesn't look thread-safe either).

Ok, I checked that. CONFIG_CONSOLE_POLL is on in that kernel.

> Just to be clear here: there's a difference between a console driver
> and a tty driver.
> 
> The console driver's write() method is serialized with the global
> console_lock() so parallel console writes are not possible.
> 
> No such guarantee exists for the tty driver write() method, although it
> probably wouldn't be difficult to provide that guarantee (since the
> line discipline write() is already serialized by tty->atomic_write_lock).

Okay, so it is safe to say that currently the drivers write() (and
put_chars()) functions need to expect to be called concurrently and
therefore they have to serialize themselves when they need it, right?


	Joerg



  reply	other threads:[~2013-05-17 11:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-15 10:56 [PATCH] tty: Add missing lock in n_tty_write() Joerg Roedel
2013-05-15 15:03 ` Jiri Slaby
2013-05-15 15:47   ` Joerg Roedel
2013-05-15 18:45     ` Peter Hurley
2013-05-15 19:48       ` Joerg Roedel
2013-05-15 23:10         ` Peter Hurley
2013-05-17 11:48           ` Joerg Roedel [this message]
2013-05-17 19:08             ` Peter Hurley

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=20130517114845.GA2602@8bytes.org \
    --to=joro@8bytes.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@hurleysoftware.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 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.