Ignore:
Timestamp:
Nov 10, 2018, 5:38:51 PM (3 years ago)
Author:
alain
Message:

Cosmetic: improve debug.

File:
1 edited

Legend:

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

    r563 r600  
    11/*
    2  * remote_rwlock.c - kernel remote rwlock implementation.
     2 * remote_rwlock.c - kernel remote read/write lock implementation.
    33 *
    44 * Authors    Alain   Greiner (2016,2017,2018)
     
    6666    cxy_t             lock_cxy = GET_CXY( lock_xp );
    6767
     68#if DEBUG_RWLOCK
     69uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
     70#endif
     71
    6872    // build useful extended pointers
    6973    xptr_t busylock_xp = XPTR( lock_cxy , &lock_ptr->lock );
     
    8185#if DEBUG_RWLOCK
    8286if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
    83 {
    84     uint32_t   type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
    85     printk("\n[DBG] %s : thread %x (%s) READ BLOCK on rwlock %s [%x,%x] / cycle %d\n",
    86     __FUNCTION__, this->trdid, thread_type_str(this->type),
    87     lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
    88 }
     87printk("\n[%s] thread[%x,%x] READ BLOCK on rwlock %s [%x,%x]\n",
     88__FUNCTION__, this->process->pid, this->trdid,
     89lock_type_str[lock_type], lock_cxy, lock_ptr );
    8990#endif
    9091        // get pointer on calling thread
     
    109110#if DEBUG_RWLOCK
    110111if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
    111 {
    112     uint32_t   type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
    113     printk("\n[DBG] %s : thread %x (%s) READ ACQUIRE on rwlock %s [%x,%x] / cycle %d\n",
    114     __FUNCTION__, this->trdid, thread_type_str(this->type),
    115     lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
    116 }
     112printk("\n[%s] thread[%x,%x] READ ACQUIRE rwlock %s [%x,%x]\n",
     113__FUNCTION__, this->process->pid, this->trdid,
     114lock_type_str[lock_type], lock_cxy, lock_ptr );
    117115#endif
    118116
     
    136134    remote_rwlock_t * lock_ptr = GET_PTR( lock_xp );
    137135    cxy_t             lock_cxy = GET_CXY( lock_xp );
     136
     137#if DEBUG_RWLOCK
     138uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
     139#endif
    138140
    139141    // build useful extended pointers
     
    152154#if DEBUG_RWLOCK
    153155if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
    154 {
    155     uint32_t   type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
    156     printk("\n[DBG] %s : thread %x (%s) WRITE BLOCK on rwlock %s [%x,%x] / cycle %d\n",
    157     __FUNCTION__, this->trdid, thread_type_str(this->type),
    158     lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
    159 }
     156printk("\n[%s] thread[%x,%x] WRITE BLOCK on rwlock %s [%x,%x]\n",
     157__FUNCTION__, this->process->pid, this->trdid,
     158lock_type_str[lock_type], lock_cxy, lock_ptr );
    160159#endif
    161160        // get local pointer on calling thread
     
    180179#if DEBUG_RWLOCK
    181180if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
    182 {
    183     uint32_t   type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
    184     printk("\n[DBG] %s : thread %x (%s) WRITE ACQUIRE on rwlock %s [%x,%x] / cycle %d\n",
    185     __FUNCTION__, this->trdid, thread_type_str(this->type),
    186     lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
    187 }
     181printk("\n[%s] thread[%x,%x] WRITE ACQUIRE rwlock %s [%x,%x]\n",
     182__FUNCTION__, this->process->pid, this->trdid,
     183lock_type_str[lock_type], lock_cxy, lock_ptr );
    188184#endif
    189185
     
    217213
    218214#if DEBUG_RWLOCK
    219 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
    220 {
    221     thread_t * this = CURRENT_THREAD;
    222     uint32_t   type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
    223     printk("\n[DBG] %s : thread %x (%s) READ RELEASE on rwlock %s [%x,%x] / cycle %d\n",
    224     __FUNCTION__, this->trdid, thread_type_str(this->type),
    225     lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
    226 }
     215thread_t * this      = CURRENT_THREAD;
     216uint32_t   lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
     217if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     218printk("\n[%s] thread[%x,%x] READ RELEASE rwlock %s [%x,%x]\n",
     219__FUNCTION__, this->process->pid, this->trdid,
     220lock_type_str[lock_type], lock_cxy, lock_ptr );
    227221#endif
    228222
     
    248242if( (uint32_t)hal_get_cycles() > DEBUG_RWLOCK )
    249243{
    250     thread_t  * this        = CURRENT_THREAD;
    251     uint32_t    lock_type   = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
    252     trdid_t     trdid       = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
    253     uint32_t    thread_type = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->type ) );
    254     printk("\n[DBG] %s : thread %x (%s) UNBLOCK thread %x (%s)"
    255     " / rwlock %s [%x,%x] / cycle %d\n",
    256     __FUNCTION__, this->trdid, thread_type_str(this->type), trdid, thread_type_str(thread_type),
    257     lock_type_str[lock_type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
     244    trdid_t     trdid     = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
     245    process_t * process   = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) );
     246    uint32_t    pid       = hal_remote_l32( XPTR( thread_cxy , &process->pid ) );
     247    printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
     248    __FUNCTION__, this->process->pid, this->trdid, pid, trdid,
     249    lock_type_str[lock_type], lock_cxy, lock_ptr );
    258250}
    259251#endif
     
    281273if( (uint32_t)hal_get_cycles() > DEBUG_RWLOCK )
    282274{
    283     thread_t  * this        = CURRENT_THREAD;
    284     uint32_t    lock_type   = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
    285     trdid_t     trdid       = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
    286     uint32_t    thread_type = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->type ) );
    287     printk("\n[DBG] %s : thread %x (%s) UNBLOCK thread %x (%s)"
    288     " / rwlock %s [%x,%x] / cycle %d\n",
    289     __FUNCTION__, this->trdid, thread_type_str(this->type), trdid, thread_type_str(thread_type),
    290     lock_type_str[lock_type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
     275    trdid_t     trdid     = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
     276    process_t * process   = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) );
     277    uint32_t    pid       = hal_remote_l32( XPTR( thread_cxy , &process->pid ) );
     278    printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
     279    __FUNCTION__, this->process->pid, this->trdid, pid, trdid,
     280    lock_type_str[lock_type], lock_cxy, lock_ptr );
    291281}
    292282#endif
     
    320310
    321311#if DEBUG_RWLOCK
    322 if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
    323 {
    324     thread_t * this = CURRENT_THREAD;
    325     uint32_t   type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
    326     printk("\n[DBG] %s : thread %x (%s) WRITE RELEASE on rwlock %s [%x,%x] / cycle %d\n",
    327     __FUNCTION__, this->trdid, thread_type_str(this->type),
    328     lock_type_str[type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
    329 }
     312thread_t * this      = CURRENT_THREAD;
     313uint32_t   lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
     314if( DEBUG_RWLOCK < (uint32_t)hal_get_cycles() )
     315printk("\n[%s] thread[%x,%x] WRITE RELEASE rwlock %s [%x,%x]\n",
     316__FUNCTION__, this->process->pid, this->trdid,
     317lock_type_str[lock_type], lock_cxy, lock_ptr );
    330318#endif
    331319
     
    350338if( (uint32_t)hal_get_cycles() > DEBUG_RWLOCK )
    351339{
    352     thread_t  * this        = CURRENT_THREAD;
    353     uint32_t    lock_type   = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
    354     trdid_t     trdid       = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
    355     uint32_t    thread_type = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->type ) );
    356     printk("\n[DBG] %s : thread %x (%s) UNBLOCK thread %x (%s)"
    357     " / rwlock %s [%x,%x] / cycle %d\n",
    358     __FUNCTION__, this->trdid, thread_type_str(this->type), trdid, thread_type_str(thread_type),
    359     lock_type_str[lock_type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
     340    trdid_t     trdid     = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
     341    process_t * process   = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) );
     342    uint32_t    pid       = hal_remote_l32( XPTR( thread_cxy , &process->pid ) );
     343    printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
     344    __FUNCTION__, this->process->pid, this->trdid, pid, trdid,
     345    lock_type_str[lock_type], lock_cxy, lock_ptr );
    360346}
    361347#endif
     
    382368if( (uint32_t)hal_get_cycles() > DEBUG_RWLOCK )
    383369{
    384     thread_t  * this        = CURRENT_THREAD;
    385     uint32_t    lock_type   = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
    386     trdid_t     trdid       = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
    387     uint32_t    thread_type = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->type ) );
    388     printk("\n[DBG] %s : thread %x (%s) UNBLOCK thread %x (%s)"
    389     " / rwlock %s [%x,%x] / cycle %d\n",
    390     __FUNCTION__, this->trdid, thread_type_str(this->type), trdid, thread_type_str(thread_type),
    391     lock_type_str[lock_type], lock_cxy, lock_ptr, (uint32_t)hal_get_cycles() );
     370    trdid_t     trdid     = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
     371    process_t * process   = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) );
     372    uint32_t    pid       = hal_remote_l32( XPTR( thread_cxy , &process->pid ) );
     373    printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
     374    __FUNCTION__, this->process->pid, this->trdid, pid, trdid,
     375    lock_type_str[lock_type], lock_cxy, lock_ptr );
    392376}
    393377#endif
Note: See TracChangeset for help on using the changeset viewer.