Changeset 440 for trunk/kernel/kern/cluster.c
- Timestamp:
- May 3, 2018, 5:51:22 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/cluster.c
r438 r440 153 153 #endif 154 154 155 // initialises RPC fifo 156 local_fifo_init( &cluster->rpc_fifo ); 157 cluster->rpc_threads = 0; 155 // initialises RPC FIFOs 156 for( lid = 0 ; lid < cluster->cores_nr; lid++ ) 157 { 158 local_fifo_init( &cluster->rpc_fifo[lid] ); 159 cluster->rpc_threads[lid] = 0; 160 } 158 161 159 162 #if( DEBUG_CLUSTER_INIT & 1 ) … … 221 224 lid_t cluster_select_local_core() 222 225 { 223 uint32_t min = 100; 224 lid_t sel = 0; 225 lid_t lid; 226 uint32_t min = 1000; 227 lid_t sel = 0; 228 uint32_t nthreads; 229 lid_t lid; 230 scheduler_t * sched; 226 231 227 232 cluster_t * cluster = LOCAL_CLUSTER; … … 229 234 for( lid = 0 ; lid < cluster->cores_nr ; lid++ ) 230 235 { 231 if( cluster->core_tbl[lid].usage < min ) 236 sched = &cluster->core_tbl[lid].scheduler; 237 nthreads = sched->u_threads_nr + sched->k_threads_nr; 238 239 if( nthreads < min ) 232 240 { 233 min = cluster->core_tbl[lid].usage;241 min = nthreads; 234 242 sel = lid; 235 243 } … … 323 331 bool_t found; 324 332 333 #if DEBUG_CLUSTER_PID_ALLOC 334 uint32_t cycle = (uint32_t)hal_get_cycles(); 335 if( DEBUG_CLUSTER_PID_ALLOC < cycle ) 336 printk("\n[DBG] %s : thread %x enters in cluster %x / cycle %d\n", 337 __FUNCTION__ , CURRENT_THREAD , local_cxy , cycle ); 338 #endif 339 325 340 pmgr_t * pm = &LOCAL_CLUSTER->pmgr; 326 341 … … 361 376 } 362 377 378 #if DEBUG_CLUSTER_PID_ALLOC 379 cycle = (uint32_t)hal_get_cycles(); 380 if( DEBUG_CLUSTER_PID_ALLOC < cycle ) 381 printk("\n[DBG] %s : thread %x exit in cluster %x / pid %x / cycle %d\n", 382 __FUNCTION__ , CURRENT_THREAD , local_cxy , *pid , cycle ); 383 #endif 384 363 385 } // end cluster_pid_alloc() 364 386 … … 366 388 void cluster_pid_release( pid_t pid ) 367 389 { 390 391 #if DEBUG_CLUSTER_PID_RELEASE 392 uint32_t cycle = (uint32_t)hal_get_cycles(); 393 if( DEBUG_CLUSTER_PID_RELEASE < cycle ) 394 printk("\n[DBG] %s : thread %x enters in cluster %x / pid %x / cycle %d\n", 395 __FUNCTION__ , CURRENT_THREAD , local_cxy , pid , cycle ); 396 #endif 397 368 398 cxy_t owner_cxy = CXY_FROM_PID( pid ); 369 399 lpid_t lpid = LPID_FROM_PID( pid ); … … 371 401 pmgr_t * pm = &LOCAL_CLUSTER->pmgr; 372 402 373 // check pid argument 374 assert( (lpid < CONFIG_MAX_PROCESS_PER_CLUSTER) && (owner_cxy == local_cxy) , 375 __FUNCTION__ , "illegal PID" ); 403 // check lpid 404 assert( (lpid < CONFIG_MAX_PROCESS_PER_CLUSTER), __FUNCTION__ , 405 "illegal LPID = %d" , lpid ); 406 407 // check owner cluster 408 assert( (owner_cxy == local_cxy) , __FUNCTION__ , 409 "local_cluster %x != owner_cluster %x" , local_cxy , owner_cxy ); 376 410 377 411 // get the process manager lock … … 384 418 // release the processs_manager lock 385 419 spinlock_unlock( &pm->pref_lock ); 420 421 #if DEBUG_CLUSTER_PID_RELEASE 422 cycle = (uint32_t)hal_get_cycles(); 423 if( DEBUG_CLUSTER_PID_RELEASE < cycle ) 424 printk("\n[DBG] %s : thread %x exit in cluster %x / cycle %d\n", 425 __FUNCTION__ , CURRENT_THREAD , local_cxy , cycle ); 426 #endif 386 427 387 428 } // end cluster_pid_release()
Note: See TracChangeset
for help on using the changeset viewer.