[rtems commit] score: Modify release job scheduler operation
Sebastian Huber
sebh at rtems.org
Wed Jun 22 12:48:01 UTC 2016
Module: rtems
Branch: master
Commit: 9a78f8a5076687a8744991998ee6119f87db12a8
Changeset: http://git.rtems.org/rtems/commit/?id=9a78f8a5076687a8744991998ee6119f87db12a8
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Jun 16 17:08:54 2016 +0200
score: Modify release job scheduler operation
Pass the deadline in watchdog ticks to the scheduler.
Update #2173.
---
cpukit/rtems/src/ratemonperiod.c | 7 ++++---
cpukit/score/include/rtems/score/scheduler.h | 4 ++--
cpukit/score/include/rtems/score/schedulercbs.h | 2 +-
cpukit/score/include/rtems/score/scheduleredf.h | 2 +-
cpukit/score/include/rtems/score/schedulerimpl.h | 6 +++---
cpukit/score/include/rtems/score/watchdogimpl.h | 8 ++++++--
cpukit/score/src/schedulercbsreleasejob.c | 2 +-
cpukit/score/src/schedulerdefaultreleasejob.c | 8 ++++----
cpukit/score/src/scheduleredfreleasejob.c | 5 ++---
9 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index 1a13731..771f9c1 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -71,20 +71,21 @@ static void _Rate_monotonic_Release_job(
)
{
Per_CPU_Control *cpu_self;
+ uint64_t deadline;
cpu_self = _Thread_Dispatch_disable_critical( lock_context );
_Rate_monotonic_Release( owner, lock_context );
- _Scheduler_Release_job( owner, next_length );
-
_ISR_lock_ISR_disable( lock_context );
- _Watchdog_Per_CPU_insert_relative(
+ deadline = _Watchdog_Per_CPU_insert_relative(
&the_period->Timer,
cpu_self,
next_length
);
_ISR_lock_ISR_enable( lock_context );
+ _Scheduler_Release_job( owner, deadline );
+
_Thread_Dispatch_enable( cpu_self );
}
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index ba9c2b5..73e2873 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -145,7 +145,7 @@ typedef struct {
void ( *release_job ) (
const Scheduler_Control *,
Thread_Control *,
- uint32_t
+ uint64_t
);
/** @see _Scheduler_Tick() */
@@ -508,7 +508,7 @@ void _Scheduler_default_Update_priority(
void _Scheduler_default_Release_job(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
- uint32_t deadline
+ uint64_t deadline
);
/**
diff --git a/cpukit/score/include/rtems/score/schedulercbs.h b/cpukit/score/include/rtems/score/schedulercbs.h
index 4e03e11..fea10d5 100644
--- a/cpukit/score/include/rtems/score/schedulercbs.h
+++ b/cpukit/score/include/rtems/score/schedulercbs.h
@@ -179,7 +179,7 @@ Scheduler_Void_or_thread _Scheduler_CBS_Unblock(
void _Scheduler_CBS_Release_job (
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
- uint32_t length
+ uint64_t length
);
/**
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index 042143f..feaa2ef 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -252,7 +252,7 @@ Scheduler_Void_or_thread _Scheduler_EDF_Yield(
void _Scheduler_EDF_Release_job (
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
- uint32_t deadline
+ uint64_t deadline
);
#ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 3621472..edad0d3 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -522,16 +522,16 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update_priority(
* @brief Releases a job of a thread with respect to the scheduler.
*
* @param[in] the_thread The thread.
- * @param[in] length The period length.
+ * @param[in] deadline The deadline in watchdog ticks since boot.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
Thread_Control *the_thread,
- uint32_t length
+ uint64_t deadline
)
{
const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
- ( *scheduler->Operations.release_job )( scheduler, the_thread, length );
+ ( *scheduler->Operations.release_job )( scheduler, the_thread, deadline );
}
/**
diff --git a/cpukit/score/include/rtems/score/watchdogimpl.h b/cpukit/score/include/rtems/score/watchdogimpl.h
index 2b24cc6..b76a51a 100644
--- a/cpukit/score/include/rtems/score/watchdogimpl.h
+++ b/cpukit/score/include/rtems/score/watchdogimpl.h
@@ -339,23 +339,27 @@ RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_release_critical(
_ISR_lock_Release( &cpu->Watchdog.Lock, lock_context );
}
-RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_insert_relative(
+RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert_relative(
Watchdog_Control *the_watchdog,
Per_CPU_Control *cpu,
uint32_t ticks
)
{
ISR_lock_Context lock_context;
+ uint64_t expire;
_Watchdog_Set_CPU( the_watchdog, cpu );
_Watchdog_Per_CPU_acquire_critical( cpu, &lock_context );
+ expire = cpu->Watchdog.ticks + ticks;
_Watchdog_Insert(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
the_watchdog,
- cpu->Watchdog.ticks + ticks
+ expire
);
_Watchdog_Per_CPU_release_critical( cpu, &lock_context );
+
+ return expire;
}
RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_insert_absolute(
diff --git a/cpukit/score/src/schedulercbsreleasejob.c b/cpukit/score/src/schedulercbsreleasejob.c
index b820829..124c02b 100644
--- a/cpukit/score/src/schedulercbsreleasejob.c
+++ b/cpukit/score/src/schedulercbsreleasejob.c
@@ -24,7 +24,7 @@
void _Scheduler_CBS_Release_job(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
- uint32_t deadline
+ uint64_t deadline
)
{
Scheduler_CBS_Node *node;
diff --git a/cpukit/score/src/schedulerdefaultreleasejob.c b/cpukit/score/src/schedulerdefaultreleasejob.c
index 90593ab..db4ab0e 100644
--- a/cpukit/score/src/schedulerdefaultreleasejob.c
+++ b/cpukit/score/src/schedulerdefaultreleasejob.c
@@ -24,10 +24,10 @@
void _Scheduler_default_Release_job(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
- uint32_t deadline
+ uint64_t deadline
)
{
- ( void ) scheduler;
- ( void ) the_thread;
- ( void ) deadline;
+ (void) scheduler;
+ (void) the_thread;
+ (void) deadline;
}
diff --git a/cpukit/score/src/scheduleredfreleasejob.c b/cpukit/score/src/scheduleredfreleasejob.c
index 2c3db65..b7c83a5 100644
--- a/cpukit/score/src/scheduleredfreleasejob.c
+++ b/cpukit/score/src/scheduleredfreleasejob.c
@@ -25,7 +25,7 @@
void _Scheduler_EDF_Release_job(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
- uint32_t deadline
+ uint64_t deadline
)
{
Priority_Control new_priority;
@@ -35,8 +35,7 @@ void _Scheduler_EDF_Release_job(
if (deadline) {
/* Initializing or shifting deadline. */
- new_priority = (_Watchdog_Ticks_since_boot + deadline)
- & ~SCHEDULER_EDF_PRIO_MSB;
+ new_priority = (uint32_t) deadline & ~SCHEDULER_EDF_PRIO_MSB;
}
else {
/* Switch back to background priority. */
More information about the vc
mailing list