[PATCH 28/32] score: _Thread_Dispatch_increment_disable_level()
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed May 18 09:20:47 UTC 2016
Avoid _Thread_Dispatch_increment_disable_level() and
_Thread_Dispatch_decrement_disable_level() and thus the Giant
lock.
This is a preparation to remove the Giant lock.
Update #2555.
---
c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c | 4 ++--
c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c | 4 ++--
c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c | 4 ++--
c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c | 4 ++--
cpukit/score/cpu/lm32/irq.c | 4 ++--
cpukit/score/cpu/nios2/nios2-iic-irq.c | 4 ++--
cpukit/score/include/rtems/score/threaddispatch.h | 12 ++++++++++++
7 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c b/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c
index dc1546e..649c89d 100644
--- a/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c
+++ b/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c
@@ -133,7 +133,7 @@ void __ISR_Handler( uint32_t vector)
_ISR_Disable( level );
- _Thread_Dispatch_increment_disable_level();
+ _Thread_Dispatch_disable();
#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
if ( _ISR_Nest_level == 0 )
@@ -155,7 +155,7 @@ void __ISR_Handler( uint32_t vector)
_ISR_Disable( level );
- _Thread_Dispatch_decrement_disable_level();
+ _Thread_Dispatch_unnest( _Per_CPU_Get() );
_ISR_Nest_level--;
diff --git a/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c b/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c
index 77b05e8..f753426 100644
--- a/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c
+++ b/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c
@@ -134,7 +134,7 @@ void __ISR_Handler( uint32_t vector)
_ISR_Disable( level );
- _Thread_Dispatch_increment_disable_level();
+ _Thread_Dispatch_disable();
#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
if ( _ISR_Nest_level == 0 )
@@ -156,7 +156,7 @@ void __ISR_Handler( uint32_t vector)
_ISR_Disable( level );
- _Thread_Dispatch_decrement_disable_level();
+ _Thread_Dispatch_unnest( _Per_CPU_Get() );
_ISR_Nest_level--;
diff --git a/c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c b/c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c
index 1614ffe..f47e360 100644
--- a/c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c
+++ b/c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c
@@ -58,7 +58,7 @@ void __ISR_Handler( uint32_t vector)
_ISR_Disable( level );
- _Thread_Dispatch_increment_disable_level();
+ _Thread_Dispatch_disable();
#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
if ( _ISR_Nest_level == 0 )
@@ -80,7 +80,7 @@ void __ISR_Handler( uint32_t vector)
_ISR_Disable( level );
- _Thread_Dispatch_decrement_disable_level();
+ _Thread_Dispatch_enable( _Per_CPU_Get() );
_ISR_Nest_level--;
diff --git a/c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c b/c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c
index 823f538..cb93c5a 100644
--- a/c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c
+++ b/c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c
@@ -35,7 +35,7 @@ void __ISR_Handler( uint32_t vector)
_ISR_Disable( level );
- _Thread_Dispatch_increment_disable_level();
+ _Thread_Dispatch_disable();
#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
if ( _ISR_Nest_level == 0 )
@@ -57,7 +57,7 @@ void __ISR_Handler( uint32_t vector)
_ISR_Disable( level );
- _Thread_Dispatch_decrement_disable_level();
+ _Thread_Dispatch_unnest( _Per_CPU_Get() );
_ISR_Nest_level--;
diff --git a/cpukit/score/cpu/lm32/irq.c b/cpukit/score/cpu/lm32/irq.c
index 1c50b11..be84d74 100644
--- a/cpukit/score/cpu/lm32/irq.c
+++ b/cpukit/score/cpu/lm32/irq.c
@@ -42,7 +42,7 @@ void __ISR_Handler(uint32_t vector, CPU_Interrupt_frame *ifr)
/* Interrupts are disabled upon entry to this Handler */
- _Thread_Dispatch_increment_disable_level();
+ _Thread_Dispatch_disable();
#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
if ( _ISR_Nest_level == 0 ) {
@@ -69,7 +69,7 @@ void __ISR_Handler(uint32_t vector, CPU_Interrupt_frame *ifr)
stack_ptr = _old_stack_ptr;
#endif
- _Thread_Dispatch_decrement_disable_level();
+ _Thread_Dispatch_unnest( _Per_CPU_Get() );
_CPU_ISR_Enable( level );
diff --git a/cpukit/score/cpu/nios2/nios2-iic-irq.c b/cpukit/score/cpu/nios2/nios2-iic-irq.c
index 75d533d..99f1618 100644
--- a/cpukit/score/cpu/nios2/nios2-iic-irq.c
+++ b/cpukit/score/cpu/nios2/nios2-iic-irq.c
@@ -108,14 +108,14 @@ void __ISR_Handler(void)
_ISR_Nest_level++;
- _Thread_Dispatch_increment_disable_level();
+ _Thread_Dispatch_disable();
__IIC_Handler();
/* Make sure that interrupts are disabled again */
_CPU_ISR_Disable( level );
- _Thread_Dispatch_decrement_disable_level();
+ _Thread_Dispatch_unnest( _Per_CPU_Get() );
_ISR_Nest_level--;
diff --git a/cpukit/score/include/rtems/score/threaddispatch.h b/cpukit/score/include/rtems/score/threaddispatch.h
index bf846e3..b0dd64c 100644
--- a/cpukit/score/include/rtems/score/threaddispatch.h
+++ b/cpukit/score/include/rtems/score/threaddispatch.h
@@ -341,6 +341,18 @@ RTEMS_INLINE_ROUTINE void _Thread_Dispatch_enable( Per_CPU_Control *cpu_self )
}
/**
+ * @brief Unnests thread dispatching.
+ *
+ * This function does not release the Giant lock.
+ *
+ * @param[in] cpu_self The current processor.
+ */
+RTEMS_INLINE_ROUTINE void _Thread_Dispatch_unnest( Per_CPU_Control *cpu_self )
+{
+ --cpu_self->thread_dispatch_disable_level;
+}
+
+/**
* @brief Disables thread dispatching and acquires the Giant lock.
*/
#if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
--
1.8.4.5
More information about the devel
mailing list