Changeset 435 for trunk/kernel/mm/mapper.c
- Timestamp:
- Feb 20, 2018, 5:32:17 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/mapper.c
r408 r435 143 143 error_t error; 144 144 145 mapper_dmsg("\n[DBG] %s : core[%x,%d] enters for page %d / mapper %x\n", 146 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , index , mapper ); 145 #if CONFIG_DEBUG_MAPPER_GET_PAGE 146 uint32_t cycle = (uint32_t)hal_get_cycles(); 147 if( CONFIG_DEBUG_MAPPER_GET_PAGE < cycle ) 148 printk("\n[DBG] %s : thread %x enter for page %d / mapper %x / cycle %d\n", 149 __FUNCTION__ , CURRENT_THREAD , index , mapper , cycle ); 150 #endif 147 151 148 152 thread_t * this = CURRENT_THREAD; … … 171 175 { 172 176 173 mapper_dmsg("\n[DBG] %s : core[%x,%d] missing page => load from device\n", 174 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid ); 175 177 #if (CONFIG_DEBUG_MAPPER_GET_PAGE & 1) 178 if( CONFIG_DEBUG_MAPPER_GET_PAGE < cycle ) 179 printk("\n[DBG] %s : missing page => load from device\n", __FUNCTION__ ); 180 #endif 176 181 // allocate one page from PPM 177 182 req.type = KMEM_PAGE; … … 230 235 // reset the page INLOAD flag to make the page available to all readers 231 236 page_clear_flag( page , PG_INLOAD ); 232 233 mapper_dmsg("\n[DBG] %s : missing page loaded / ppn = %x\n",234 __FUNCTION__ , ppm_page2ppn(XPTR(local_cxy,page)) );235 236 237 } 237 238 else if( page_is_flag( page , PG_INLOAD ) ) // page is loaded by another thread … … 256 257 } 257 258 258 mapper_dmsg("\n[DBG] %s : exit for page %d / mapper %x / page_desc = %x\n", 259 __FUNCTION__ , index , mapper , page ); 259 #if CONFIG_DEBUG_MAPPER_GET_PAGE 260 cycle = (uint32_t)hal_get_cycles(); 261 if( CONFIG_DEBUG_MAPPER_GET_PAGE < cycle ) 262 printk("\n[DBG] %s : thread %x exit for page %d / ppn %x / cycle %d\n", 263 __FUNCTION__, CURRENT_THREAD, index, ppm_page2ppn(XPTR(local_cxy, page)), cycle ); 264 #endif 260 265 261 266 return page; … … 312 317 uint8_t * buf_ptr; // current buffer address 313 318 314 mapper_dmsg("\n[DBG] %s : enters / to_buf = %d / buffer = %x\n", 315 __FUNCTION__ , to_buffer , buffer ); 319 #if CONFIG_DEBUG_MAPPER_MOVE_USER 320 uint32_t cycle = (uint32_t)hal_get_cycles(); 321 if( CONFIG_DEBUG_MAPPER_MOVE_USER < cycle ) 322 printk("\n[DBG] %s : thread %x enter / to_buf %d / buffer %x / cycle %d\n", 323 __FUNCTION__ , CURRENT_THREAD , to_buffer , buffer , cycle ); 324 #endif 316 325 317 326 // compute offsets of first and last bytes in file … … 338 347 else page_count = CONFIG_PPM_PAGE_SIZE; 339 348 340 mapper_dmsg("\n[DBG] %s : index = %d / offset = %d / count = %d\n", 341 __FUNCTION__ , index , page_offset , page_count ); 349 #if (CONFIG_DEBUG_MAPPER_MOVE_USER & 1) 350 if( CONFIG_DEBUG_MAPPER_MOVE_USER < cycle ) 351 printk("\n[DBG] %s : index = %d / offset = %d / count = %d\n", 352 __FUNCTION__ , index , page_offset , page_count ); 353 #endif 342 354 343 355 // get page descriptor … … 353 365 buf_ptr = (uint8_t *)buffer + done; 354 366 355 mapper_dmsg("\n[DBG] %s : index = %d / buf_ptr = %x / map_ptr = %x\n",356 __FUNCTION__ , index , buf_ptr , map_ptr );357 358 367 // move fragment 359 368 if( to_buffer ) … … 370 379 } 371 380 372 mapper_dmsg("\n[DBG] %s : exit for buffer %x\n", 373 __FUNCTION__, buffer ); 381 #if CONFIG_DEBUG_MAPPER_MOVE_USER 382 cycle = (uint32_t)hal_get_cycles(); 383 if( CONFIG_DEBUG_MAPPER_MOVE_USER < cycle ) 384 printk("\n[DBG] %s : thread %x exit / to_buf %d / buffer %x / cycle %d\n", 385 __FUNCTION__ , CURRENT_THREAD , to_buffer , buffer , cycle ); 386 #endif 374 387 375 388 return 0; … … 399 412 uint8_t * buffer_ptr = (uint8_t *)GET_PTR( buffer_xp ); 400 413 401 mapper_dmsg("\n[DBG] %s : core[%x,%d] / to_buf = %d / buf_cxy = %x / buf_ptr = %x / size = %x\n", 402 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, to_buffer, buffer_cxy, buffer_ptr, size ); 414 #if CONFIG_DEBUG_MAPPER_MOVE_KERNEL 415 uint32_t cycle = (uint32_t)hal_get_cycles(); 416 if( CONFIG_DEBUG_MAPPER_MOVE_KERNEL < cycle ) 417 printk("\n[DBG] %s : thread %x enter / to_buf %d / buf_cxy %x / buf_ptr %x / cycle %d\n", 418 __FUNCTION__ , CURRENT_THREAD , to_buffer , buffer_cxy , buffer_ptr , cycle ); 419 #endif 403 420 404 421 // compute offsets of first and last bytes in file … … 410 427 uint32_t last = max_byte >> CONFIG_PPM_PAGE_SHIFT; 411 428 412 mapper_dmsg("\n[DBG] %s : core[%x,%d] / first_page = %d / last_page = %d\n", 413 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, first, last ); 429 #if (CONFIG_DEBUG_MAPPER_MOVE_KERNEL & 1) 430 if( CONFIG_DEBUG_MAPPER_MOVE_KERNEL < cycle ) 431 printk("\n[DBG] %s : first_page %d / last_page %d\n", __FUNCTION__, first, last ); 432 #endif 414 433 415 434 // compute source and destination clusters … … 440 459 else page_count = CONFIG_PPM_PAGE_SIZE; 441 460 442 mapper_dmsg("\n[DBG] %s : core[%x;%d] / page_index = %d / offset = %d / bytes = %d\n", 443 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, index, page_offset, page_count ); 461 #if (CONFIG_DEBUG_MAPPER_MOVE_KERNEL & 1) 462 if( CONFIG_DEBUG_MAPPER_MOVE_KERNEL < cycle ) 463 printk("\n[DBG] %s : page_index = %d / offset = %d / bytes = %d\n", 464 __FUNCTION__ , index , page_offset , page_count ); 465 #endif 444 466 445 467 // get page descriptor … … 472 494 } 473 495 474 mapper_dmsg("\n[DBG] %s : core_cxy[%x,%d] / exit / buf_cxy = %x / buf_ptr = %x / size = %x\n", 475 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, buffer_cxy, buffer_ptr, size ); 496 #if CONFIG_DEBUG_MAPPER_MOVE_KERNEL 497 cycle = (uint32_t)hal_get_cycles(); 498 if( CONFIG_DEBUG_MAPPER_MOVE_KERNEL < cycle ) 499 printk("\n[DBG] %s : thread %x exit / to_buf %d / buf_cxy %x / buf_ptr %x / cycle %d\n", 500 __FUNCTION__ , CURRENT_THREAD , to_buffer , buffer_cxy , buffer_ptr , cycle ); 501 #endif 476 502 477 503 return 0;
Note: See TracChangeset
for help on using the changeset viewer.