[RTEMS Project] #1736: Termios transmit starvation

RTEMS trac trac at rtems.org
Thu Dec 18 09:36:00 UTC 2014


#1736: Termios transmit starvation
-----------------------------+----------------------------
 Reporter:  sebastian.huber  |       Owner:  joel.sherrill
     Type:  defect           |      Status:  closed
 Priority:  normal           |   Milestone:  4.11
Component:  cpukit           |     Version:  4.11
 Severity:  normal           |  Resolution:  worksforme
 Keywords:                   |
-----------------------------+----------------------------
Changes (by sebastian.huber):

 * status:  new => closed
 * resolution:   => worksforme


Old description:

> A workaround for this problem is to disable the preemption around
> rtems_termios_dequeue_characters().
>
> Index: ./libcsupport/src/termios.c
> ===================================================================
> RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/termios.c,v
> retrieving revision 1.64
> diff -u -r1.64 termios.c
> --- ./libcsupport/src/termios.c 10 Aug 2010 22:15:32 -0000      1.64
> +++ ./libcsupport/src/termios.c 8 Feb 2011 11:37:06 -0000
> @@ -1311,6 +1311,15 @@
>         * wake up any pending writer task
>         */
>        rtems_semaphore_release (tty->rawOutBuf.Semaphore);
> +
> +      /*
> +       * FIXME: Here we have a race condition.  In case this function is
> not
> +       * invoked with preemption disabled (e.g. interrupt context) the
> release
> +       * may interrupt us here and let the waiting task run.  We may
> enter the
> +       * rob_wait state again.  Later in this function we loose this
> +       * information, because we simply overwrite the state.  This leads
> to
> +       * transmit starvation.
> +       */
>      }
>
>      if (newTail == tty->rawOutBuf.Head) {

New description:

 A workaround for this problem is to disable the preemption around
 rtems_termios_dequeue_characters().

 Index: ./libcsupport/src/termios.c
 ===================================================================
 RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/termios.c,v
 retrieving revision 1.64
 diff -u -r1.64 termios.c
 --- ./libcsupport/src/termios.c 10 Aug 2010 22:15:32 -0000      1.64
 +++ ./libcsupport/src/termios.c 8 Feb 2011 11:37:06 -0000
 @@ -1311,6 +1311,15 @@
         * wake up any pending writer task
         */
        rtems_semaphore_release (tty->rawOutBuf.Semaphore);
 +
 +      /*
 +       * FIXME: Here we have a race condition.  In case this function is
 not
 +       * invoked with preemption disabled (e.g. interrupt context) the
 release
 +       * may interrupt us here and let the waiting task run.  We may
 enter the
 +       * rob_wait state again.  Later in this function we loose this
 +       * information, because we simply overwrite the state.  This leads
 to
 +       * transmit starvation.
 +       */
      }

      if (newTail == tty->rawOutBuf.Head) {

--

Comment:

 After a review I don't think this problem exists.

--
Ticket URL: <http://devel.rtems.org/ticket/1736#comment:3>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list