Changeset 637 for trunk/kernel/kern/cluster.c
- Timestamp:
- Jul 18, 2019, 2:06:55 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/cluster.c
r635 r637 76 76 77 77 // initialize the cluster_info[][] array 78 for (x = 0; x < CONFIG_MAX_CLUSTERS_X; x++)79 { 80 for (y = 0; y < CONFIG_MAX_CLUSTERS_Y;y++)78 for( x = 0 ; x < CONFIG_MAX_CLUSTERS_X ; x++ ) 79 { 80 for( y = 0; y < CONFIG_MAX_CLUSTERS_Y ; y++ ) 81 81 { 82 82 cluster->cluster_info[x][y] = info->cluster_info[x][y]; … … 95 95 } 96 96 97 // initialize number of cores97 // initialize number of local cores 98 98 cluster->cores_nr = info->cores_nr; 99 99 100 100 } // end cluster_info_init() 101 102 ////////////////////////////////////// 103 void cluster_info_display( cxy_t cxy ) 104 { 105 uint32_t x; 106 uint32_t y; 107 uint32_t ncores; 108 109 cluster_t * cluster = LOCAL_CLUSTER; 110 111 // get x_size & y_size from target cluster 112 uint32_t x_size = hal_remote_l32( XPTR( cxy , &cluster->x_size ) ); 113 uint32_t y_size = hal_remote_l32( XPTR( cxy , &cluster->y_size ) ); 114 115 // get pointers on TXT0 chdev 116 xptr_t txt0_xp = chdev_dir.txt_tx[0]; 117 cxy_t txt0_cxy = GET_CXY( txt0_xp ); 118 chdev_t * txt0_ptr = GET_PTR( txt0_xp ); 119 120 // get extended pointer on remote TXT0 lock 121 xptr_t lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 122 123 // get TXT0 lock 124 remote_busylock_acquire( lock_xp ); 125 126 nolock_printk("\n***** cluster_info in cluster %x / x_size %d / y_size %d\n", 127 cxy, x_size, y_size ); 128 129 for( x = 0 ; x < x_size ; x++ ) 130 { 131 for( y = 0 ; y < y_size ; y++ ) 132 { 133 ncores = (uint32_t)hal_remote_lb( XPTR( cxy , &cluster->cluster_info[x][y] ) ); 134 nolock_printk(" - ncores[%d][%d] = %d\n", x, y, ncores ); 135 } 136 } 137 138 // release TXT0 lock 139 remote_busylock_release( lock_xp ); 140 141 } // end cluster_info_display() 101 142 102 143 ///////////////////////////////////////////////////////// … … 115 156 printk("\n[%s] thread[%x,%x] enters for cluster %x / cycle %d\n", 116 157 __FUNCTION__, this->process->pid, this->trdid, local_cxy , cycle ); 158 #endif 159 160 #if (DEBUG_CLUSTER_INIT & 1) 161 cluster_info_display( local_cxy ); 117 162 #endif 118 163 … … 243 288 } 244 289 245 //////////////////////////////////////// 246 bool_t cluster_is_undefined( cxy_t cxy ) 247 { 248 uint32_t x_size = LOCAL_CLUSTER->x_size; 249 uint32_t y_size = LOCAL_CLUSTER->y_size; 250 251 uint32_t x = HAL_X_FROM_CXY( cxy ); 252 uint32_t y = HAL_Y_FROM_CXY( cxy ); 253 254 if( x >= x_size ) return true; 255 if( y >= y_size ) return true; 256 257 return false; 258 } 259 260 ////////////////////////////////////// 261 bool_t cluster_is_active ( cxy_t cxy ) 290 ///////////////////////////////////////////// 291 inline bool_t cluster_is_active ( cxy_t cxy ) 262 292 { 263 293 uint32_t x = HAL_X_FROM_CXY( cxy ); … … 271 301 //////////////////////////////////////////////////////////////////////////////////// 272 302 273 /////////////////////////////////////// 274 lid_t cluster_select_local_core( void)275 { 276 uint32_t min = 1000 ;303 ///////////////////////////////////////////// 304 lid_t cluster_select_local_core( cxy_t cxy ) 305 { 306 uint32_t min = 1000000; 277 307 lid_t sel = 0; 278 308 uint32_t nthreads; 279 309 lid_t lid; 280 310 scheduler_t * sched; 281 282 cluster_t * cluster = LOCAL_CLUSTER; 283 284 for( lid = 0 ; lid < cluster->cores_nr ; lid++ ) 285 { 286 sched = &cluster->core_tbl[lid].scheduler; 287 nthreads = sched->u_threads_nr + sched->k_threads_nr; 311 cluster_t * cluster = LOCAL_CLUSTER; 312 uint32_t ncores = hal_remote_l32( XPTR( cxy , &cluster->cores_nr ) ); 313 314 for( lid = 0 ; lid < ncores ; lid++ ) 315 { 316 sched = &cluster->core_tbl[lid].scheduler; 317 318 nthreads = hal_remote_l32( XPTR( cxy , &sched->u_threads_nr ) ) + 319 hal_remote_l32( XPTR( cxy , &sched->k_threads_nr ) ); 288 320 289 321 if( nthreads < min ) … … 700 732 uint32_t pref_nr; // number of owned processes in cluster cxy 701 733 702 assert( (cluster_is_ undefined( cxy ) == false), "illegal cluster index" );734 assert( (cluster_is_active( cxy ) ), "illegal cluster index" ); 703 735 704 736 // get extended pointer on root and lock for local process list in cluster
Note: See TracChangeset
for help on using the changeset viewer.