mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Pfaff <tpfaff@pcs.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Question about TTY_DO_WRITE_WAKEUP
Date: Thu, 20 Nov 2008 17:39:38 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0811201700320.1274@lxtpfaff.pcs.ditec.de> (raw)
In-Reply-To: <20081120155502.608812d9@lxorguk.ukuu.org.uk>


On Thu, 20 Nov 2008, Alan Cox wrote:

> > But n_tty_write_wakeup is only called from tty_wakeup when this bit is already 
> > set, therefore it makes no sense to set this bit in n_tty_write_wakeup again.
> 
> The base code should probably really use test_and_clear_bit() when
> calling that method.

Why should you test it, clear it and set it again in n_tty_write_wakeup ?

> > 
> > The flow looks to me as
> > 
> > If the tty driver sets TTY_DO_WRITE_WAKEUP a SIGIO is generated on every 
> > tty_wakeup.
> > 
> > If it is not set then n_tty_write_wakeup is never called and a SIGIO is not 
> > generated.
> 
> Which isn't perfect (excess SIGIO cases) but doesn't seem incorrect. If
> you've not blocked the tty output buffer then write() has not returned a
> short write and no SIGIO is due.
> 

Of course this is not incorrect, but this does not solve my problem with the 
TTY_DO_WRITE_WAKEUP flag.

IMHO a SIGIO on write possible should always be generated if the user wants it, 
currently it is generated when the user wants it and the tty driver enables the 
TTY_DO_WRITE_WAKEUP flag. Unfortunately most drivers don't set it.

Regarding excess SIGIO cases:

Once a write fails with EAGAIN a flag can be set and only in that case a SIGIO is 
generated, afterwards the bit is cleared. Maybe that is what TTY_DO_WRITE_WAKEUP 
was intended for. 

Thomas

  reply	other threads:[~2008-11-20 16:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-20 10:06 Thomas Pfaff
2008-11-20 13:17 ` Alan Cox
2008-11-20 14:09   ` Thomas Pfaff
2008-11-20 14:31     ` Alan Cox
2008-11-20 15:12       ` Thomas Pfaff
2008-11-20 15:55         ` Alan Cox
2008-11-20 16:39           ` Thomas Pfaff [this message]
2008-11-20 16:47             ` Alan Cox
2008-11-20 16:58             ` Alan Cox

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=Pine.LNX.4.64.0811201700320.1274@lxtpfaff.pcs.ditec.de \
    --to=tpfaff@pcs.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®