[PATCH 34/45] score: Do not inline SMP lock if profiling enabled
Gedare Bloom
gedare at gwu.edu
Sun May 17 02:21:03 UTC 2015
Not really related, but what is the "rule" for when we should use
RTEMS_INLINE_ROUTINE versus being able to say "static inline"?
-Gedare
On Fri, May 15, 2015 at 7:41 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> This reduces the code size drastically.
> ---
> cpukit/score/Makefile.am | 1 +
> cpukit/score/include/rtems/score/smplock.h | 57 ++++++++++++++++++++++++-
> cpukit/score/src/smplock.c | 68 ++++++++++++++++++++++++++++++
> 3 files changed, 125 insertions(+), 1 deletion(-)
> create mode 100644 cpukit/score/src/smplock.c
>
> diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
> index cede673..714bd66 100644
> --- a/cpukit/score/Makefile.am
> +++ b/cpukit/score/Makefile.am
> @@ -138,6 +138,7 @@ libscore_a_SOURCES += src/schedulerprioritysmp.c
> libscore_a_SOURCES += src/schedulersimplesmp.c
> libscore_a_SOURCES += src/schedulersmpdebug.c
> libscore_a_SOURCES += src/smp.c
> +libscore_a_SOURCES += src/smplock.c
> libscore_a_SOURCES += src/smpmulticastaction.c
> libscore_a_SOURCES += src/cpuset.c
> libscore_a_SOURCES += src/cpusetprintsupport.c
> diff --git a/cpukit/score/include/rtems/score/smplock.h b/cpukit/score/include/rtems/score/smplock.h
> index 5eb6ef3..50a0662 100644
> --- a/cpukit/score/include/rtems/score/smplock.h
> +++ b/cpukit/score/include/rtems/score/smplock.h
> @@ -10,7 +10,7 @@
> * COPYRIGHT (c) 1989-2011.
> * On-Line Applications Research Corporation (OAR).
> *
> - * Copyright (c) 2013-2014 embedded brains GmbH
> + * Copyright (c) 2013-2015 embedded brains GmbH
> *
> * The license and distribution terms for this file may be
> * found in the file LICENSE in this distribution or at
> @@ -32,6 +32,10 @@
> #include <string.h>
> #endif
>
> +#if defined( RTEMS_PROFILING )
> +#define RTEMS_SMP_LOCK_DO_NOT_INLINE
> +#endif
> +
> #ifdef __cplusplus
> extern "C" {
> #endif /* __cplusplus */
> @@ -368,7 +372,16 @@ typedef struct {
> * @param[in] name The name for the SMP lock statistics. This name must be
> * persistent throughout the life time of this statistics block.
> */
> +#if defined( RTEMS_SMP_LOCK_DO_NOT_INLINE )
> +void _SMP_lock_Initialize(
> + SMP_lock_Control *lock,
> + const char *name
> +);
> +
> +static inline void _SMP_lock_Initialize_body(
> +#else
> static inline void _SMP_lock_Initialize(
> +#endif
> SMP_lock_Control *lock,
> const char *name
> )
> @@ -383,7 +396,13 @@ static inline void _SMP_lock_Initialize(
> *
> * @param[in,out] lock The SMP lock control.
> */
> +#if defined( RTEMS_SMP_LOCK_DO_NOT_INLINE )
> +void _SMP_lock_Destroy( SMP_lock_Control *lock );
> +
> +static inline void _SMP_lock_Destroy_body( SMP_lock_Control *lock )
> +#else
> static inline void _SMP_lock_Destroy( SMP_lock_Control *lock )
> +#endif
> {
> _SMP_ticket_lock_Destroy( &lock->ticket_lock );
> }
> @@ -399,7 +418,16 @@ static inline void _SMP_lock_Destroy( SMP_lock_Control *lock )
> * @param[in,out] context The local SMP lock context for an acquire and release
> * pair.
> */
> +#if defined( RTEMS_SMP_LOCK_DO_NOT_INLINE )
> +void _SMP_lock_Acquire(
> + SMP_lock_Control *lock,
> + SMP_lock_Context *context
> +);
> +
> +static inline void _SMP_lock_Acquire_body(
> +#else
> static inline void _SMP_lock_Acquire(
> +#endif
> SMP_lock_Control *lock,
> SMP_lock_Context *context
> )
> @@ -415,7 +443,16 @@ static inline void _SMP_lock_Acquire(
> * @param[in,out] context The local SMP lock context for an acquire and release
> * pair.
> */
> +#if defined( RTEMS_SMP_LOCK_DO_NOT_INLINE )
> +void _SMP_lock_Release(
> + SMP_lock_Control *lock,
> + SMP_lock_Context *context
> +);
> +
> +static inline void _SMP_lock_Release_body(
> +#else
> static inline void _SMP_lock_Release(
> +#endif
> SMP_lock_Control *lock,
> SMP_lock_Context *context
> )
> @@ -431,7 +468,16 @@ static inline void _SMP_lock_Release(
> * @param[in,out] context The local SMP lock context for an acquire and release
> * pair.
> */
> +#if defined( RTEMS_SMP_LOCK_DO_NOT_INLINE )
> +void _SMP_lock_ISR_disable_and_acquire(
> + SMP_lock_Control *lock,
> + SMP_lock_Context *context
> +);
> +
> +static inline void _SMP_lock_ISR_disable_and_acquire_body(
> +#else
> static inline void _SMP_lock_ISR_disable_and_acquire(
> +#endif
> SMP_lock_Control *lock,
> SMP_lock_Context *context
> )
> @@ -447,7 +493,16 @@ static inline void _SMP_lock_ISR_disable_and_acquire(
> * @param[in,out] context The local SMP lock context for an acquire and release
> * pair.
> */
> +#if defined( RTEMS_SMP_LOCK_DO_NOT_INLINE )
> +void _SMP_lock_Release_and_ISR_enable(
> + SMP_lock_Control *lock,
> + SMP_lock_Context *context
> +);
> +
> +static inline void _SMP_lock_Release_and_ISR_enable_body(
> +#else
> static inline void _SMP_lock_Release_and_ISR_enable(
> +#endif
> SMP_lock_Control *lock,
> SMP_lock_Context *context
> )
> diff --git a/cpukit/score/src/smplock.c b/cpukit/score/src/smplock.c
> new file mode 100644
> index 0000000..1440091
> --- /dev/null
> +++ b/cpukit/score/src/smplock.c
> @@ -0,0 +1,68 @@
> +/*
> + * Copyright (c) 2015 embedded brains GmbH. All rights reserved.
> + *
> + * embedded brains GmbH
> + * Dornierstr. 4
> + * 82178 Puchheim
> + * Germany
> + * <rtems at embedded-brains.de>
> + *
> + * The license and distribution terms for this file may be
> + * found in the file LICENSE in this distribution or at
> + * http://www.rtems.org/license/LICENSE.
> + */
> +
> +#if HAVE_CONFIG_H
> + #include "config.h"
> +#endif
> +
> +#include <rtems/score/smplock.h>
> +
> +#if defined(RTEMS_SMP_LOCK_DO_NOT_INLINE)
> +
> +void _SMP_lock_Initialize(
> + SMP_lock_Control *lock,
> + const char *name
> +)
> +{
> + _SMP_lock_Initialize_body( lock, name );
> +}
> +
> +void _SMP_lock_Destroy( SMP_lock_Control *lock )
> +{
> + _SMP_lock_Destroy_body( lock );
> +}
> +
> +void _SMP_lock_Acquire(
> + SMP_lock_Control *lock,
> + SMP_lock_Context *context
> +)
> +{
> + _SMP_lock_Acquire_body( lock, context );
> +}
> +
> +void _SMP_lock_Release(
> + SMP_lock_Control *lock,
> + SMP_lock_Context *context
> +)
> +{
> + _SMP_lock_Release_body( lock, context );
> +}
> +
> +void _SMP_lock_ISR_disable_and_acquire(
> + SMP_lock_Control *lock,
> + SMP_lock_Context *context
> +)
> +{
> + _SMP_lock_ISR_disable_and_acquire_body( lock, context );
> +}
> +
> +void _SMP_lock_Release_and_ISR_enable(
> + SMP_lock_Control *lock,
> + SMP_lock_Context *context
> +)
> +{
> + _SMP_lock_Release_and_ISR_enable_body( lock, context );
> +}
> +
> +#endif /* defined(RTEMS_SMP_LOCK_DO_NOT_INLINE) */
> --
> 1.8.4.5
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list