Re: [PATCH] Enhancement of the RMS manager for the overrun handling.
Hello Gedare, I take the latest version of RTEMS eae4541d7b8001aa18c6fc2d62b32385b0310125 to integrate my patch this time. All you mentioned coding-convention issues are solved accordingly I think. I will hold the copyright by myself. rtems_rate_monotonic_postponed_num() this function is prepared for run-time monitoring. The user can call this function to check the number of postponed jobs in run-time. Therefore I name it with rtems prefix as the feature for users. Should I add the description of this function in the documentation? Best, Kuan-Hsun 2016-12-20 23:10 GMT+01:00 Gedare Bloom: > On Fri, Dec 9, 2016 at 11:21 AM, Kuan-Hsun Chen wrote: > > Three additional functions: > > RM_Postponed_num, RM_Renew_deadline, and RM_Release_postponedjob. > > > > Four refined functions: > > RM_Activate, RM_Block_while_expired, rtems_rate_monotonic_period, > RM_Timeout. > > > > Rate_monotonic_Control contains one counter for counting the postponed > jobs and one for recording the recent deadline. > > --- > > cpukit/rtems/include/rtems/rtems/ratemon.h | 42 ++-- > > cpukit/rtems/include/rtems/rtems/ratemonimpl.h | 25 +++-- > > cpukit/rtems/src/ratemonperiod.c | 144 > + > > cpukit/rtems/src/ratemontimeout.c | 13 ++- > > 4 files changed, 183 insertions(+), 41 deletions(-) > > > > diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h > b/cpukit/rtems/include/rtems/rtems/ratemon.h > > index 50b8478..71a99dc 100644 > > --- a/cpukit/rtems/include/rtems/rtems/ratemon.h > > +++ b/cpukit/rtems/include/rtems/rtems/ratemon.h > > @@ -22,6 +22,7 @@ > > > > /* COPYRIGHT (c) 1989-2009, 2016. > > * On-Line Applications Research Corporation (OAR). > > + * COPYRIGHT (c) 2016 Kuan-Hsun Chen, TU Dortmund University (TUDo). > > * > > * The license and distribution terms for this file may be > > * found in the file LICENSE in this distribution or at > > @@ -194,11 +195,6 @@ typedef struct { > >/** This field is the object management portion of a Period instance. > */ > >Objects_Control Object; > > > > - /** > > - * @brief Protects the rate monotonic period state. > > - */ > > - ISR_LOCK_MEMBER(Lock ) > > - > Why are these removed? > > >/** This is the timer used to provide the unblocking mechanism. */ > >Watchdog_ControlTimer; > > > > @@ -206,12 +202,6 @@ typedef struct { > >rtems_rate_monotonic_period_states state; > > > >/** > > - * @brief A priority node for use by the scheduler job release and > cancel > > - * operations. > > - */ > > - Priority_Node Priority; > > - > > - /** > Ditto. > > > * This field contains the length of the next period to be > > * executed. > > */ > > @@ -240,6 +230,19 @@ typedef struct { > > * This field contains the statistics maintained for the period. > > */ > >Rate_monotonic_Statistics Statistics; > > + > > + /** > > + * This field contains the number of postponed jobs. When the > watchdog timeout, > > + * this variable will be increased immediately. > > + */ > > + uint32_tpostponed_jobs; > > + > > + /** > > + * This field contains the tick of the latest deadline decided by > the period > > + * watchdog. > > + */ > > + uint64_tlatest_deadline; > > + > > } Rate_monotonic_Control; > > > > /** > > @@ -386,6 +389,23 @@ void rtems_rate_monotonic_report_ > statistics_with_plugin( > > void rtems_rate_monotonic_report_statistics( void ); > > > > /** > > + * @brief RTEMS Return the number of postponed jobs > remove "RTEMS". > > > + * > > + * This is a helper function to return the number of postponed jobs by > this > by -> in > > > + * given period. This number is only increased by the corresponding > watchdog, > Is it only in a given period, or is it postponed jobs generally, i.e. > you could miss multiple periods hence jobs in multiple periods would > be counted here? > > > + * and is decreased by RMS manager with the postponed job releasing. > > + * > > + * @param[in] id is the period id > > + * > > + * @retval This helper function returns the number of postponed > > + * jobs with given period_id. > > + * > > + */ > > +uint32_t rtems_rate_monotonic_Postponed_num( > See coding conventions for naming rules. this is better > 'rtems_rate_monotonic_postponed_jobs(). Is this function needed in the > public-facing API? > > > + rtems_idperiod_id > > +); > > + > > +/** > > * @brief RTEMS Rate Monotonic Period > > * > > * This routine implements the rtems_rate_monotonic_period directive. > When > > diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h > b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h > > index b6b3ffd..6cdaaeb 100644 > > --- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h > > +++
Re: [PATCH] Enhancement of the RMS manager for the overrun handling.
On Fri, Dec 9, 2016 at 11:21 AM, Kuan-Hsun Chenwrote: > Three additional functions: > RM_Postponed_num, RM_Renew_deadline, and RM_Release_postponedjob. > > Four refined functions: > RM_Activate, RM_Block_while_expired, rtems_rate_monotonic_period, RM_Timeout. > > Rate_monotonic_Control contains one counter for counting the postponed jobs > and one for recording the recent deadline. > --- > cpukit/rtems/include/rtems/rtems/ratemon.h | 42 ++-- > cpukit/rtems/include/rtems/rtems/ratemonimpl.h | 25 +++-- > cpukit/rtems/src/ratemonperiod.c | 144 > + > cpukit/rtems/src/ratemontimeout.c | 13 ++- > 4 files changed, 183 insertions(+), 41 deletions(-) > > diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h > b/cpukit/rtems/include/rtems/rtems/ratemon.h > index 50b8478..71a99dc 100644 > --- a/cpukit/rtems/include/rtems/rtems/ratemon.h > +++ b/cpukit/rtems/include/rtems/rtems/ratemon.h > @@ -22,6 +22,7 @@ > > /* COPYRIGHT (c) 1989-2009, 2016. > * On-Line Applications Research Corporation (OAR). > + * COPYRIGHT (c) 2016 Kuan-Hsun Chen, TU Dortmund University (TUDo). > * > * The license and distribution terms for this file may be > * found in the file LICENSE in this distribution or at > @@ -194,11 +195,6 @@ typedef struct { >/** This field is the object management portion of a Period instance. */ >Objects_Control Object; > > - /** > - * @brief Protects the rate monotonic period state. > - */ > - ISR_LOCK_MEMBER(Lock ) > - Why are these removed? >/** This is the timer used to provide the unblocking mechanism. */ >Watchdog_ControlTimer; > > @@ -206,12 +202,6 @@ typedef struct { >rtems_rate_monotonic_period_states state; > >/** > - * @brief A priority node for use by the scheduler job release and cancel > - * operations. > - */ > - Priority_Node Priority; > - > - /** Ditto. > * This field contains the length of the next period to be > * executed. > */ > @@ -240,6 +230,19 @@ typedef struct { > * This field contains the statistics maintained for the period. > */ >Rate_monotonic_Statistics Statistics; > + > + /** > + * This field contains the number of postponed jobs. When the watchdog > timeout, > + * this variable will be increased immediately. > + */ > + uint32_tpostponed_jobs; > + > + /** > + * This field contains the tick of the latest deadline decided by the > period > + * watchdog. > + */ > + uint64_tlatest_deadline; > + > } Rate_monotonic_Control; > > /** > @@ -386,6 +389,23 @@ void rtems_rate_monotonic_report_statistics_with_plugin( > void rtems_rate_monotonic_report_statistics( void ); > > /** > + * @brief RTEMS Return the number of postponed jobs remove "RTEMS". > + * > + * This is a helper function to return the number of postponed jobs by this by -> in > + * given period. This number is only increased by the corresponding watchdog, Is it only in a given period, or is it postponed jobs generally, i.e. you could miss multiple periods hence jobs in multiple periods would be counted here? > + * and is decreased by RMS manager with the postponed job releasing. > + * > + * @param[in] id is the period id > + * > + * @retval This helper function returns the number of postponed > + * jobs with given period_id. > + * > + */ > +uint32_t rtems_rate_monotonic_Postponed_num( See coding conventions for naming rules. this is better 'rtems_rate_monotonic_postponed_jobs(). Is this function needed in the public-facing API? > + rtems_idperiod_id > +); > + > +/** > * @brief RTEMS Rate Monotonic Period > * > * This routine implements the rtems_rate_monotonic_period directive. When > diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h > b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h > index b6b3ffd..6cdaaeb 100644 > --- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h > +++ b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h > @@ -9,6 +9,7 @@ > /* COPYRIGHT (c) 1989-2008. > * On-Line Applications Research Corporation (OAR). > * Copyright (c) 2016 embedded brains GmbH. > + * COPYRIGHT (c) 2016 Kuan-Hsun Chen, TU Dortmund University (TUDo). > * > * The license and distribution terms for this file may be > * found in the file LICENSE in this distribution or at > @@ -69,19 +70,19 @@ RTEMS_INLINE_ROUTINE Rate_monotonic_Control > *_Rate_monotonic_Allocate( void ) > } > > RTEMS_INLINE_ROUTINE void _Rate_monotonic_Acquire_critical( > - Rate_monotonic_Control *the_period, > - ISR_lock_Context *lock_context > + Thread_Control *the_thread, > + ISR_lock_Context *lock_context > ) > { > - _ISR_lock_Acquire( _period->Lock, lock_context ); > + _Thread_Wait_acquire_default_critical( the_thread, lock_context ); > } At
[PATCH] Enhancement of the RMS manager for the overrun handling.
Three additional functions: RM_Postponed_num, RM_Renew_deadline, and RM_Release_postponedjob. Four refined functions: RM_Activate, RM_Block_while_expired, rtems_rate_monotonic_period, RM_Timeout. Rate_monotonic_Control contains one counter for counting the postponed jobs and one for recording the recent deadline. --- cpukit/rtems/include/rtems/rtems/ratemon.h | 42 ++-- cpukit/rtems/include/rtems/rtems/ratemonimpl.h | 25 +++-- cpukit/rtems/src/ratemonperiod.c | 144 + cpukit/rtems/src/ratemontimeout.c | 13 ++- 4 files changed, 183 insertions(+), 41 deletions(-) diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h b/cpukit/rtems/include/rtems/rtems/ratemon.h index 50b8478..71a99dc 100644 --- a/cpukit/rtems/include/rtems/rtems/ratemon.h +++ b/cpukit/rtems/include/rtems/rtems/ratemon.h @@ -22,6 +22,7 @@ /* COPYRIGHT (c) 1989-2009, 2016. * On-Line Applications Research Corporation (OAR). + * COPYRIGHT (c) 2016 Kuan-Hsun Chen, TU Dortmund University (TUDo). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -194,11 +195,6 @@ typedef struct { /** This field is the object management portion of a Period instance. */ Objects_Control Object; - /** - * @brief Protects the rate monotonic period state. - */ - ISR_LOCK_MEMBER(Lock ) - /** This is the timer used to provide the unblocking mechanism. */ Watchdog_ControlTimer; @@ -206,12 +202,6 @@ typedef struct { rtems_rate_monotonic_period_states state; /** - * @brief A priority node for use by the scheduler job release and cancel - * operations. - */ - Priority_Node Priority; - - /** * This field contains the length of the next period to be * executed. */ @@ -240,6 +230,19 @@ typedef struct { * This field contains the statistics maintained for the period. */ Rate_monotonic_Statistics Statistics; + + /** + * This field contains the number of postponed jobs. When the watchdog timeout, + * this variable will be increased immediately. + */ + uint32_tpostponed_jobs; + + /** + * This field contains the tick of the latest deadline decided by the period + * watchdog. + */ + uint64_tlatest_deadline; + } Rate_monotonic_Control; /** @@ -386,6 +389,23 @@ void rtems_rate_monotonic_report_statistics_with_plugin( void rtems_rate_monotonic_report_statistics( void ); /** + * @brief RTEMS Return the number of postponed jobs + * + * This is a helper function to return the number of postponed jobs by this + * given period. This number is only increased by the corresponding watchdog, + * and is decreased by RMS manager with the postponed job releasing. + * + * @param[in] id is the period id + * + * @retval This helper function returns the number of postponed + * jobs with given period_id. + * + */ +uint32_t rtems_rate_monotonic_Postponed_num( + rtems_idperiod_id +); + +/** * @brief RTEMS Rate Monotonic Period * * This routine implements the rtems_rate_monotonic_period directive. When diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h index b6b3ffd..6cdaaeb 100644 --- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h +++ b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h @@ -9,6 +9,7 @@ /* COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * Copyright (c) 2016 embedded brains GmbH. + * COPYRIGHT (c) 2016 Kuan-Hsun Chen, TU Dortmund University (TUDo). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -69,19 +70,19 @@ RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Allocate( void ) } RTEMS_INLINE_ROUTINE void _Rate_monotonic_Acquire_critical( - Rate_monotonic_Control *the_period, - ISR_lock_Context *lock_context + Thread_Control *the_thread, + ISR_lock_Context *lock_context ) { - _ISR_lock_Acquire( _period->Lock, lock_context ); + _Thread_Wait_acquire_default_critical( the_thread, lock_context ); } RTEMS_INLINE_ROUTINE void _Rate_monotonic_Release( - Rate_monotonic_Control *the_period, - ISR_lock_Context *lock_context + Thread_Control *the_thread, + ISR_lock_Context *lock_context ) { - _ISR_lock_Release_and_ISR_enable( _period->Lock, lock_context ); + _Thread_Wait_release_default( the_thread, lock_context ); } RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Get( @@ -116,6 +117,18 @@ 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. +