Changeset 595
- Timestamp:
- Nov 10, 2018, 2:51:32 PM (6 years ago)
- Location:
- trunk/kernel/mm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/vmm.c
r585 r595 4 4 * Authors Ghassan Almaless (2008,2009,2010,2011, 2012) 5 5 * Mohamed Lamine Karaoui (2015) 6 * Alain Greiner (2016 )6 * Alain Greiner (2016,2017,2018) 7 7 * 8 8 * Copyright (c) UPMC Sorbonne Universites … … 69 69 uint32_t cycle = (uint32_t)hal_get_cycles(); 70 70 if( DEBUG_VMM_INIT ) 71 printk("\n[ DBG] %s : thread %x in process %xenter for process %x / cycle %d\n",72 __FUNCTION__ , this-> trdid, this->process->pid, process->pid , cycle );71 printk("\n[%s] thread[%x,%x] enter for process %x / cycle %d\n", 72 __FUNCTION__ , this->process->pid, this->trdid, process->pid , cycle ); 73 73 #endif 74 74 … … 195 195 cycle = (uint32_t)hal_get_cycles(); 196 196 if( DEBUG_VMM_INIT ) 197 printk("\n[ DBG] %s : thread %x in process %x exit / process %x / entry_point =%x / cycle %d\n",198 __FUNCTION__, this-> trdid, this->process->pid, process->pid , process->vmm.entry_point, cycle );197 printk("\n[%s] thread[%x,%x] exit / process %x / entry_point %x / cycle %d\n", 198 __FUNCTION__, this->process->pid, this->trdid, process->pid, process->vmm.entry_point, cycle ); 199 199 #endif 200 200 … … 295 295 } 296 296 297 ///////////////////// i//////////////////////////297 //////////////////////////////////////////////// 298 298 void vmm_global_update_pte( process_t * process, 299 299 vpn_t vpn, … … 316 316 #if DEBUG_VMM_UPDATE_PTE 317 317 uint32_t cycle = (uint32_t)hal_get_cycles(); 318 thread_t * this = CURRENT_THREAD; 318 319 if( DEBUG_VMM_UPDATE_PTE < cycle ) 319 printk("\n[ DBG] %s : thread %xenter for process %x / vpn %x / cycle %d\n",320 __FUNCTION__ , CURRENT_THREAD, process->pid , vpn , cycle );320 printk("\n[%s] thread[%x,%x] enter for process %x / vpn %x / cycle %d\n", 321 __FUNCTION__, this->process->pid, this->trdid, process->pid , vpn , cycle ); 321 322 #endif 322 323 … … 341 342 #if (DEBUG_VMM_UPDATE_PTE & 0x1) 342 343 if( DEBUG_VMM_UPDATE_PTE < cycle ) 343 printk("\n[ DBG] %s : thread %x handlingprocess %x in cluster %x\n",344 __FUNCTION__ , CURRENT_THREAD , process->pid, remote_process_cxy );344 printk("\n[%s] threadr[%x,%x] handling vpn %x for process %x in cluster %x\n", 345 __FUNCTION__, this->process->pid, this->trdid, vpn, process->pid, remote_process_cxy ); 345 346 #endif 346 347 … … 355 356 cycle = (uint32_t)hal_get_cycles(); 356 357 if( DEBUG_VMM_UPDATE_PTE < cycle ) 357 printk("\n[ DBG] %s : thread %xexit for process %x / vpn %x / cycle %d\n",358 __FUNCTION__ , CURRENT_THREAD, process->pid , vpn , cycle );358 printk("\n[%s] thread[%x,%x] exit for process %x / vpn %x / cycle %d\n", 359 __FUNCTION__, this->process->pid, this->trdid, process->pid , vpn , cycle ); 359 360 #endif 360 361 … … 386 387 387 388 #if DEBUG_VMM_SET_COW 388 uint32_t cycle = (uint32_t)hal_get_cycles(); 389 uint32_t cycle = (uint32_t)hal_get_cycles(); 390 thread_t * this = CURRENT_THREAD; 389 391 if( DEBUG_VMM_SET_COW < cycle ) 390 printk("\n[ DBG] %s : thread %xenter for process %x / cycle %d\n",391 __FUNCTION__ , CURRENT_THREAD, process->pid , cycle );392 printk("\n[%s] thread[%x,%x] enter for process %x / cycle %d\n", 393 __FUNCTION__, this->process->pid, this->trdid, process->pid , cycle ); 392 394 #endif 393 395 … … 417 419 remote_process_cxy = GET_CXY( remote_process_xp ); 418 420 419 #if (DEBUG_VMM_SET_COW & 0x1)421 #if (DEBUG_VMM_SET_COW & 1) 420 422 if( DEBUG_VMM_SET_COW < cycle ) 421 printk("\n[ DBG] %s : thread %xhandling process %x in cluster %x\n",422 __FUNCTION__ , CURRENT_THREAD, process->pid , remote_process_cxy );423 printk("\n[%s] thread[%x,%x] handling process %x in cluster %x\n", 424 __FUNCTION__, this->process->pid, this->trdid, process->pid , remote_process_cxy ); 423 425 #endif 424 426 … … 441 443 vpn_t vpn_size = vseg->vpn_size; 442 444 443 #if (DEBUG_VMM_SET_COW & 0x1)445 #if (DEBUG_VMM_SET_COW & 1) 444 446 if( DEBUG_VMM_SET_COW < cycle ) 445 printk("\n[ DBG] %s : thread %xhandling vseg %s / vpn_base = %x / vpn_size = %x\n",446 __FUNCTION__, CURRENT_THREAD, vseg_type_str(type), vpn_base, vpn_size );447 printk("\n[%s] thread[%x,%x] handling vseg %s / vpn_base = %x / vpn_size = %x\n", 448 __FUNCTION__, this->process->pid, this->trdid, vseg_type_str(type), vpn_base, vpn_size ); 447 449 #endif 448 450 // only DATA, ANON and REMOTE vsegs … … 505 507 cycle = (uint32_t)hal_get_cycles(); 506 508 if( DEBUG_VMM_SET_COW < cycle ) 507 printk("\n[ DBG] %s : thread %xexit for process %x / cycle %d\n",508 __FUNCTION__ , CURRENT_THREAD, process->pid , cycle );509 printk("\n[%s] thread[%x,%x] exit for process %x / cycle %d\n", 510 __FUNCTION__, this->process->pid, this->trdid, process->pid , cycle ); 509 511 #endif 510 512 … … 541 543 #if DEBUG_VMM_FORK_COPY 542 544 uint32_t cycle = (uint32_t)hal_get_cycles(); 545 thread_t * this = CURRENT_THREAD; 543 546 if( DEBUG_VMM_FORK_COPY < cycle ) 544 printk("\n[ DBG] %s :thread %x enter / cycle %d\n",545 __FUNCTION__ , CURRENT_THREAD, cycle );547 printk("\n[%s] thread %x enter / cycle %d\n", 548 __FUNCTION__ , this->process->pid, this->trdid, cycle ); 546 549 #endif 547 550 … … 592 595 cycle = (uint32_t)hal_get_cycles(); 593 596 if( DEBUG_VMM_FORK_COPY < cycle ) 594 printk("\n[ DBG] %s : thread %xfound parent vseg %s / vpn_base = %x / cycle %d\n",595 __FUNCTION__ , CURRENT_THREAD, vseg_type_str(type),597 printk("\n[%s] thread[%x,%x] found parent vseg %s / vpn_base = %x / cycle %d\n", 598 __FUNCTION__ , this->process->pid, this->trdid, vseg_type_str(type), 596 599 hal_remote_l32( XPTR( parent_cxy , &parent_vseg->vpn_base ) ) , cycle ); 597 600 #endif … … 618 621 cycle = (uint32_t)hal_get_cycles(); 619 622 if( DEBUG_VMM_FORK_COPY < cycle ) 620 printk("\n[ DBG] %s : thread %xcopied vseg %s / vpn_base = %x to child VSL / cycle %d\n",621 __FUNCTION__ , CURRENT_THREAD, vseg_type_str(type),623 printk("\n[%s] thread[%x,%x] copied vseg %s / vpn_base = %x to child VSL / cycle %d\n", 624 __FUNCTION__ , this->process->pid, this->trdid, vseg_type_str(type), 622 625 hal_remote_l32( XPTR( parent_cxy , &parent_vseg->vpn_base ) ) , cycle ); 623 626 #endif … … 672 675 cycle = (uint32_t)hal_get_cycles(); 673 676 if( DEBUG_VMM_FORK_COPY < cycle ) 674 printk("\n[ DBG] %s : thread %xcopied vpn %x to child GPT / cycle %d\n",675 __FUNCTION__ , CURRENT_THREAD, vpn , cycle );677 printk("\n[%s] thread[%x,%x] copied vpn %x to child GPT / cycle %d\n", 678 __FUNCTION__ , this->process->pid, this->trdid , vpn , cycle ); 676 679 #endif 677 680 } … … 723 726 cycle = (uint32_t)hal_get_cycles(); 724 727 if( DEBUG_VMM_FORK_COPY < cycle ) 725 printk("\n[ DBG] %s : thread %xexit successfully / cycle %d\n",726 __FUNCTION__ , CURRENT_THREAD, cycle );728 printk("\n[%s] thread[%x,%x] exit successfully / cycle %d\n", 729 __FUNCTION__ , this->process->pid, this->trdid , cycle ); 727 730 #endif 728 731 … … 739 742 #if DEBUG_VMM_DESTROY 740 743 uint32_t cycle = (uint32_t)hal_get_cycles(); 744 thread_t * this = CURRENT_THREAD; 741 745 if( DEBUG_VMM_DESTROY < cycle ) 742 printk("\n[ DBG] %s : thread %xenter for process %x in cluster %x / cycle %d\n",743 __FUNCTION__, CURRENT_THREAD->trdid, process->pid, local_cxy, cycle );746 printk("\n[%s] thread[%x,%x] enter for process %x in cluster %x / cycle %d\n", 747 __FUNCTION__, this->process->pid, this->trdid, process->pid, local_cxy, cycle ); 744 748 #endif 745 749 … … 773 777 #if( DEBUG_VMM_DESTROY & 1 ) 774 778 if( DEBUG_VMM_DESTROY < cycle ) 775 printk("\n[ DBG] %s :%s vseg released / vpn_base %x / vpn_size %d\n",779 printk("\n[%s] %s vseg released / vpn_base %x / vpn_size %d\n", 776 780 __FUNCTION__ , vseg_type_str( vseg->type ), vseg->vpn_base, vseg->vpn_size ); 777 781 #endif … … 789 793 #if( DEBUG_VMM_DESTROY & 1 ) 790 794 if( DEBUG_VMM_DESTROY < cycle ) 791 printk("\n[ DBG] %s :found zombi vseg / vpn_base %x / vpn_size %d\n",795 printk("\n[%s] found zombi vseg / vpn_base %x / vpn_size %d\n", 792 796 __FUNCTION__ , vseg_type_str( vseg->type ), vseg->vpn_base, vseg->vpn_size ); 793 797 #endif … … 797 801 #if( DEBUG_VMM_DESTROY & 1 ) 798 802 if( DEBUG_VMM_DESTROY < cycle ) 799 printk("\n[ DBG] %s :zombi vseg released / vpn_base %x / vpn_size %d\n",803 printk("\n[%s] zombi vseg released / vpn_base %x / vpn_size %d\n", 800 804 __FUNCTION__ , vseg_type_str( vseg->type ), vseg->vpn_base, vseg->vpn_size ); 801 805 #endif … … 809 813 cycle = (uint32_t)hal_get_cycles(); 810 814 if( DEBUG_VMM_DESTROY < cycle ) 811 printk("\n[ DBG] %s : thread %xexit for process %x in cluster %x / cycle %d\n",812 __FUNCTION__, CURRENT_THREAD->trdid, process->pid, local_cxy , cycle );815 printk("\n[%s] thread[%x,%x] exit for process %x in cluster %x / cycle %d\n", 816 __FUNCTION__, this->process->pid, this->trdid, process->pid, local_cxy , cycle ); 813 817 #endif 814 818 … … 957 961 vseg_t * vseg; // created vseg pointer 958 962 vpn_t vpn_base; // first page index 959 vpn_t vpn_size; // number of pages 963 vpn_t vpn_size; // number of pages covered by vseg 960 964 error_t error; 961 965 962 966 #if DEBUG_VMM_CREATE_VSEG 963 uint32_t cycle = (uint32_t)hal_get_cycles(); 967 thread_t * this = CURRENT_THREAD; 968 uint32_t cycle = (uint32_t)hal_get_cycles(); 964 969 if( DEBUG_VMM_CREATE_VSEG < cycle ) 965 printk("\n[ DBG] %s : thread %x enter / process %x / base %x / size %x/ %s / cxy %x / cycle %d\n",966 __FUNCTION__, CURRENT_THREAD, process->pid, base, size, vseg_type_str(type), cxy, cycle );970 printk("\n[%s] thread[%x,%x] enter / %s / cxy %x / cycle %d\n", 971 __FUNCTION__, this->process->pid, this->trdid, vseg_type_str(type), cxy, cycle ); 967 972 #endif 968 973 … … 972 977 // compute base, size, vpn_base, vpn_size, depending on vseg type 973 978 // we use the VMM specific allocators for "stack", "file", "anon", & "remote" vsegs 979 974 980 if( type == VSEG_TYPE_STACK ) 975 981 { … … 987 993 size = vpn_size << CONFIG_PPM_PAGE_SHIFT; 988 994 } 989 else if( (type == VSEG_TYPE_ANON) || 990 (type == VSEG_TYPE_FILE) || 991 (type == VSEG_TYPE_REMOTE) ) 992 { 995 else if( type == VSEG_TYPE_FILE ) 996 { 997 // compute page index (in mapper) for first byte 998 vpn_t vpn_min = file_offset >> CONFIG_PPM_PAGE_SHIFT; 999 1000 // compute page index (in mapper) for last byte 1001 vpn_t vpn_max = (file_offset + size - 1) >> CONFIG_PPM_PAGE_SHIFT; 1002 1003 // compute offset in first page 1004 uint32_t offset = file_offset & CONFIG_PPM_PAGE_MASK; 1005 1006 // compute number of pages required in virtual space 1007 vpn_t npages = vpn_max - vpn_min + 1; 1008 993 1009 // get vpn_base and vpn_size from MMAP allocator 994 vpn_t npages = size >> CONFIG_PPM_PAGE_SHIFT;995 1010 error = vmm_mmap_alloc( vmm , npages , &vpn_base , &vpn_size ); 996 1011 if( error ) … … 1001 1016 } 1002 1017 1003 // compute vseg base and size from vpn_base and vpn_size 1018 // set the vseg base (not always aligned for FILE) 1019 base = (vpn_base << CONFIG_PPM_PAGE_SHIFT) + offset; 1020 } 1021 else if( (type == VSEG_TYPE_ANON) || 1022 (type == VSEG_TYPE_REMOTE) ) 1023 { 1024 // compute number of required pages in virtual space 1025 vpn_t npages = size >> CONFIG_PPM_PAGE_SHIFT; 1026 if( size & CONFIG_PPM_PAGE_MASK) npages++; 1027 1028 // get vpn_base and vpn_size from MMAP allocator 1029 error = vmm_mmap_alloc( vmm , npages , &vpn_base , &vpn_size ); 1030 if( error ) 1031 { 1032 printk("\n[ERROR] in %s : no vspace for mmap vseg / process %x in cluster %x\n", 1033 __FUNCTION__ , process->pid , local_cxy ); 1034 return NULL; 1035 } 1036 1037 // set vseg base (always aligned for ANON or REMOTE) 1004 1038 base = vpn_base << CONFIG_PPM_PAGE_SHIFT; 1005 size = vpn_size << CONFIG_PPM_PAGE_SHIFT; 1006 } 1007 else 1039 } 1040 else // VSEG_TYPE_DATA or VSEG_TYPE_CODE 1008 1041 { 1009 1042 uint32_t vpn_min = base >> CONFIG_PPM_PAGE_SHIFT; … … 1051 1084 cycle = (uint32_t)hal_get_cycles(); 1052 1085 if( DEBUG_VMM_CREATE_VSEG < cycle ) 1053 printk("\n[ DBG] %s : thread %x exit / process %x/ %s / cxy %x / cycle %d\n",1054 __FUNCTION__, CURRENT_THREAD, process->pid, vseg_type_str(type), cxy, cycle );1086 printk("\n[%s] thread[%x,%x] exit / %s / cxy %x / cycle %d\n", 1087 __FUNCTION__, this->process->pid, this->trdid, vseg_type_str(type), cxy, cycle ); 1055 1088 #endif 1056 1089 … … 1125 1158 1126 1159 #if DEBUG_VMM_UNMAP_VSEG 1127 uint32_t cycle = (uint32_t)hal_get_cycles(); 1160 uint32_t cycle = (uint32_t)hal_get_cycles(); 1161 thread_t * this = CURRENT_THREAD; 1128 1162 if( DEBUG_VMM_UNMAP_VSEG < cycle ) 1129 printk("\n[DBG] %s : thread %x enter / process %x / vseg %s / base %x / cycle %d\n", 1130 __FUNCTION__, CURRENT_THREAD, process->pid, vseg_type_str( vseg->type ), vseg->vpn_base, cycle ); 1163 printk("\n[%s] thread[%x,%x] enter / process %x / vseg %s / base %x / cycle %d\n", 1164 __FUNCTION__, this->process->pid, this->trdid, process->pid, 1165 vseg_type_str( vseg->type ), vseg->vpn_base, cycle ); 1131 1166 #endif 1132 1167 … … 1198 1233 cycle = (uint32_t)hal_get_cycles(); 1199 1234 if( DEBUG_VMM_UNMAP_VSEG < cycle ) 1200 printk("\n[DBG] %s : thread %x exit / process %x / vseg %s / base %x / cycle %d\n", 1201 __FUNCTION__, CURRENT_THREAD, process->pid, vseg_type_str( vseg->type ), vseg->vpn_base, cycle ); 1235 printk("\n[%s] thread[%x,%x] exit / process %x / vseg %s / base %x / cycle %d\n", 1236 __FUNCTION__, this->process->pid, this->trdid, process->pid, 1237 vseg_type_str( vseg->type ), vseg->vpn_base, cycle ); 1202 1238 #endif 1203 1239 … … 1213 1249 // @ return vseg pointer if success / return NULL if not found. 1214 1250 ////////////////////////////////////////////////////////////////////////////////////////// 1215 static vseg_t * v seg_from_vaddr( vmm_t * vmm,1216 intptr_t vaddr )1251 static vseg_t * vmm_vseg_from_vaddr( vmm_t * vmm, 1252 intptr_t vaddr ) 1217 1253 { 1218 1254 xptr_t iter_xp; … … 1232 1268 vseg_xp = XLIST_ELEMENT( iter_xp , vseg_t , xlist ); 1233 1269 vseg = GET_PTR( vseg_xp ); 1270 1234 1271 if( (vaddr >= vseg->min) && (vaddr < vseg->max) ) 1235 { 1272 { 1236 1273 // return success 1237 1274 remote_rwlock_rd_release( lock_xp ); … … 1244 1281 return NULL; 1245 1282 1246 } // end v seg_from_vaddr()1283 } // end vmm_vseg_from_vaddr() 1247 1284 1248 1285 ///////////////////////////////////////////// … … 1263 1300 1264 1301 // get pointer on vseg 1265 vseg_t * vseg = v seg_from_vaddr( vmm , base );1302 vseg_t * vseg = vmm_vseg_from_vaddr( vmm , base ); 1266 1303 1267 1304 if( vseg == NULL) return EINVAL; … … 1343 1380 vseg_t ** found_vseg ) 1344 1381 { 1345 xptr_t vseg_xp;1346 error_t error;1347 v seg_t * vseg;1348 vmm_t * vmm;1382 xptr_t vseg_xp; 1383 vseg_t * vseg; 1384 vmm_t * vmm; 1385 error_t error; 1349 1386 1350 1387 // get pointer on local VMM … … 1352 1389 1353 1390 // try to get vseg from local VMM 1354 vseg = v seg_from_vaddr( vmm , vaddr );1391 vseg = vmm_vseg_from_vaddr( vmm , vaddr ); 1355 1392 1356 1393 if( vseg == NULL ) // vseg not found in local cluster => try to get it from ref … … 1379 1416 1380 1417 // register local vseg in local VMM 1381 vmm_vseg_attach( &process->vmm , vseg );1418 vmm_vseg_attach( vmm , vseg ); 1382 1419 } 1383 1420 1384 1421 // success 1385 1422 *found_vseg = vseg; … … 1400 1437 1401 1438 #if DEBUG_VMM_ALLOCATE_PAGE 1439 uint32_t cycle = (uint32_t)hal_get_cycles(); 1440 thread_t * this = CURRENT_THREAD; 1402 1441 if( DEBUG_VMM_ALLOCATE_PAGE < (uint32_t)hal_get_cycles() ) 1403 printk("\n[ DBG] in %s : thread %x enter for vpn %x\n",1404 __FUNCTION__ , CURRENT_THREAD, vpn);1442 printk("\n[%s] thread[%x,%x] enter for vpn %x / cycle %d\n", 1443 __FUNCTION__ , this->process->pid, this->trdid, vpn, cycle ); 1405 1444 #endif 1406 1445 … … 1449 1488 1450 1489 #if DEBUG_VMM_ALLOCATE_PAGE 1490 cycle = (uint32_t)hal_get_cycles(); 1451 1491 if( DEBUG_VMM_ALLOCATE_PAGE < (uint32_t)hal_get_cycles() ) 1452 printk("\n[DBG] in %s : thread %x exit for vpn = %d / ppn = %x\n", 1453 __FUNCTION__ , CURRENT_THREAD, vpn, ppm_page2ppn( XPTR( page_cxy , page_ptr ) ) ); 1492 printk("\n[%s] thread[%x,%x] exit for vpn %x / ppn %x / cycle %d\n", 1493 __FUNCTION__ , this->process->pid, this->trdid, vpn, 1494 ppm_page2ppn( XPTR( page_cxy , page_ptr ) , cycle ); 1454 1495 #endif 1455 1496 … … 1474 1515 1475 1516 #if DEBUG_VMM_GET_ONE_PPN 1476 thread_t * this = CURRENT_THREAD; 1477 if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1478 printk("\n[DBG] %s : thread %x enter for vpn = %x / type = %s / index = %d\n", 1479 __FUNCTION__, this, vpn, vseg_type_str(type), index ); 1517 uint32_t cycle = (uint32_t)hal_get_cycles(); 1518 thread_t * this = CURRENT_THREAD; 1519 if( DEBUG_VMM_GET_ONE_PPN < cycle ) 1520 printk("\n[%s] thread[%x,%x] enter for vpn %x / type %s / index %d / cycle %d\n", 1521 __FUNCTION__, this->process->pid, this->trdid, vpn, vseg_type_str(type), index, cycle ); 1480 1522 #endif 1481 1523 … … 1539 1581 #if (DEBUG_VMM_GET_ONE_PPN & 0x1) 1540 1582 if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1541 printk("\n[ DBG] %s : thread %xfor vpn = %x / elf_offset = %x\n",1542 __FUNCTION__, this , vpn, elf_offset );1583 printk("\n[%s] thread[%x,%x] for vpn = %x / elf_offset = %x\n", 1584 __FUNCTION__, this->process->pid, this->trdid, vpn, elf_offset ); 1543 1585 #endif 1544 1586 // compute extended pointer on page base … … 1553 1595 #if (DEBUG_VMM_GET_ONE_PPN & 0x1) 1554 1596 if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1555 printk("\n[ DBG] %s : thread%x for vpn =%x / fully in BSS\n",1556 __FUNCTION__, this , vpn );1597 printk("\n[%s] thread[%x,%x] for vpn %x / fully in BSS\n", 1598 __FUNCTION__, this->process->pid, this->trdid, vpn ); 1557 1599 #endif 1558 1600 if( GET_CXY( page_xp ) == local_cxy ) … … 1570 1612 #if (DEBUG_VMM_GET_ONE_PPN & 0x1) 1571 1613 if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1572 printk("\n[ DBG] %s : thread %x, for vpn =%x / fully in mapper\n",1573 __FUNCTION__, this , vpn );1614 printk("\n[%s] thread[%x,%x] for vpn %x / fully in mapper\n", 1615 __FUNCTION__, this->process->pid, this->trdid, vpn ); 1574 1616 #endif 1575 1617 if( mapper_cxy == local_cxy ) … … 1601 1643 #if (DEBUG_VMM_GET_ONE_PPN & 0x1) 1602 1644 if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1603 printk("\n[ DBG] %s : thread %x for vpn = %x / both mapper & BSS\n"1645 printk("\n[%s] thread[%x,%x] for vpn %x / both mapper & BSS\n", 1604 1646 " %d bytes from mapper / %d bytes from BSS\n", 1605 __FUNCTION__, this , vpn,1647 __FUNCTION__, this->process->pid, this->trdid, vpn, 1606 1648 file_size - offset , offset + CONFIG_PPM_PAGE_SIZE - file_size ); 1607 1649 #endif … … 1647 1689 1648 1690 #if DEBUG_VMM_GET_ONE_PPN 1649 if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1650 printk("\n[DBG] %s : thread %x exit for vpn = %x / ppn = %x\n", 1651 __FUNCTION__ , this , vpn , *ppn ); 1691 cycle = (uint32_t)hal_get_cycles(); 1692 if( DEBUG_VMM_GET_ONE_PPN < cycle ) 1693 printk("\n[%s] thread[%x,%x] exit for vpn %x / ppn %x / cycle\n", 1694 __FUNCTION__ , this->process->pid, this->trdid , vpn , *ppn, cycle ); 1652 1695 #endif 1653 1696 … … 1680 1723 if( error ) 1681 1724 { 1682 printk("\n[ERROR] in %s : illegal VPN %x in process %x\n",1725 printk("\n[ERROR] in %s : vpn %x in process %x not in a registered vseg\n", 1683 1726 __FUNCTION__ , vpn , process->pid ); 1684 1727 … … 1690 1733 thread_t * this = CURRENT_THREAD; 1691 1734 if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle ) 1692 printk("\n[ DBG] %s :threadr[%x,%x] enter for vpn %x / %s / cycle %d\n",1735 printk("\n[%s] threadr[%x,%x] enter for vpn %x / %s / cycle %d\n", 1693 1736 __FUNCTION__, this->process->pid, this->trdid, vpn, vseg_type_str(vseg->type), cycle ); 1694 1737 #endif … … 1705 1748 1706 1749 // check VPN still unmapped in local GPT 1750 1707 1751 // do nothing if VPN has been mapped by a a concurrent page_fault 1708 1752 hal_gpt_get_pte( local_gpt_xp, … … 1757 1801 cycle = (uint32_t)hal_get_cycles(); 1758 1802 if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle ) 1759 printk("\n[ DBG] %s :private page fault handled / vpn %x / ppn %x / attr %x / cycle %d\n",1803 printk("\n[%s] private page fault handled / vpn %x / ppn %x / attr %x / cycle %d\n", 1760 1804 __FUNCTION__, vpn, new_ppn, new_attr, cycle ); 1761 1805 #endif … … 1812 1856 if( error ) 1813 1857 { 1814 printk("\n[ERROR] in %s : cannot update local GPT / process %x / vpn =%x\n",1858 printk("\n[ERROR] in %s : cannot update local GPT / process %x / vpn %x\n", 1815 1859 __FUNCTION__ , process->pid , vpn ); 1816 1860 … … 1834 1878 cycle = (uint32_t)hal_get_cycles(); 1835 1879 if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle ) 1836 printk("\n[ DBG] %s :false page fault handled / vpn %x / ppn %x / attr %x / cycle %d\n",1880 printk("\n[%s] false page fault handled / vpn %x / ppn %x / attr %x / cycle %d\n", 1837 1881 __FUNCTION__, vpn, ref_ppn, ref_attr, cycle ); 1838 1882 #endif … … 1904 1948 cycle = (uint32_t)hal_get_cycles(); 1905 1949 if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle ) 1906 printk("\n[ DBG] %s :true page fault handled / vpn %x / ppn %x / attr %x / cycle %d\n",1950 printk("\n[%s] true page fault handled / vpn %x / ppn %x / attr %x / cycle %d\n", 1907 1951 __FUNCTION__, vpn, new_ppn, new_attr, cycle ); 1908 1952 #endif … … 1931 1975 thread_t * this = CURRENT_THREAD; 1932 1976 if( DEBUG_VMM_HANDLE_COW < cycle ) 1933 printk("\n[ DBG] %s :thread[%x,%x] enter for vpn %x / core[%x,%d] / cycle %d\n",1977 printk("\n[%s] thread[%x,%x] enter for vpn %x / core[%x,%d] / cycle %d\n", 1934 1978 __FUNCTION__, process->pid, this->trdid, vpn, local_cxy, this->core->lid, cycle ); 1935 1979 #endif … … 1942 1986 if( error ) 1943 1987 { 1944 printk("\n[PANIC] in %s : VPN %x in process %x not inregistered vseg\n",1988 printk("\n[PANIC] in %s : vpn %x in process %x not in a registered vseg\n", 1945 1989 __FUNCTION__, vpn, process->pid ); 1946 1990 … … 2035 2079 #if(DEBUG_VMM_HANDLE_COW & 1) 2036 2080 if( DEBUG_VMM_HANDLE_COW < cycle ) 2037 printk("\n[ DBG] %s :thread[%x,%x] : pending forks => allocate a new PPN %x\n",2081 printk("\n[%s] thread[%x,%x] : pending forks => allocate a new PPN %x\n", 2038 2082 __FUNCTION__, process->pid, this->trdid, new_ppn ); 2039 2083 #endif … … 2045 2089 #if(DEBUG_VMM_HANDLE_COW & 1) 2046 2090 if( DEBUG_VMM_HANDLE_COW < cycle ) 2047 printk("\n[ DBG] %s :thread[%x,%x] no pending forks => keep existing PPN %x\n",2091 printk("\n[%s] thread[%x,%x] no pending forks => keep existing PPN %x\n", 2048 2092 __FUNCTION__, process->pid, this->trdid, new_ppn ); 2049 2093 #endif … … 2092 2136 cycle = (uint32_t)hal_get_cycles(); 2093 2137 if( DEBUG_VMM_HANDLE_COW < cycle ) 2094 printk("\n[ DBG] %s :thread[%x,%x] exit for vpn %x / core[%x,%d] / cycle %d\n",2138 printk("\n[%s] thread[%x,%x] exit for vpn %x / core[%x,%d] / cycle %d\n", 2095 2139 __FUNCTION__, process->pid, this->trdid, vpn, local_cxy, this->core->lid, cycle ); 2096 2140 #endif -
trunk/kernel/mm/vmm.h
r585 r595 275 275 /********************************************************************************************* 276 276 * This function allocates memory for a vseg descriptor, initialises it, and register it 277 * in the VMM of the local process descriptor, that shouldbe the reference process.277 * in the VMM of the local process descriptor, that must be the reference process. 278 278 * For the 'stack", "file", "anon", & "remote" types, it does not use the <base> argument, 279 279 * but uses the STACK and MMAP virtual memory allocators. -
trunk/kernel/mm/vseg.c
r567 r595 4 4 * Authors Ghassan Almaless (2008,2009,2010,2011, 2012) 5 5 * Mohamed Lamine Karaoui (2015) 6 * Alain Greiner (2016 )6 * Alain Greiner (2016,2018,2019) 7 7 * 8 8 * Copyright (c) UPMC Sorbonne Universites -
trunk/kernel/mm/vseg.h
r567 r595 36 36 /******************************************************************************************* 37 37 * This enum defines the vseg types for an user process. 38 *********************************************************************************** VSEG*******/38 ******************************************************************************************/ 39 39 40 40 typedef enum
Note: See TracChangeset
for help on using the changeset viewer.