termios+PTY=real-time killer? (was Re: Interrupt Latency on PPC)

Thomas Doerfler Thomas.Doerfler at imd-systems.de
Mon Nov 19 19:30:35 UTC 2001


Hi,

> My own implementation (a very particular) ot PTY is a way to
> give to shell() a tcp/ip solution but with a standard 
conection telnet
> client.
> 
> I couldn't think in this kind of problems when the 
implementation.

I think it is the termios code that should be changed, (and 
possibly I broke it two years ago), there is really no reason 
to disable interrupts during polled write. I think it is easy 
to check, whether the device is working polled and skip irq 
blocking then. Please not that for task-driven mode, some irq 
disables may still be needed.

I won't find time to change this before the next weekend, so 
if the problem is urgent, maybe someone else could try to 
solve it?

Bye,
	Thomas.

> 
> Fernando RUIZ CASAS
> home:correo at fenando-ruiz.com
> work:fernando.ruiz at ctv.es
> 
> -----Mensaje original-----
> De: Joel Sherrill [mailto:joel.sherrill at oarcorp.com]
> Enviado el: sabado, 17 de noviembre de 2001 18:41
> Para: Till Straumann
> CC: Fernando RUIZ CASAS (E-mail); 'RTEMS List'
> Asunto: Re: termios+PTY=real-time killer? (was Re: Interrupt 
Latency on
> PPC)
> 
> 
> 
> 
> Till Straumann wrote:
> >
> > "Fernando RUIZ CASAS (E-mail)" wrote:
> >
> > > Hi.
> > >  Is the PTY driver the pty.c file placed close to 
telnetd.c?
> > >
> > >  This pty driver doesn't make any special thing with 
termios.
> > >  If the tcp/ip works fine the driver also.
> > >
> >
> > We are talking about the very one. I agree, pty.c does not 
do anything
> > special. However, termios [under some circumstances] calls
> > pty's pollWrite() function with _Interrupts_disabled_:
> >
> >   rtems_interrupt_disable(level);
> >   ...
> >   tty->device.write(...);
> >   ...
> >   rtems_interrupt_enable(level);
> >
> > Because PTY's pollWrite() does socket/IO, I guess it could 
even
> > block! - Or am I missing something?
> >
> > I suppose that termios could relax its interrupt-disabling 
policy
> > in task driven mode. PTY should then probably be run in 
task
> > driven or polled mode.
> 
> Another more general solution may be for there to be a PTY
> server that processes requests.  I don't know if having
> a single task to do all PTY requests is good or bad though.
> 
> I have a couple of more general questions.
> 
>   + Does this mean that the PTY  is doing socket IO inside
>     an interrupt?  If so, I suspect this is very dangerous.
>     Eric Norum should comment.
>   + Is the interrupt disable necessary in general?
> 
> > -- Till
> >
> > >
> > > Perhaps I'm speaking about other oignons.
> > >
> > > Fernando RUIZ CASAS
> > > home:correo at fenando-ruiz.com
> > > work:fernando.ruiz at ctv.es
> > >
> > > -----Mensaje original-----
> > > De: till at MAILBOX.SLAC.Stanford.EDU
> > > [mailto:till at MAILBOX.SLAC.Stanford.EDU]En nombre de Till 
Straumann
> > > Enviado el: viernes, 16 de noviembre de 2001 2:26
> > > Para: RTEMS List; joel.sherrill at oarcorp.com
> > > Asunto: Re: Interrupt Latency on PPC
> > >
> > > Things get _really_ bad when the PTY driver is
> > > heavily used. I measured IRQ latencies of ~200us
> > > during quite short measurement intervals (remember,
> > > we're doing statistics here). This is in the order of
> > > 100 times the average.
> > >
> > > I guess that the problem is caused by termios.c
> > > which under some circumstances calls the
> > > device's 'write' callback with _IRQs_disabled_.
> > > The PTY driver's write callback is a
> > >
> > > write(socket,...)
> > >
> > > outchh!
> > >
> > > Is there a termios expert out there who could explain
> > > to me what really needs to be protected from interrupts?
> > >
> > > Also, shouldn't the PTY driver run in task driven
> > > (as opposed to the current IRQ driven) mode?
> > >
> > > -----Mensaje original-----
> > > De: till at MAILBOX.SLAC.Stanford.EDU
> > > [mailto:till at MAILBOX.SLAC.Stanford.EDU]En nombre de Till 
Straumann
> > > Enviado el: viernes, 16 de noviembre de 2001 2:26
> > > Para: RTEMS List; joel.sherrill at oarcorp.com
> > > Asunto: Re: Interrupt Latency on PPC
> > >
> > > Things get _really_ bad when the PTY driver is
> > > heavily used. I measured IRQ latencies of ~200us
> > > during quite short measurement intervals (remember,
> > > we're doing statistics here). This is in the order of
> > > 100 times the average.
> > >
> > > I guess that the problem is caused by termios.c
> > > which under some circumstances calls the
> > > device's 'write' callback with _IRQs_disabled_.
> > > The PTY driver's write callback is a
> > >
> > > write(socket,...)
> > >
> > > outchh!
> > >
> > > Is there a termios expert out there who could explain
> > > to me what really needs to be protected from interrupts?
> > >
> > > Also, shouldn't the PTY driver run in task driven
> > > (as opposed to the current IRQ driven) mode?
> > >
> > > -- Till.
> 
> --
> Joel Sherrill, Ph.D.             Director of Research & 
Development
> joel at OARcorp.com                 On-Line Applications 
Research
> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
>    Support Available             (256) 722-9985

--------------------------------------------
IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler           Herbststrasse 8
D-82178 Puchheim          Germany
email:    Thomas.Doerfler at imd-systems.de
PGP public key available at: http://www.imd-
systems.de/pgp_key.htm




More information about the users mailing list