Ignore:
Timestamp:
Oct 4, 2018, 11:47:36 PM (6 years ago)
Author:
alain
Message:

Complete restructuration of kernel locks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/dqdt.c

    r562 r564  
    4040extern chdev_directory_t  chdev_dir;  // defined in chdev.h / allocated in kernel_init.c
    4141
    42 
     42/*
    4343///////////////////////////////////////////////////////////////////////////////////////////
    4444// This static recursive function traverse the DQDT quad-tree from root to bottom.
     
    6565    }
    6666}
    67 
    68 ///////////////////
     67*/
     68
     69/////////////////////////
    6970void dqdt_display( void )
    7071{
    71     /*
    72     reg_t   save_sr;
    73 
     72    return;
     73
     74/*
    7475    // build extended pointer on DQDT root node
    7576        cluster_t * cluster = LOCAL_CLUSTER;
     
    8283    chdev_t * txt0_ptr = GET_PTR( txt0_xp );
    8384
    84     // get extended pointer on remote TXT0 chdev lock
     85    // get extended pointer on remote TXT0 lock
    8586    xptr_t  lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock );
    8687
    87     // get TXT0 lock in busy waiting mode
    88     remote_spinlock_lock_busy( lock_xp , &save_sr );
     88    // get TXT0 lock
     89    remote_busylock_acquire( lock_xp );
    8990
    9091    // print header
     
    9596
    9697    // release lock
    97     remote_spinlock_unlock_busy( lock_xp , save_sr );
    98     */
     98    remote_busylock_release( lock_xp );
     99*/
     100
    99101}
    100102
    101103////////////////////////////////////
    102104uint32_t dqdt_init( uint32_t x_size,
    103                     uint32_t y_size,
    104                     uint32_t y_width )
     105                    uint32_t y_size )
    105106{
    106107    assert( ((x_size <= 32) && (y_size <= 32)) , "illegal mesh size\n");
    107 
     108 
     109    // compute level_max
     110    uint32_t  x_size_ext = POW2_ROUNDUP( x_size );
     111    uint32_t  y_size_ext = POW2_ROUNDUP( y_size );
     112    uint32_t  size_ext   = MAX(x_size_ext , y_size_ext);
     113    uint32_t  level_max  = (bits_log2(size_ext * size_ext) >> 1) + 1;
     114
     115return level_max;
     116
     117/*
    108118        dqdt_node_t * node;
    109119    cxy_t         p_cxy;         // cluster coordinates for parent node
     
    114124    cluster_t   * cluster;       // pointer on local cluster
    115125
    116     cluster = LOCAL_CLUSTER;
    117 
    118     // compute level_max
    119     uint32_t  x_size_ext = POW2_ROUNDUP( x_size );
    120     uint32_t  y_size_ext = POW2_ROUNDUP( y_size );
    121     uint32_t  size_ext   = MAX(x_size_ext , y_size_ext);
    122     uint32_t  level_max  = (bits_log2(size_ext * size_ext) >> 1) + 1;
    123 
    124     return level_max;
    125 
    126     /*
     126    cluster_t   * cluster = LOCAL_CLUSTER;
     127
    127128    // get cluster coordinates
    128     uint32_t    x       = local_cxy >> y_width;
    129     uint32_t    y       = local_cxy & ((1<<y_width)-1);
     129    uint32_t    x       = HAL_X_FROM_CXY( local_cxy );
     130    uint32_t    y       = HAL_Y_FROM_CXY( local_cxy );
    130131
    131132    // loop on local dqdt nodes (at most one node per level)
     
    154155        {
    155156            // set parent extended pointer
    156             p_cxy = ((x & ~pmask)<<y_width) + (y & ~pmask);
     157            p_cxy = HAL_CXY_FROM_XY( (x & ~pmask) , (y & ~pmask) );
    157158            node->parent = XPTR( p_cxy , &cluster->dqdt_tbl[level+1] );
    158159
     
    168169            if ( (level > 0) && ((y + (1<<(level-1))) < y_size) )
    169170            {
    170                 c_cxy = local_cxy + (1<<(level-1));
     171                c_cxy = local_cxy + HAL_CXY_FROM_XY( 0 , (1<<(level-1) );
    171172                node->children[1] = XPTR( c_cxy , &cluster->dqdt_tbl[level-1] );
    172173                node->arity++;
     
    176177            if ( (level > 0) && ((x + (1<<(level-1))) < x_size) )
    177178            {
    178                 c_cxy = local_cxy + ((1<<(level-1))<<y_width);
     179                c_cxy = local_cxy + HAL_CXY_FROM_XY( (1<<(level-1)) , 0 );
    179180                node->children[2] = XPTR( c_cxy , &cluster->dqdt_tbl[level-1]);
    180181                node->arity++;
     
    186187                 ((y + (1<<(level-1))) < y_size) )
    187188            {
    188                 c_cxy = local_cxy + ((1<<(level-1))<<y_width) + (1<<(level-1));
     189                c_cxy = local_cxy + HAL_CXY_FROM_XY( (1<<(level-1)) , (1<<(level-1) );
    189190                node->children[3] = XPTR( c_cxy , &cluster->dqdt_tbl[level-1]);
    190191                node->arity++;
     
    194195
    195196    return level_max;
    196     */
     197*/
    197198
    198199} // end dqdt_init()
    199200
     201/*
    200202///////////////////////////////////////////////////////////////////////////
    201203// This recursive function is called by the dqdt_update_threads() function.
     
    216218
    217219    // get extended pointer on parent node
    218     xptr_t parent = (xptr_t)hal_remote_lwd( XPTR( cxy , &ptr->parent ) );
     220    xptr_t parent = (xptr_t)hal_remote_l64( XPTR( cxy , &ptr->parent ) );
    219221
    220222    // propagate if required
    221223    if ( parent != XPTR_NULL ) dqdt_propagate_threads( parent, increment );
    222224}
    223 
     225*/
     226
     227/*
    224228///////////////////////////////////////////////////////////////////////////
    225229// This recursive function is called by the dqdt_update_pages() function.
     
    240244
    241245    // get extended pointer on parent node
    242     xptr_t parent = (xptr_t)hal_remote_lwd( XPTR( cxy , &ptr->parent ) );
     246    xptr_t parent = (xptr_t)hal_remote_l64( XPTR( cxy , &ptr->parent ) );
    243247
    244248    // propagate if required
    245249    if ( parent != XPTR_NULL ) dqdt_propagate_pages( parent, increment );
    246250}
     251*/
    247252
    248253/////////////////////////////////////////////
    249 void dqdt_update_threads( int32_t increment )
    250 {
    251     return;
    252     /*
     254void dqdt_update_threads( int32_t increment __attribute__ ((__unused__)) )
     255{
     256
     257return;
     258
     259/*
    253260        cluster_t   * cluster = LOCAL_CLUSTER;
    254261    dqdt_node_t * node    = &cluster->dqdt_tbl[0];
     
    259266    // propagate to DQDT upper levels
    260267    if( node->parent != XPTR_NULL ) dqdt_propagate_threads( node->parent , increment );
    261     */
     268*/
     269
    262270}
    263271
    264272///////////////////////////////////////////
    265 void dqdt_update_pages( int32_t increment )
    266 {
    267     return;
    268     /*
     273void dqdt_update_pages( int32_t increment  __attribute__ ((__unused__)) )
     274{
     275
     276return;
     277
     278/*
    269279        cluster_t   * cluster = LOCAL_CLUSTER;
    270280    dqdt_node_t * node    = &cluster->dqdt_tbl[0];
     
    275285    // propagate to DQDT upper levels
    276286    if( node->parent != XPTR_NULL ) dqdt_propagate_pages( node->parent , increment );
    277     */
    278 }
    279 
    280 
     287*/
     288
     289}
     290
     291/*
    281292////////////////////////////////////////////////////////////////////////////////
    282293// This recursive function is called by both the dqdt_get_cluster_for_process()
     
    313324            cxy  = (cxy_t)GET_CXY( child );
    314325            ptr  = (dqdt_node_t *)GET_PTR( child );
    315             if( for_memory ) load = hal_remote_lw( XPTR( cxy , &ptr->pages ) );
    316             else             load = hal_remote_lw( XPTR( cxy , &ptr->threads ) );
     326            if( for_memory ) load = hal_remote_l32( XPTR( cxy , &ptr->pages ) );
     327            else             load = hal_remote_l32( XPTR( cxy , &ptr->threads ) );
    317328            if( load < load_min )
    318329            {
     
    326337    return dqdt_select_cluster( node_copy.children[select], for_memory );
    327338}
    328 
    329 ////////////////////////////////////
     339*/
     340
     341//////////////////////////////////////////
    330342cxy_t dqdt_get_cluster_for_process( void )
    331343{
    332     return cluster_random_select();
    333     /*
     344
     345return cluster_random_select();
     346
     347/*
    334348    // build extended pointer on DQDT root node
    335349        cluster_t * cluster = LOCAL_CLUSTER;
     
    339353    // call recursive function
    340354    return dqdt_select_cluster( root_xp , false );
    341     */
    342 }
    343 
    344 ////////////////////////////////////
     355*/
     356
     357}
     358
     359/////////////////////////////////////////
    345360cxy_t dqdt_get_cluster_for_memory( void )
    346361{
    347     return cluster_random_select();
    348     /*
     362
     363return cluster_random_select();
     364 
     365/*
    349366    // build extended pointer on DQDT root node
    350367        cluster_t * cluster = LOCAL_CLUSTER;
     
    354371    // call recursive function
    355372    return dqdt_select_cluster( root_xp , true );
    356     */
    357 }
    358 
     373*/
     374
     375}
     376
Note: See TracChangeset for help on using the changeset viewer.