Changeset 635 for trunk/kernel/mm/vmm.c
- Timestamp:
- Jun 26, 2019, 11:42:37 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/vmm.c
r634 r635 49 49 #include <hal_exception.h> 50 50 51 ////////////////////////////////////////////////////////////////////////////////// 51 //////////////////////////////////////////////////////////////////////////////////////////// 52 52 // Extern global variables 53 ////////////////////////////////////////////////////////////////////////////////// 53 //////////////////////////////////////////////////////////////////////////////////////////// 54 54 55 55 extern process_t process_zero; // allocated in cluster.c … … 286 286 } // end vmm_detach_from_vsl() 287 287 288 289 290 291 288 //////////////////////////////////////////// 292 289 error_t vmm_user_init( process_t * process ) 293 290 { 294 vseg_t * vseg_args;295 vseg_t * vseg_envs;296 intptr_t base;297 intptr_t size;298 291 uint32_t i; 299 292 … … 319 312 "STACK zone too small\n"); 320 313 314 // initialize the lock protecting the VSL 315 remote_rwlock_init( XPTR( local_cxy , &vmm->vsl_lock ) , LOCK_VMM_VSL ); 316 317 318 /* 321 319 // register "args" vseg in VSL 322 320 base = CONFIG_VMM_UTILS_BASE << CONFIG_PPM_PAGE_SHIFT; … … 358 356 359 357 vmm->envs_vpn_base = base; 360 358 */ 361 359 // initialize STACK allocator 362 360 vmm->stack_mgr.bitmap = 0; … … 375 373 376 374 // initialize instrumentation counters 377 vmm->pgfault_nr = 0; 375 vmm->false_pgfault_nr = 0; 376 vmm->local_pgfault_nr = 0; 377 vmm->global_pgfault_nr = 0; 378 vmm->false_pgfault_cost = 0; 379 vmm->local_pgfault_cost = 0; 380 vmm->global_pgfault_cost = 0; 378 381 379 382 hal_fence(); … … 398 401 399 402 #if DEBUG_VMM_USER_RESET 400 uint32_t cycle = (uint32_t)hal_get_cycles();403 uint32_t cycle; 401 404 thread_t * this = CURRENT_THREAD; 405 #endif 406 407 #if (DEBUG_VMM_USER_RESET & 1 ) 408 cycle = (uint32_t)hal_get_cycles(); 402 409 if( DEBUG_VMM_USER_RESET < cycle ) 403 410 printk("\n[%s] thread[%x,%x] enter for process %x in cluster %x / cycle %d\n", … … 407 414 #if (DEBUG_VMM_USER_RESET & 1 ) 408 415 if( DEBUG_VMM_USER_RESET < cycle ) 409 hal_vmm_display( process, true );416 hal_vmm_display( XPTR( local_cxy , process ) , true ); 410 417 #endif 411 418 … … 478 485 #endif 479 486 487 #if (DEBUG_VMM_USER_RESET & 1 ) 488 if( DEBUG_VMM_USER_RESET < cycle ) 489 hal_vmm_display( XPTR( local_cxy , process ) , true ); 490 #endif 491 480 492 } // end vmm_user_reset() 481 493 … … 503 515 thread_t * this = CURRENT_THREAD; 504 516 if( DEBUG_VMM_UPDATE_PTE < cycle ) 505 printk("\n[%s] thread[%x,%x] enter for process %x / vpn %x / cycle %d\n", 506 __FUNCTION__, this->process->pid, this->trdid, process->pid , vpn , cycle ); 507 #endif 508 509 // check cluster is reference 510 assert( (GET_CXY( process->ref_xp ) == local_cxy) , "not called in reference cluster\n"); 517 printk("\n[%s] thread[%x,%x] enter for process %x / vpn %x / attr %x / ppn %x / ycle %d\n", 518 __FUNCTION__, this->process->pid, this->trdid, process->pid, vpn, attr, ppn, cycle ); 519 #endif 511 520 512 521 // get extended pointer on root of process copies xlist in owner cluster … … 517 526 process_root_xp = XPTR( owner_cxy , process_root_ptr ); 518 527 528 // check local cluster is owner cluster 529 assert( (owner_cxy == local_cxy) , "must be called in owner cluster\n"); 530 519 531 // loop on destination process copies 520 532 XLIST_FOREACH( process_root_xp , process_iter_xp ) … … 525 537 remote_process_cxy = GET_CXY( remote_process_xp ); 526 538 527 #if (DEBUG_VMM_UPDATE_PTE & 0x1)539 #if (DEBUG_VMM_UPDATE_PTE & 1) 528 540 if( DEBUG_VMM_UPDATE_PTE < cycle ) 529 printk("\n[%s] thread r[%x,%x] handling vpn %x for process %x in cluster %x\n",541 printk("\n[%s] thread[%x,%x] handling vpn %x for process %x in cluster %x\n", 530 542 __FUNCTION__, this->process->pid, this->trdid, vpn, process->pid, remote_process_cxy ); 531 543 #endif … … 545 557 #endif 546 558 559 #if (DEBUG_VMM_UPDATE_PTE & 1) 560 hal_vmm_display( process , true ); 561 #endif 562 547 563 } // end vmm_global_update_pte() 548 564 … … 570 586 cxy_t owner_cxy; 571 587 lpid_t owner_lpid; 588 589 // get target process PID 590 pid = process->pid; 572 591 573 592 #if DEBUG_VMM_SET_COW … … 576 595 if( DEBUG_VMM_SET_COW < cycle ) 577 596 printk("\n[%s] thread[%x,%x] enter for process %x / cycle %d\n", 578 __FUNCTION__, this->process->pid, this->trdid, process->pid , cycle ); 597 __FUNCTION__, this->process->pid, this->trdid, pid , cycle ); 598 #endif 599 600 #if (DEBUG_VMM_SET_COW & 1) 601 if( DEBUG_VMM_SET_COW < cycle ) 602 hal_vmm_display( process , true ); 579 603 #endif 580 604 581 605 // check cluster is reference 582 assert( ( GET_CXY( process->ref_xp ) == local_cxy),583 "local cluster is notprocess reference cluster\n");606 assert( (XPTR( local_cxy , process ) == process->ref_xp), 607 "local cluster must be process reference cluster\n"); 584 608 585 609 // get pointer on reference VMM … … 587 611 588 612 // get extended pointer on root of process copies xlist in owner cluster 589 pid = process->pid;590 613 owner_cxy = CXY_FROM_PID( pid ); 591 614 owner_lpid = LPID_FROM_PID( pid ); … … 596 619 vseg_root_xp = XPTR( local_cxy , &vmm->vsegs_root ); 597 620 598 // loop on destinationprocess copies621 // loop on target process copies 599 622 XLIST_FOREACH( process_root_xp , process_iter_xp ) 600 623 { 601 // get cluster and local pointer on remote process 624 // get cluster and local pointer on remote process copy 602 625 remote_process_xp = XLIST_ELEMENT( process_iter_xp , process_t , copies_list ); 603 626 remote_process_ptr = GET_PTR( remote_process_xp ); … … 606 629 #if (DEBUG_VMM_SET_COW & 1) 607 630 if( DEBUG_VMM_SET_COW < cycle ) 608 printk("\n[%s] thread[%x,%x] handlingprocess %x in cluster %x\n",609 __FUNCTION__, this->process->pid, this->trdid, process->pid, remote_process_cxy );631 printk("\n[%s] thread[%x,%x] (%x) handles process %x in cluster %x\n", 632 __FUNCTION__, this->process->pid, this->trdid, this, pid, remote_process_cxy ); 610 633 #endif 611 634 … … 620 643 vseg = GET_PTR( vseg_xp ); 621 644 622 assert( (GET_CXY( vseg_xp ) == local_cxy) ,623 "all vsegs in reference VSL must be local\n" );624 625 645 // get vseg type, base and size 626 646 uint32_t type = vseg->type; … … 630 650 #if (DEBUG_VMM_SET_COW & 1) 631 651 if( DEBUG_VMM_SET_COW < cycle ) 632 printk("\n[%s] thread[%x,%x] handlingvseg %s / vpn_base = %x / vpn_size = %x\n",652 printk("\n[%s] thread[%x,%x] found vseg %s / vpn_base = %x / vpn_size = %x\n", 633 653 __FUNCTION__, this->process->pid, this->trdid, vseg_type_str(type), vpn_base, vpn_size ); 634 654 #endif … … 653 673 654 674 // atomically increment pending forks counter in physical pages, 655 // for all vseg pages that are mapped in reference cluster675 // this is only done once, when handling the reference copy 656 676 if( remote_process_cxy == local_cxy ) 657 677 { 678 679 #if (DEBUG_VMM_SET_COW & 1) 680 if( DEBUG_VMM_SET_COW < cycle ) 681 printk("\n[%s] thread[%x,%x] handles vseg %s / vpn_base = %x / vpn_size = %x\n", 682 __FUNCTION__, this->process->pid, this->trdid, vseg_type_str(type), vpn_base, vpn_size ); 683 #endif 658 684 // scan all pages in vseg 659 685 for( vpn = vpn_base ; vpn < (vpn_base + vpn_size) ; vpn++ ) … … 684 710 } 685 711 } // end loop on vpn 712 713 #if (DEBUG_VMM_SET_COW & 1) 714 if( DEBUG_VMM_SET_COW < cycle ) 715 printk("\n[%s] thread[%x,%x] completes vseg %s / vpn_base = %x / vpn_size = %x\n", 716 __FUNCTION__, this->process->pid, this->trdid, vseg_type_str(type), vpn_base, vpn_size ); 717 #endif 686 718 } // end if local 687 719 } // end if vseg type … … 713 745 vseg_t * child_vseg; 714 746 uint32_t type; 715 bool_t cow;716 747 vpn_t vpn; 717 748 vpn_t vpn_base; 718 749 vpn_t vpn_size; 719 xptr_t page_xp; // extended pointer on page descriptor720 page_t * page_ptr;721 cxy_t page_cxy;722 xptr_t forks_xp; // extended pointer on forks counter in page descriptor723 750 xptr_t parent_root_xp; 724 751 bool_t mapped; … … 740 767 parent_vmm = &parent_process->vmm; 741 768 child_vmm = &child_process->vmm; 742 743 // initialize the lock protecting the child VSL744 remote_rwlock_init( XPTR( local_cxy , &child_vmm->vsl_lock ) , LOCK_VMM_VSL );745 746 // initialize the child VSL as empty747 xlist_root_init( XPTR( local_cxy, &child_vmm->vsegs_root ) );748 child_vmm->vsegs_nr = 0;749 750 // create an empty child GPT751 error = hal_gpt_create( &child_vmm->gpt );752 if( error )753 {754 printk("\n[ERROR] in %s : cannot create GPT\n", __FUNCTION__ );755 return -1;756 }757 769 758 770 // build extended pointer on parent VSL root and lock … … 820 832 { 821 833 // activate the COW for DATA, ANON, REMOTE vsegs only 822 cow = ( type != VSEG_TYPE_FILE );834 // cow = ( type != VSEG_TYPE_FILE ); 823 835 824 836 vpn_base = child_vseg->vpn_base; … … 832 844 XPTR( parent_cxy , &parent_vmm->gpt ), 833 845 vpn, 834 cow,835 &ppn, 836 &mapped ); 846 false, // does not handle COW flag 847 &ppn, // unused 848 &mapped ); // unused 837 849 if( error ) 838 850 { … … 842 854 } 843 855 844 // increment pending forks counter in page if mapped845 if( mapped )846 {847 // get pointers and cluster on page descriptor848 page_xp = ppm_ppn2page( ppn );849 page_cxy = GET_CXY( page_xp );850 page_ptr = GET_PTR( page_xp );851 852 // get extended pointers on "forks" and "lock"853 forks_xp = XPTR( page_cxy , &page_ptr->forks );854 lock_xp = XPTR( page_cxy , &page_ptr->lock );855 856 // get lock protecting "forks" counter857 remote_busylock_acquire( lock_xp );858 859 // increment "forks"860 hal_remote_atomic_add( forks_xp , 1 );861 862 // release lock protecting "forks" counter863 remote_busylock_release( lock_xp );864 865 856 #if DEBUG_VMM_FORK_COPY 866 857 cycle = (uint32_t)hal_get_cycles(); … … 869 860 __FUNCTION__ , this->process->pid, this->trdid , vpn , cycle ); 870 861 #endif 871 }872 862 } 873 863 } // end if no code & no stack … … 877 867 // release the parent VSL lock in read mode 878 868 remote_rwlock_rd_release( parent_lock_xp ); 879 880 // update child VMM with kernel vsegs881 error = hal_vmm_kernel_update( child_process );882 883 if( error )884 {885 printk("\n[ERROR] in %s : cannot update child VMM\n", __FUNCTION__ );886 return -1;887 }888 869 889 870 // initialize the child VMM STACK allocator … … 902 883 903 884 // initialize instrumentation counters 904 child_vmm->pgfault_nr = 0; 885 child_vmm->false_pgfault_nr = 0; 886 child_vmm->local_pgfault_nr = 0; 887 child_vmm->global_pgfault_nr = 0; 888 child_vmm->false_pgfault_cost = 0; 889 child_vmm->local_pgfault_cost = 0; 890 child_vmm->global_pgfault_cost = 0; 905 891 906 892 // copy base addresses from parent VMM to child VMM … … 933 919 934 920 #if DEBUG_VMM_DESTROY 935 uint32_t cycle = (uint32_t)hal_get_cycles();936 thread_t * this = CURRENT_THREAD;921 uint32_t cycle = (uint32_t)hal_get_cycles(); 922 thread_t * this = CURRENT_THREAD; 937 923 if( DEBUG_VMM_DESTROY < cycle ) 938 924 printk("\n[%s] thread[%x,%x] enter for process %x in cluster %x / cycle %d\n", … … 942 928 #if (DEBUG_VMM_DESTROY & 1 ) 943 929 if( DEBUG_VMM_DESTROY < cycle ) 944 hal_vmm_display( process, true );930 hal_vmm_display( XPTR( local_cxy, process ) , true ); 945 931 #endif 946 932 … … 1062 1048 vseg_t * vmm_create_vseg( process_t * process, 1063 1049 vseg_type_t type, 1064 intptr_t base, 1050 intptr_t base, // ltid for VSEG_TYPE_STACK 1065 1051 uint32_t size, 1066 1052 uint32_t file_offset, … … 1074 1060 error_t error; 1075 1061 1076 #if DEBUG_VMM_CREATE_VSEG1062 #if (DEBUG_VMM_CREATE_VSEG & 1) 1077 1063 thread_t * this = CURRENT_THREAD; 1078 1064 uint32_t cycle = (uint32_t)hal_get_cycles(); 1079 1065 if( DEBUG_VMM_CREATE_VSEG < cycle ) 1080 printk("\n[%s] thread[%x,%x] enter for process %x / %s / cxy %x / cycle %d\n", 1081 __FUNCTION__, this->process->pid, this->trdid, process->pid, vseg_type_str(type), cxy, cycle ); 1066 printk("\n[%s] thread[%x,%x] enter / process %x / %s / base %x / cxy %x / cycle %d\n", 1067 __FUNCTION__, this->process->pid, this->trdid, 1068 process->pid, vseg_type_str(type), base, cxy, cycle ); 1082 1069 #endif 1083 1070 … … 1171 1158 } 1172 1159 1173 #if DEBUG_VMM_CREATE_VSEG1160 #if (DEBUG_VMM_CREATE_VSEG & 1) 1174 1161 if( DEBUG_VMM_CREATE_VSEG < cycle ) 1175 1162 printk("\n[%s] thread[%x,%x] : base %x / size %x / vpn_base %x / vpn_size %x\n", … … 1204 1191 cycle = (uint32_t)hal_get_cycles(); 1205 1192 if( DEBUG_VMM_CREATE_VSEG < cycle ) 1206 printk("\n[%s] thread[%x,%x] exit / %s / cxy %x / cycle %d\n", 1207 __FUNCTION__, this->process->pid, this->trdid, vseg_type_str(type), cxy, cycle ); 1193 printk("\n[%s] thread[%x,%x] exit / process %x / %s / base %x / cxy %x / cycle %d\n", 1194 __FUNCTION__, this->process->pid, this->trdid, 1195 process->pid, vseg_type_str(type), base, cxy, cycle ); 1208 1196 #endif 1209 1197 … … 1685 1673 xptr_t page_xp; 1686 1674 cxy_t page_cxy; 1675 page_t * page_ptr; 1687 1676 uint32_t index; 1688 1677 … … 1711 1700 } 1712 1701 1713 // allocate a 4 Kbytes physical page from target cluster 1714 page_xp = ppm_remote_alloc_pages( page_cxy , 0 ); 1702 // allocate one small physical page from target cluster 1703 page_ptr = ppm_remote_alloc_pages( page_cxy , 0 ); 1704 1705 page_xp = XPTR( page_cxy , page_ptr ); 1715 1706 1716 1707 #if DEBUG_VMM_PAGE_ALLOCATE 1717 1708 cycle = (uint32_t)hal_get_cycles(); 1718 1709 if( DEBUG_VMM_PAGE_ALLOCATE < cycle ) 1719 printk("\n[%s] thread[%x,%x] exit for vpn %x / ppn %x / c luster %x / cycle %d\n",1720 __FUNCTION__ , this->process->pid, this->trdid, vpn, ppm_page2ppn(page_xp), page_cxy,cycle );1710 printk("\n[%s] thread[%x,%x] exit for vpn %x / ppn %x / cycle %d\n", 1711 __FUNCTION__ , this->process->pid, this->trdid, vpn, ppm_page2ppn(page_xp), cycle ); 1721 1712 #endif 1722 1713 … … 1741 1732 uint32_t cycle = (uint32_t)hal_get_cycles(); 1742 1733 thread_t * this = CURRENT_THREAD; 1743 // if( DEBUG_VMM_GET_ONE_PPN < cycle ) 1744 if( vpn == 0x40B ) 1734 if( (DEBUG_VMM_GET_ONE_PPN < cycle) && (vpn == 0x40b) ) 1745 1735 printk("\n[%s] thread[%x,%x] enter for vpn %x / type %s / page_id %d / cycle %d\n", 1746 1736 __FUNCTION__, this->process->pid, this->trdid, vpn, vseg_type_str(type), page_id, cycle ); … … 1769 1759 page_xp = vmm_page_allocate( vseg , vpn ); 1770 1760 1771 if( page_xp == XPTR_NULL ) return ENOMEM;1761 if( page_xp == XPTR_NULL ) return -1; 1772 1762 1773 1763 // initialise missing page from .elf file mapper for DATA and CODE types … … 1788 1778 1789 1779 #if (DEBUG_VMM_GET_ONE_PPN & 0x1) 1790 // if( DEBUG_VMM_GET_ONE_PPN < cycle ) 1791 if( vpn == 0x40B ) 1780 if( (DEBUG_VMM_GET_ONE_PPN < cycle) && (vpn == 0x40b) ) 1792 1781 printk("\n[%s] thread[%x,%x] for vpn = %x / elf_offset = %x\n", 1793 1782 __FUNCTION__, this->process->pid, this->trdid, vpn, elf_offset ); … … 1803 1792 1804 1793 #if (DEBUG_VMM_GET_ONE_PPN & 0x1) 1805 // if( DEBUG_VMM_GET_ONE_PPN < cycle ) 1806 if( vpn == 0x40B ) 1794 if( (DEBUG_VMM_GET_ONE_PPN < cycle) && (vpn == 0x40b) ) 1807 1795 printk("\n[%s] thread[%x,%x] for vpn %x / fully in BSS\n", 1808 1796 __FUNCTION__, this->process->pid, this->trdid, vpn ); … … 1821 1809 1822 1810 #if (DEBUG_VMM_GET_ONE_PPN & 0x1) 1823 // if( DEBUG_VMM_GET_ONE_PPN < cycle ) 1824 if( vpn == 0x40B ) 1811 if( (DEBUG_VMM_GET_ONE_PPN < cycle) && (vpn == 0x40b) ) 1825 1812 printk("\n[%s] thread[%x,%x] for vpn %x / fully in mapper\n", 1826 1813 __FUNCTION__, this->process->pid, this->trdid, vpn ); … … 1839 1826 1840 1827 #if (DEBUG_VMM_GET_ONE_PPN & 0x1) 1841 // if( DEBUG_VMM_GET_ONE_PPN < cycle ) 1842 if( vpn == 0x40B ) 1828 if( (DEBUG_VMM_GET_ONE_PPN < cycle) && (vpn == 0x40b) ) 1843 1829 printk("\n[%s] thread[%x,%x] for vpn %x / both mapper & BSS\n" 1844 1830 " %d bytes from mapper / %d bytes from BSS\n", … … 1874 1860 #if DEBUG_VMM_GET_ONE_PPN 1875 1861 cycle = (uint32_t)hal_get_cycles(); 1876 // if( DEBUG_VMM_GET_ONE_PPN < cycle ) 1877 if( vpn == 0x40B ) 1878 printk("\n[%s] thread[%x,%x] exit for vpn %x / ppn %x / cycle\n", 1862 if( (DEBUG_VMM_GET_ONE_PPN < cycle) && (vpn == 0x40b) ) 1863 printk("\n[%s] thread[%x,%x] exit for vpn %x / ppn %x / cycle %d\n", 1879 1864 __FUNCTION__ , this->process->pid, this->trdid , vpn , *ppn, cycle ); 1880 1865 #endif … … 1906 1891 1907 1892 #if DEBUG_VMM_HANDLE_PAGE_FAULT 1908 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )1893 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 1909 1894 printk("\n[%s] thread[%x,%x] enter for vpn %x / cycle %d\n", 1910 1895 __FUNCTION__, this->process->pid, this->trdid, vpn, start_cycle ); … … 1912 1897 1913 1898 #if (DEBUG_VMM_HANDLE_PAGE_FAULT & 1) 1914 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )1915 hal_vmm_display( this->process , false );1899 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 1900 hal_vmm_display( this->process , true ); 1916 1901 #endif 1917 1902 … … 1928 1913 } 1929 1914 1930 #if DEBUG_VMM_HANDLE_PAGE_FAULT1931 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )1915 #if (DEBUG_VMM_HANDLE_PAGE_FAULT & 1) 1916 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 1932 1917 printk("\n[%s] thread[%x,%x] found vseg %s\n", 1933 1918 __FUNCTION__, this->process->pid, this->trdid, vseg_type_str(vseg->type) ); … … 1950 1935 } 1951 1936 1952 #if DEBUG_VMM_HANDLE_PAGE_FAULT1953 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )1954 printk("\n[%s] thread[%x,%x] locked vpn %x in cluster %x / cycle %d\n",1937 #if (DEBUG_VMM_HANDLE_PAGE_FAULT & 1) 1938 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 1939 printk("\n[%s] thread[%x,%x] locked vpn %x in cluster %x\n", 1955 1940 __FUNCTION__, this->process->pid, this->trdid, vpn, local_cxy ); 1956 1941 #endif … … 1970 1955 { 1971 1956 1972 #if DEBUG_VMM_HANDLE_PAGE_FAULT 1973 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) ) 1974 printk("\n[%s] thread[%x,%x] access local gpt : cxy %x / ref_cxy %x / type %s\n", 1975 __FUNCTION__, this->process->pid, this->trdid, local_cxy, ref_cxy, vseg_type_str(vseg->type) ); 1957 #if (DEBUG_VMM_HANDLE_PAGE_FAULT & 1) 1958 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 1959 printk("\n[%s] thread[%x,%x] access local gpt : cxy %x / ref_cxy %x / type %s / cycle %d\n", 1960 __FUNCTION__, this->process->pid, this->trdid, 1961 local_cxy, ref_cxy, vseg_type_str(vseg->type), (uint32_t)hal_get_cycles() ); 1976 1962 #endif 1977 1963 // allocate and initialise a physical page … … 2008 1994 2009 1995 #if DEBUG_VMM_HANDLE_PAGE_FAULT 2010 if( (end_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )1996 if( (end_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 2011 1997 printk("\n[%s] thread[%x,%x] handled local pgfault / ppn %x / attr %x / cycle %d\n", 2012 1998 __FUNCTION__, this->process->pid, this->trdid, ppn, attr, end_cycle ); … … 2026 2012 { 2027 2013 2028 #if DEBUG_VMM_HANDLE_PAGE_FAULT 2029 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) ) 2030 printk("\n[%s] thread[%x,%x] access ref gpt : cxy %x / ref_cxy %x / type %s\n", 2031 __FUNCTION__, this->process->pid, this->trdid, local_cxy, ref_cxy, vseg_type_str(vseg->type) ); 2014 #if (DEBUG_VMM_HANDLE_PAGE_FAULT & 1) 2015 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 2016 printk("\n[%s] thread[%x,%x] access ref gpt : cxy %x / ref_cxy %x / type %s / cycle %d\n", 2017 __FUNCTION__, this->process->pid, this->trdid, 2018 local_cxy, ref_cxy, vseg_type_str(vseg->type), (uint32_t)hal_get_cycles() ); 2032 2019 #endif 2033 2020 // build extended pointer on reference GPT … … 2050 2037 } 2051 2038 2052 #if DEBUG_VMM_HANDLE_PAGE_FAULT2053 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )2039 #if (DEBUG_VMM_HANDLE_PAGE_FAULT & 1) 2040 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 2054 2041 printk("\n[%s] thread[%x,%x] get pte from ref gpt / attr %x / ppn %x\n", 2055 2042 __FUNCTION__, this->process->pid, this->trdid, ref_attr, ref_ppn ); … … 2065 2052 ref_ppn ); 2066 2053 2067 #if DEBUG_VMM_HANDLE_PAGE_FAULT2068 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )2054 #if (DEBUG_VMM_HANDLE_PAGE_FAULT & 1) 2055 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 2069 2056 printk("\n[%s] thread[%x,%x] updated local gpt for a false pgfault\n", 2070 2057 __FUNCTION__, this->process->pid, this->trdid ); … … 2074 2061 hal_gpt_unlock_pte( ref_gpt_xp, vpn ); 2075 2062 2076 #if DEBUG_VMM_HANDLE_PAGE_FAULT2077 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )2063 #if (DEBUG_VMM_HANDLE_PAGE_FAULT &1) 2064 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 2078 2065 printk("\n[%s] thread[%x,%x] unlock the ref gpt after a false pgfault\n", 2079 2066 __FUNCTION__, this->process->pid, this->trdid ); … … 2085 2072 2086 2073 #if DEBUG_VMM_HANDLE_PAGE_FAULT 2087 if( (end_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )2074 if( (end_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 2088 2075 printk("\n[%s] thread[%x,%x] handled false pgfault / ppn %x / attr %x / cycle %d\n", 2089 2076 __FUNCTION__, this->process->pid, this->trdid, ref_ppn, ref_attr, end_cycle ); … … 2120 2107 if( vseg->flags & VSEG_CACHE ) attr |= GPT_CACHABLE; 2121 2108 2122 #if DEBUG_VMM_HANDLE_PAGE_FAULT2123 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )2109 #if (DEBUG_VMM_HANDLE_PAGE_FAULT & 1) 2110 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 2124 2111 printk("\n[%s] thread[%x,%x] build a new PTE for a true pgfault\n", 2125 2112 __FUNCTION__, this->process->pid, this->trdid ); … … 2132 2119 ppn ); 2133 2120 2134 #if DEBUG_VMM_HANDLE_PAGE_FAULT2135 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )2121 #if (DEBUG_VMM_HANDLE_PAGE_FAULT & 1) 2122 if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 2136 2123 printk("\n[%s] thread[%x,%x] set new PTE in ref gpt for a true page fault\n", 2137 2124 __FUNCTION__, this->process->pid, this->trdid ); … … 2150 2137 2151 2138 #if DEBUG_VMM_HANDLE_PAGE_FAULT 2152 if( (end_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )2139 if( (end_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 2153 2140 printk("\n[%s] thread[%x,%x] handled global pgfault / ppn %x / attr %x / cycle %d\n", 2154 2141 __FUNCTION__, this->process->pid, this->trdid, ppn, attr, end_cycle ); … … 2173 2160 2174 2161 #if DEBUG_VMM_HANDLE_PAGE_FAULT 2175 if( (end_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )2162 if( (end_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn > 0) ) 2176 2163 printk("\n[%s] handled by another thread / vpn %x / ppn %x / attr %x / cycle %d\n", 2177 2164 __FUNCTION__, vpn, ppn, attr, end_cycle ); … … 2212 2199 #endif 2213 2200 2214 #if ( DEBUG_VMM_HANDLE_PAGE_FAULT & 1)2201 #if ((DEBUG_VMM_HANDLE_COW & 3) == 3 ) 2215 2202 hal_vmm_display( process , true ); 2216 2203 #endif … … 2352 2339 #if(DEBUG_VMM_HANDLE_COW & 1) 2353 2340 if( DEBUG_VMM_HANDLE_COW < cycle ) 2354 printk("\n[%s] thread[%x,%x] 2341 printk("\n[%s] thread[%x,%x] no pending forks / keep existing PPN %x\n", 2355 2342 __FUNCTION__, this->process->pid, this->trdid, old_ppn ); 2356 2343 #endif … … 2360 2347 // build new_attr : set WRITABLE, reset COW, reset LOCKED 2361 2348 new_attr = (((old_attr | GPT_WRITABLE) & (~GPT_COW)) & (~GPT_LOCKED)); 2349 2350 #if(DEBUG_VMM_HANDLE_COW & 1) 2351 if( DEBUG_VMM_HANDLE_COW < cycle ) 2352 printk("\n[%s] thread[%x,%x] new_attr %x / new_ppn %x\n", 2353 __FUNCTION__, this->process->pid, this->trdid, new_attr, new_ppn ); 2354 #endif 2362 2355 2363 2356 // update the relevant GPT(s) … … 2366 2359 if( (vseg->type == VSEG_TYPE_STACK) || (vseg->type == VSEG_TYPE_CODE) ) 2367 2360 { 2368 // set the new PTE22361 // set new PTE in local gpt 2369 2362 hal_gpt_set_pte( gpt_xp, 2370 2363 vpn, … … 2398 2391 #endif 2399 2392 2393 #if ((DEBUG_VMM_HANDLE_COW & 3) == 3) 2394 hal_vmm_display( process , true ); 2395 #endif 2396 2400 2397 return EXCP_NON_FATAL; 2401 2398
Note: See TracChangeset
for help on using the changeset viewer.