Changeset 564 for trunk/kernel/kern/dqdt.c
- Timestamp:
- Oct 4, 2018, 11:47:36 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/dqdt.c
r562 r564 40 40 extern chdev_directory_t chdev_dir; // defined in chdev.h / allocated in kernel_init.c 41 41 42 42 /* 43 43 /////////////////////////////////////////////////////////////////////////////////////////// 44 44 // This static recursive function traverse the DQDT quad-tree from root to bottom. … … 65 65 } 66 66 } 67 68 /////////////////// 67 */ 68 69 ///////////////////////// 69 70 void dqdt_display( void ) 70 71 { 71 /*72 reg_t save_sr; 73 72 return; 73 74 /* 74 75 // build extended pointer on DQDT root node 75 76 cluster_t * cluster = LOCAL_CLUSTER; … … 82 83 chdev_t * txt0_ptr = GET_PTR( txt0_xp ); 83 84 84 // get extended pointer on remote TXT0 chdevlock85 // get extended pointer on remote TXT0 lock 85 86 xptr_t lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 86 87 87 // get TXT0 lock in busy waiting mode88 remote_ spinlock_lock_busy( lock_xp , &save_sr);88 // get TXT0 lock 89 remote_busylock_acquire( lock_xp ); 89 90 90 91 // print header … … 95 96 96 97 // release lock 97 remote_spinlock_unlock_busy( lock_xp , save_sr ); 98 */ 98 remote_busylock_release( lock_xp ); 99 */ 100 99 101 } 100 102 101 103 //////////////////////////////////// 102 104 uint32_t dqdt_init( uint32_t x_size, 103 uint32_t y_size, 104 uint32_t y_width ) 105 uint32_t y_size ) 105 106 { 106 107 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 115 return level_max; 116 117 /* 108 118 dqdt_node_t * node; 109 119 cxy_t p_cxy; // cluster coordinates for parent node … … 114 124 cluster_t * cluster; // pointer on local cluster 115 125 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 127 128 // 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 ); 130 131 131 132 // loop on local dqdt nodes (at most one node per level) … … 154 155 { 155 156 // set parent extended pointer 156 p_cxy = ((x & ~pmask)<<y_width) + (y & ~pmask);157 p_cxy = HAL_CXY_FROM_XY( (x & ~pmask) , (y & ~pmask) ); 157 158 node->parent = XPTR( p_cxy , &cluster->dqdt_tbl[level+1] ); 158 159 … … 168 169 if ( (level > 0) && ((y + (1<<(level-1))) < y_size) ) 169 170 { 170 c_cxy = local_cxy + (1<<(level-1));171 c_cxy = local_cxy + HAL_CXY_FROM_XY( 0 , (1<<(level-1) ); 171 172 node->children[1] = XPTR( c_cxy , &cluster->dqdt_tbl[level-1] ); 172 173 node->arity++; … … 176 177 if ( (level > 0) && ((x + (1<<(level-1))) < x_size) ) 177 178 { 178 c_cxy = local_cxy + ((1<<(level-1))<<y_width);179 c_cxy = local_cxy + HAL_CXY_FROM_XY( (1<<(level-1)) , 0 ); 179 180 node->children[2] = XPTR( c_cxy , &cluster->dqdt_tbl[level-1]); 180 181 node->arity++; … … 186 187 ((y + (1<<(level-1))) < y_size) ) 187 188 { 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) ); 189 190 node->children[3] = XPTR( c_cxy , &cluster->dqdt_tbl[level-1]); 190 191 node->arity++; … … 194 195 195 196 return level_max; 196 197 */ 197 198 198 199 } // end dqdt_init() 199 200 201 /* 200 202 /////////////////////////////////////////////////////////////////////////// 201 203 // This recursive function is called by the dqdt_update_threads() function. … … 216 218 217 219 // get extended pointer on parent node 218 xptr_t parent = (xptr_t)hal_remote_l wd( XPTR( cxy , &ptr->parent ) );220 xptr_t parent = (xptr_t)hal_remote_l64( XPTR( cxy , &ptr->parent ) ); 219 221 220 222 // propagate if required 221 223 if ( parent != XPTR_NULL ) dqdt_propagate_threads( parent, increment ); 222 224 } 223 225 */ 226 227 /* 224 228 /////////////////////////////////////////////////////////////////////////// 225 229 // This recursive function is called by the dqdt_update_pages() function. … … 240 244 241 245 // get extended pointer on parent node 242 xptr_t parent = (xptr_t)hal_remote_l wd( XPTR( cxy , &ptr->parent ) );246 xptr_t parent = (xptr_t)hal_remote_l64( XPTR( cxy , &ptr->parent ) ); 243 247 244 248 // propagate if required 245 249 if ( parent != XPTR_NULL ) dqdt_propagate_pages( parent, increment ); 246 250 } 251 */ 247 252 248 253 ///////////////////////////////////////////// 249 void dqdt_update_threads( int32_t increment ) 250 { 251 return; 252 /* 254 void dqdt_update_threads( int32_t increment __attribute__ ((__unused__)) ) 255 { 256 257 return; 258 259 /* 253 260 cluster_t * cluster = LOCAL_CLUSTER; 254 261 dqdt_node_t * node = &cluster->dqdt_tbl[0]; … … 259 266 // propagate to DQDT upper levels 260 267 if( node->parent != XPTR_NULL ) dqdt_propagate_threads( node->parent , increment ); 261 */ 268 */ 269 262 270 } 263 271 264 272 /////////////////////////////////////////// 265 void dqdt_update_pages( int32_t increment ) 266 { 267 return; 268 /* 273 void dqdt_update_pages( int32_t increment __attribute__ ((__unused__)) ) 274 { 275 276 return; 277 278 /* 269 279 cluster_t * cluster = LOCAL_CLUSTER; 270 280 dqdt_node_t * node = &cluster->dqdt_tbl[0]; … … 275 285 // propagate to DQDT upper levels 276 286 if( node->parent != XPTR_NULL ) dqdt_propagate_pages( node->parent , increment ); 277 */ 278 } 279 280 287 */ 288 289 } 290 291 /* 281 292 //////////////////////////////////////////////////////////////////////////////// 282 293 // This recursive function is called by both the dqdt_get_cluster_for_process() … … 313 324 cxy = (cxy_t)GET_CXY( child ); 314 325 ptr = (dqdt_node_t *)GET_PTR( child ); 315 if( for_memory ) load = hal_remote_l w( XPTR( cxy , &ptr->pages ) );316 else load = hal_remote_l w( 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 ) ); 317 328 if( load < load_min ) 318 329 { … … 326 337 return dqdt_select_cluster( node_copy.children[select], for_memory ); 327 338 } 328 329 //////////////////////////////////// 339 */ 340 341 ////////////////////////////////////////// 330 342 cxy_t dqdt_get_cluster_for_process( void ) 331 343 { 332 return cluster_random_select(); 333 /* 344 345 return cluster_random_select(); 346 347 /* 334 348 // build extended pointer on DQDT root node 335 349 cluster_t * cluster = LOCAL_CLUSTER; … … 339 353 // call recursive function 340 354 return dqdt_select_cluster( root_xp , false ); 341 */ 342 } 343 344 //////////////////////////////////// 355 */ 356 357 } 358 359 ///////////////////////////////////////// 345 360 cxy_t dqdt_get_cluster_for_memory( void ) 346 361 { 347 return cluster_random_select(); 348 /* 362 363 return cluster_random_select(); 364 365 /* 349 366 // build extended pointer on DQDT root node 350 367 cluster_t * cluster = LOCAL_CLUSTER; … … 354 371 // call recursive function 355 372 return dqdt_select_cluster( root_xp , true ); 356 */ 357 } 358 373 */ 374 375 } 376
Note: See TracChangeset
for help on using the changeset viewer.