[PATCH] score: RTEMS_PREDICT_TRUE(), RTEMS_PREDICT_FALSE()
Add RTEMS_PREDICT_TRUE() and RTEMS_PREDICT_FALSE() for static branch prediction hints. Close #3475. --- cpukit/include/rtems/score/basedefs.h | 28 cpukit/posix/src/sempost.c| 4 ++-- cpukit/posix/src/semtimedwait.c | 2 +- cpukit/posix/src/semtrywait.c | 2 +- cpukit/score/src/condition.c | 4 +++- cpukit/score/src/futex.c | 2 +- cpukit/score/src/mutex.c | 16 cpukit/score/src/semaphore.c | 10 +- testsuites/sptests/spmisc01/init.c| 25 + 9 files changed, 74 insertions(+), 19 deletions(-) diff --git a/cpukit/include/rtems/score/basedefs.h b/cpukit/include/rtems/score/basedefs.h index 8169f6db8c..7a52de895d 100644 --- a/cpukit/include/rtems/score/basedefs.h +++ b/cpukit/include/rtems/score/basedefs.h @@ -281,6 +281,34 @@ #define RTEMS_DEFINE_GLOBAL_SYMBOL( _name, _value ) #endif +/** + * @brief Returns the value of the specified integral expressen and tells the + * compiler that the predicted value is true (1). + * + * @param[in] _exp The expression. + * + * @return The value of the expression. + */ +#if defined(__GNUC__) + #define RTEMS_PREDICT_TRUE( _exp ) __builtin_expect( ( _exp ), 1 ) +#else + #define RTEMS_PREDICT_TRUE( _exp ) ( _exp ) +#endif + +/** + * @brief Returns the value of the specified integral expressen and tells the + * compiler that the predicted value is false (0). + * + * @param[in] _exp The expression. + * + * @return The value of the expression. + */ +#if defined(__GNUC__) + #define RTEMS_PREDICT_FALSE( _exp ) __builtin_expect( ( _exp ), 0 ) +#else + #define RTEMS_PREDICT_FALSE( _exp ) ( _exp ) +#endif + #if __cplusplus >= 201103L #define RTEMS_STATIC_ASSERT(cond, msg) \ static_assert(cond, # msg) diff --git a/cpukit/posix/src/sempost.c b/cpukit/posix/src/sempost.c index de0ae71fc7..d750c1178c 100644 --- a/cpukit/posix/src/sempost.c +++ b/cpukit/posix/src/sempost.c @@ -40,13 +40,13 @@ int sem_post( sem_t *_sem ) heads = sem->Queue.Queue.heads; count = sem->count; - if ( __predict_true( heads == NULL && count < SEM_VALUE_MAX ) ) { + if ( RTEMS_PREDICT_TRUE( heads == NULL && count < SEM_VALUE_MAX ) ) { sem->count = count + 1; _Sem_Queue_release( sem, level, &queue_context ); return 0; } - if ( __predict_true( heads != NULL ) ) { + if ( RTEMS_PREDICT_TRUE( heads != NULL ) ) { const Thread_queue_Operations *operations; Thread_Control *first; diff --git a/cpukit/posix/src/semtimedwait.c b/cpukit/posix/src/semtimedwait.c index 9e7bb466dd..16d0c24c9f 100644 --- a/cpukit/posix/src/semtimedwait.c +++ b/cpukit/posix/src/semtimedwait.c @@ -46,7 +46,7 @@ int sem_timedwait( executing = _Sem_Queue_acquire_critical( sem, &queue_context ); count = sem->count; - if ( __predict_true( count > 0 ) ) { + if ( RTEMS_PREDICT_TRUE( count > 0 ) ) { sem->count = count - 1; _Sem_Queue_release( sem, level, &queue_context ); return 0; diff --git a/cpukit/posix/src/semtrywait.c b/cpukit/posix/src/semtrywait.c index 673343d4b4..759744ec8e 100644 --- a/cpukit/posix/src/semtrywait.c +++ b/cpukit/posix/src/semtrywait.c @@ -35,7 +35,7 @@ int sem_trywait( sem_t *_sem ) _Sem_Queue_acquire_critical( sem, &queue_context ); count = sem->count; - if ( __predict_true( count > 0 ) ) { + if ( RTEMS_PREDICT_TRUE( count > 0 ) ) { sem->count = count - 1; _Sem_Queue_release( sem, level, &queue_context ); return 0; diff --git a/cpukit/score/src/condition.c b/cpukit/score/src/condition.c index 9913d86d34..892245baf5 100644 --- a/cpukit/score/src/condition.c +++ b/cpukit/score/src/condition.c @@ -279,7 +279,9 @@ static void _Condition_Wake( struct _Condition_Control *_condition, int count ) * In common uses cases of condition variables there are normally no threads * on the queue, so check this condition early. */ - if ( __predict_true( _Thread_queue_Is_empty( &condition->Queue.Queue ) ) ) { + if ( +RTEMS_PREDICT_TRUE( _Thread_queue_Is_empty( &condition->Queue.Queue ) ) + ) { _Condition_Queue_release( condition, &context.Base ); return; } diff --git a/cpukit/score/src/futex.c b/cpukit/score/src/futex.c index 6487882819..f32a13c449 100644 --- a/cpukit/score/src/futex.c +++ b/cpukit/score/src/futex.c @@ -151,7 +151,7 @@ int _Futex_Wake( struct _Futex_Control *_futex, int count ) * called in the fast path. Normally there are no threads on the queue, so * check this condition early. */ - if ( __predict_true( _Thread_queue_Is_empty( &futex->Queue.Queue ) ) ) { + if ( RTEMS_PREDICT_TRUE( _Thread_queue_Is_empty( &futex->Queue.Queue ) ) ) { _Futex_Queue_release( futex, level, &context.Base ); return 0; } diff --git a/cpukit/score/src/mutex.c b/cpukit/score/src/mutex.c index e2f5bb52fc..8cc47f28bb 100644 --- a/cpukit/score/src/mutex.c +++ b/cpukit/score/src/mutex.c @@ -128,7 +128,7 @@ static void _Mutex_Release_c
RTEMS 5 tool chain update
Hello, I updated the tool chain (RSB) to use the latest Newlib snapshot (3.0.0.20180720) and Binutils 2.31.1. An immediate update from the previous tools based on Newlib 3.0.0 is not necessary. I merged the RISC-V tool targets riscv32-rtems5 and riscv64-rtems5 into a common riscv-rtems5 target. On RISC-V only the latest GCC 9 development version is used. -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] score: RTEMS_PREDICT_TRUE(), RTEMS_PREDICT_FALSE()
On Tue, Jul 24, 2018, 2:03 AM Sebastian Huber < sebastian.hu...@embedded-brains.de> wrote: > Add RTEMS_PREDICT_TRUE() and RTEMS_PREDICT_FALSE() for static branch > prediction hints. > > Close #3475. > --- > cpukit/include/rtems/score/basedefs.h | 28 > cpukit/posix/src/sempost.c| 4 ++-- > cpukit/posix/src/semtimedwait.c | 2 +- > cpukit/posix/src/semtrywait.c | 2 +- > cpukit/score/src/condition.c | 4 +++- > cpukit/score/src/futex.c | 2 +- > cpukit/score/src/mutex.c | 16 > cpukit/score/src/semaphore.c | 10 +- > testsuites/sptests/spmisc01/init.c| 25 + > 9 files changed, 74 insertions(+), 19 deletions(-) > > diff --git a/cpukit/include/rtems/score/basedefs.h > b/cpukit/include/rtems/score/basedefs.h > index 8169f6db8c..7a52de895d 100644 > --- a/cpukit/include/rtems/score/basedefs.h > +++ b/cpukit/include/rtems/score/basedefs.h > @@ -281,6 +281,34 @@ >#define RTEMS_DEFINE_GLOBAL_SYMBOL( _name, _value ) > #endif > > +/** > + * @brief Returns the value of the specified integral expressen and tells > the > Spelling error here and in the other comment block. Search to make sure it isn't elsewhere. + * compiler that the predicted value is true (1). > + * > + * @param[in] _exp The expression. > + * > + * @return The value of the expression. > + */ > +#if defined(__GNUC__) > + #define RTEMS_PREDICT_TRUE( _exp ) __builtin_expect( ( _exp ), 1 ) > +#else > + #define RTEMS_PREDICT_TRUE( _exp ) ( _exp ) > +#endif > + > +/** > + * @brief Returns the value of the specified integral expressen and tells > the > + * compiler that the predicted value is false (0). > + * > + * @param[in] _exp The expression. > + * > + * @return The value of the expression. > + */ > +#if defined(__GNUC__) > + #define RTEMS_PREDICT_FALSE( _exp ) __builtin_expect( ( _exp ), 0 ) > +#else > + #define RTEMS_PREDICT_FALSE( _exp ) ( _exp ) > +#endif > + > #if __cplusplus >= 201103L >#define RTEMS_STATIC_ASSERT(cond, msg) \ > static_assert(cond, # msg) > diff --git a/cpukit/posix/src/sempost.c b/cpukit/posix/src/sempost.c > index de0ae71fc7..d750c1178c 100644 > --- a/cpukit/posix/src/sempost.c > +++ b/cpukit/posix/src/sempost.c > @@ -40,13 +40,13 @@ int sem_post( sem_t *_sem ) >heads = sem->Queue.Queue.heads; >count = sem->count; > > - if ( __predict_true( heads == NULL && count < SEM_VALUE_MAX ) ) { > + if ( RTEMS_PREDICT_TRUE( heads == NULL && count < SEM_VALUE_MAX ) ) { > sem->count = count + 1; > _Sem_Queue_release( sem, level, &queue_context ); > return 0; >} > > - if ( __predict_true( heads != NULL ) ) { > + if ( RTEMS_PREDICT_TRUE( heads != NULL ) ) { > const Thread_queue_Operations *operations; > Thread_Control *first; > > diff --git a/cpukit/posix/src/semtimedwait.c > b/cpukit/posix/src/semtimedwait.c > index 9e7bb466dd..16d0c24c9f 100644 > --- a/cpukit/posix/src/semtimedwait.c > +++ b/cpukit/posix/src/semtimedwait.c > @@ -46,7 +46,7 @@ int sem_timedwait( >executing = _Sem_Queue_acquire_critical( sem, &queue_context ); > >count = sem->count; > - if ( __predict_true( count > 0 ) ) { > + if ( RTEMS_PREDICT_TRUE( count > 0 ) ) { > sem->count = count - 1; > _Sem_Queue_release( sem, level, &queue_context ); > return 0; > diff --git a/cpukit/posix/src/semtrywait.c b/cpukit/posix/src/semtrywait.c > index 673343d4b4..759744ec8e 100644 > --- a/cpukit/posix/src/semtrywait.c > +++ b/cpukit/posix/src/semtrywait.c > @@ -35,7 +35,7 @@ int sem_trywait( sem_t *_sem ) >_Sem_Queue_acquire_critical( sem, &queue_context ); > >count = sem->count; > - if ( __predict_true( count > 0 ) ) { > + if ( RTEMS_PREDICT_TRUE( count > 0 ) ) { > sem->count = count - 1; > _Sem_Queue_release( sem, level, &queue_context ); > return 0; > diff --git a/cpukit/score/src/condition.c b/cpukit/score/src/condition.c > index 9913d86d34..892245baf5 100644 > --- a/cpukit/score/src/condition.c > +++ b/cpukit/score/src/condition.c > @@ -279,7 +279,9 @@ static void _Condition_Wake( struct _Condition_Control > *_condition, int count ) > * In common uses cases of condition variables there are normally no > threads > * on the queue, so check this condition early. > */ > - if ( __predict_true( _Thread_queue_Is_empty( &condition->Queue.Queue ) > ) ) { > + if ( > +RTEMS_PREDICT_TRUE( _Thread_queue_Is_empty( &condition->Queue.Queue ) > ) > + ) { > _Condition_Queue_release( condition, &context.Base ); > return; >} > diff --git a/cpukit/score/src/futex.c b/cpukit/score/src/futex.c > index 6487882819..f32a13c449 100644 > --- a/cpukit/score/src/futex.c > +++ b/cpukit/score/src/futex.c > @@ -151,7 +151,7 @@ int _Futex_Wake( struct _Futex_Control *_futex, int > count ) > * called in the fast path. Normally there are no threads on the > queue, so > * check this condition early. > */ > - if
[PATCH 1/3] score: _SMP_Inter_processor_interrupt_handler()
Pass current processor control via parameter since it may be already available at the caller side. --- bsps/arm/raspberrypi/irq/irq.c | 4 +++- bsps/arm/shared/start/arm-a9mpcore-smp.c | 2 +- bsps/i386/pc386/start/smp-imps.c | 2 +- bsps/powerpc/qoriq/irq/irq.c | 2 +- bsps/powerpc/qoriq/start/bspsmp.c| 2 +- bsps/sparc/leon3/start/bspsmp.c | 2 +- cpukit/include/rtems/score/smpimpl.h | 9 - 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bsps/arm/raspberrypi/irq/irq.c b/bsps/arm/raspberrypi/irq/irq.c index 5b10385bfe..925596ae51 100644 --- a/bsps/arm/raspberrypi/irq/irq.c +++ b/bsps/arm/raspberrypi/irq/irq.c @@ -109,7 +109,9 @@ void bsp_interrupt_dispatch(void) if ( local_source & BCM2836_IRQ_SOURCE_MBOX3 ) { /* reset mailbox 3 contents to zero */ BCM2835_REG(BCM2836_MAILBOX_3_READ_CLEAR_BASE + 0x10 * cpu_index_self) = 0x; -_SMP_Inter_processor_interrupt_handler(); +_SMP_Inter_processor_interrupt_handler( + _Per_CPU_Get_by_index(cpu_index_self) +); } if ( cpu_index_self != 0 ) return; diff --git a/bsps/arm/shared/start/arm-a9mpcore-smp.c b/bsps/arm/shared/start/arm-a9mpcore-smp.c index a8d3a541d4..c2550136f8 100644 --- a/bsps/arm/shared/start/arm-a9mpcore-smp.c +++ b/bsps/arm/shared/start/arm-a9mpcore-smp.c @@ -22,7 +22,7 @@ static void bsp_inter_processor_interrupt(void *arg) { - _SMP_Inter_processor_interrupt_handler(); + _SMP_Inter_processor_interrupt_handler(_Per_CPU_Get()); } uint32_t _CPU_SMP_Initialize(void) diff --git a/bsps/i386/pc386/start/smp-imps.c b/bsps/i386/pc386/start/smp-imps.c index 2ba36804cb..405f7f0a92 100644 --- a/bsps/i386/pc386/start/smp-imps.c +++ b/bsps/i386/pc386/start/smp-imps.c @@ -755,7 +755,7 @@ static void bsp_inter_processor_interrupt(void *arg) smp_apic_ack(); - message = _SMP_Inter_processor_interrupt_handler(); + message = _SMP_Inter_processor_interrupt_handler(_Per_CPU_Get()); if ((message & SMP_MESSAGE_CLOCK_TICK) != 0) { Clock_isr(NULL); diff --git a/bsps/powerpc/qoriq/irq/irq.c b/bsps/powerpc/qoriq/irq/irq.c index 625b9fce1b..18ca0741e0 100644 --- a/bsps/powerpc/qoriq/irq/irq.c +++ b/bsps/powerpc/qoriq/irq/irq.c @@ -100,7 +100,7 @@ void bsp_interrupt_dispatch(uintptr_t exception_number) #ifdef RTEMS_SMP if (exception_number == 36) { - _SMP_Inter_processor_interrupt_handler(); + _SMP_Inter_processor_interrupt_handler(_Per_CPU_Get()); return; } #endif diff --git a/bsps/powerpc/qoriq/start/bspsmp.c b/bsps/powerpc/qoriq/start/bspsmp.c index a2d9fbede5..048275b1fc 100644 --- a/bsps/powerpc/qoriq/start/bspsmp.c +++ b/bsps/powerpc/qoriq/start/bspsmp.c @@ -101,7 +101,7 @@ void bsp_start_on_secondary_processor(void) #ifndef QORIQ_IS_HYPERVISOR_GUEST static void bsp_inter_processor_interrupt(void *arg) { - _SMP_Inter_processor_interrupt_handler(); + _SMP_Inter_processor_interrupt_handler(_Per_CPU_Get()); } #endif diff --git a/bsps/sparc/leon3/start/bspsmp.c b/bsps/sparc/leon3/start/bspsmp.c index 280788fa1c..1ef6e8eb3b 100644 --- a/bsps/sparc/leon3/start/bspsmp.c +++ b/bsps/sparc/leon3/start/bspsmp.c @@ -32,7 +32,7 @@ static rtems_isr bsp_inter_processor_interrupt( rtems_vector_number vector ) { - _SMP_Inter_processor_interrupt_handler(); + _SMP_Inter_processor_interrupt_handler(_Per_CPU_Get()); } void bsp_start_on_secondary_processor() diff --git a/cpukit/include/rtems/score/smpimpl.h b/cpukit/include/rtems/score/smpimpl.h index 48e6a12498..fd92f655c7 100644 --- a/cpukit/include/rtems/score/smpimpl.h +++ b/cpukit/include/rtems/score/smpimpl.h @@ -165,12 +165,11 @@ void _SMP_Multicast_actions_process( void ); * * @return The received message. */ -static inline long unsigned _SMP_Inter_processor_interrupt_handler( void ) +static inline long unsigned _SMP_Inter_processor_interrupt_handler( + Per_CPU_Control *cpu_self +) { - Per_CPU_Control *cpu_self; - unsigned longmessage; - - cpu_self = _Per_CPU_Get(); + unsigned long message; /* * In the common case the inter-processor interrupt is issued to carry out a -- 2.13.7 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 2/3] bsps: bsp_start_on_secondary_processor()
Pass current processor control as first parameter in bsp_start_on_secondary_processor() and qoriq_start_thread() to make dependency more explicit. --- bsps/include/bsp/bootcard.h | 4 +++- bsps/powerpc/qoriq/include/bsp.h | 4 +++- bsps/powerpc/qoriq/start/bspsmp.c | 10 -- bsps/powerpc/qoriq/start/start.S | 8 +--- bsps/sparc/leon3/start/bspsmp.c | 5 +++-- bsps/sparc/shared/start/start.S | 1 + testsuites/smptests/smpfatal08/init.c | 6 -- 7 files changed, 23 insertions(+), 15 deletions(-) diff --git a/bsps/include/bsp/bootcard.h b/bsps/include/bsp/bootcard.h index 4dc3f4c2b0..f78000587a 100644 --- a/bsps/include/bsp/bootcard.h +++ b/bsps/include/bsp/bootcard.h @@ -167,6 +167,8 @@ static inline void bsp_work_area_initialize_with_table( void bsp_work_area_initialize(void); +struct Per_CPU_Control; + /** * @brief Standard start routine for secondary processors. * @@ -175,7 +177,7 @@ void bsp_work_area_initialize(void); * of this function is a call to * _SMP_Start_multitasking_on_secondary_processor(). */ -void bsp_start_on_secondary_processor(void); +void bsp_start_on_secondary_processor(struct Per_CPU_Control *cpu_self); /** @} */ diff --git a/bsps/powerpc/qoriq/include/bsp.h b/bsps/powerpc/qoriq/include/bsp.h index d7e9e95b3f..1c292f6767 100644 --- a/bsps/powerpc/qoriq/include/bsp.h +++ b/bsps/powerpc/qoriq/include/bsp.h @@ -105,7 +105,9 @@ typedef struct { extern qoriq_start_spin_table * qoriq_start_spin_table_addr[QORIQ_CPU_COUNT / QORIQ_THREAD_COUNT]; -void qoriq_start_thread(void); +struct Per_CPU_Control; + +void qoriq_start_thread(struct Per_CPU_Control *); void qoriq_restart_secondary_processor( const qoriq_start_spin_table *spin_table diff --git a/bsps/powerpc/qoriq/start/bspsmp.c b/bsps/powerpc/qoriq/start/bspsmp.c index 048275b1fc..2b95f943dd 100644 --- a/bsps/powerpc/qoriq/start/bspsmp.c +++ b/bsps/powerpc/qoriq/start/bspsmp.c @@ -44,10 +44,8 @@ static bool is_started_by_u_boot(uint32_t cpu_index) return cpu_index % QORIQ_THREAD_COUNT == 0; } -void qoriq_start_thread(void) +void qoriq_start_thread(Per_CPU_Control *cpu_self) { - const Per_CPU_Control *cpu_self = _Per_CPU_Get(); - ppc_exc_initialize_interrupt_stack( (uintptr_t) cpu_self->interrupt_stack_low, rtems_configuration_get_interrupt_stack_size() @@ -85,14 +83,14 @@ static void start_thread_if_necessary(uint32_t cpu_index_self) #endif } -void bsp_start_on_secondary_processor(void) +void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self) { - uint32_t cpu_index_self = _SMP_Get_current_processor(); - const Per_CPU_Control *cpu_self = _Per_CPU_Get_by_index(cpu_index_self); + uint32_t cpu_index_self; qoriq_initialize_exceptions(cpu_self->interrupt_stack_low); bsp_interrupt_facility_initialize(); + cpu_index_self = _Per_CPU_Get_index(cpu_self); start_thread_if_necessary(cpu_index_self); _SMP_Start_multitasking_on_secondary_processor(); diff --git a/bsps/powerpc/qoriq/start/start.S b/bsps/powerpc/qoriq/start/start.S index 96e00bf38b..57342971b6 100644 --- a/bsps/powerpc/qoriq/start/start.S +++ b/bsps/powerpc/qoriq/start/start.S @@ -38,6 +38,7 @@ #define START_STACK r15 #define SAVED_LINK_REGISTER r16 #define FDT_REGISTER r17 +#define CPU_SELF r18 .globl _start #ifdef RTEMS_SMP @@ -195,7 +196,7 @@ _start: LA r13, _SDA_BASE_ #endif - SET_SELF_CPU_CONTROLr4, r5 + SET_SELF_CPU_CONTROLCPU_SELF, r5 blr @@ -316,8 +317,7 @@ _start_thread: bl .Linitearly /* Initialize start stack */ - GET_SELF_CPU_CONTROLr3 - PPC_REG_LOADr3, PER_CPU_INTERRUPT_STACK_HIGH(r3) + PPC_REG_LOADr3, PER_CPU_INTERRUPT_STACK_HIGH(CPU_SELF) subir1, r3, PPC_MINIMUM_STACK_FRAME_SIZE clrrwi r1, r1, PPC_STACK_ALIGN_POWER li r0, 0 @@ -327,6 +327,7 @@ _start_thread: bl .Linitfpu #endif + mr r3, CPU_SELF b qoriq_start_thread PPC64_NOP_FOR_LINKER_TOC_POINTER_RESTORE #endif @@ -339,6 +340,7 @@ _start_secondary_processor: bl .Linitmore li r3, 0 bl .Linitmmu + mr r3, CPU_SELF b bsp_start_on_secondary_processor PPC64_NOP_FOR_LINKER_TOC_POINTER_RESTORE #endif /* RTEMS_SMP */ diff --git a/bsps/sparc/leon3/start/bspsmp.c b/bsps/sparc/leon3/start/bspsmp.c index 1ef6e8eb3b..5b939fc765 100644 --- a/bsps/sparc/leon3/start/bspsmp.c +++ b/bsps/sparc/leon3/start/bspsmp.c @@ -35,9 +35,9 @@ static rtems_isr bsp_inter_processor_interrupt( _SMP_Inter_processor_interrupt_handler(_Per_CPU_Get()); } -void bsp_start_on_secondary_processor() +void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self) { - uint32_t cpu_index_self = _CPU_SMP_Get_current_processor(); + uint32_t cpu_index_self; /* * If data cache snooping is not enabled we terminate using BSP_fatal_exit() @@ -49
[PATCH 3/3] _SMP_Start_multitasking_on_secondary_processor()
Pass current processor control as first parameter to make dependency more explicit. --- bsps/arm/include/bsp/arm-a9mpcore-start.h | 2 +- bsps/arm/raspberrypi/start/bspsmp_init.c | 2 +- bsps/i386/pc386/start/smp-imps.c | 2 +- bsps/powerpc/qoriq/start/bspsmp.c | 2 +- bsps/sparc/leon3/start/bspsmp.c | 2 +- cpukit/include/rtems/score/smpimpl.h | 7 +-- cpukit/score/src/smp.c| 26 +- 7 files changed, 27 insertions(+), 16 deletions(-) diff --git a/bsps/arm/include/bsp/arm-a9mpcore-start.h b/bsps/arm/include/bsp/arm-a9mpcore-start.h index dd1e1247de..5648dc0daf 100644 --- a/bsps/arm/include/bsp/arm-a9mpcore-start.h +++ b/bsps/arm/include/bsp/arm-a9mpcore-start.h @@ -109,7 +109,7 @@ arm_a9mpcore_start_on_secondary_processor(void) ctrl |= ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M; arm_cp15_set_control(ctrl); - _SMP_Start_multitasking_on_secondary_processor(); + _SMP_Start_multitasking_on_secondary_processor(_Per_CPU_Get()); } BSP_START_TEXT_SECTION static inline void diff --git a/bsps/arm/raspberrypi/start/bspsmp_init.c b/bsps/arm/raspberrypi/start/bspsmp_init.c index 8c8cd74712..a8c79e9f7c 100644 --- a/bsps/arm/raspberrypi/start/bspsmp_init.c +++ b/bsps/arm/raspberrypi/start/bspsmp_init.c @@ -77,5 +77,5 @@ void rpi_start_rtems_on_secondary_processor(void) ctrl &= ~ARM_CP15_CTRL_V; arm_cp15_set_control(ctrl); - _SMP_Start_multitasking_on_secondary_processor(); + _SMP_Start_multitasking_on_secondary_processor(_Per_CPU_Get()); } diff --git a/bsps/i386/pc386/start/smp-imps.c b/bsps/i386/pc386/start/smp-imps.c index 405f7f0a92..d8b2dd3edc 100644 --- a/bsps/i386/pc386/start/smp-imps.c +++ b/bsps/i386/pc386/start/smp-imps.c @@ -794,7 +794,7 @@ static void secondary_cpu_initialize(void) enable_sse(); #endif - _SMP_Start_multitasking_on_secondary_processor(); + _SMP_Start_multitasking_on_secondary_processor( _Per_CPU_Get() ); } uint32_t _CPU_SMP_Initialize( void ) diff --git a/bsps/powerpc/qoriq/start/bspsmp.c b/bsps/powerpc/qoriq/start/bspsmp.c index 2b95f943dd..634d0f89eb 100644 --- a/bsps/powerpc/qoriq/start/bspsmp.c +++ b/bsps/powerpc/qoriq/start/bspsmp.c @@ -53,7 +53,7 @@ void qoriq_start_thread(Per_CPU_Control *cpu_self) bsp_interrupt_facility_initialize(); - _SMP_Start_multitasking_on_secondary_processor(); + _SMP_Start_multitasking_on_secondary_processor(cpu_self); } #endif diff --git a/bsps/sparc/leon3/start/bspsmp.c b/bsps/sparc/leon3/start/bspsmp.c index 5b939fc765..caf0200a3c 100644 --- a/bsps/sparc/leon3/start/bspsmp.c +++ b/bsps/sparc/leon3/start/bspsmp.c @@ -52,7 +52,7 @@ void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self) cpu_index_self = _Per_CPU_Get_index(cpu_self); LEON3_IrqCtrl_Regs->mask[cpu_index_self] |= 1U << LEON3_mp_irq; - _SMP_Start_multitasking_on_secondary_processor(); + _SMP_Start_multitasking_on_secondary_processor(cpu_self); } uint32_t _CPU_SMP_Initialize( void ) diff --git a/cpukit/include/rtems/score/smpimpl.h b/cpukit/include/rtems/score/smpimpl.h index fd92f655c7..762b3e5fc1 100644 --- a/cpukit/include/rtems/score/smpimpl.h +++ b/cpukit/include/rtems/score/smpimpl.h @@ -134,9 +134,12 @@ extern Processor_mask _SMP_Online_processors; * uses _Thread_Start_multitasking() instead. * * This function does not return to the caller. + * + * @param[in] cpu_self The current processor control. */ -void _SMP_Start_multitasking_on_secondary_processor( void ) - RTEMS_NO_RETURN; +void _SMP_Start_multitasking_on_secondary_processor( + Per_CPU_Control *cpu_self +) RTEMS_NO_RETURN; typedef void ( *SMP_Test_message_handler )( Per_CPU_Control *cpu_self ); diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c index 1a29e37d15..1c7eb6d947 100644 --- a/cpukit/score/src/smp.c +++ b/cpukit/score/src/smp.c @@ -145,14 +145,19 @@ void _SMP_Handler_initialize( void ) void _SMP_Request_start_multitasking( void ) { - Per_CPU_Control *self_cpu = _Per_CPU_Get(); - uint32_t cpu_count = _SMP_Get_processor_count(); - uint32_t cpu_index; + Per_CPU_Control *cpu_self; + uint32_t cpu_count; + uint32_t cpu_index; + + cpu_self = _Per_CPU_Get(); + _Per_CPU_State_change( cpu_self, PER_CPU_STATE_READY_TO_START_MULTITASKING ); - _Per_CPU_State_change( self_cpu, PER_CPU_STATE_READY_TO_START_MULTITASKING ); + cpu_count = _SMP_Get_processor_count(); for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) { -Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index ); +Per_CPU_Control *cpu; + +cpu = _Per_CPU_Get_by_index( cpu_index ); if ( _Per_CPU_Is_processor_online( cpu ) ) { _Per_CPU_State_change( cpu, PER_CPU_STATE_REQUEST_START_MULTITASKING ); @@ -168,10 +173,13 @@ bool _SMP_Should_start_processor( uint32_t cpu_index ) return _Scheduler_Should_start_processor( assignment ); } -void _SMP_Start_multitasking_on_secondary_processor( void ) +void _SMP_Start_multi
[PATCH] Coverage: Add support to generate separate reports for each symbol-set
Invoke covoar multiple times from the script to generate separate reports for each symbol-set. --- tester/rt/coverage.py | 32 +-- tester/rtems/testing/coverage/symbol-sets.ini | 11 ++--- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py index 7dd5002..e2f4dca 100644 --- a/tester/rt/coverage.py +++ b/tester/rt/coverage.py @@ -100,7 +100,7 @@ class summary: class report_gen_html: def __init__(self, p_symbol_sets_list, build_dir, rtdir, bsp): -self.symbol_sets_list = ['score'] +self.symbol_sets_list = p_symbol_sets_list self.build_dir = build_dir self.partial_reports_files = list(['index.html', 'summary.txt']) self.number_of_columns = 1 @@ -267,24 +267,19 @@ class symbol_parser(object): except: raise error.general('Symbol set parsing failed') -def _write_ini(self): +def write_ini(self, symbol_set): config = configparser.ConfigParser() try: -sets = ', '.join(self.symbol_sets.keys()) +sset = symbol_set config.add_section('symbol-sets') -config.set('symbol-sets', 'sets', sets) -for key in self.symbol_sets.keys(): -config.add_section(key) -config.set(key, 'libraries', self.symbol_sets[key]) +config.set('symbol-sets', 'sets', sset) +config.add_section(sset) +config.set(sset, 'libraries', self.symbol_sets[sset]) with open(self.symbol_select_file, 'w') as conf: config.write(conf) except: raise error.general('symbol parser write failed') -def run(self): -self.parse() -self._write_ini() - class covoar(object): ''' Covoar runner @@ -371,20 +366,23 @@ class coverage_run(object): self.symbol_select_path, self.symbol_set, build_dir) -parser.run() -covoar_runner = covoar(self.test_dir, self.symbol_select_path, +parser.parse() +ssets = parser.symbol_sets.keys() +for sset in ssets: +parser.write_ini(sset) +covoar_runner = covoar(self.test_dir, self.symbol_select_path, self.executables, self.explanations_txt, self.trace) -covoar_runner.run('score', self.symbol_select_path) -self._generate_reports(); +covoar_runner.run(sset, self.symbol_select_path) +self._generate_reports(ssets); self._summarize(); finally: self._cleanup(); -def _generate_reports(self): +def _generate_reports(self, symbol_sets): log.notice('Coverage generating reports') if self.report_format == 'html': -report = report_gen_html(self.symbol_sets, +report = report_gen_html(symbol_sets, self.build_dir, self.rtdir, self.macros['bsp']) diff --git a/tester/rtems/testing/coverage/symbol-sets.ini b/tester/rtems/testing/coverage/symbol-sets.ini index a2ec7bc..3900f14 100644 --- a/tester/rtems/testing/coverage/symbol-sets.ini +++ b/tester/rtems/testing/coverage/symbol-sets.ini @@ -29,8 +29,13 @@ # [symbol-sets] -sets = score,rtems +sets = score,rtems,libblock,libcrypt,libcsupport,libmd,libnetworking [libraries] -score = @BUILD-TARGET@/c/@BSP@/cpukit/score/libscore.a -rtems = @BUILD-TARGET@/c/@BSP@/cpukit/rtems/librtems.a +score = @BUILD-TARGET@/c/@BSP@/cpukit/score/libscore.a +rtems = @BUILD-TARGET@/c/@BSP@/cpukit/rtems/librtems.a +libblock = @BUILD-TARGET@/c/@BSP@/cpukit/libblock/libblock.a +libcrypt = @BUILD-TARGET@/c/@BSP@/cpukit/libcrypt/libcrypt.a +libcsupport = @BUILD-TARGET@/c/@BSP@/cpukit/libcsupport/libcsupport.a +libmd = @BUILD-TARGET@/c/@BSP@/cpukit/libmd/libmd.a +libnetworking = @BUILD-TARGET@/c/@BSP@/cpukit/libnetworking/libnetworking.a -- 2.14.2 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel