diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-08-05 14:25:41 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-08-09 21:58:39 +0200 |
commit | 85817254348c558ec99a5c0499f16839802165e5 (patch) | |
tree | 39964aef2897b26dd81745b08cdd3e7fa6c04d63 /cpukit/score/include/rtems/score | |
parent | smp: Use ISR lock in per-CPU control (diff) | |
download | rtems-85817254348c558ec99a5c0499f16839802165e5.tar.bz2 |
score: Add and use _Per_CPU_Acquire_all().
Add and use _Per_CPU_Release_all().
The context switch user extensions are invoked in _Thread_Dispatch().
This change is necessary to avoid the giant lock in _Thread_Dispatch().
Diffstat (limited to 'cpukit/score/include/rtems/score')
-rw-r--r-- | cpukit/score/include/rtems/score/percpu.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/percpu.h b/cpukit/score/include/rtems/score/percpu.h index 6e3a18e6db..7a4c70e646 100644 --- a/cpukit/score/include/rtems/score/percpu.h +++ b/cpukit/score/include/rtems/score/percpu.h @@ -235,6 +235,36 @@ extern Per_CPU_Control_envelope _Per_CPU_Information[] CPU_STRUCTURE_ALIGNMENT; _ISR_lock_Release( &( per_cpu )->lock ) #if defined( RTEMS_SMP ) +#define _Per_CPU_Acquire_all( isr_cookie ) \ + do { \ + uint32_t ncpus = _SMP_Get_processor_count(); \ + uint32_t cpu; \ + _ISR_Disable( isr_cookie ); \ + for ( cpu = 0 ; cpu < ncpus ; ++cpu ) { \ + _Per_CPU_Acquire( _Per_CPU_Get_by_index( cpu ) ); \ + } \ + } while ( 0 ) +#else +#define _Per_CPU_Acquire_all( isr_cookie ) \ + _ISR_Disable( isr_cookie ) +#endif + +#if defined( RTEMS_SMP ) +#define _Per_CPU_Release_all( isr_cookie ) \ + do { \ + uint32_t ncpus = _SMP_Get_processor_count(); \ + uint32_t cpu; \ + for ( cpu = 0 ; cpu < ncpus ; ++cpu ) { \ + _Per_CPU_Release( _Per_CPU_Get_by_index( cpu ) ); \ + } \ + _ISR_Enable( isr_cookie ); \ + } while ( 0 ) +#else +#define _Per_CPU_Release_all( isr_cookie ) \ + _ISR_Enable( isr_cookie ) +#endif + +#if defined( RTEMS_SMP ) static inline Per_CPU_Control *_Per_CPU_Get( void ) { _Assert_Thread_dispatching_repressed(); |