diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-08-05 14:54:11 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-08-09 23:02:38 +0200 |
commit | d19cce29dcaffa7c679407bc211ee09c2d9dc40a (patch) | |
tree | 2e0eb6211f0199680fcf9445b644a25495e53732 /cpukit/score/cpu | |
parent | score: Add and use _Per_CPU_Acquire_all(). (diff) | |
download | rtems-d19cce29dcaffa7c679407bc211ee09c2d9dc40a.tar.bz2 |
score: Per-CPU thread dispatch disable level
Use a per-CPU thread dispatch disable level. So instead of one global
thread dispatch disable level we have now one instance per processor.
This is a major performance improvement for SMP. On non-SMP
configurations this may simplifiy the interrupt entry/exit code.
The giant lock is still present, but it is now decoupled from the thread
dispatching in _Thread_Dispatch(), _Thread_Handler(),
_Thread_Restart_self() and the interrupt entry/exit. Access to the
giant lock is now available via _Giant_Acquire() and _Giant_Release().
The giant lock is still implicitly acquired via
_Thread_Dispatch_decrement_disable_level().
The giant lock is only acquired for high-level operations in interrupt
handlers (e.g. release of a semaphore, sending of an event).
As a side-effect this change fixes the lost thread dispatch necessary
indication bug in _Thread_Dispatch().
A per-CPU thread dispatch disable level greatly simplifies the SMP
support for the interrupt entry/exit code since no spin locks have to be
acquired in this area. It is only necessary to get the current
processor index and use this to calculate the address of the own per-CPU
control. This reduces the interrupt latency considerably.
All elements for the interrupt entry/exit code are now part of the
Per_CPU_Control structure: thread dispatch disable level, ISR nest level
and thread dispatch necessary. Nothing else is required (except CPU
port specific stuff like on SPARC).
Diffstat (limited to 'cpukit/score/cpu')
-rw-r--r-- | cpukit/score/cpu/bfin/cpu_asm.S | 9 | ||||
-rw-r--r-- | cpukit/score/cpu/h8300/cpu_asm.S | 8 | ||||
-rw-r--r-- | cpukit/score/cpu/m68k/cpu_asm.S | 4 | ||||
-rw-r--r-- | cpukit/score/cpu/mips/cpu_asm.S | 10 |
4 files changed, 14 insertions, 17 deletions
diff --git a/cpukit/score/cpu/bfin/cpu_asm.S b/cpukit/score/cpu/bfin/cpu_asm.S index 39701d8ffa..d10336caf9 100644 --- a/cpukit/score/cpu/bfin/cpu_asm.S +++ b/cpukit/score/cpu/bfin/cpu_asm.S @@ -313,7 +313,6 @@ SYM(_CPU_Context_restore): .globl SYM(_ISR_Handler) SYM(_ISR_Handler): - .extern SYM(_Thread_Dispatch_disable_level) /* all interrupts are disabled at this point */ /* the following few items are pushed onto the task stack for at most one interrupt; nested interrupts will be using the interrupt @@ -338,8 +337,8 @@ SYM(_ISR_Handler): [--sp] = r0; noStackSwitch: /* disable thread dispatch */ - p0.h = SYM(_Thread_Dispatch_disable_level); - p0.l = SYM(_Thread_Dispatch_disable_level); + p0.h = THREAD_DISPATCH_DISABLE_LEVEL; + p0.l = THREAD_DISPATCH_DISABLE_LEVEL; r0 = [p0]; r0 += 1; [p0] = r0; @@ -459,8 +458,8 @@ noStackRestore: /* check this stuff to ensure context_switch_necessary and isr_signals_to_thread_executing are being handled appropriately. */ - p0.h = SYM(_Thread_Dispatch_disable_level); - p0.l = SYM(_Thread_Dispatch_disable_level); + p0.h = THREAD_DISPATCH_DISABLE_LEVEL; + p0.l = THREAD_DISPATCH_DISABLE_LEVEL; r0 = [p0]; r0 += -1; [p0] = r0; diff --git a/cpukit/score/cpu/h8300/cpu_asm.S b/cpukit/score/cpu/h8300/cpu_asm.S index 4b48cd9b85..59685b44d9 100644 --- a/cpukit/score/cpu/h8300/cpu_asm.S +++ b/cpukit/score/cpu/h8300/cpu_asm.S @@ -127,9 +127,9 @@ nested: mov.l @ISR_NEST_LEVEL,er1 inc.l #1,er1 mov.l er1,@ISR_NEST_LEVEL - mov.l @SYM(_Thread_Dispatch_disable_level),er1 + mov.l @THREAD_DISPATCH_DISABLE_LEVEL,er1 inc.l #1,er1 - mov.l er1,@SYM(_Thread_Dispatch_disable_level) + mov.l er1,@THREAD_DISPATCH_DISABLE_LEVEL /* Vector to ISR */ @@ -145,9 +145,9 @@ nested: mov.l @ISR_NEST_LEVEL,er1 dec.l #1,er1 mov.l er1,@ISR_NEST_LEVEL - mov.l @SYM(_Thread_Dispatch_disable_level),er1 + mov.l @THREAD_DISPATCH_DISABLE_LEVEL,er1 dec.l #1,er1 - mov.l er1,@SYM(_Thread_Dispatch_disable_level) + mov.l er1,@THREAD_DISPATCH_DISABLE_LEVEL bne exit mov.b @DISPATCH_NEEDED,er1 diff --git a/cpukit/score/cpu/m68k/cpu_asm.S b/cpukit/score/cpu/m68k/cpu_asm.S index f68cb104e6..216bce2f4e 100644 --- a/cpukit/score/cpu/m68k/cpu_asm.S +++ b/cpukit/score/cpu/m68k/cpu_asm.S @@ -248,7 +248,7 @@ norst: SYM (_ISR_Handler): | disable multitasking - addql #1,SYM (_Thread_Dispatch_disable_level) + addql #1,THREAD_DISPATCH_DISABLE_LEVEL #if ( !defined(__mcoldfire__) ) moveml d0-d1/a0-a1,a7@- | save d0-d1,a0-a1 #else @@ -298,7 +298,7 @@ SYM (_ISR_Handler): movel (a7),a7 | Restore task stack pointer 1: #endif /* CPU_HAS_SOFTWARE_INTERRUPT_STACK == 1 */ - subql #1,SYM (_Thread_Dispatch_disable_level) + subql #1,THREAD_DISPATCH_DISABLE_LEVEL | unnest multitasking bne.b exit | If dispatch disabled, exit diff --git a/cpukit/score/cpu/mips/cpu_asm.S b/cpukit/score/cpu/mips/cpu_asm.S index 836cf2329c..9d232b6fc7 100644 --- a/cpukit/score/cpu/mips/cpu_asm.S +++ b/cpukit/score/cpu/mips/cpu_asm.S @@ -582,8 +582,6 @@ FRAME(_CPU_Context_restore,sp,0,ra) ENDFRAME(_CPU_Context_restore) -ASM_EXTERN(_Thread_Dispatch_disable_level,4) - .extern _Thread_Dispatch .extern _ISR_Vector_table @@ -892,10 +890,10 @@ _ISR_Handler_1: /* * _Thread_Dispatch_disable_level++; */ - lw t1,_Thread_Dispatch_disable_level + lw t1,THREAD_DISPATCH_DISABLE_LEVEL NOP add t1,t1,1 - sw t1,_Thread_Dispatch_disable_level + sw t1,THREAD_DISPATCH_DISABLE_LEVEL /* * Call the CPU model or BSP specific routine to decode the @@ -928,10 +926,10 @@ _ISR_Handler_1: /* * --_Thread_Dispatch_disable_level; */ - lw t1,_Thread_Dispatch_disable_level + lw t1,THREAD_DISPATCH_DISABLE_LEVEL NOP add t1,t1,-1 - sw t1,_Thread_Dispatch_disable_level + sw t1,THREAD_DISPATCH_DISABLE_LEVEL /* * if ( _Thread_Dispatch_disable_level || _ISR_Nest_level ) * goto the label "exit interrupt (simple case)" |