Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#1736 closed defect (worksforme)

Termios transmit starvation

Reported by: Sebastian Huber Owned by: Joel Sherrill
Priority: normal Milestone: 4.11
Component: score Version: 4.11
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Sebastian Huber)

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) {

Change History (3)

comment:1 Changed on 02/08/11 at 10:39:57 by Sebastian Huber

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:2 Changed on 11/24/14 at 18:58:28 by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

comment:3 Changed on 12/18/14 at 09:36:00 by Sebastian Huber

Description: modified (diff)
Resolution: worksforme
Status: newclosed

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

Note: See TracTickets for help on using tickets.