[PATCH 12/16] score: Modify release job scheduler operation
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Jun 17 10:51:49 UTC 2016
Pass the deadline in watchdog ticks to the scheduler.
---
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 c4e2bb9..f7045c5 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() */
@@ -521,7 +521,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 8dfc187..562620a 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 fad7ecc..2ea27b8 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -524,16 +524,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. */
--
1.8.4.5
More information about the devel
mailing list