Changeset 19 for trunk/kernel/kern/cluster.c
- Timestamp:
- Jun 3, 2017, 4:46:59 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/cluster.c
r14 r19 1 1 /* 2 2 * cluster.c - Cluster-Manager related operations 3 * 3 * 4 4 * Author Ghassan Almaless (2008,2009,2010,2011,2012) 5 5 * Mohamed Lamine Karaoui (2015) … … 68 68 69 69 // initialize cluster global parameters 70 cluster->paddr_width = info->paddr_width; 70 cluster->paddr_width = info->paddr_width; 71 71 cluster->x_width = info->x_width; 72 72 cluster->y_width = info->y_width; … … 77 77 // initialize cluster local parameters 78 78 cluster->cores_nr = info->cores_nr; 79 cluster->cores_in_kernel = info->cores_nr; 80 81 // initialize the lock protecti g the embedded kcm allocator79 cluster->cores_in_kernel = info->cores_nr; // all cpus start in kernel mode 80 81 // initialize the lock protecting the embedded kcm allocator 82 82 spinlock_init( &cluster->kcm_lock ); 83 83 84 // initialises DQDT 85 cluster->dqdt_root_level = dqdt_init( info->x_size, 86 info->y_size, 84 // initialises DQDT 85 cluster->dqdt_root_level = dqdt_init( info->x_size, 86 info->y_size, 87 87 info->y_width ); 88 88 cluster->threads_var = 0; … … 96 96 // initialises embedded KHM 97 97 khm_init( &cluster->khm ); 98 99 // initialises embedded KCM 98 99 // initialises embedded KCM 100 100 kcm_init( &cluster->kcm , KMEM_KCM ); 101 101 … … 107 107 info->core[lid].gid ); // gid from boot_info_t 108 108 } 109 109 110 110 // initialises RPC fifo 111 111 rpc_fifo_init( &cluster->rpc_fifo ); … … 114 114 spinlock_init( &cluster->pmgr.pref_lock ); 115 115 cluster->pmgr.pref_nr = 0; 116 cluster->pmgr.pref_tbl[0] = XPTR( local_cxy , &process_zero ); 116 cluster->pmgr.pref_tbl[0] = XPTR( local_cxy , &process_zero ); 117 117 for( lpid = 1 ; lpid < CONFIG_MAX_PROCESS_PER_CLUSTER ; lpid++ ) 118 118 { … … 131 131 cluster->pmgr.copies_nr[lpid] = 0; 132 132 xlist_root_init( XPTR( local_cxy , &cluster->pmgr.copies_root[lpid] ) ); 133 } 133 } 134 134 135 135 hal_wbflush(); … … 148 148 uint32_t y = cxy & ((1<<y_width)-1); 149 149 150 if( x >= cluster->x_size ) return true; 151 if( y >= cluster->y_size ) return true; 150 if( x >= cluster->x_size ) return true; 151 if( y >= cluster->y_size ) return true; 152 152 153 153 return false; … … 188 188 sel = lid; 189 189 } 190 } 190 } 191 191 return sel; 192 192 } … … 198 198 ////////////////////////////////////////////////////////// 199 199 xptr_t cluster_get_reference_process_from_pid( pid_t pid ) 200 { 200 { 201 201 xptr_t xp; // extended pointer on process descriptor 202 202 … … 207 207 lpid_t lpid = LPID_FROM_PID( pid ); 208 208 209 // Check valid PID 209 // Check valid PID 210 210 if( lpid >= CONFIG_MAX_PROCESS_PER_CLUSTER ) 211 211 { … … 215 215 216 216 if( local_cxy == owner_cxy ) // local cluster is owner cluster 217 { 217 { 218 218 xp = cluster->pmgr.pref_tbl[lpid]; 219 219 } … … 264 264 { 265 265 error = EAGAIN; 266 } 266 } 267 267 268 268 // release the processs_manager lock … … 307 307 list_entry_t * iter; 308 308 process_t * process; 309 309 310 310 LIST_FOREACH( root , iter ) 311 311 { … … 370 370 xptr_t copies_entry = XPTR( local_cxy , &process->copies_list ); 371 371 372 // get lock protecting copies_list[lpid] 372 // get lock protecting copies_list[lpid] 373 373 remote_spinlock_lock( copies_lock ); 374 374 … … 376 376 hal_remote_atomic_add( XPTR( owner_cxy , &pm->copies_nr[lpid] ) , 1 ); 377 377 378 // release lock protecting copies_list[lpid] 378 // release lock protecting copies_list[lpid] 379 379 remote_spinlock_unlock( copies_lock ); 380 380 } … … 396 396 xptr_t copies_entry = XPTR( local_cxy , &process->copies_list ); 397 397 398 // get lock protecting copies_list[lpid] 398 // get lock protecting copies_list[lpid] 399 399 remote_spinlock_lock( copies_lock ); 400 400 … … 402 402 hal_remote_atomic_add( XPTR( owner_cxy , &pm->copies_nr[lpid] ) , -1 ); 403 403 404 // release lock protecting copies_list[lpid] 404 // release lock protecting copies_list[lpid] 405 405 remote_spinlock_unlock( copies_lock ); 406 406 } … … 408 408 //////////////////////////////////////////////////////////////////////////////////////// 409 409 // TODO Il me semble que la seule chose que fait ce kernel thread à chaque réveil 410 // est de mettre à jour la DQDT, et de se rendormir... A-t-on besoin d'un thread ? [AG] 410 // est de mettre à jour la DQDT, et de se rendormir... A-t-on besoin d'un thread ? [AG] 411 411 ////////////////////////////////////////////////////////////////////////////////////////// 412 412 … … 437 437 isRootMgr = (cluster == root_home) ? true : false; 438 438 cntr = 0; 439 period = (isRootMgr) ? 440 CONFIG_DQDT_ROOTMGR_PERIOD * MSEC_PER_TICK : 439 period = (isRootMgr) ? 440 CONFIG_DQDT_ROOTMGR_PERIOD * MSEC_PER_TICK : 441 441 CONFIG_DQDT_MGR_PERIOD * MSEC_PER_TICK; 442 442 … … 444 444 event_set_priority(&event, E_CHR); 445 445 event_set_handler(&event, &manager_alarm_event_handler); 446 446 447 447 info.event = &event; 448 448 thread_preempt_disable(CURRENT_THREAD); … … 459 459 if((cntr % 10) == 0) 460 460 { 461 printk(INFO, "INFO: cpu %d, DQDT update ended [ %u - %u ]\n", 462 cpu_id, 463 tm_end, 461 printk(INFO, "INFO: cpu %d, DQDT update ended [ %u - %u ]\n", 462 cpu_id, 463 tm_end, 464 464 tm_end - tm_start); 465 465 … … 480 480 { 481 481 struct thread_s *manager; 482 482 483 483 manager = event_get_senderId(event); 484 484 485 485 thread_preempt_disable(CURRENT_THREAD); 486 486 … … 488 488 489 489 sched_wakeup(manager); 490 490 491 491 thread_preempt_enable(CURRENT_THREAD); 492 492 … … 513 513 { 514 514 ckey->val = key; 515 cluster->keys_tbl[key] = (void *) 0x1; // Reserved 515 cluster->keys_tbl[key] = (void *) 0x1; // Reserved 516 516 cluster->next_key = key; 517 517 event_set_error(event, 0);
Note: See TracChangeset
for help on using the changeset viewer.