Changeset 50 for trunk/kernel/libk


Ignore:
Timestamp:
Jun 26, 2017, 3:15:11 PM (7 years ago)
Author:
alain
Message:

bloup

Location:
trunk/kernel/libk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/remote_rwlock.c

    r23 r50  
    2626#include <hal_irqmask.h>
    2727#include <thread.h>
     28#include <printk.h>
    2829#include <cluster.h>
    2930#include <scheduler.h>
     
    185186
    186187    // compute extended pointers on lock->ticket, lock->owner and thread->remote_locks
    187     xptr_t              current_xp = XPTR( lock_cxy   , &lock_ptr->ticket );
     188    xptr_t              current_xp = XPTR( lock_cxy   , &lock_ptr->current );
    188189    xptr_t              owner_xp   = XPTR( lock_cxy   , &lock_ptr->owner );
    189190    xptr_t              locks_xp   = XPTR( thread_cxy , &thread_ptr->remote_locks );
     
    202203}  // end remote_rwlock_wr_unlock()
    203204
    204 
     205///////////////////////////////////////////
     206void remote_rwlock_print( xptr_t   lock_xp,
     207                          char   * comment )
     208{
     209    uint32_t     ticket;                // first free ticket index
     210    uint32_t     current;               // ticket index of current owner
     211    uint32_t     count;                 // current number of reader threads
     212    xptr_t       owner;                 // extended pointer on writer thread
     213
     214    // get cluster and local pointer on remote_rwlock
     215    remote_rwlock_t * lock_ptr = (remote_rwlock_t *)GET_PTR( lock_xp );
     216    cxy_t             lock_cxy = GET_CXY( lock_xp );
     217
     218    ticket  = hal_remote_lw ( XPTR( lock_cxy , &lock_ptr->ticket ) );
     219    current = hal_remote_lw ( XPTR( lock_cxy , &lock_ptr->current ) );
     220    count   = hal_remote_lw ( XPTR( lock_cxy , &lock_ptr->count ) );
     221    owner   = hal_remote_lwd( XPTR( lock_cxy , &lock_ptr->owner ) );
     222
     223    printk("\n*** rwlock <%l> %s : ticket = %d / current = %d / count = %d / owner = %l\n",
     224           lock_xp , comment , ticket , current , count , owner );
     225
     226}  // end remote_rwlock_print()
     227
  • trunk/kernel/libk/remote_rwlock.h

    r23 r50  
    9292void remote_rwlock_wr_unlock( xptr_t lock_xp );
    9393
     94/***************************************************************************************
     95 * Display the lock state on kernel TTY.
     96 ***************************************************************************************
     97 * @ lock_xp    : extended pointer on the remote rwlock
     98 * @ comment    : comment to be printed.
     99 **************************************************************************************/
     100void remote_rwlock_print( xptr_t   lock_xp,
     101                          char   * comment );
     102
    94103#endif
  • trunk/kernel/libk/xhtab.c

    r23 r50  
    143143                      xptr_t   xlist_xp )
    144144{
    145 
    146 printk("\n                @@@ xhtab_insert : 0 / name = %s / xhtab_xp = %l / xlist_xp = %l\n",
    147        key , xhtab_xp , xlist_xp );
    148 
    149145    // get xhtab cluster and local pointer
    150146    cxy_t     xhtab_cxy = GET_CXY( xhtab_xp );
     
    154150        uint32_t index = xhtab_ptr->index( key );
    155151
    156 printk("\n                @@@ xhtab_insert : 1 / name = %s / index = %d\n",
    157        key , index );
    158 
    159152    // take the lock protecting hash table
    160153    remote_rwlock_wr_lock( XPTR( xhtab_cxy , &xhtab_ptr->lock ) );
     
    168161        remote_rwlock_wr_unlock( XPTR( xhtab_cxy , &xhtab_ptr->lock ) );
    169162
    170 printk("\n                @@@ xhtab_insert : 2 / name = %s / item_xp = %l\n",
    171        key , item_xp );
    172 
    173163        return EINVAL;
    174164    }
     
    183173        // release the lock protecting hash table
    184174        remote_rwlock_wr_unlock( XPTR( xhtab_cxy , &xhtab_ptr->lock ) );
    185 
    186 printk("\n                @@@ xhtab_insert : 3 / name = %s / item_xp = %l\n",
    187        key , xhtab_ptr->scan( xhtab_xp , index , key ) );
    188175
    189176        return 0;
Note: See TracChangeset for help on using the changeset viewer.