Changeset 580 for trunk/kernel/libk


Ignore:
Timestamp:
Oct 8, 2018, 11:31:42 AM (3 years ago)
Author:
alain
Message:

1) Register the kernel process in the cluster manager local list.
2) Introduce a new service in idbg : display the set of busylocks taken by a given thread.

Location:
trunk/kernel/libk
Files:
2 edited

Legend:

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

    r563 r580  
    7777#if DEBUG_BUSYLOCK
    7878if( (lock->type != LOCK_CHDEV_TXT0) &&
    79     (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) &&
    8079    ((uint32_t)hal_get_cycles() > DEBUG_BUSYLOCK) )
    8180{
     
    8483    // update thread list of busylocks
    8584    xlist_add_last( root_xp , XPTR( local_cxy , &lock->xlist ) );
     85}
     86#endif
    8687
    87     // display list of taken locks for the selected thread
    88     thread_display_busylocks( lock->type , true );
     88#if( DEBUG_BUSYLOCK && DEBUG_BUSYLOCK_THREAD_XP )
     89if( (lock->type != LOCK_CHDEV_TXT0) &&
     90    (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) )
     91{
     92    // get cluster and local pointer of target thread
     93    cxy_t      thread_cxy = GET_CXY( DEBUG_BUSYLOCK_THREAD_XP );
     94    thread_t * thread_ptr = GET_PTR( DEBUG_BUSYLOCK_THREAD_XP );
     95
     96    // display message on kernel TXT0
     97    printk("\n### thread [%x,%x] ACQUIRE lock %s\n",
     98    thread_cxy, thread_ptr, lock_type_str[lock->type] );
    8999}
    90100#endif
     
    111121#if DEBUG_BUSYLOCK
    112122if( (lock->type != LOCK_CHDEV_TXT0) &&
    113     (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) &&
    114123    ((uint32_t)hal_get_cycles() > DEBUG_BUSYLOCK) )
    115124{
    116125    // remove lock from thread list of busylocks
    117126    xlist_unlink( XPTR( local_cxy , &lock->xlist ) );
     127}
     128#endif
    118129
    119     // display list of taken locks for the selected thread
    120     thread_display_busylocks( lock->type , false );
     130#if( DEBUG_BUSYLOCK && DEBUG_BUSYLOCK_THREAD_XP )
     131if( (lock->type != LOCK_CHDEV_TXT0) &&
     132    (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) )
     133{
     134    // get cluster and local pointer of target thread
     135    cxy_t      thread_cxy = GET_CXY( DEBUG_BUSYLOCK_THREAD_XP );
     136    thread_t * thread_ptr = GET_PTR( DEBUG_BUSYLOCK_THREAD_XP );
     137
     138    // display message on kernel TXT0
     139    printk("\n### thread [%x,%x] RELEASE lock %s\n",
     140    thread_cxy, thread_ptr, lock_type_str[lock->type] );
    121141}
    122142#endif
  • trunk/kernel/libk/remote_busylock.c

    r563 r580  
    8888uint32_t type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->type ) );
    8989if( (type != LOCK_CHDEV_TXT0) &&
    90     (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) &&
    9190    ((uint32_t)hal_get_cycles() > DEBUG_BUSYLOCK) )
    9291{
     
    9594    // update thread list of busyslocks
    9695    xlist_add_last( root_xp , XPTR( lock_cxy  , &lock_ptr->xlist ) );
     96}
     97#endif
    9798
    98     // display busylocks for the selected thread (acquire)
    99     thread_display_busylocks( type , true );
     99#if( DEBUG_BUSYLOCK && DEBUG_BUSYLOCK_THREAD_XP )
     100if( (type != LOCK_CHDEV_TXT0) &&
     101    (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) )
     102{
     103    // get cluster and local pointer of target thread
     104    cxy_t      thread_cxy = GET_CXY( DEBUG_BUSYLOCK_THREAD_XP );
     105    thread_t * thread_ptr = GET_PTR( DEBUG_BUSYLOCK_THREAD_XP );
     106
     107    // display message on kernel TXT0
     108    printk("\n### thread [%x,%x] ACQUIRE lock %s\n",
     109    thread_cxy, thread_ptr, lock_type_str[type] );
    100110}
    101111#endif
     
    132142    // remove lock from thread list of busyslocks
    133143    xlist_unlink( XPTR( lock_cxy  , &lock_ptr->xlist ) );
     144}
     145#endif
    134146
    135     // display busylocks for the selected thread (release)
    136     thread_display_busylocks( type , false );   
     147#if (DEBUG_BUSYLOCK && DEBUG_BUSYLOCK_THREAD_XP )
     148if( (type != LOCK_CHDEV_TXT0) &&
     149    (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) )
     150{
     151    // get cluster and local pointer of target thread
     152    cxy_t      thread_cxy = GET_CXY( DEBUG_BUSYLOCK_THREAD_XP );
     153    thread_t * thread_ptr = GET_PTR( DEBUG_BUSYLOCK_THREAD_XP );
     154
     155    // display message on kernel TXT0
     156    printk("\n### thread [%x,%x] RELEASE lock %s\n",
     157    thread_cxy, thread_ptr, lock_type_str[type] );
    137158}
    138159#endif
Note: See TracChangeset for help on using the changeset viewer.