Changeset 43e1573c in rtems


Ignore:
Timestamp:
Feb 28, 2015, 5:06:37 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
5b393fa5
Parents:
1512761
git-author:
Sebastian Huber <sebastian.huber@…> (02/28/15 17:06:37)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/05/15 10:36:40)
Message:

score: Add ISR lock to Objects_Control

This enables per-object SMP locks on SMP configurations and is the first
step to support fine-grained locking. On uni-processor configuration
there will be no overhead. The _Objects_Acquire() is intended to
replace _Objects_Get_isr_disable().

Update #2273.

Location:
cpukit/score
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/Makefile.am

    r1512761 r43e1573c  
    203203    src/objectnamespaceremove.c \
    204204    src/objectactivecount.c
     205libscore_a_SOURCES += src/objectacquire.c
    205206
    206207## SCHEDULER_C_FILES
  • cpukit/score/include/rtems/score/object.h

    r1512761 r43e1573c  
    2424#include <rtems/score/cpu.h>
    2525#include <rtems/score/chain.h>
     26#include <rtems/score/isrlock.h>
    2627
    2728#ifdef __cplusplus
     
    237238  /** This is the object's name. */
    238239  Objects_Name   name;
     240  /** This is the object's ISR lock. */
     241  ISR_LOCK_MEMBER( Lock )
    239242} Objects_Control;
    240243
  • cpukit/score/include/rtems/score/objectimpl.h

    r1512761 r43e1573c  
    592592
    593593/**
     594 * @brief Acquires an object by its identifier.
     595 *
     596 * This function is similar to _Objects_Get_isr_disable().  It acquires the
     597 * object specific ISR lock for local objects.  Thread dispatching is not
     598 * disabled for local objects.  For remote objects thread dispatching is
     599 * disabled.
     600 *
     601 * @param[in] information The object information.
     602 * @param[in] id The object identifier.
     603 * @param[in] location The location of the object.
     604 * @param[in] lock_context The lock context for local objects.
     605 *
     606 * @retval object The object corresponding to the identifier.
     607 * @retval NULL No object exists in this domain for this identifer.
     608 *
     609 * @see _Objects_Release(), _Objects_Release_and_ISR_enable(), and
     610 * _Objects_Release_and_thread_dispatch_disable().
     611 */
     612Objects_Control *_Objects_Acquire(
     613  const Objects_Information *information,
     614  Objects_Id                 id,
     615  Objects_Locations         *location,
     616  ISR_lock_Context          *lock_context
     617);
     618
     619/**
     620 * @brief Releases a local object.
     621 *
     622 * @param[in] the_object The local object acquired by _Objects_Acquire().
     623 * @param[in] lock_context The lock context initialized by _Objects_Acquire().
     624 */
     625RTEMS_INLINE_ROUTINE void _Objects_Release(
     626  Objects_Control  *the_object,
     627  ISR_lock_Context *lock_context
     628)
     629{
     630  _ISR_lock_Release( &the_object->Lock, lock_context );
     631}
     632
     633/**
     634 * @brief Releases a local object and restores the interrupt level.
     635 *
     636 * @param[in] the_object The local object acquired by _Objects_Acquire().
     637 * @param[in] lock_context The lock context initialized by _Objects_Acquire().
     638 */
     639RTEMS_INLINE_ROUTINE void _Objects_Release_and_ISR_enable(
     640  Objects_Control  *the_object,
     641  ISR_lock_Context *lock_context
     642)
     643{
     644  _ISR_lock_Release_and_ISR_enable( &the_object->Lock, lock_context );
     645}
     646
     647/**
     648 * @brief Releases a local object, disables thread dispatching and restores the
     649 * interrupt level.
     650 *
     651 * @param[in] the_object The local object acquired by _Objects_Acquire().
     652 * @param[in] lock_context The lock context initialized by _Objects_Acquire().
     653 *
     654 * @return The current processor.
     655 */
     656RTEMS_INLINE_ROUTINE Per_CPU_Control *
     657_Objects_Release_and_thread_dispatch_disable(
     658  Objects_Control  *the_object,
     659  ISR_lock_Context *lock_context
     660)
     661{
     662  Per_CPU_Control *cpu_self = _Per_CPU_Get();
     663
     664  _Thread_Dispatch_disable_critical( cpu_self );
     665  _Objects_Release_and_ISR_enable( the_object, lock_context );
     666
     667  return cpu_self;
     668}
     669
     670/**
    594671 *  Like @ref _Objects_Get, but is used to find "next" open object.
    595672 *
     
    904981
    905982  the_object->name = name;
     983  _ISR_lock_Initialize( &the_object->Lock, "Object" );
    906984
    907985  _Objects_Set_local_object(
     
    9281006  /* ASSERT: information->is_string == false */
    9291007  the_object->name.name_u32 = name;
     1008  _ISR_lock_Initialize( &the_object->Lock, "Object" );
    9301009
    9311010  _Objects_Set_local_object(
     
    9541033    the_object->name.name_p = name;
    9551034  #endif
     1035  _ISR_lock_Initialize( &the_object->Lock, "Object" );
    9561036
    9571037  _Objects_Set_local_object(
  • cpukit/score/src/objectclose.c

    r1512761 r43e1573c  
    2929
    3030  _Objects_Namespace_remove( information, the_object );
     31
     32  _ISR_lock_Destroy( &the_object->Lock );
    3133}
Note: See TracChangeset for help on using the changeset viewer.