Generalize _Cache_manager_Send_smp_msg()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Sep 17 06:18:15 UTC 2014


Hello,

the function _Cache_manager_Send_smp_msg() is currently implemented in the BSP 
specific domain and not available for all BSPs.  This leads currently to build 
errors.  One hack to solve this problem exists:

http://lists.rtems.org/pipermail/devel/2014-September/007948.html

Since the functionality provided by _Cache_manager_Send_smp_msg() is useful for 
other use cases (e.g. MMU maintenance operations) it should be generalized to 
something like:

typedef struct SMP_Barrier_operation_node SMP_Barrier_operation_node;

typedef void ( *SMP_Barrier_operation )( SMP_Barrier_operation_node *node );

typedef struct {
   Chain_Node Node;
   SMP_Barrier_operation operation
   cpu_set_t *recipients;
   size_t setsize;
   Atomic_Ulong done;
} SMP_Barrier_operation_node;

void _SMP_Barrier_operation( SMP_Barrier_operation_node *node );

Specializations can use something like:

typedef struct {
   SMP_Barrier_operation_node Node;
   some_type more_data;
} specialization_node;

Currently we have:

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 i;
   Cache_manager_SMP_node node;
   size_t set_size = CPU_ALLOC_SIZE( _SMP_Get_processor_count() );
   char cpu_set_copy[set_size];
   SMP_lock_Context lock_context;

   if ( ! _System_state_Is_up( _System_state_Get() ) ) {
     func( addr, size );
     return;
   }
[...]

So in the ! _System_state_Is_up( _System_state_Get() ) case there is no send. 
This is not what a user expects from this function.  One option is to add the 
SMP message processing to the per-CPU state wait for change loop 
(_Per_CPU_State_busy_wait()).

This can be used to avoid the special case _LEON3_Start_multitasking() function.

In case a processor not available to the application is set in the recipients, 
then _Cache_manager_Send_smp_msg() waits forever.  This function should ignore 
unavailable processors.  This is what the other processor set dependent 
functions do (e.g. rtems_task_set_affinity()).  There should be a test case for 
this.

-- 
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.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


More information about the devel mailing list