Changeset 433 for trunk/kernel/kern/cluster.c
- Timestamp:
- Feb 14, 2018, 3:40:19 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/cluster.c
r428 r433 89 89 spinlock_init( &cluster->kcm_lock ); 90 90 91 cluster_dmsg("\n[DBG] %s for cluster %x enters\n", 92 __FUNCTION__ , local_cxy ); 91 #if CONFIG_DEBUG_CLUSTER_INIT 92 uint32_t cycle = (uint32_t)hal_get_cycles(); 93 if( CONFIG_DEBUG_CLUSTER_INIT < cycle ) 94 printk("\n[DBG] %s enters for cluster %x / cycle %d\n", 95 __FUNCTION__ , local_cxy , cycle ); 96 #endif 93 97 94 98 // initialises DQDT … … 109 113 } 110 114 111 cluster_dmsg("\n[DBG] %s : PPM initialized in cluster %x at cycle %d\n", 112 __FUNCTION__ , local_cxy , hal_get_cycles() ); 115 #if CONFIG_DEBUG_CLUSTER_INIT 116 cycle = (uint32_t)hal_get_cycles(); 117 if( CONFIG_DEBUG_CLUSTER_INIT < cycle ) 118 cluster_dmsg("\n[DBG] %s : PPM initialized in cluster %x / cycle %d\n", 119 __FUNCTION__ , local_cxy , cycle ); 120 #endif 113 121 114 122 // initialises embedded KHM … … 132 140 } 133 141 134 cluster_dmsg("\n[DBG] %s : cores initialized in cluster %x at cycle %d\n", 135 __FUNCTION__ , local_cxy , hal_get_cycles() ); 142 #if CONFIG_DEBUG_CLUSTER_INIT 143 cycle = (uint32_t)hal_get_cycles(); 144 if( CONFIG_DEBUG_CLUSTER_INIT < cycle ) 145 cluster_dmsg("\n[DBG] %s : cores initialized in cluster %x / cycle %d\n", 146 __FUNCTION__ , local_cxy , cycle ); 147 #endif 136 148 137 149 // initialises RPC fifo … … 164 176 } 165 177 166 cluster_dmsg("\n[DBG] %s Process Manager initialized in cluster %x at cycle %d\n", 167 __FUNCTION__ , local_cxy , hal_get_cycles() ); 178 #if CONFIG_DEBUG_CLUSTER_INIT 179 cycle = (uint32_t)hal_get_cycles(); 180 if( CONFIG_DEBUG_CLUSTER_INIT < cycle ) 181 cluster_dmsg("\n[DBG] %s Process Manager initialized in cluster %x / cycle %d\n", 182 __FUNCTION__ , local_cxy , cycle ); 183 #endif 168 184 169 185 hal_fence(); … … 215 231 // Process related functions 216 232 //////////////////////////////////////////////////////////////////////////////////// 233 234 235 ////////////////////////////////////////////////////// 236 xptr_t cluster_get_owner_process_from_pid( pid_t pid ) 237 { 238 xptr_t root_xp; // xptr on root of list of processes in owner cluster 239 xptr_t lock_xp; // xptrr on lock protecting this list 240 xptr_t iter_xp; // iterator 241 xptr_t current_xp; // xptr on current process descriptor 242 process_t * current_ptr; // local pointer on current process 243 pid_t current_pid; // current process identifier 244 bool_t found; 245 246 cluster_t * cluster = LOCAL_CLUSTER; 247 248 // get owner cluster and lpid 249 cxy_t owner_cxy = CXY_FROM_PID( pid ); 250 251 // get lock & root of list of process in owner cluster 252 root_xp = XPTR( owner_cxy , &cluster->pmgr.local_root ); 253 lock_xp = XPTR( owner_cxy , &cluster->pmgr.local_lock ); 254 255 // take the lock protecting the list of processes 256 remote_spinlock_lock( lock_xp ); 257 258 // scan list of processes in owner cluster 259 found = false; 260 XLIST_FOREACH( root_xp , iter_xp ) 261 { 262 current_xp = XLIST_ELEMENT( iter_xp , process_t , local_list ); 263 current_ptr = GET_PTR( current_xp ); 264 current_pid = hal_remote_lw( XPTR( owner_cxy , ¤t_ptr->pid ) ); 265 266 if( current_pid == pid ) 267 { 268 found = true; 269 break; 270 } 271 } 272 273 // release the lock protecting the list of processes 274 remote_spinlock_unlock( lock_xp ); 275 276 // return extended pointer on process descriptor in owner cluster 277 if( found ) return current_xp; 278 else return XPTR_NULL; 279 } 217 280 218 281 ////////////////////////////////////////////////////////// … … 442 505 443 506 // skip one line 444 printk("\n ");507 printk("\n***** processes in cluster %x / cycle %d\n", cxy , (uint32_t)hal_get_cycles() ); 445 508 446 509 // loop on all reference processes in cluster cxy
Note: See TracChangeset
for help on using the changeset viewer.