From 1240aade5a35c4e8c43d5409e2329eeb6a173299 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 24 Jan 2017 14:37:42 +0100 Subject: 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(-) (limited to 'cpukit/rtems') diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h index c4133c7e03..ba38a3e61a 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 128af57dee..a4d224f0d9 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 c2a0291fd8..bcc4ccfbf8 100644 --- a/cpukit/rtems/src/ratemontimeout.c +++ b/cpukit/rtems/src/ratemontimeout.c @@ -22,6 +22,27 @@ #include +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 ); } } -- cgit v1.2.3