Changeset 595 for trunk/kernel/mm


Ignore:
Timestamp:
Nov 10, 2018, 2:51:32 PM (5 years ago)
Author:
alain
Message:

Cosmetic: improve debug.

Location:
trunk/kernel/mm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/vmm.c

    r585 r595  
    44 * Authors   Ghassan Almaless (2008,2009,2010,2011, 2012)
    55 *           Mohamed Lamine Karaoui (2015)
    6  *           Alain Greiner (2016)
     6 *           Alain Greiner (2016,2017,2018)
    77 *
    88 * Copyright (c) UPMC Sorbonne Universites
     
    6969uint32_t cycle = (uint32_t)hal_get_cycles();
    7070if( DEBUG_VMM_INIT )
    71 printk("\n[DBG] %s : thread %x in process %x enter for process %x / cycle %d\n",
    72 __FUNCTION__ , this->trdid, this->process->pid, process->pid , cycle );
     71printk("\n[%s] thread[%x,%x] enter for process %x / cycle %d\n",
     72__FUNCTION__ , this->process->pid, this->trdid, process->pid , cycle );
    7373#endif
    7474
     
    195195cycle = (uint32_t)hal_get_cycles();
    196196if( 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 );
     197printk("\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 );
    199199#endif
    200200
     
    295295}
    296296
    297 /////////////////////i//////////////////////////
     297////////////////////////////////////////////////
    298298void vmm_global_update_pte( process_t * process,
    299299                            vpn_t       vpn,
     
    316316#if DEBUG_VMM_UPDATE_PTE
    317317uint32_t cycle = (uint32_t)hal_get_cycles();
     318thread_t * this = CURRENT_THREAD;
    318319if( DEBUG_VMM_UPDATE_PTE < cycle )
    319 printk("\n[DBG] %s : thread %x enter for process %x / vpn %x / cycle %d\n",
    320 __FUNCTION__ , CURRENT_THREAD , process->pid , vpn , cycle );
     320printk("\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 );
    321322#endif
    322323
     
    341342#if (DEBUG_VMM_UPDATE_PTE & 0x1)
    342343if( DEBUG_VMM_UPDATE_PTE < cycle )
    343 printk("\n[DBG] %s : thread %x handling process %x in cluster %x\n",
    344 __FUNCTION__ , CURRENT_THREAD , process->pid , remote_process_cxy );
     344printk("\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 );
    345346#endif
    346347
     
    355356cycle = (uint32_t)hal_get_cycles();
    356357if( DEBUG_VMM_UPDATE_PTE < cycle )
    357 printk("\n[DBG] %s : thread %x exit for process %x / vpn %x / cycle %d\n",
    358 __FUNCTION__ , CURRENT_THREAD , process->pid , vpn , cycle );
     358printk("\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 );
    359360#endif
    360361
     
    386387
    387388#if DEBUG_VMM_SET_COW
    388 uint32_t cycle = (uint32_t)hal_get_cycles();
     389uint32_t   cycle = (uint32_t)hal_get_cycles();
     390thread_t * this  = CURRENT_THREAD;
    389391if( DEBUG_VMM_SET_COW < cycle )
    390 printk("\n[DBG] %s : thread %x enter for process %x / cycle %d\n",
    391 __FUNCTION__ , CURRENT_THREAD , process->pid , cycle );
     392printk("\n[%s] thread[%x,%x] enter for process %x / cycle %d\n",
     393__FUNCTION__, this->process->pid, this->trdid, process->pid , cycle );
    392394#endif
    393395
     
    417419        remote_process_cxy = GET_CXY( remote_process_xp );
    418420
    419 #if (DEBUG_VMM_SET_COW &0x1)
     421#if (DEBUG_VMM_SET_COW & 1)
    420422if( DEBUG_VMM_SET_COW < cycle )
    421 printk("\n[DBG] %s : thread %x handling process %x in cluster %x\n",
    422 __FUNCTION__ , CURRENT_THREAD , process->pid , remote_process_cxy );
     423printk("\n[%s] thread[%x,%x] handling process %x in cluster %x\n",
     424__FUNCTION__, this->process->pid, this->trdid, process->pid , remote_process_cxy );
    423425#endif
    424426
     
    441443            vpn_t    vpn_size = vseg->vpn_size;
    442444
    443 #if (DEBUG_VMM_SET_COW & 0x1)
     445#if (DEBUG_VMM_SET_COW & 1)
    444446if( DEBUG_VMM_SET_COW < cycle )
    445 printk("\n[DBG] %s : thread %x handling vseg %s / vpn_base = %x / vpn_size = %x\n",
    446 __FUNCTION__, CURRENT_THREAD , vseg_type_str(type), vpn_base, vpn_size );
     447printk("\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 );
    447449#endif
    448450            // only DATA, ANON and REMOTE vsegs
     
    505507cycle = (uint32_t)hal_get_cycles();
    506508if( DEBUG_VMM_SET_COW < cycle )
    507 printk("\n[DBG] %s : thread %x exit for process %x / cycle %d\n",
    508 __FUNCTION__ , CURRENT_THREAD , process->pid , cycle );
     509printk("\n[%s] thread[%x,%x] exit for process %x / cycle %d\n",
     510__FUNCTION__, this->process->pid, this->trdid, process->pid , cycle );
    509511#endif
    510512
     
    541543#if DEBUG_VMM_FORK_COPY
    542544uint32_t cycle = (uint32_t)hal_get_cycles();
     545thread_t * this = CURRENT_THREAD;
    543546if( DEBUG_VMM_FORK_COPY < cycle )
    544 printk("\n[DBG] %s : thread %x enter / cycle %d\n",
    545 __FUNCTION__ , CURRENT_THREAD, cycle );
     547printk("\n[%s] thread %x enter / cycle %d\n",
     548__FUNCTION__ , this->process->pid, this->trdid, cycle );
    546549#endif
    547550
     
    592595cycle = (uint32_t)hal_get_cycles();
    593596if( DEBUG_VMM_FORK_COPY < cycle )
    594 printk("\n[DBG] %s : thread %x found parent vseg %s / vpn_base = %x / cycle %d\n",
    595 __FUNCTION__ , CURRENT_THREAD, vseg_type_str(type),
     597printk("\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),
    596599hal_remote_l32( XPTR( parent_cxy , &parent_vseg->vpn_base ) ) , cycle );
    597600#endif
     
    618621cycle = (uint32_t)hal_get_cycles();
    619622if( DEBUG_VMM_FORK_COPY < cycle )
    620 printk("\n[DBG] %s : thread %x copied vseg %s / vpn_base = %x to child VSL / cycle %d\n",
    621 __FUNCTION__ , CURRENT_THREAD , vseg_type_str(type),
     623printk("\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),
    622625hal_remote_l32( XPTR( parent_cxy , &parent_vseg->vpn_base ) ) , cycle );
    623626#endif
     
    672675cycle = (uint32_t)hal_get_cycles();
    673676if( DEBUG_VMM_FORK_COPY < cycle )
    674 printk("\n[DBG] %s : thread %x copied vpn %x to child GPT / cycle %d\n",
    675 __FUNCTION__ , CURRENT_THREAD , vpn , cycle );
     677printk("\n[%s] thread[%x,%x] copied vpn %x to child GPT / cycle %d\n",
     678__FUNCTION__ , this->process->pid, this->trdid , vpn , cycle );
    676679#endif
    677680                    }
     
    723726cycle = (uint32_t)hal_get_cycles();
    724727if( DEBUG_VMM_FORK_COPY < cycle )
    725 printk("\n[DBG] %s : thread %x exit successfully / cycle %d\n",
    726 __FUNCTION__ , CURRENT_THREAD , cycle );
     728printk("\n[%s] thread[%x,%x] exit successfully / cycle %d\n",
     729__FUNCTION__ , this->process->pid, this->trdid , cycle );
    727730#endif
    728731
     
    739742#if DEBUG_VMM_DESTROY
    740743uint32_t cycle = (uint32_t)hal_get_cycles();
     744thread_t * this = CURRENT_THREAD;
    741745if( DEBUG_VMM_DESTROY < cycle )
    742 printk("\n[DBG] %s : thread %x enter for process %x in cluster %x / cycle %d\n",
    743 __FUNCTION__, CURRENT_THREAD->trdid, process->pid, local_cxy, cycle );
     746printk("\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 );
    744748#endif
    745749
     
    773777#if( DEBUG_VMM_DESTROY & 1 )
    774778if( DEBUG_VMM_DESTROY < cycle )
    775 printk("\n[DBG] %s : %s vseg released / vpn_base %x / vpn_size %d\n",
     779printk("\n[%s] %s vseg released / vpn_base %x / vpn_size %d\n",
    776780__FUNCTION__ , vseg_type_str( vseg->type ), vseg->vpn_base, vseg->vpn_size );
    777781#endif
     
    789793#if( DEBUG_VMM_DESTROY & 1 )
    790794if( DEBUG_VMM_DESTROY < cycle )
    791 printk("\n[DBG] %s : found zombi vseg / vpn_base %x / vpn_size %d\n",
     795printk("\n[%s] found zombi vseg / vpn_base %x / vpn_size %d\n",
    792796__FUNCTION__ , vseg_type_str( vseg->type ), vseg->vpn_base, vseg->vpn_size );
    793797#endif
     
    797801#if( DEBUG_VMM_DESTROY & 1 )
    798802if( DEBUG_VMM_DESTROY < cycle )
    799 printk("\n[DBG] %s : zombi vseg released / vpn_base %x / vpn_size %d\n",
     803printk("\n[%s] zombi vseg released / vpn_base %x / vpn_size %d\n",
    800804__FUNCTION__ , vseg_type_str( vseg->type ), vseg->vpn_base, vseg->vpn_size );
    801805#endif
     
    809813cycle = (uint32_t)hal_get_cycles();
    810814if( DEBUG_VMM_DESTROY < cycle )
    811 printk("\n[DBG] %s : thread %x exit for process %x in cluster %x / cycle %d\n",
    812 __FUNCTION__, CURRENT_THREAD->trdid, process->pid, local_cxy , cycle );
     815printk("\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 );
    813817#endif
    814818
     
    957961    vseg_t     * vseg;          // created vseg pointer
    958962    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
    960964        error_t      error;
    961965
    962966#if DEBUG_VMM_CREATE_VSEG
    963 uint32_t cycle = (uint32_t)hal_get_cycles();
     967thread_t * this  = CURRENT_THREAD;
     968uint32_t   cycle = (uint32_t)hal_get_cycles();
    964969if( 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 );
     970printk("\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 );
    967972#endif
    968973
     
    972977    // compute base, size, vpn_base, vpn_size, depending on vseg type
    973978    // we use the VMM specific allocators for "stack", "file", "anon", & "remote" vsegs
     979
    974980    if( type == VSEG_TYPE_STACK )
    975981    {
     
    987993        size = vpn_size << CONFIG_PPM_PAGE_SHIFT;
    988994    }
    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
    9931009        // get vpn_base and vpn_size from MMAP allocator
    994         vpn_t npages = size >> CONFIG_PPM_PAGE_SHIFT;
    9951010        error = vmm_mmap_alloc( vmm , npages , &vpn_base , &vpn_size );
    9961011        if( error )
     
    10011016        }
    10021017
    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)
    10041038        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
    10081041    {
    10091042        uint32_t vpn_min = base >> CONFIG_PPM_PAGE_SHIFT;
     
    10511084cycle = (uint32_t)hal_get_cycles();
    10521085if( 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 );
     1086printk("\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 );
    10551088#endif
    10561089
     
    11251158
    11261159#if DEBUG_VMM_UNMAP_VSEG
    1127 uint32_t cycle = (uint32_t)hal_get_cycles();
     1160uint32_t   cycle = (uint32_t)hal_get_cycles();
     1161thread_t * this  = CURRENT_THREAD;
    11281162if( 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 );
     1163printk("\n[%s] thread[%x,%x] enter / process %x / vseg %s / base %x / cycle %d\n",
     1164__FUNCTION__, this->process->pid, this->trdid, process->pid,
     1165vseg_type_str( vseg->type ), vseg->vpn_base, cycle );
    11311166#endif
    11321167
     
    11981233cycle = (uint32_t)hal_get_cycles();
    11991234if( 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 );
     1235printk("\n[%s] thread[%x,%x] exit / process %x / vseg %s / base %x / cycle %d\n",
     1236__FUNCTION__, this->process->pid, this->trdid, process->pid,
     1237vseg_type_str( vseg->type ), vseg->vpn_base, cycle );
    12021238#endif
    12031239
     
    12131249// @ return vseg pointer if success / return NULL if not found.
    12141250//////////////////////////////////////////////////////////////////////////////////////////
    1215 static vseg_t * vseg_from_vaddr( vmm_t    * vmm,
    1216                                  intptr_t   vaddr )
     1251static vseg_t * vmm_vseg_from_vaddr( vmm_t    * vmm,
     1252                                     intptr_t   vaddr )
    12171253{
    12181254    xptr_t   iter_xp;
     
    12321268        vseg_xp = XLIST_ELEMENT( iter_xp , vseg_t , xlist );
    12331269        vseg    = GET_PTR( vseg_xp );
     1270
    12341271        if( (vaddr >= vseg->min) && (vaddr < vseg->max) )
    1235         {
     1272        { 
    12361273            // return success
    12371274            remote_rwlock_rd_release( lock_xp );
     
    12441281    return NULL;
    12451282
    1246 }  // end vseg_from_vaddr()
     1283}  // end vmm_vseg_from_vaddr()
    12471284
    12481285/////////////////////////////////////////////
     
    12631300
    12641301    // get pointer on vseg
    1265         vseg_t * vseg = vseg_from_vaddr( vmm , base );
     1302        vseg_t * vseg = vmm_vseg_from_vaddr( vmm , base );
    12661303
    12671304        if( vseg == NULL)  return EINVAL;
     
    13431380                       vseg_t   ** found_vseg )
    13441381{
    1345     xptr_t   vseg_xp;
    1346     error_t  error;
    1347     vseg_t * vseg;
    1348     vmm_t  * vmm;
     1382    xptr_t    vseg_xp;
     1383    vseg_t  * vseg;
     1384    vmm_t   * vmm;
     1385    error_t   error;
    13491386
    13501387    // get pointer on local VMM
     
    13521389
    13531390    // try to get vseg from local VMM
    1354     vseg = vseg_from_vaddr( vmm , vaddr );
     1391    vseg = vmm_vseg_from_vaddr( vmm , vaddr );
    13551392
    13561393    if( vseg == NULL )   // vseg not found in local cluster => try to get it from ref
     
    13791416
    13801417        // register local vseg in local VMM
    1381         vmm_vseg_attach( &process->vmm , vseg );
     1418        vmm_vseg_attach( vmm , vseg );
    13821419    }   
    1383    
     1420
    13841421    // success
    13851422    *found_vseg = vseg;
     
    14001437
    14011438#if DEBUG_VMM_ALLOCATE_PAGE
     1439uint32_t   cycle = (uint32_t)hal_get_cycles();
     1440thread_t * this  = CURRENT_THREAD;
    14021441if( 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 );
     1442printk("\n[%s] thread[%x,%x] enter for vpn %x / cycle %d\n",
     1443__FUNCTION__ , this->process->pid, this->trdid, vpn, cycle );
    14051444#endif
    14061445
     
    14491488
    14501489#if DEBUG_VMM_ALLOCATE_PAGE
     1490cycle = (uint32_t)hal_get_cycles();
    14511491if( 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 ) ) );
     1492printk("\n[%s] thread[%x,%x] exit for vpn %x / ppn %x / cycle %d\n",
     1493__FUNCTION__ , this->process->pid, this->trdid, vpn,
     1494ppm_page2ppn( XPTR( page_cxy , page_ptr ) , cycle );
    14541495#endif
    14551496
     
    14741515
    14751516#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 );
     1517uint32_t   cycle = (uint32_t)hal_get_cycles();
     1518thread_t * this  = CURRENT_THREAD;
     1519if( DEBUG_VMM_GET_ONE_PPN < cycle )
     1520printk("\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 );
    14801522#endif
    14811523
     
    15391581#if (DEBUG_VMM_GET_ONE_PPN & 0x1)
    15401582if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() )
    1541 printk("\n[DBG] %s : thread %x for vpn = %x / elf_offset = %x\n",
    1542 __FUNCTION__, this, vpn, elf_offset );
     1583printk("\n[%s] thread[%x,%x] for vpn = %x / elf_offset = %x\n",
     1584__FUNCTION__, this->process->pid, this->trdid, vpn, elf_offset );
    15431585#endif
    15441586            // compute extended pointer on page base
     
    15531595#if (DEBUG_VMM_GET_ONE_PPN & 0x1)
    15541596if( 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 );
     1597printk("\n[%s] thread[%x,%x] for vpn %x / fully in BSS\n",
     1598__FUNCTION__, this->process->pid, this->trdid, vpn );
    15571599#endif
    15581600                if( GET_CXY( page_xp ) == local_cxy )
     
    15701612#if (DEBUG_VMM_GET_ONE_PPN & 0x1)
    15711613if( 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 );
     1614printk("\n[%s] thread[%x,%x] for vpn %x / fully in mapper\n",
     1615__FUNCTION__, this->process->pid, this->trdid, vpn );
    15741616#endif
    15751617                if( mapper_cxy == local_cxy )
     
    16011643#if (DEBUG_VMM_GET_ONE_PPN & 0x1)
    16021644if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() )
    1603 printk("\n[DBG] %s : thread %x for vpn = %x / both mapper & BSS\n"
     1645printk("\n[%s] thread[%x,%x] for vpn  %x / both mapper & BSS\n",
    16041646"      %d bytes from mapper / %d bytes from BSS\n",
    1605 __FUNCTION__, this, vpn,
     1647__FUNCTION__, this->process->pid, this->trdid, vpn,
    16061648file_size - offset , offset + CONFIG_PPM_PAGE_SIZE - file_size  );
    16071649#endif
     
    16471689
    16481690#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 );
     1691cycle = (uint32_t)hal_get_cycles();
     1692if( DEBUG_VMM_GET_ONE_PPN < cycle )
     1693printk("\n[%s] thread[%x,%x] exit for vpn %x / ppn %x / cycle\n",
     1694__FUNCTION__ , this->process->pid, this->trdid , vpn , *ppn, cycle );
    16521695#endif
    16531696
     
    16801723    if( error )
    16811724    {
    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",
    16831726        __FUNCTION__ , vpn , process->pid );
    16841727       
     
    16901733thread_t * this  = CURRENT_THREAD;
    16911734if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle )
    1692 printk("\n[DBG] %s : threadr[%x,%x] enter for vpn %x / %s / cycle %d\n",
     1735printk("\n[%s] threadr[%x,%x] enter for vpn %x / %s / cycle %d\n",
    16931736__FUNCTION__, this->process->pid, this->trdid, vpn, vseg_type_str(vseg->type), cycle );
    16941737#endif
     
    17051748
    17061749        // check VPN still unmapped in local GPT
     1750
    17071751        // do nothing if VPN has been mapped by a a concurrent page_fault
    17081752        hal_gpt_get_pte( local_gpt_xp,
     
    17571801cycle = (uint32_t)hal_get_cycles();
    17581802if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle )
    1759 printk("\n[DBG] %s : private page fault handled / vpn %x / ppn %x / attr %x / cycle %d\n",
     1803printk("\n[%s] private page fault handled / vpn %x / ppn %x / attr %x / cycle %d\n",
    17601804__FUNCTION__, vpn, new_ppn, new_attr, cycle );
    17611805#endif
     
    18121856                if( error )
    18131857                {
    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",
    18151859                    __FUNCTION__ , process->pid , vpn );
    18161860
     
    18341878cycle = (uint32_t)hal_get_cycles();
    18351879if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle )
    1836 printk("\n[DBG] %s : false page fault handled / vpn %x / ppn %x / attr %x / cycle %d\n",
     1880printk("\n[%s] false page fault handled / vpn %x / ppn %x / attr %x / cycle %d\n",
    18371881__FUNCTION__, vpn, ref_ppn, ref_attr, cycle );
    18381882#endif
     
    19041948cycle = (uint32_t)hal_get_cycles();
    19051949if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle )
    1906 printk("\n[DBG] %s : true page fault handled / vpn %x / ppn %x / attr %x / cycle %d\n",
     1950printk("\n[%s] true page fault handled / vpn %x / ppn %x / attr %x / cycle %d\n",
    19071951__FUNCTION__, vpn, new_ppn, new_attr, cycle );
    19081952#endif
     
    19311975thread_t * this  = CURRENT_THREAD;
    19321976if( DEBUG_VMM_HANDLE_COW < cycle )
    1933 printk("\n[DBG] %s : thread[%x,%x] enter for vpn %x / core[%x,%d] / cycle %d\n",
     1977printk("\n[%s] thread[%x,%x] enter for vpn %x / core[%x,%d] / cycle %d\n",
    19341978__FUNCTION__, process->pid, this->trdid, vpn, local_cxy, this->core->lid, cycle );
    19351979#endif
     
    19421986    if( error )
    19431987    {
    1944         printk("\n[PANIC] in %s : VPN %x in process %x not in registered vseg\n",
     1988        printk("\n[PANIC] in %s : vpn %x in process %x not in a registered vseg\n",
    19451989        __FUNCTION__, vpn, process->pid );
    19461990
     
    20352079#if(DEBUG_VMM_HANDLE_COW & 1)
    20362080if( DEBUG_VMM_HANDLE_COW < cycle )
    2037 printk("\n[DBG] %s : thread[%x,%x] : pending forks => allocate a new PPN %x\n",
     2081printk("\n[%s] thread[%x,%x] : pending forks => allocate a new PPN %x\n",
    20382082__FUNCTION__, process->pid, this->trdid, new_ppn );
    20392083#endif
     
    20452089#if(DEBUG_VMM_HANDLE_COW & 1)
    20462090if( DEBUG_VMM_HANDLE_COW < cycle )
    2047 printk("\n[DBG] %s : thread[%x,%x]  no pending forks => keep existing PPN %x\n",
     2091printk("\n[%s] thread[%x,%x]  no pending forks => keep existing PPN %x\n",
    20482092__FUNCTION__, process->pid, this->trdid, new_ppn );
    20492093#endif
     
    20922136cycle = (uint32_t)hal_get_cycles();
    20932137if( DEBUG_VMM_HANDLE_COW < cycle )
    2094 printk("\n[DBG] %s : thread[%x,%x] exit for vpn %x / core[%x,%d] / cycle %d\n",
     2138printk("\n[%s] thread[%x,%x] exit for vpn %x / core[%x,%d] / cycle %d\n",
    20952139__FUNCTION__, process->pid, this->trdid, vpn, local_cxy, this->core->lid, cycle );
    20962140#endif
  • trunk/kernel/mm/vmm.h

    r585 r595  
    275275/*********************************************************************************************
    276276 * This function allocates memory for a vseg descriptor, initialises it, and register it
    277  * in the VMM of the local process descriptor, that should be the reference process.
     277 * in the VMM of the local process descriptor, that must be the reference process.
    278278 * For the 'stack", "file", "anon", & "remote" types, it does not use the <base> argument,
    279279 * but uses the STACK and MMAP virtual memory allocators.
  • trunk/kernel/mm/vseg.c

    r567 r595  
    44 * Authors   Ghassan Almaless (2008,2009,2010,2011, 2012)
    55 *           Mohamed Lamine Karaoui (2015)
    6  *           Alain Greiner (2016)
     6 *           Alain Greiner (2016,2018,2019)
    77 *
    88 * Copyright (c) UPMC Sorbonne Universites
  • trunk/kernel/mm/vseg.h

    r567 r595  
    3636/*******************************************************************************************
    3737 * This enum defines the vseg types for an user process.
    38  ***********************************************************************************VSEG*******/
     38 ******************************************************************************************/
    3939
    4040typedef enum
Note: See TracChangeset for help on using the changeset viewer.