Re: [PATCH 3/4] capture: Remove nested rtems_interrupt_lock_acquire calls.
On 2014-07-11 04:08, Chris Johns wrote: On 10/07/2014 11:44 pm, Jennifer Averett wrote: Use of the cenable command was resulting in a lock in rtems_interrupt_lock_acquire due to nesting. I am rejecting this change. RTEMS as an RTOS should provide support to handle this case in a consistent manner in SMP and non-SMP builds of the code. The change highlights an issue in RTEMS's locking support. This code works on a non-SMP build because the rtems_interrupt_lock_acquire nests and this is the functionality of the call it replaces. It is dangerous to promote rtems_interrupt_lock_acquire and rtems_interrupt_lock_release as replacements for old interrupt disable and enable calls if they are not functionally the same as the code they replace and functionally the same on SMP and non-SMP builds. I understand the current implementation of the rtems_interrupt_lock_* code is optimised for performance and adding nesting checks adds overhead however I feel we should considering providing support with no-nesting versions for code that can support this. The pattern in the capture engine this change addresses is a common one and forcing users to remember this issue and then rewrite exist code to manage it is not being a helpful RTOS. I am fine with adding additional locks which allow nesting, but the default lock used a the lowest level must not allow nesting. -- 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-V2 5/7] score/sparc: Add comment on icache flush after trap table update
On 2014-07-09 16:38, Gedare Bloom wrote: On Wed, Jul 9, 2014 at 3:02 AM, Daniel Cederman wrote: Changes to the trap table might be missed by other cores. If the system state is up, the other cores can be notified using SMP messages that they need to flush their icache. If the up state has not been reached there is no need to notify other cores. They will do an automatic flush of the icache just after entering the up state, but before enabling interrupts. --- cpukit/score/cpu/sparc/cpu.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cpukit/score/cpu/sparc/cpu.c b/cpukit/score/cpu/sparc/cpu.c index c616de4..88228b7 100644 --- a/cpukit/score/cpu/sparc/cpu.c +++ b/cpukit/score/cpu/sparc/cpu.c @@ -210,10 +210,16 @@ void _CPU_ISR_install_raw_handler( (u32_handler & HIGH_BITS_MASK) >> HIGH_BITS_SHIFT; slot->jmp_to_low_of_handler_plus_l4 |= (u32_handler & LOW_BITS_MASK); - /* need to flush icache after this !!! */ - + /* + * Changes to the trap table might be missed by other cores. + * If the system state is up, the other cores can be notified + * using SMP messages that they need to flush their icache. + * If the up state has not been reached there is no need to + * notify other cores. They will do an automatic flush of the + * icache just after entering the up state, but before enabling + * interrupts. + */ This was needed for UP mode also, since stores to the trap table are cached in d-cache instead of i-cache, you need to flush/invalidate i-cache so the updated trap table entry will be loaded from memory. It should be made clear that this is the situation, else someone might think to make this invalidate conditional on SMP mode... -Gedare I will add that to the comment. Thanks! rtems_cache_invalidate_entire_instruction(); - } void _CPU_ISR_install_vector( -- 1.7.9.5 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel -- Daniel Cederman Software Engineer Aeroflex Gaisler AB Aeroflex Microelectronic Solutions – HiRel Kungsgatan 12 SE-411 19 Gothenburg, Sweden Phone: +46 31 7758665 ceder...@gaisler.com www.Aeroflex.com/Gaisler ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH-V2 6/7] bsp/sparc: Ensure that data cache snooping is enabled
On 2014-07-11 09:12, Daniel Cederman wrote: >> +BSP_fatal_exit( >> LEON3_FATAL_INVALID_CACHE_CONFIG_SECONDARY_PROCESSOR ); > > bsp_fatal()? I wanted to use bsp_fatal, but it tries to acquire a ticket lock which does not work when data cache snooping is disabled. Ok, can you please add this as a comment, since the next person reviewing this code will probably ask the same question. -- 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-V2 7/7] bsp/sparc: Flush only instruction cache
On 2014-07-09 16:40, Gedare Bloom wrote: On Wed, Jul 9, 2014 at 3:02 AM, Daniel Cederman wrote: The flush instruction on LEON flushes both the data and the instruction cache. Flushing of just the instruction cache can be done by setting the "flush instruction cache" bit in the cache control register. --- c/src/lib/libbsp/sparc/leon3/include/cache_.h |5 - c/src/lib/libbsp/sparc/leon3/include/leon.h |1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/c/src/lib/libbsp/sparc/leon3/include/cache_.h b/c/src/lib/libbsp/sparc/leon3/include/cache_.h index 63790c1..ced5b6d 100644 --- a/c/src/lib/libbsp/sparc/leon3/include/cache_.h +++ b/c/src/lib/libbsp/sparc/leon3/include/cache_.h @@ -136,7 +136,10 @@ static inline void _CPU_cache_unfreeze_data(void) static inline void _CPU_cache_invalidate_entire_instruction(void) { - __asm__ volatile ("flush"); + uint32_t cache_reg = leon3_get_cache_control_register(); + + cache_reg |= LEON3_REG_CACHE_CTRL_FI; + leon3_set_cache_control_register(cache_reg); } Now you should also flush the d-cache explicitly for the case of updating the trap table, as I mentioned in my previous email the store to tbr[] can get cached in d-cache, so if we don't flush d-cache to memory and it is write-back cache, there could be a problem. (I don't know whether sparc32 cache are write-back or write-thru.) -Gedare The cache is write-thru so there should not be any need to flush the d-cache. static inline void _CPU_cache_invalidate_instruction_range( diff --git a/c/src/lib/libbsp/sparc/leon3/include/leon.h b/c/src/lib/libbsp/sparc/leon3/include/leon.h index a62ad29..bc3cdde 100644 --- a/c/src/lib/libbsp/sparc/leon3/include/leon.h +++ b/c/src/lib/libbsp/sparc/leon3/include/leon.h @@ -90,6 +90,7 @@ extern "C" { * The following defines the bits in the LEON Cache Control Register. */ #define LEON3_REG_CACHE_CTRL_DS 0x0080 /* Data cache snooping */ +#define LEON3_REG_CACHE_CTRL_FI 0x0020 /* Flush instruction cache */ /* LEON3 Interrupt Controller */ extern volatile struct irqmp_regs *LEON3_IrqCtrl_Regs; -- 1.7.9.5 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH-V2 6/7] bsp/sparc: Ensure that data cache snooping is enabled
>> +BSP_fatal_exit( >> LEON3_FATAL_INVALID_CACHE_CONFIG_SECONDARY_PROCESSOR ); > > bsp_fatal()? I wanted to use bsp_fatal, but it tries to acquire a ticket lock which does not work when data cache snooping is disabled. On 2014-07-09 09:28, Sebastian Huber wrote: On 2014-07-09 09:02, Daniel Cederman wrote: Check that data cache snooping exists and is enabled on all cores. --- c/src/lib/libbsp/shared/include/fatal.h |2 ++ c/src/lib/libbsp/sparc/leon3/include/leon.h | 10 ++ c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c |8 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/c/src/lib/libbsp/shared/include/fatal.h b/c/src/lib/libbsp/shared/include/fatal.h index e928bba..99da207 100644 --- a/c/src/lib/libbsp/shared/include/fatal.h +++ b/c/src/lib/libbsp/shared/include/fatal.h @@ -49,6 +49,8 @@ typedef enum { /* LEON3 fatal codes */ LEON3_FATAL_NO_IRQMP_CONTROLLER = BSP_FATAL_CODE_BLOCK(2), LEON3_FATAL_CONSOLE_REGISTER_DEV, + LEON3_FATAL_INVALID_CACHE_CONFIG_MAIN_PROCESSOR, + LEON3_FATAL_INVALID_CACHE_CONFIG_SECONDARY_PROCESSOR, /* LPC24XX fatal codes */ LPC24XX_FATAL_PL111_SET_UP = BSP_FATAL_CODE_BLOCK(3), diff --git a/c/src/lib/libbsp/sparc/leon3/include/leon.h b/c/src/lib/libbsp/sparc/leon3/include/leon.h index d7048f3..a62ad29 100644 --- a/c/src/lib/libbsp/sparc/leon3/include/leon.h +++ b/c/src/lib/libbsp/sparc/leon3/include/leon.h @@ -86,6 +86,11 @@ extern "C" { #define LEON_REG_TIMER_CONTROL_LD0x0004 /* 1 = load counter */ /* 0 = no function */ +/* + * The following defines the bits in the LEON Cache Control Register. + */ +#define LEON3_REG_CACHE_CTRL_DS 0x0080 /* Data cache snooping */ + /* LEON3 Interrupt Controller */ extern volatile struct irqmp_regs *LEON3_IrqCtrl_Regs; /* LEON3 GP Timer */ @@ -347,6 +352,11 @@ static inline uint32_t leon3_get_cache_control_register(void) return leon3_get_system_register(0x0); } +static inline bool leon3_data_cache_snooping_enabled(void) +{ + return leon3_get_cache_control_register() & LEON3_REG_CACHE_CTRL_DS; +} + static inline uint32_t leon3_get_inst_cache_config_register(void) { return leon3_get_system_register(0x8); diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c b/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c index 9166ad5..312488d 100644 --- a/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c +++ b/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -39,7 +40,9 @@ void bsp_start_on_secondary_processor() { uint32_t cpu_index_self = _CPU_SMP_Get_current_processor(); - leon3_set_cache_control_register(0x8F); + if ( ! leon3_data_cache_snooping_enabled() ) +BSP_fatal_exit( LEON3_FATAL_INVALID_CACHE_CONFIG_SECONDARY_PROCESSOR ); bsp_fatal()? + /* Unmask IPI interrupts at Interrupt controller for this CPU */ LEON3_IrqCtrl_Regs->mask[cpu_index_self] |= 1U << LEON3_MP_IRQ; @@ -48,7 +51,8 @@ void bsp_start_on_secondary_processor() uint32_t _CPU_SMP_Initialize( void ) { - leon3_set_cache_control_register(0x8F); + if ( ! leon3_data_cache_snooping_enabled() ) +bsp_fatal( LEON3_FATAL_INVALID_CACHE_CONFIG_MAIN_PROCESSOR ); if ( rtems_configuration_get_maximum_processors() > 1 ) { LEON_Unmask_interrupt(LEON3_MP_IRQ); ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH-V2 3/7] score: Add SMP support to the cache manager
I'm currently working on adding tests. Thank you for your other comments! On 2014-07-09 09:41, Sebastian Huber wrote: The new cache manager functions should have tests, see also http://git.rtems.org/rtems/tree/testsuites/sptests/spcache01/init.c On 2014-07-09 09:02, Daniel Cederman wrote: Adds functions that allows the user to specify which cores that should perform the cache operation. SMP messages are sent to all the specified cores and the caller waits until all cores have acknowledged that they have flushed their cache. If CPU_CACHE_NO_INSTRUCTION_CACHE_SNOOPING is defined the instruction cache invalidation function will perform the operation on all cores using the previous method. --- c/src/lib/libbsp/sparc/leon3/include/cache_.h |2 + c/src/lib/libcpu/shared/src/cache_manager.c | 200 - cpukit/rtems/include/rtems/rtems/cache.h | 88 +++ cpukit/score/include/rtems/score/smpimpl.h| 13 ++ 4 files changed, 297 insertions(+), 6 deletions(-) diff --git a/c/src/lib/libbsp/sparc/leon3/include/cache_.h b/c/src/lib/libbsp/sparc/leon3/include/cache_.h index 70c1e2c..63790c1 100644 --- a/c/src/lib/libbsp/sparc/leon3/include/cache_.h +++ b/c/src/lib/libbsp/sparc/leon3/include/cache_.h @@ -26,6 +26,8 @@ extern "C" { #define CPU_CACHE_SUPPORT_PROVIDES_CACHE_SIZE_FUNCTIONS +#define CPU_CACHE_NO_INSTRUCTION_CACHE_SNOOPING + #define CPU_INSTRUCTION_CACHE_ALIGNMENT 64 #define CPU_DATA_CACHE_ALIGNMENT 64 diff --git a/c/src/lib/libcpu/shared/src/cache_manager.c b/c/src/lib/libcpu/shared/src/cache_manager.c index 420a013..da57c12 100644 --- a/c/src/lib/libcpu/shared/src/cache_manager.c +++ b/c/src/lib/libcpu/shared/src/cache_manager.c This file should follow the coding and naming conventions: http://www.rtems.org/wiki/index.php/Coding_Conventions @@ -37,6 +37,156 @@ #include #include "cache_.h" +#include +#include +#include + +#if defined( RTEMS_SMP ) + +typedef void (*Cache_manager_Function_ptr)(const void *d_addr, size_t n_bytes); + +typedef struct { + Atomic_Flag lock; + Cache_manager_Function_ptr func; + Atomic_Uint count; + const void *addr; + size_t size; +} Cache_manager_SMP_control; + +static Cache_manager_SMP_control _CM_SMP = { + .lock = ATOMIC_INITIALIZER_FLAG, + .count = ATOMIC_INITIALIZER_UINT(0) +}; + +void +_SMP_Cache_manager_message_handler(void) +{ + _CM_SMP.func( _CM_SMP.addr, _CM_SMP.size ); + _Atomic_Fetch_add_uint( &_CM_SMP.count, 1, ATOMIC_ORDER_RELEASE ); +} + +#if defined(CPU_DATA_CACHE_ALIGNMENT) || \ +(defined(CPU_INSTRUCTION_CACHE_ALIGNMENT) && \ +defined(CPU_CACHE_NO_INSTRUCTION_CACHE_SNOOPING)) + +static void +_cache_manager_process_cache_messages( void ) +{ + unsigned long message; + Per_CPU_Control *cpu_self = _Per_CPU_Get(); + + message = _Atomic_Load_ulong( &cpu_self->message, ATOMIC_ORDER_RELAXED ); + + if ( message & SMP_MESSAGE_CACHE_MANAGER) { +if ( _Atomic_Compare_exchange_ulong( &cpu_self->message, &message, +message & ~SMP_MESSAGE_CACHE_MANAGER, ATOMIC_ORDER_RELAXED, +ATOMIC_ORDER_RELAXED ) ) { + _SMP_Cache_manager_message_handler(); +} + } +} + +static void +_cache_manager_send_smp_msg( +const size_t setsize, +const cpu_set_t *set, +Cache_manager_Function_ptr func, +const void * addr, +size_t size + ) +{ + uint32_t cpu_count = 0; + + if ( ! _System_state_Is_up( _System_state_Get() ) ) { +func( addr, size ); +return; + } + + if ( set == NULL ) +cpu_count = _SMP_Get_processor_count(); + else +cpu_count = CPU_COUNT_S( setsize, set ); + + _Thread_Disable_dispatch(); This will not work since _Thread_Disable_dispatch() obtains the Giant lock. Other processors acquiring the Giant lock will do this with interrupts disabled, thus you cannot make progress ... + + while ( _Atomic_Flag_test_and_set( &_CM_SMP.lock, ATOMIC_ORDER_ACQUIRE ) ) +_cache_manager_process_cache_messages(); + + _CM_SMP.func = func; + _CM_SMP.addr = addr; + _CM_SMP.size = size; + _Atomic_Store_uint( &_CM_SMP.count, 0, ATOMIC_ORDER_RELEASE ); + _Atomic_Fence( ATOMIC_ORDER_RELEASE ); + + if ( set == NULL ) { +_SMP_Send_message_broadcast( SMP_MESSAGE_CACHE_MANAGER ); +_SMP_Cache_manager_message_handler(); + } else { +_SMP_Send_message_multicast( setsize, set, SMP_MESSAGE_CACHE_MANAGER ); +_cache_manager_process_cache_messages(); + } + + while ( _Atomic_Load_uint( &_CM_SMP.count, ATOMIC_ORDER_ACQUIRE ) + != cpu_count ); ... here. + + _Atomic_Flag_clear( &_CM_SMP.lock, ATOMIC_ORDER_RELEASE ); + + _Thread_Enable_dispatch(); +} +#endif + +void +rtems_cache_flush_multiple_data_lines_processor_set( + const void *addr, + size_t size, + const size_t setsize, + const cpu_set_t *set +) +{ +#if defined(CPU_DATA_CACHE_ALIGNMENT) + _cache_manager_send_smp_msg( setsize, set, + rtems_cache_flush_multiple_data_lines, addr, size ); +#endif +} + +void +rtems_cache_invalidate_multiple_data_lines_processor_set(
[PATCH] doc: Update console driver documentation
--- doc/bsp_howto/console.t | 716 ++- 1 files changed, 331 insertions(+), 385 deletions(-) diff --git a/doc/bsp_howto/console.t b/doc/bsp_howto/console.t index 555cf04..e35ca36 100644 --- a/doc/bsp_howto/console.t +++ b/doc/bsp_howto/console.t @@ -7,7 +7,7 @@ @section Introduction -This chapter describes the operation of a console driver using +This chapter describes the operation of a console driver using the RTEMS POSIX Termios support. Traditionally RTEMS has referred to all serial device drivers as console device drivers. A console driver can be used to do raw data processing in addition @@ -16,20 +16,20 @@ of a console. The serial driver may be called as the consequence of a C Library call such as @code{printf} or @code{scanf} or directly via the -@code{read} or @code{write} system calls. -There are two main functioning modes: +@code{read} or @code{write} system calls. +There are two main functioning modes: @itemize @bullet @item console: formatted input/output, with special characters (end of line, tabulations, etc.) recognition and processing, -@item raw: permits raw data processing. +@item raw: permits raw data processing. @end itemize One may think that two serial drivers are needed to handle these two types -of data, but Termios permits having only one driver. +of data, but Termios permits having only one driver. @section Termios @@ -38,7 +38,7 @@ Termios is a standard for terminal management, included in the POSIX Specification, is commonly provided on UNIX implementations. The Open Group has the termios portion of the POSIX standard online at @uref{http://opengroup.org/onlinepubs/007908775/xbd/termios.html -,http://opengroup.org/onlinepubs/007908775/xbd/termios.html}. +,http://opengroup.org/onlinepubs/007908775/xbd/termios.html}. The requirements for the @code{} file are also provided and are at @uref{http://opengroup.org/onlinepubs/007908775/xsh/termios.h.html, http://opengroup.org/onlinepubs/007908775/xsh/termios.h.html}. @@ -49,10 +49,10 @@ Having RTEMS support for Termios is beneficial because: @item from the user's side because it provides standard primitive operations to access the terminal and change configuration settings. These operations -are the same under UNIX and RTEMS. +are the same under UNIX and RTEMS. @item from the BSP developer's side because it frees the -developer from dealing with buffer states and mutual exclusions on them. +developer from dealing with buffer states and mutual exclusions on them. Early RTEMS console device drivers also did their own special character processing. @@ -62,14 +62,14 @@ character processing. @end itemize -Termios support includes: +Termios support includes: @itemize @bullet @item raw and console handling, @item blocking or non-blocking characters receive, with or without -Timeout. +Timeout. @end itemize @@ -81,18 +81,19 @@ at @section Driver Functioning Modes -There are generally two main functioning modes for an UART (Universal -Asynchronous Receiver-Transmitter, i.e. the serial chip): +There are generally three main functioning modes for an UART (Universal +Asynchronous Receiver-Transmitter, i.e. the serial chip): @itemize @bullet @item polled mode @item interrupt driven mode +@item task driven mode @end itemize In polled mode, the processor blocks on sending/receiving characters. -This mode is not the most efficient way to utilize the UART. But +This mode is not the most efficient way to utilize the UART. But polled mode is usually necessary when one wants to print an error message in the event of a fatal error such as a fatal error in the BSP. This is also the simplest mode to @@ -120,12 +121,15 @@ one or more characters in the UART (the exact number depends on the UART) An interrupt will be raised when all the characters have been transmitted. The interrupt service routine has to send the characters remaining in the output buffer the same way. When the transmitting side -of the UART is idle, it is typically necessary to prime the transmitter +of the UART is idle, it is typically necessary to prime the transmitter before the first interrupt will occur. +The task driven mode is similar to interrupt driven mode, but the actual data +processing is done in dedicated tasks instead of interrupt routines. + @section Serial Driver Functioning Overview -The following Figure shows how a Termios driven serial driver works: +The following Figure shows how a Termios driven serial driver works: @ifset use-ascii @center Figure not included in ASCII version @@ -149,167 +153,185 @@ The following list describes the basic flow. @item the application programmer uses standard C library call (printf, scanf, read, write, etc.), -@item C library (e.g. RedHat (formerly Cygnus) Newlib) calls +@item C library (ctx.g. RedHat (formerly Cygnus) Newlib) calls the RTEMS system call interface. Th
RE: [PATCH 2/4] capture: Fix capture engine to handle new extensions.
> -Original Message- > From: devel [mailto:devel-boun...@rtems.org] On Behalf Of Chris Johns > Sent: Thursday, July 10, 2014 8:44 PM > To: devel@rtems.org > Subject: Re: [PATCH 2/4] capture: Fix capture engine to handle new > extensions. > > > > On 10/07/2014 11:44 pm, Jennifer Averett wrote: > > --- > > cpukit/libmisc/capture/capture.c | 96 > > > cpukit/libmisc/capture/capture.h | 17 --- > > 2 files changed, 78 insertions(+), 35 deletions(-) > > > > diff --git a/cpukit/libmisc/capture/capture.c > > b/cpukit/libmisc/capture/capture.c > > index 6f8e0a2..ec5e408 100644 > > --- a/cpukit/libmisc/capture/capture.c > > +++ b/cpukit/libmisc/capture/capture.c > > @@ -51,11 +51,41 @@ > > RTEMS_CAPTURE_DELETED_BY_EVENT | \ > > RTEMS_CAPTURE_DELETED_EVENT | \ > > RTEMS_CAPTURE_BEGIN_EVENT | \ > > - RTEMS_CAPTURE_EXITTED_EVENT) > > + RTEMS_CAPTURE_EXITTED_EVENT | \ > > + RTEMS_CAPTURE_TERMINATED_EVENT) > > #else > > #define RTEMS_CAPTURE_RECORD_EVENTS (0) > > #endif > > > > +static bool > > +rtems_capture_create_task (rtems_tcb* current_task, > > + rtems_tcb* new_task); > > + > > +static void > > +rtems_capture_start_task (rtems_tcb* current_task, > > + rtems_tcb* started_task); > > + > > +static void > > +rtems_capture_restart_task (rtems_tcb* current_task, > > +rtems_tcb* restarted_task); > > + > > +static void > > +rtems_capture_delete_task (rtems_tcb* current_task, > > + rtems_tcb* deleted_task); > > + > > +static void > > +rtems_capture_switch_task (rtems_tcb* current_task, > > + rtems_tcb* heir_task); > > + > > +static void > > +rtems_capture_begin_task (rtems_tcb* begin_task); > > + > > +static void > > +rtems_capture_exitted_task (rtems_tcb* exitted_task); > > + > > +static void > > +rtems_capture_terminated_task (rtems_tcb* terminated_task); > > + > > /* > >* Global capture flags. > >*/ > > @@ -88,6 +118,18 @@ static rtems_id capture_reader; > > static rtems_interrupt_lock capture_lock = > > RTEMS_INTERRUPT_LOCK_INITIALIZER("capture"); > > > > +static rtems_extensions_table capture_extensions = { > > + .thread_create= rtems_capture_create_task, > > + .thread_start = rtems_capture_start_task, > > + .thread_restart = rtems_capture_restart_task, > > + .thread_delete= rtems_capture_delete_task, > > + .thread_switch= rtems_capture_switch_task, > > + .thread_begin = rtems_capture_begin_task, > > + .thread_exitted = rtems_capture_exitted_task, > > + .fatal= NULL, > > + .thread_terminate = rtems_capture_terminated_task }; > > + > > This should be const so it lives in the program text. A requirement has always > been to not use any RAM if not enabled and linked in and the requirement is > mostly met with just a few pointers plus the lock. > Fixed > > /* > >* RTEMS Event text. > >*/ > > @@ -101,6 +143,7 @@ static const char* capture_event_text[] = > > "RESTARTED", > > "DELETED_BY", > > "DELETED", > > + "TERMINATED", > > "BEGIN", > > "EXITTED", > > "SWITCHED_OUT", > > @@ -787,21 +830,28 @@ rtems_capture_exitted_task (rtems_tcb* > exitted_task) > > static void > > rtems_capture_terminated_task (rtems_tcb* terminated_task) > > { > > - rtems_capture_delete_task (terminated_task, terminated_task); -} > > + /* > > + * Get the capture task control block so we can trace this > > + * event. > > + */ > > + rtems_capture_task_t* tt; > > > > -/* > > - * This function is called when a fatal error occurs. > > - */ > > -static void > > -rtems_capture_fatal( > > - Internal_errors_Source source, > > - bool is_internal, > > - Internal_errors_t code > > -) > > -{ > > + tt = terminated_task->extensions[capture_extension_index]; > > + > > + /* > > + * The task pointers may not be known as the task may have > > + * been created before the capture engine was open. Add them. > > + */ > > + > > + if (tt == NULL) > > +tt = rtems_capture_create_capture_task (terminated_task); > > + > > + if (rtems_capture_trigger (NULL, tt, RTEMS_CAPTURE_TERMINATED)) > > +rtems_capture_record (tt, RTEMS_CAPTURE_TERMINATED_EVENT); > > + > > + rtems_capture_task_stack_usage (tt); > > } > > - > > + > > /* > >* This function is called when a context is switched. > >*/ > > @@ -887,7 +937,6 @@ rtems_capture_switch_task (rtems_tcb* > current_task, > > rtems_status_code > > rtems_capture_open (uint32_t size, rtems_capture_timestamp > timestamp __attribute__((unused))) > > { > > - rtems_extensions_table capture_extensions; > > rtems_name
Phytec MPC5554 not running out of flash?
I've been developing code just fine running in SRAM with the current head. I just tried to run out of flash. My software put the program in flash just fine, but it doesn't run, it winds up in the BAM code trying to boot off the serial port / CAN. The difference between SRAM and FLASH is only the setup of the MMU, and it's the same code in both cases. For SRAM flash is moved from 0 up to 2140 and 4MB of SRAM down from 2140 to 0. The MMU is setup in the debugger and at startup the MMU setup is skipped if a flag in low memory is clear. That's the only difference in the behavior (see below), and I've never noted any differences before. I verified that I have the same MMU setup except for the address translation in both situations. It was different, someone changed the setup to only set the supervisor mappings and not map certain sections executable but that didn't matter, I've duplicated those settings and it works the same way. Before I go too far can anyone (Sebastian) think of changes in any other places that might affect this? static BSP_START_TEXT_SECTION void mpc55xx_start_mmu(void) { #ifdef MPC55XX_BOOTFLAGS /* If the low bit of bootflag 0 is clear don't change the MMU. */ bool do_mmu_config = (mpc55xx_bootflag_0 [0] & 1) != 0; #else bool do_mmu_config = true; #endif if (do_mmu_config) { mpc55xx_start_mmu_apply_config( &mpc55xx_start_config_mmu [0], mpc55xx_start_config_mmu_count [0] ); } } Peter - Peter Dufault HD Associates, Inc. Software and System Engineering ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] Add const qualifier in
I think today or yesterday is a suitable tag. Pavel is the arm fix in Newlib CVS? We can bump it again when openrisc code is merged. Sebastian did you want a GCC bump also? On Jul 10, 2014 9:26 PM, Chris Johns wrote: On 9/07/2014 2:40 am, Joel Sherrill wrote: > > On 7/8/2014 9:59 AM, Sebastian Huber wrote: >> On 2014-07-07 23:27, Joel Sherrill wrote: >>> Hi Chris, >>> >>> I added this patch to rtems-tools. Attached is a patch to >>> RSB to use it for the sparc tools. If this looks OK, should >>> I make a similar update to all applicable 4.11 targets? >> Why don't we move to another Newlib snapshot which includes this patch? >> Pavel >> needs also the recent memchr() fix for its ARM tool chain. >> > The default version is 2.1.0 with a few patches. I don't mind if > the version gets bumped or if we add the memchr() patch. Version please ? For CVS I need a date. > > But Chris is on holiday for a few more days. Whatever he wants > is OK with me. > Back (boo hoo). > There is value in moving to a CVS snapshot given that it is mid-year > but I don't know if that negatively impacts any odd targets. I am happy to use CVS when we are not on release branches however if we move to release 4.11 with CVS referenced we need to capture that version as a tarball. I would like have users build releases offline. If we release referencing cvs and we make a tarball (referencing it) it would be nice to be able to tag newlib's cvs repo. Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] Add const qualifier in
On 2014-07-11 15:44, Joel Sherrill wrote: I think today or yesterday is a suitable tag. Pavel is the arm fix in Newlib CVS? We can bump it again when openrisc code is merged. Sebastian did you want a GCC bump also? Once the multilib patches are in it would be nice to use the latest GCC 4.8 or 4.9 branch. -- 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
[PATCH 2/6] smpschedaffinity02: New test.
This test checks setting the affinity of a secondary task on a two core system. --- testsuites/smptests/Makefile.am| 1 + testsuites/smptests/configure.ac | 1 + testsuites/smptests/smpschedaffinity02/Makefile.am | 19 ++ testsuites/smptests/smpschedaffinity02/init.c | 230 + .../smpschedaffinity02/smpschedaffinity02.doc | 17 ++ .../smpschedaffinity02/smpschedaffinity02.scn | 15 ++ 6 files changed, 283 insertions(+) create mode 100644 testsuites/smptests/smpschedaffinity02/Makefile.am create mode 100644 testsuites/smptests/smpschedaffinity02/init.c create mode 100644 testsuites/smptests/smpschedaffinity02/smpschedaffinity02.doc create mode 100644 testsuites/smptests/smpschedaffinity02/smpschedaffinity02.scn diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am index 227c036..424fa28 100644 --- a/testsuites/smptests/Makefile.am +++ b/testsuites/smptests/Makefile.am @@ -24,6 +24,7 @@ SUBDIRS += smpmigration01 SUBDIRS += smpmigration02 SUBDIRS += smpmrsp01 SUBDIRS += smpschedaffinity01 +SUBDIRS += smpschedaffinity02 SUBDIRS += smpscheduler01 SUBDIRS += smpscheduler02 SUBDIRS += smpscheduler03 diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac index 88b43cd..eac0e65 100644 --- a/testsuites/smptests/configure.ac +++ b/testsuites/smptests/configure.ac @@ -82,6 +82,7 @@ smppsxaffinity01/Makefile smppsxaffinity02/Makefile smppsxsignal01/Makefile smpschedaffinity01/Makefile +smpschedaffinity02/Makefile smpscheduler01/Makefile smpscheduler02/Makefile smpscheduler03/Makefile diff --git a/testsuites/smptests/smpschedaffinity02/Makefile.am b/testsuites/smptests/smpschedaffinity02/Makefile.am new file mode 100644 index 000..ef56a90 --- /dev/null +++ b/testsuites/smptests/smpschedaffinity02/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpschedaffinity02 +smpschedaffinity02_SOURCES = init.c + +dist_rtems_tests_DATA = smpschedaffinity02.scn smpschedaffinity02.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpschedaffinity02_OBJECTS) +LINK_LIBS = $(smpschedaffinity02_LDLIBS) + +smpschedaffinity02$(EXEEXT): $(smpschedaffinity02_OBJECTS) $(smpschedaffinity02_DEPENDENCIES) + @rm -f smpschedaffinity02$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpschedaffinity02/init.c b/testsuites/smptests/smpschedaffinity02/init.c new file mode 100644 index 000..a3e0ddf --- /dev/null +++ b/testsuites/smptests/smpschedaffinity02/init.c @@ -0,0 +1,230 @@ +/* + * COPYRIGHT (c) 2014. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +/* + * Test designed for 2 cores: Init task and TA1 task. + * of equal priorities. + * + * - Set TA1 affinity to core 0 verify + * - Set TA1 affinity to core 1 verify it does not run because + *the Init task never blocks + * - Set Init affinity to core 0 verify both tasks are on the correct cores. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include + +#include "tmacros.h" + +const char rtems_test_name[] = "SMPSCHEDAFFINITY 2"; + +#define NUM_CPUS 2 + +struct task_data_t { + rtems_id id; + intexpected_cpu; + cpu_set_t cpuset; + bool ran; + intactual_cpu; +}; + +struct task_data_t task_data = { + 0x0, 0, {{0x3}}, false, -1 +}; + +rtems_id task_sem; + +static void task(rtems_task_argument arg); +static void show_threads(void); +static void task_verify( bool ran, bool change_affinity, int cpu ); +static void init_verify( int expect ); + +static void test_delay(int ticks) +{ + rtems_interval start, stop; + start = rtems_clock_get_ticks_since_boot(); + do { +stop = rtems_clock_get_ticks_since_boot(); + } while ( (stop - start) < ticks ); +} + +static void task_verify( bool ran, bool change_affinity, int cpu ) +{ + rtems_status_code sc; + size_t size = sizeof(cpu_set_t); + + /* Obtain the semaphore without blocking */ + while( rtems_semaphore_obtain (task_sem, RTEMS_NO_WAIT, 0) != RTEMS_SUCCESSFUL ); + + /* print the expected and actual values */ + printf( "TA01: expected=%d actual=%d ran=%d\n", + task_data.expected_cpu, + task_data.actual_cpu, + task_data.ran + ); + + /* Verify expected results */ + rtems_test_assert( task_data.ran == ran ); + if (ran) +rtems_test_assert( task_data.expected_cpu == task_data.actual_cpu ); + + if (change_affinity) { +printf("Set TA01 to cpu %d\n", cpu); +CPU_ZERO(&task_data.cpuset); +CPU_SET(cpu, &task_data.cpuset); +sc = rtems_task_set_affinity( task_data.id, size, &task_d
[PATCH 5/6] smpschedaffinity05: Add test for worst case migration for affintiy scheduler.
This test uses a combination of priority and affinity to cause the tasks running on all 4 cores to change due to one task priority change. --- testsuites/smptests/Makefile.am| 1 + testsuites/smptests/configure.ac | 1 + testsuites/smptests/smpschedaffinity05/Makefile.am | 19 ++ testsuites/smptests/smpschedaffinity05/init.c | 243 + .../smpschedaffinity05/smpschedaffinity05.doc | 13 ++ .../smpschedaffinity05/smpschedaffinity05.scn | 18 ++ 6 files changed, 295 insertions(+) create mode 100644 testsuites/smptests/smpschedaffinity05/Makefile.am create mode 100644 testsuites/smptests/smpschedaffinity05/init.c create mode 100644 testsuites/smptests/smpschedaffinity05/smpschedaffinity05.doc create mode 100644 testsuites/smptests/smpschedaffinity05/smpschedaffinity05.scn diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am index e025dab..29f802c 100644 --- a/testsuites/smptests/Makefile.am +++ b/testsuites/smptests/Makefile.am @@ -27,6 +27,7 @@ SUBDIRS += smpschedaffinity01 SUBDIRS += smpschedaffinity02 SUBDIRS += smpschedaffinity03 SUBDIRS += smpschedaffinity04 +SUBDIRS += smpschedaffinity05 SUBDIRS += smpscheduler01 SUBDIRS += smpscheduler02 SUBDIRS += smpscheduler03 diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac index cb8ac65..c181cbc 100644 --- a/testsuites/smptests/configure.ac +++ b/testsuites/smptests/configure.ac @@ -85,6 +85,7 @@ smpschedaffinity01/Makefile smpschedaffinity02/Makefile smpschedaffinity03/Makefile smpschedaffinity04/Makefile +smpschedaffinity05/Makefile smpscheduler01/Makefile smpscheduler02/Makefile smpscheduler03/Makefile diff --git a/testsuites/smptests/smpschedaffinity05/Makefile.am b/testsuites/smptests/smpschedaffinity05/Makefile.am new file mode 100644 index 000..2577ba6 --- /dev/null +++ b/testsuites/smptests/smpschedaffinity05/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpschedaffinity05 +smpschedaffinity05_SOURCES = init.c + +dist_rtems_tests_DATA = smpschedaffinity05.scn smpschedaffinity05.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpschedaffinity05_OBJECTS) +LINK_LIBS = $(smpschedaffinity05_LDLIBS) + +smpschedaffinity05$(EXEEXT): $(smpschedaffinity05_OBJECTS) $(smpschedaffinity05_DEPENDENCIES) + @rm -f smpschedaffinity05$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpschedaffinity05/init.c b/testsuites/smptests/smpschedaffinity05/init.c new file mode 100644 index 000..754c226 --- /dev/null +++ b/testsuites/smptests/smpschedaffinity05/init.c @@ -0,0 +1,243 @@ +/* + * COPYRIGHT (c) 2014. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +/* + * Start 4 tasks with affinity for each of the 4 cpus. + * Allow tasks to set their actual cpu value and delete themselves. + * Verify the actual cpu values match the expected cpu values. + * + * Init task is at a lower priority 8 and the threads + * with affinity are at priority 4, so the affinity task + * on the core init is running on will preempt it. + * + * Test tasks run and delete themselves. + * Init task never blocks. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include + +#include "tmacros.h" + +const char rtems_test_name[] = "SMPSCHEDAFFINITY 5"; + +#define NUM_CPUS 4 +#define TASK_COUNT 5 + +struct task_data_t { + rtems_idid; + cpu_set_t cpuset; + rtems_task_priority priority; + boolran; + int expected_cpu; + int actual_cpu; + int migrate_cpu; +}; + +static struct task_data_t task_data[TASK_COUNT] = { + {0x0, {{0xc}}, 7, false, 3, -1, 2}, + {0x0, {{0xf}}, 8, false, 2, -1, -1}, + {0x0, {{0x3}}, 5, false, 1, -1, 0}, + {0x0, {{0x9}}, 6, false, 0, -1, 3}, + {0x0, {{0x2}}, 9, false, -1, -1, 1} +}; + +rtems_id task_sem; + +static void verify_tasks(void); + +/* + * Spin loop to allow tasks to delay without yeilding the + * processor. + */ +static void test_delay(int ticks) +{ + rtems_interval start, stop; + start = rtems_clock_get_ticks_since_boot(); + do { +stop = rtems_clock_get_ticks_since_boot(); + } while ( (stop - start) < ticks ); +} + +static void task(rtems_task_argument arg) +{ + rtems_status_code sc; + + while (true) { +sc = rtems_semaphore_obtain (task_sem, RTEMS_NO_WAIT, 0); +if (sc == RTEMS_SUCCESSFUL) { + task_data[arg].ran = true; + task_data[arg].actual_cpu = rtems_get_current_processor(); + rtems_semaphore_release(task_sem); +} + } +} +static void
[PATCH 1/6] smpschedaffinity01: New test.
This test verifies that affinity is honored when set prior to task start. --- testsuites/smptests/Makefile.am| 1 + testsuites/smptests/configure.ac | 1 + testsuites/smptests/smpschedaffinity01/Makefile.am | 19 +++ testsuites/smptests/smpschedaffinity01/init.c | 173 + .../smpschedaffinity01/smpschedaffinity01.doc | 11 ++ .../smpschedaffinity01/smpschedaffinity01.scn | 15 ++ 6 files changed, 220 insertions(+) create mode 100644 testsuites/smptests/smpschedaffinity01/Makefile.am create mode 100644 testsuites/smptests/smpschedaffinity01/init.c create mode 100644 testsuites/smptests/smpschedaffinity01/smpschedaffinity01.doc create mode 100644 testsuites/smptests/smpschedaffinity01/smpschedaffinity01.scn diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am index 1edfbde..227c036 100644 --- a/testsuites/smptests/Makefile.am +++ b/testsuites/smptests/Makefile.am @@ -23,6 +23,7 @@ SUBDIRS += smplock01 SUBDIRS += smpmigration01 SUBDIRS += smpmigration02 SUBDIRS += smpmrsp01 +SUBDIRS += smpschedaffinity01 SUBDIRS += smpscheduler01 SUBDIRS += smpscheduler02 SUBDIRS += smpscheduler03 diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac index 79b3bf8..88b43cd 100644 --- a/testsuites/smptests/configure.ac +++ b/testsuites/smptests/configure.ac @@ -81,6 +81,7 @@ smpmrsp01/Makefile smppsxaffinity01/Makefile smppsxaffinity02/Makefile smppsxsignal01/Makefile +smpschedaffinity01/Makefile smpscheduler01/Makefile smpscheduler02/Makefile smpscheduler03/Makefile diff --git a/testsuites/smptests/smpschedaffinity01/Makefile.am b/testsuites/smptests/smpschedaffinity01/Makefile.am new file mode 100644 index 000..353abe1 --- /dev/null +++ b/testsuites/smptests/smpschedaffinity01/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpschedaffinity01 +smpschedaffinity01_SOURCES = init.c + +dist_rtems_tests_DATA = smpschedaffinity01.scn smpschedaffinity01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpschedaffinity01_OBJECTS) +LINK_LIBS = $(smpschedaffinity01_LDLIBS) + +smpschedaffinity01$(EXEEXT): $(smpschedaffinity01_OBJECTS) $(smpschedaffinity01_DEPENDENCIES) + @rm -f smpschedaffinity01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpschedaffinity01/init.c b/testsuites/smptests/smpschedaffinity01/init.c new file mode 100644 index 000..1f1e32a --- /dev/null +++ b/testsuites/smptests/smpschedaffinity01/init.c @@ -0,0 +1,173 @@ +/* + * COPYRIGHT (c) 2014. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +/* + * Start 4 tasks with affinity for each of the 4 cpus. + * Allow tasks to set their actual cpu value and delete themselves. + * Verify the actual cpu values match the expected cpu values. + * + * Init task is at a lower priority 8 and the threads + * with affinity are at priority 4, so the affinity task + * on the core init is running on will preempt it. + * + * Test tasks run and delete themselves. + * Init task never blocks. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include + +#include "tmacros.h" + +const char rtems_test_name[] = "SMPSCHEDAFFINITY 1"; + +#define NUM_CPUS 4 +#define TASK_COUNT 5 + +struct task_data_t { + rtems_id id; + intexpected_cpu; + cpu_set_t cpuset; + bool ran; + intactual_cpu; +}; + +static struct task_data_t task_data[NUM_CPUS] = { + {0x0, 2, {{0x4}}, false, -1}, + {0x0, 0, {{0x1}}, false, -1}, + {0x0, 3, {{0x8}}, false, -1}, + {0x0, 1, {{0x2}}, false, -1} +}; + +/* + * Spin loop to allow tasks to delay without yeilding the + * processor. + */ +static void test_delay(int ticks) +{ + rtems_interval start, stop; + start = rtems_clock_get_ticks_since_boot(); + do { +stop = rtems_clock_get_ticks_since_boot(); + } while ( (stop - start) < ticks ); +} + +static void task(rtems_task_argument arg) +{ + uint32_t cpu; + cpu_set_t cpuset; + + cpu = rtems_get_current_processor(); + + rtems_task_get_affinity( rtems_task_self(), sizeof(cpuset), &cpuset ); + + task_data[arg].ran = true; + task_data[arg].actual_cpu = cpu; + + rtems_task_delete( RTEMS_SELF ); +} + +static void test(void) +{ + rtems_status_code sc; + rtems_task_argument i; + size_t size; + uint32_tcpu_count; + + /* Get the number of processors that we are using. */ + cpu_count = rtems_get_processor_count(); + + size = sizeof(cpu_set_t); + + /* Create and start tasks on each cpu with the appropriate affinity. */ + for (i = 0; i < NUM_CPUS; i++) { + + /* Skip if
[PATCH 4/6] smpschedaffinity04: New test.
This test walks a secondary high prority task across all the cores. --- testsuites/smptests/Makefile.am| 1 + testsuites/smptests/configure.ac | 1 + testsuites/smptests/smpschedaffinity04/Makefile.am | 19 +++ testsuites/smptests/smpschedaffinity04/init.c | 184 + .../smpschedaffinity04/smpschedaffinity04.doc | 11 ++ .../smpschedaffinity04/smpschedaffinity04.scn | 13 ++ 6 files changed, 229 insertions(+) create mode 100644 testsuites/smptests/smpschedaffinity04/Makefile.am create mode 100644 testsuites/smptests/smpschedaffinity04/init.c create mode 100644 testsuites/smptests/smpschedaffinity04/smpschedaffinity04.doc create mode 100644 testsuites/smptests/smpschedaffinity04/smpschedaffinity04.scn diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am index 961ef55..e025dab 100644 --- a/testsuites/smptests/Makefile.am +++ b/testsuites/smptests/Makefile.am @@ -26,6 +26,7 @@ SUBDIRS += smpmrsp01 SUBDIRS += smpschedaffinity01 SUBDIRS += smpschedaffinity02 SUBDIRS += smpschedaffinity03 +SUBDIRS += smpschedaffinity04 SUBDIRS += smpscheduler01 SUBDIRS += smpscheduler02 SUBDIRS += smpscheduler03 diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac index 4c21646..cb8ac65 100644 --- a/testsuites/smptests/configure.ac +++ b/testsuites/smptests/configure.ac @@ -84,6 +84,7 @@ smppsxsignal01/Makefile smpschedaffinity01/Makefile smpschedaffinity02/Makefile smpschedaffinity03/Makefile +smpschedaffinity04/Makefile smpscheduler01/Makefile smpscheduler02/Makefile smpscheduler03/Makefile diff --git a/testsuites/smptests/smpschedaffinity04/Makefile.am b/testsuites/smptests/smpschedaffinity04/Makefile.am new file mode 100644 index 000..d75216c --- /dev/null +++ b/testsuites/smptests/smpschedaffinity04/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpschedaffinity04 +smpschedaffinity04_SOURCES = init.c + +dist_rtems_tests_DATA = smpschedaffinity04.scn smpschedaffinity04.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpschedaffinity04_OBJECTS) +LINK_LIBS = $(smpschedaffinity04_LDLIBS) + +smpschedaffinity04$(EXEEXT): $(smpschedaffinity04_OBJECTS) $(smpschedaffinity04_DEPENDENCIES) + @rm -f smpschedaffinity04$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpschedaffinity04/init.c b/testsuites/smptests/smpschedaffinity04/init.c new file mode 100644 index 000..bdfc56c --- /dev/null +++ b/testsuites/smptests/smpschedaffinity04/init.c @@ -0,0 +1,184 @@ +/* + * COPYRIGHT (c) 2014. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +/* + * Use the Init task to walk the higher priority TA1 across all the cores. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include + +#include "tmacros.h" + +const char rtems_test_name[] = "SMPSCHEDAFFINITY 4"; + +#define NUM_CPUS 4 +#define TASK_COUNT 2 + +struct task_data_t { + rtems_id id; + intexpected_cpu; + bool ran; + intactual_cpu; +}; + +struct task_data_t task_data = { + 0x0, 2, false, 0xff +}; + +rtems_id task_sem; + +static void task(rtems_task_argument arg); + +static void test_delay(int ticks) +{ + rtems_interval start, stop; + start = rtems_clock_get_ticks_since_boot(); + do { +stop = rtems_clock_get_ticks_since_boot(); + } while ( (stop - start) < ticks ); +} + +/* + * Task that continually sets the cpu and + * run indicators without blocking. + */ +static void task(rtems_task_argument arg) +{ + rtems_status_code sc; + + while (true) { +sc = rtems_semaphore_obtain (task_sem, RTEMS_NO_WAIT, 0); +if (sc == RTEMS_SUCCESSFUL) { + task_data.ran = true; + task_data.actual_cpu = rtems_get_current_processor(); + rtems_semaphore_release(task_sem); +} + } +} + +static void test(void) +{ + rtems_status_code sc; + uint32_tcpu_count; + int cpu; + int i; + cpu_set_t cpuset; + + /* Get the number of processors that we are using. */ + cpu_count = rtems_get_processor_count(); + if (cpu_count < 2) { +printf("Error: Test requires at least 2 cpus\n"); +return; + } + + printf("Create Semaphore\n"); + sc = rtems_semaphore_create( +rtems_build_name('S', 'E', 'M', '0'), +1, /* initial count = 1 */ +RTEMS_LOCAL | +RTEMS_SIMPLE_BINARY_SEMAPHORE | +RTEMS_NO_INHERIT_PRIORITY | +RTEMS_NO_PRIORITY_CEILING | +RTEMS_FIFO, +0, +&task_sem + ); + rtems_test_assert(
[PATCH 3/6] smpschedaffinity03: New test.
This task walks the affinity of self across all the cores. --- testsuites/smptests/Makefile.am| 1 + testsuites/smptests/configure.ac | 1 + testsuites/smptests/smpschedaffinity03/Makefile.am | 19 testsuites/smptests/smpschedaffinity03/init.c | 101 + .../smpschedaffinity03/smpschedaffinity03.doc | 10 ++ .../smpschedaffinity03/smpschedaffinity03.scn | 10 ++ 6 files changed, 142 insertions(+) create mode 100644 testsuites/smptests/smpschedaffinity03/Makefile.am create mode 100644 testsuites/smptests/smpschedaffinity03/init.c create mode 100644 testsuites/smptests/smpschedaffinity03/smpschedaffinity03.doc create mode 100644 testsuites/smptests/smpschedaffinity03/smpschedaffinity03.scn diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am index 424fa28..961ef55 100644 --- a/testsuites/smptests/Makefile.am +++ b/testsuites/smptests/Makefile.am @@ -25,6 +25,7 @@ SUBDIRS += smpmigration02 SUBDIRS += smpmrsp01 SUBDIRS += smpschedaffinity01 SUBDIRS += smpschedaffinity02 +SUBDIRS += smpschedaffinity03 SUBDIRS += smpscheduler01 SUBDIRS += smpscheduler02 SUBDIRS += smpscheduler03 diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac index eac0e65..4c21646 100644 --- a/testsuites/smptests/configure.ac +++ b/testsuites/smptests/configure.ac @@ -83,6 +83,7 @@ smppsxaffinity02/Makefile smppsxsignal01/Makefile smpschedaffinity01/Makefile smpschedaffinity02/Makefile +smpschedaffinity03/Makefile smpscheduler01/Makefile smpscheduler02/Makefile smpscheduler03/Makefile diff --git a/testsuites/smptests/smpschedaffinity03/Makefile.am b/testsuites/smptests/smpschedaffinity03/Makefile.am new file mode 100644 index 000..995f587 --- /dev/null +++ b/testsuites/smptests/smpschedaffinity03/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpschedaffinity03 +smpschedaffinity03_SOURCES = init.c + +dist_rtems_tests_DATA = smpschedaffinity03.scn smpschedaffinity03.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpschedaffinity03_OBJECTS) +LINK_LIBS = $(smpschedaffinity03_LDLIBS) + +smpschedaffinity03$(EXEEXT): $(smpschedaffinity03_OBJECTS) $(smpschedaffinity03_DEPENDENCIES) + @rm -f smpschedaffinity03$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpschedaffinity03/init.c b/testsuites/smptests/smpschedaffinity03/init.c new file mode 100644 index 000..5b8acf7 --- /dev/null +++ b/testsuites/smptests/smpschedaffinity03/init.c @@ -0,0 +1,101 @@ +/* + * COPYRIGHT (c) 2014. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +/* + * Test to walk the affinity of the init task across all the cores. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include + +#include "tmacros.h" + +const char rtems_test_name[] = "SMPSCHEDAFFINITY 3"; + +#define NUM_CPUS 4 +#define TASK_COUNT NUM_CPUS + +static void test_delay(int ticks) +{ + rtems_interval start, stop; + start = rtems_clock_get_ticks_since_boot(); + do { +stop = rtems_clock_get_ticks_since_boot(); + } while ( (stop - start) < ticks ); +} + +static void test(void) +{ + rtems_status_code sc; + rtems_idid; + uint32_tcpu_count; + int cpu; + int i; + cpu_set_t cpuset; + + /* Get the number of processors that we are using. */ + cpu_count = rtems_get_processor_count(); + + id = rtems_task_self(); + + /* + * The Init task comes up on the maximum core so start at + * that core and walk the affinity down to core 0. + */ + for( i=cpu_count-1; i >= 0; i--) { + +/* Move the affinity to the current core - 1 */ +CPU_ZERO(&cpuset); +CPU_SET(i, &cpuset); +printf("Set Affinity for cpu %d\n", i); +sc = rtems_task_set_affinity( id, sizeof(cpuset), &cpuset ); +rtems_test_assert(sc == RTEMS_SUCCESSFUL); + +/* Wait 100 clock ticks */ +test_delay(100); + +/* Check the cpu the Init task is running on */ +cpu = rtems_get_current_processor(); +printf("On cpu %d\n", cpu); +rtems_test_assert(cpu == i); + } +} + +static void Init(rtems_task_argument arg) +{ + TEST_BEGIN(); + + test(); + + TEST_END(); + rtems_test_exit(0); +} + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_SMP_APPLICATION + +#define CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP + +#define CONFIGURE_SMP_MAXIMUM_PROCESSORS NUM_CPUS + +#define CONFIGURE_MAXIMUM_TASKS TASK_COUNT + +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTE
[PATCH 6/6] smpschedsem01: new test.
This test verifies priority is inherited from a high priority semaphore by a lower priority task. --- testsuites/smptests/Makefile.am| 1 + testsuites/smptests/configure.ac | 1 + testsuites/smptests/smpschedsem01/Makefile.am | 19 + testsuites/smptests/smpschedsem01/init.c | 94 ++ .../smptests/smpschedsem01/smpschedsem01.doc | 12 +++ .../smptests/smpschedsem01/smpschedsem01.scn | 7 ++ 6 files changed, 134 insertions(+) create mode 100644 testsuites/smptests/smpschedsem01/Makefile.am create mode 100644 testsuites/smptests/smpschedsem01/init.c create mode 100644 testsuites/smptests/smpschedsem01/smpschedsem01.doc create mode 100644 testsuites/smptests/smpschedsem01/smpschedsem01.scn diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am index 29f802c..a6e7209 100644 --- a/testsuites/smptests/Makefile.am +++ b/testsuites/smptests/Makefile.am @@ -31,6 +31,7 @@ SUBDIRS += smpschedaffinity05 SUBDIRS += smpscheduler01 SUBDIRS += smpscheduler02 SUBDIRS += smpscheduler03 +SUBDIRS += smpschedsem01 SUBDIRS += smpsignal01 SUBDIRS += smpswitchextension01 SUBDIRS += smpthreadlife01 diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac index c181cbc..d88b9a0 100644 --- a/testsuites/smptests/configure.ac +++ b/testsuites/smptests/configure.ac @@ -89,6 +89,7 @@ smpschedaffinity05/Makefile smpscheduler01/Makefile smpscheduler02/Makefile smpscheduler03/Makefile +smpschedsem01/Makefile smpsignal01/Makefile smpswitchextension01/Makefile smpthreadlife01/Makefile diff --git a/testsuites/smptests/smpschedsem01/Makefile.am b/testsuites/smptests/smpschedsem01/Makefile.am new file mode 100644 index 000..bf39506 --- /dev/null +++ b/testsuites/smptests/smpschedsem01/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = smpschedsem01 +smpschedsem01_SOURCES = init.c + +dist_rtems_tests_DATA = smpschedsem01.scn smpschedsem01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(smpschedsem01_OBJECTS) +LINK_LIBS = $(smpschedsem01_LDLIBS) + +smpschedsem01$(EXEEXT): $(smpschedsem01_OBJECTS) $(smpschedsem01_DEPENDENCIES) + @rm -f smpschedsem01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/smptests/smpschedsem01/init.c b/testsuites/smptests/smpschedsem01/init.c new file mode 100644 index 000..894ba81 --- /dev/null +++ b/testsuites/smptests/smpschedsem01/init.c @@ -0,0 +1,94 @@ +/* + * COPYRIGHT (c) 2014. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include + +#include "tmacros.h" + +const char rtems_test_name[] = "SMPSCHEDSEM 01"; + +#define NUM_CPUS 1 +#define TASK_COUNT 2 +#define TASK_PRIORITY 8 +#define SEM_PRIORITY 5 + +/* + * Test verifies priority, + * Changes priority by obtaining a higher priority semaphore + * Releases semaphore to return priority + */ +static void test(void) +{ + rtems_idid; + rtems_status_code sc; + rtems_task_priority priority; + rtems_idtask_sem; + + sc = rtems_semaphore_create( +rtems_build_name('S', 'E', 'M', '0'), +1, +RTEMS_BINARY_SEMAPHORE | +RTEMS_PRIORITY | +RTEMS_PRIORITY_CEILING, +5, +&task_sem + ); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority); + printf("Init: priority %d expected %d\n",(int)priority, TASK_PRIORITY ); + rtems_test_assert( priority == TASK_PRIORITY ); + + printf("Init: Obtain Semaphore\n"); + sc = rtems_semaphore_obtain (task_sem, RTEMS_WAIT, RTEMS_NO_TIMEOUT); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority); + printf("Init: priority %d expected %d\n",(int)priority, SEM_PRIORITY ); + rtems_test_assert( priority == SEM_PRIORITY ); + + printf("Init: Release Semaphore\n"); + rtems_semaphore_release(task_sem); + rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority); + printf("Init: priority %d expected %d\n",(int)priority, TASK_PRIORITY ); + rtems_test_assert( priority == TASK_PRIORITY ); +} + +static void Init(rtems_task_argument arg) +{ + TEST_BEGIN(); + + test(); + + TEST_END(); + rtems_test_exit(0); +} + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_SMP_APPLICATION + +#define CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP + +#define CONFIGURE_SMP_MAXIMUM_PROCESSORS NUM_CPUS + +#define CONFIGURE_MAXIMUM_TASKS TASK_COUNT + +#define CONFIG
Re: [PATCH 3/4] capture: Remove nested rtems_interrupt_lock_acquire calls.
On 11/07/2014 4:59 pm, Sebastian Huber wrote: On 2014-07-11 04:08, Chris Johns wrote: On 10/07/2014 11:44 pm, Jennifer Averett wrote: Use of the cenable command was resulting in a lock in rtems_interrupt_lock_acquire due to nesting. I am rejecting this change. RTEMS as an RTOS should provide support to handle this case in a consistent manner in SMP and non-SMP builds of the code. The change highlights an issue in RTEMS's locking support. This code works on a non-SMP build because the rtems_interrupt_lock_acquire nests and this is the functionality of the call it replaces. It is dangerous to promote rtems_interrupt_lock_acquire and rtems_interrupt_lock_release as replacements for old interrupt disable and enable calls if they are not functionally the same as the code they replace and functionally the same on SMP and non-SMP builds. I understand the current implementation of the rtems_interrupt_lock_* code is optimised for performance and adding nesting checks adds overhead however I feel we should considering providing support with no-nesting versions for code that can support this. The pattern in the capture engine this change addresses is a common one and forcing users to remember this issue and then rewrite exist code to manage it is not being a helpful RTOS. I am fine with adding additional locks which allow nesting, Great. but the default lock used a the lowest level must not allow nesting. I agree. Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] Fix RTL colon problem
On 5/07/2014 5:22 pm, Peng Fan wrote: When loading an object file which is in an archive file using such a command "dlo tmp.ra:xx.rap", it shows file not found. This patch fix it. Applied. Thanks. Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel