Changeset ede4f16 in rtems


Ignore:
Timestamp:
03/07/06 22:09:49 (18 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Children:
ca6df52
Parents:
5b07faf
Message:

2006-03-07 Steven Johnson <sjohnson@…>

PR 850/rtems

  • src/watchdogtickle.c: A Watchdog (used to timeout an event) with a delay of 1 sometimes does not seem to timeout. The problem occurs, because for whatever reason when the watchdog tickle function executes, the watchdog->delta_interval is 0. it is then decremented before being tested, becomes huge and so doesnt time out. It is thought there is a race condition where the watchdog->delta_interval is calculated by reference to a head (also with a delay of 1). But before it can be added after the head, the head is removed, so the new head now has a delay of 0.
Location:
cpukit/score
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/ChangeLog

    r5b07faf rede4f16  
     12006-03-07      Steven Johnson <sjohnson@sakuraindustries.com>
     2
     3        PR 850/rtems
     4        * src/watchdogtickle.c: A Watchdog (used to timeout an event) with
     5        a delay of 1 sometimes does not seem to timeout.  The problem
     6        occurs, because for whatever reason when the watchdog tickle function
     7        executes, the watchdog->delta_interval is 0. it is then decremented
     8        before being tested, becomes huge and so doesnt time out.  It is
     9        thought there is a race condition where the watchdog->delta_interval
     10        is calculated by reference to a head (also with a delay of 1). But
     11        before it can be added after the head, the head is removed, so the
     12        new head now has a delay of 0.
     13
    1142006-03-07      Joel Sherrill <joel@OARcorp.com>
    215
  • cpukit/score/src/watchdogtickle.c

    r5b07faf rede4f16  
    5050
    5151  the_watchdog = _Watchdog_First( header );
    52   the_watchdog->delta_interval--;
    53   if ( the_watchdog->delta_interval != 0 )
    54     goto leave;
     52 
     53  /*
     54   * For some reason, on rare occasions the_watchdog->delta_interval
     55   * of the head of the watchdog chain is 0.  Before this test was
     56   * added, on these occasions an event (which usually was supposed
     57   * to have a timeout of 1 tick would have a delta_interval of 0, which
     58   * would be decremented to 0xFFFFFFFF by the unprotected
     59   * "the_watchdog->delta_interval--;" operation.
     60   * This would mean the event would not timeout, and also the chain would
     61   * be blocked, because a timeout with a very high number would be at the
     62   * head, rather than at the end.
     63   * The test "if (the_watchdog->delta_interval != 0)"
     64   * here prevents this from occuring.
     65   *
     66   * We were not able to categorically identify the situation that causes
     67   * this, but proved it to be true empirically.  So this check causes
     68   * correct behaviour in this circumstance.
     69   *
     70   * The belief is that a race condition exists whereby an event at the head
     71   * of the chain is removed (by a pending ISR or higher priority task)
     72   * during the _ISR_Flash( level ); in _Watchdog_Insert, but the watchdog
     73   * to be inserted has already had its delta_interval adjusted to 0, and
     74   * so is added to the head of the chain with a delta_interval of 0. 
     75   *
     76   * Steven Johnson - 12/2005 (gcc-3.2.3 -O3 on powerpc)
     77   */
     78  if (the_watchdog->delta_interval != 0) {
     79    the_watchdog->delta_interval--;
     80    if ( the_watchdog->delta_interval != 0 )
     81      goto leave;
     82  }     
    5583
    5684  do {
Note: See TracChangeset for help on using the changeset viewer.