score: Change Priority_Control to 64-bit

A 32-bit Priority_Control limits the uptime to 49 days with a 1ms clock
tick in case the EDF scheduler is used.  Increase it to 64-bit to enable
proper operation of the EDF scheduler,

Close 2173.
This commit is contained in:
Sebastian Huber
2016-06-24 11:22:03 +02:00
parent 1d72f03e5a
commit 254dc82daf
11 changed files with 27 additions and 20 deletions

View File

@@ -20,6 +20,7 @@
#define _RTEMS_POSIX_PRIORITYIMPL_H
#include <rtems/score/scheduler.h>
#include <rtems/score/assert.h>
#ifdef __cplusplus
extern "C" {
@@ -48,7 +49,13 @@ extern "C" {
*
* @return The maximum POSIX API priority for this scheduler instance.
*/
int _POSIX_Priority_Get_maximum( const Scheduler_Control *scheduler );
RTEMS_INLINE_ROUTINE int _POSIX_Priority_Get_maximum(
const Scheduler_Control *scheduler
)
{
_Assert( (int) scheduler->maximum_priority > 1 );
return (int) scheduler->maximum_priority - 1;
}
/**
* @brief Converts the POSIX API priority to the corresponding SuperCore

View File

@@ -190,7 +190,7 @@ int _POSIX_signals_Send(
* + rtems internal threads do not receive signals.
*/
interested = NULL;
interested_priority = PRIORITY_MAXIMUM + 1;
interested_priority = UINT64_MAX;
for (the_api = OBJECTS_CLASSIC_API; the_api <= OBJECTS_APIS_LAST; the_api++) {

View File

@@ -21,15 +21,6 @@
#include <rtems/posix/priorityimpl.h>
#include <rtems/score/schedulerimpl.h>
int _POSIX_Priority_Get_maximum( const Scheduler_Control *scheduler )
{
if ( scheduler->maximum_priority < INT_MAX ) {
return (int) scheduler->maximum_priority - 1;
} else {
return INT_MAX;
}
}
Priority_Control _POSIX_Priority_To_core(
const Scheduler_Control *scheduler,
int posix_priority,

View File

@@ -75,7 +75,7 @@ extern "C" {
/**
* Define the type for an RTEMS API task priority.
*/
typedef Priority_Control rtems_task_priority;
typedef uint32_t rtems_task_priority;
/**
* This is the constant used with the rtems_task_set_priority

View File

@@ -53,7 +53,7 @@ extern "C" {
*
* @note Priority 0 is reserved for internal threads only.
*/
typedef uint32_t Priority_Control;
typedef uint64_t Priority_Control;
/** This defines the highest (most important) thread priority. */
#define PRIORITY_MINIMUM 0

View File

@@ -24,6 +24,8 @@
#include <rtems/score/schedulerpriority.h>
#include <rtems/score/rbtree.h>
#include <limits.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -35,7 +37,12 @@ extern "C" {
*/
/**@{*/
#define SCHEDULER_EDF_MAXIMUM_PRIORITY 0x7fffffff
/*
* Actually the EDF scheduler supports a maximum priority of
* 0x7fffffffffffffff, but the user API is limited to uint32_t or int for
* thread priorities. Ignore ILP64 targets for now.
*/
#define SCHEDULER_EDF_MAXIMUM_PRIORITY INT_MAX
/**
* Entry points for the Earliest Deadline First Scheduler.

View File

@@ -38,7 +38,7 @@ extern "C" {
* ones who do not have any deadlines and thus are considered background
* tasks.
*/
#define SCHEDULER_EDF_PRIO_MSB 0x80000000
#define SCHEDULER_EDF_PRIO_MSB 0x8000000000000000
RTEMS_INLINE_ROUTINE Scheduler_EDF_Context *
_Scheduler_EDF_Get_context( const Scheduler_Control *scheduler )

View File

@@ -210,13 +210,13 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_update(
Chain_Control *ready_queues
)
{
ready_queue->current_priority = new_priority;
ready_queue->current_priority = (unsigned int) new_priority;
ready_queue->ready_chain = &ready_queues[ new_priority ];
_Priority_bit_map_Initialize_information(
bit_map,
&ready_queue->Priority_map,
new_priority
(unsigned int) new_priority
);
}

View File

@@ -37,7 +37,8 @@ Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
}
node = _Scheduler_priority_Thread_get_node( the_thread );
priority = _Scheduler_Node_get_priority( &node->Base, &prepend_it );
priority = (unsigned int )
_Scheduler_Node_get_priority( &node->Base, &prepend_it );
if ( priority == node->Ready_queue.current_priority ) {
/* Nothing to do */

View File

@@ -34,7 +34,8 @@ Scheduler_Void_or_thread _Scheduler_priority_Unblock (
context = _Scheduler_priority_Get_context( scheduler );
node = _Scheduler_priority_Thread_get_node( the_thread );
priority = _Scheduler_Node_get_priority( &node->Base, &prepend_it );
priority = (unsigned int )
_Scheduler_Node_get_priority( &node->Base, &prepend_it );
(void) prepend_it;
if ( priority != node->Ready_queue.current_priority ) {

View File

@@ -204,7 +204,7 @@ static void print_switch_events(test_context *ctx)
rtems_object_get_name(e->heir_node->Object.id, sizeof(hn), &hn[0]);
printf(
"[%" PRIu32 "] %4s -> %4s (prio %3" PRIu32 ", node %4s)\n",
"[%" PRIu32 "] %4s -> %4s (prio %3" PRIu64 ", node %4s)\n",
e->cpu_index,
&ex[0],
&hr[0],