Changeset 433 for trunk/kernel/mm/ppm.c
- Timestamp:
- Feb 14, 2018, 3:40:19 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/ppm.c
r407 r433 193 193 list_add_first( &ppm->free_pages_root[current_order] , ¤t->list ); 194 194 ppm->free_pages_nr[current_order] ++; 195 } 195 196 } // end ppm_free_pages_nolock() 196 197 197 198 //////////////////////////////////////////// … … 201 202 page_t * remaining_block; 202 203 uint32_t current_size; 204 205 #if CONFIG_DEBUG_PPM_ALLOC_PAGES 206 uint32_t cycle = (uint32_t)hal_get_cycles(); 207 if( CONFIG_DEBUG_PPM_ALLOC_PAGES < cycle ) 208 printk("\n[DBG] in %s : thread %x enter for %d page(s) / cycle %d\n", 209 __FUNCTION__ , CURRENT_THREAD , 1<<order, cycle ); 210 #endif 211 212 #if(CONFIG_DEBUG_PPM_ALLOC_PAGES & 0x1) 213 if( CONFIG_DEBUG_PPM_ALLOC_PAGES < cycle ) 214 ppm_print(); 215 #endif 203 216 204 217 ppm_t * ppm = &LOCAL_CLUSTER->ppm; … … 208 221 209 222 page_t * block = NULL; 210 211 ppm_dmsg("\n[DBG] %s : enters / order = %d\n",212 __FUNCTION__ , order );213 223 214 224 // take lock protecting free lists … … 231 241 spinlock_unlock( &ppm->free_lock ); 232 242 243 #if CONFIG_DEBUG_PPM_ALLOC_PAGES 244 cycle = (uint32_t)hal_get_cycles(); 245 if( CONFIG_DEBUG_PPM_ALLOC_PAGES < cycle ) 246 printk("\n[DBG] in %s : thread %x cannot allocate %d page(s) at cycle %d\n", 247 __FUNCTION__ , CURRENT_THREAD , 1<<order, cycle ); 248 #endif 249 233 250 return NULL; 234 251 } … … 260 277 spinlock_unlock( &ppm->free_lock ); 261 278 262 ppm_dmsg("\n[DBG] %s : base = %x / order = %d\n", 263 __FUNCTION__ , (uint32_t)ppm_page2base( block ) , order ); 279 #if CONFIG_DEBUG_PPM_ALLOC_PAGES 280 cycle = (uint32_t)hal_get_cycles(); 281 if( CONFIG_DEBUG_PPM_ALLOC_PAGES < cycle ) 282 printk("\n[DBG] in %s : thread %x exit / %d page(s) allocated / ppn = %x / cycle %d\n", 283 __FUNCTION__, CURRENT_THREAD, 1<<order, ppm_page2ppn(XPTR( local_cxy , block )), cycle ); 284 #endif 264 285 265 286 return block; 266 } 287 288 } // end ppm_alloc_pages() 267 289 268 290 … … 272 294 ppm_t * ppm = &LOCAL_CLUSTER->ppm; 273 295 296 #if CONFIG_DEBUG_PPM_FREE_PAGES 297 uint32_t cycle = (uint32_t)hal_get_cycles(); 298 if( CONFIG_DEBUG_PPM_FREE_PAGES < cycle ) 299 printk("\n[DBG] in %s : thread %x enter for %d page(s) / cycle %d\n", 300 __FUNCTION__ , CURRENT_THREAD , 1<<page->order , cycle ); 301 #endif 302 303 #if(CONFIG_DEBUG_PPM_FREE_PAGES & 0x1) 304 if( CONFIG_DEBUG_PPM_FREE_PAGES < cycle ) 305 ppm_print(); 306 #endif 307 274 308 // get lock protecting free_pages[] array 275 309 spinlock_lock( &ppm->free_lock ); … … 279 313 // release lock protecting free_pages[] array 280 314 spinlock_unlock( &ppm->free_lock ); 315 316 #if CONFIG_DEBUG_PPM_FREE_PAGES 317 cycle = (uint32_t)hal_get_cycles(); 318 if( CONFIG_DEBUG_PPM_FREE_PAGES < cycle ) 319 printk("\n[DBG] in %s : thread %x exit / %d page(s) released / ppn = %x / cycle %d\n", 320 __FUNCTION__, CURRENT_THREAD, 1<<page->order, ppm_page2ppn(XPTR(local_cxy , page)), cycle ); 321 #endif 322 281 323 } 282 324 283 //////////////////////////// 284 void ppm_print( ppm_t * ppm, 285 char * string ) 325 //////////////// 326 void ppm_print() 286 327 { 287 328 uint32_t order; … … 289 330 page_t * page; 290 331 332 ppm_t * ppm = &LOCAL_CLUSTER->ppm; 333 291 334 // get lock protecting free lists 292 335 spinlock_lock( &ppm->free_lock ); 293 336 294 printk("\n*** PPM in cluster %x : %d pages / &pages_tbl = %x / vaddr_base = %x ***\n", 295 local_cxy , ppm->pages_nr , (intptr_t)ppm->pages_tbl , (intptr_t)ppm->vaddr_base ); 337 printk("\n*** PPM in cluster %x : %d pages ***\n", local_cxy , ppm->pages_nr ); 296 338 297 339 for( order = 0 ; order < CONFIG_PPM_MAX_ORDER ; order++ ) 298 340 { 299 printk("- order = %d / free_pages = %d [",341 printk("- order = %d / free_pages = %d\t: ", 300 342 order , ppm->free_pages_nr[order] ); 301 343 … … 303 345 { 304 346 page = LIST_ELEMENT( iter , page_t , list ); 305 printk("% d," , page - ppm->pages_tbl );347 printk("%x," , page - ppm->pages_tbl ); 306 348 } 307 349 308 printk(" ]\n", NULL);350 printk("\n"); 309 351 } 310 352
Note: See TracChangeset
for help on using the changeset viewer.