Changeset 634 for trunk/kernel/mm/ppm.c
- Timestamp:
- May 29, 2019, 3:26:44 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/ppm.c
r632 r634 42 42 43 43 //////////////////////////////////////////////////////////////////////////////////////// 44 // global variables 45 //////////////////////////////////////////////////////////////////////////////////////// 46 47 extern chdev_directory_t chdev_dir; // allocated in kernel_init.c 48 49 //////////////////////////////////////////////////////////////////////////////////////// 44 50 // functions to translate [ page <-> base <-> ppn ] 45 51 //////////////////////////////////////////////////////////////////////////////////////// 46 47 52 48 53 ///////////////////////////////////////////// … … 212 217 if( DEBUG_PPM_ALLOC_PAGES < cycle ) 213 218 printk("\n[%s] thread[%x,%x] enter for %d page(s) in cluster %x / cycle %d\n", 214 __FUNCTION__, this->process->pid, this->trdid, 1<<order, cxy, cycle );219 __FUNCTION__, this->process->pid, this->trdid, 1<<order, local_cxy, cycle ); 215 220 #endif 216 221 … … 266 271 if( DEBUG_PPM_ALLOC_PAGES < cycle ) 267 272 printk("\n[%s] thread[%x,%x] cannot allocate %d page(s) in cluster %x / cycle %d\n", 268 __FUNCTION__, this->process->pid, this->trdid, 1<<order, cxy, cycle );273 __FUNCTION__, this->process->pid, this->trdid, 1<<order, local_cxy, cycle ); 269 274 #endif 270 275 … … 307 312 printk("\n[%s] thread[%x,%x] exit for %d page(s) in cluster %x / ppn = %x / cycle %d\n", 308 313 __FUNCTION__, this->process->pid, this->trdid, 309 1<<order, ppm_page2ppn(XPTR( local_cxy , found_block )), cxy, cycle );314 1<<order, ppm_page2ppn(XPTR( local_cxy , found_block )), local_cxy, cycle ); 310 315 #endif 311 316 … … 377 382 page_t * found_block; 378 383 379 #if DEBUG_PPM_ ALLOC_PAGES384 #if DEBUG_PPM_REMOTE_ALLOC_PAGES 380 385 thread_t * this = CURRENT_THREAD; 381 386 uint32_t cycle = (uint32_t)hal_get_cycles(); 382 if( DEBUG_PPM_ ALLOC_PAGES < cycle )387 if( DEBUG_PPM_REMOTE_ALLOC_PAGES < cycle ) 383 388 printk("\n[%s] thread[%x,%x] enter for %d small page(s) in cluster %x / cycle %d\n", 384 389 __FUNCTION__, this->process->pid, this->trdid, 1<<order, cxy, cycle ); 385 390 #endif 386 391 387 #if(DEBUG_PPM_ ALLOC_PAGES & 0x1)388 if( DEBUG_PPM_ ALLOC_PAGES < cycle )392 #if(DEBUG_PPM_REMOTE_ALLOC_PAGES & 0x1) 393 if( DEBUG_PPM_REMOTE_ALLOC_PAGES < cycle ) 389 394 ppm_remote_display( cxy ); 390 395 #endif … … 436 441 remote_busylock_release( lock_xp ); 437 442 438 #if DEBUG_ PPM_ALLOC_PAGES443 #if DEBUG_REMOTE_PPM_ALLOC_PAGES 439 444 cycle = (uint32_t)hal_get_cycles(); 440 if( DEBUG_PPM_ ALLOC_PAGES < cycle )445 if( DEBUG_PPM_REMOTE_ALLOC_PAGES < cycle ) 441 446 printk("\n[%s] thread[%x,%x] cannot allocate %d page(s) in cluster %x / cycle %d\n", 442 447 __FUNCTION__, this->process->pid, this->trdid, 1<<order, cxy, cycle ); … … 468 473 } 469 474 470 // update refcount, flags and order fields in found block remote page descriptor475 // update refcount, flags and order fields in found block 471 476 page_remote_clear_flag( XPTR( cxy , found_block ), PG_FREE ); 472 477 page_remote_refcount_up( XPTR( cxy , found_block ) ); … … 479 484 dqdt_increment_pages( cxy , order ); 480 485 481 #if DEBUG_PPM_ ALLOC_PAGES486 #if DEBUG_PPM_REMOTE_ALLOC_PAGES 482 487 cycle = (uint32_t)hal_get_cycles(); 483 if( DEBUG_PPM_ ALLOC_PAGES < cycle )488 if( DEBUG_PPM_REMOTE_ALLOC_PAGES < cycle ) 484 489 printk("\n[%s] thread[%x,%x] exit for %d page(s) / ppn = %x in cluster %x / cycle %d\n", 485 490 __FUNCTION__, this->process->pid, this->trdid, … … 487 492 #endif 488 493 489 #if(DEBUG_PPM_ ALLOC_PAGES & 0x1)490 if( DEBUG_PPM_ ALLOC_PAGES < cycle )494 #if(DEBUG_PPM_REMOTE_ALLOC_PAGES & 0x1) 495 if( DEBUG_PPM_REMOTE_ALLOC_PAGES < cycle ) 491 496 ppm_remote_display( cxy ); 492 497 #endif … … 509 514 uint32_t current_order; // current (merged) block order 510 515 511 #if DEBUG_PPM_ FREE_PAGES516 #if DEBUG_PPM_REMOTE_FREE_PAGES 512 517 thread_t * this = CURRENT_THREAD; 513 518 uint32_t cycle = (uint32_t)hal_get_cycles(); 514 if( DEBUG_PPM_ FREE_PAGES < cycle )515 printk("\n[%s] thread[%x,%x] enter for %d page(s) in cluster%x / ppn %x / cycle %d\n",519 if( DEBUG_PPM_REMOTE_FREE_PAGES < cycle ) 520 printk("\n[%s] thread[%x,%x] enter for %d page(s) / cxy %x / ppn %x / cycle %d\n", 516 521 __FUNCTION__, this->process->pid, this->trdid, 517 522 1<<page->order, cxy, ppm_page2ppn(XPTR(cxy , page)), cycle ); 518 523 #endif 519 524 520 #if(DEBUG_PPM_ FREE_PAGES & 0x1)521 if( DEBUG_PPM_ FREE_PAGES < cycle )525 #if(DEBUG_PPM_REMOTE_FREE_PAGES & 0x1) 526 if( DEBUG_PPM_REMOTE_FREE_PAGES < cycle ) 522 527 ppm_remote_display( cxy ); 523 528 #endif … … 594 599 dqdt_decrement_pages( cxy , page->order ); 595 600 596 #if DEBUG_PPM_ FREE_PAGES601 #if DEBUG_PPM_REMOTE_FREE_PAGES 597 602 cycle = (uint32_t)hal_get_cycles(); 598 if( DEBUG_PPM_ FREE_PAGES < cycle )603 if( DEBUG_PPM_REMOTE_FREE_PAGES < cycle ) 599 604 printk("\n[%s] thread[%x,%x] exit for %d page(s) in cluster %x / ppn %x / cycle %d\n", 600 605 __FUNCTION__, this->process->pid, this->trdid, … … 602 607 #endif 603 608 604 #if(DEBUG_PPM_ FREE_PAGES & 0x1)605 if( DEBUG_PPM_ FREE_PAGES < cycle )609 #if(DEBUG_PPM_REMOTE_FREE_PAGES & 0x1) 610 if( DEBUG_PPM_REMOTE_FREE_PAGES < cycle ) 606 611 ppm_remote_display( cxy ); 607 612 #endif … … 614 619 uint32_t order; 615 620 list_entry_t * iter; 616 page_t * page;621 xptr_t page_xp; 617 622 618 623 ppm_t * ppm = &LOCAL_CLUSTER->ppm; 619 624 620 625 // build extended pointer on lock protecting remote PPM 621 xptr_t lock_xp = XPTR( cxy , &ppm->free_lock ); 622 623 // get lock protecting free lists in remote cluster 624 remote_busylock_acquire( lock_xp ); 625 626 printk("\n***** PPM in cluster %x / %d pages\n", local_cxy , ppm->pages_nr ); 626 xptr_t ppm_lock_xp = XPTR( cxy , &ppm->free_lock ); 627 628 // get pointers on TXT0 chdev 629 xptr_t txt0_xp = chdev_dir.txt_tx[0]; 630 cxy_t txt0_cxy = GET_CXY( txt0_xp ); 631 chdev_t * txt0_ptr = GET_PTR( txt0_xp ); 632 633 // build extended pointer on remote TXT0 lock 634 xptr_t txt_lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 635 636 // get PPM lock 637 remote_busylock_acquire( ppm_lock_xp ); 638 639 // get TXT0 lock 640 remote_busylock_acquire( txt_lock_xp ); 641 642 nolock_printk("\n***** PPM in cluster %x / %d pages\n", local_cxy , ppm->pages_nr ); 627 643 628 644 for( order = 0 ; order < CONFIG_PPM_MAX_ORDER ; order++ ) … … 630 646 // get number of free pages for free_list[order] in remote cluster 631 647 uint32_t n = hal_remote_l32( XPTR( cxy , &ppm->free_pages_nr[order] ) ); 632 printk("- order = %d / free_pages = %d\t: ", order , n ); 648 649 nolock_printk("- order = %d / n = %d\t: ", order , n ); 633 650 634 651 LIST_REMOTE_FOREACH( cxy , &ppm->free_pages_root[order] , iter ) 635 652 { 636 page = LIST_ELEMENT( iter , page_t , list ); 637 printk("%x," , page - ppm->pages_tbl ); 653 // build extended pointer on page descriptor 654 page_xp = XPTR( cxy , LIST_ELEMENT( iter , page_t , list ) ); 655 656 // display PPN 657 nolock_printk("%x," , ppm_page2ppn( page_xp ) ); 638 658 } 639 659 640 printk("\n"); 641 } 642 643 // release lock protecting free lists in remote cluster 644 remote_busylock_release( lock_xp ); 660 nolock_printk("\n"); 661 } 662 663 // release TXT0 lock 664 remote_busylock_release( txt_lock_xp ); 665 666 // release PPM lock 667 remote_busylock_release( ppm_lock_xp ); 645 668 } 646 669
Note: See TracChangeset
for help on using the changeset viewer.