[rtems commit] rtems: Fix _Rate_monotonic_Renew_deadline()

Sebastian Huber sebh at rtems.org
Tue Jan 24 13:45:10 UTC 2017


Module:    rtems
Branch:    master
Commit:    1240aade5a35c4e8c43d5409e2329eeb6a173299
Changeset: http://git.rtems.org/rtems/commit/?id=1240aade5a35c4e8c43d5409e2329eeb6a173299

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jan 24 14:37:42 2017 +0100

rtems: Fix _Rate_monotonic_Renew_deadline()

Make _Rate_monotonic_Renew_deadline() static and use proper locking in SMP
configurations.

Update #2795.

---

 cpukit/rtems/include/rtems/rtems/ratemonimpl.h | 12 -----------
 cpukit/rtems/src/ratemonperiod.c               | 24 ---------------------
 cpukit/rtems/src/ratemontimeout.c              | 29 +++++++++++++++++++-------
 3 files changed, 21 insertions(+), 44 deletions(-)

diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
index c4133c7..ba38a3e 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
@@ -117,18 +117,6 @@ bool _Rate_monotonic_Get_status(
   Timestamp_Control            *cpu_since_last_period
 );
 
-/**
- * @brief Renew the watchdog deadline
- *
- * This routine is prepared for the watchdog timeout to renew its deadline
- * without releasing jobs.
- */
-void _Rate_monotonic_Renew_deadline(
-  Rate_monotonic_Control *the_period,
-  Thread_Control         *owner,
-  ISR_lock_Context       *lock_context
-);
-
 void _Rate_monotonic_Restart(
   Rate_monotonic_Control *the_period,
   Thread_Control         *owner,
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index 128af57..a4d224f 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -120,30 +120,6 @@ static void _Rate_monotonic_Release_job(
   _Thread_Dispatch_enable( cpu_self );
 }
 
-void _Rate_monotonic_Renew_deadline(
-  Rate_monotonic_Control *the_period,
-  Thread_Control         *owner,
-  ISR_lock_Context       *lock_context
-)
-{
-  Per_CPU_Control *cpu_self;
-  uint64_t deadline;
-
-  cpu_self = _Thread_Dispatch_disable_critical( lock_context );
-  _Rate_monotonic_Release( owner, lock_context );
-
-  _ISR_lock_ISR_disable( lock_context );
-  deadline = _Watchdog_Per_CPU_insert_relative(
-    &the_period->Timer,
-    cpu_self,
-    the_period->next_length
-  );
-  the_period->latest_deadline = deadline;
-  _ISR_lock_ISR_enable( lock_context );
-  _Thread_Dispatch_enable( cpu_self );
-
-}
-
 void _Rate_monotonic_Restart(
   Rate_monotonic_Control *the_period,
   Thread_Control         *owner,
diff --git a/cpukit/rtems/src/ratemontimeout.c b/cpukit/rtems/src/ratemontimeout.c
index c2a0291..bcc4ccf 100644
--- a/cpukit/rtems/src/ratemontimeout.c
+++ b/cpukit/rtems/src/ratemontimeout.c
@@ -22,6 +22,27 @@
 
 #include <rtems/rtems/ratemonimpl.h>
 
+static void _Rate_monotonic_Renew_deadline(
+  Rate_monotonic_Control *the_period,
+  Thread_Control         *owner,
+  ISR_lock_Context       *lock_context
+)
+{
+  uint64_t deadline;
+
+  ++the_period->postponed_jobs;
+  the_period->state = RATE_MONOTONIC_EXPIRED;
+
+  deadline = _Watchdog_Per_CPU_insert_relative(
+    &the_period->Timer,
+    _Per_CPU_Get(),
+    the_period->next_length
+  );
+  the_period->latest_deadline = deadline;
+
+  _Rate_monotonic_Release( the_period, lock_context );
+}
+
 void _Rate_monotonic_Timeout( Watchdog_Control *the_watchdog )
 {
   Rate_monotonic_Control *the_period;
@@ -64,14 +85,6 @@ void _Rate_monotonic_Timeout( Watchdog_Control *the_watchdog )
       _Thread_Unblock( owner );
     }
   } else {
-    /*
-     * If the watchdog is timeout, it means there is an additional postponed
-     * job in the next period but it is not available to release now:
-     * Either the current task is still executed, or it is preemptive by the
-     * other higher priority tasks.
-     */
-    the_period->postponed_jobs += 1;
-    the_period->state = RATE_MONOTONIC_EXPIRED;
     _Rate_monotonic_Renew_deadline( the_period, owner, &lock_context );
   }
 }



More information about the vc mailing list