Changeset 611 for trunk/kernel/mm/ppm.c


Ignore:
Timestamp:
Jan 9, 2019, 3:02:51 PM (6 years ago)
Author:
alain
Message:

Introduce sigificant modifs in VFS to support the <ls> command,
and the . and .. directories entries.

File:
1 edited

Legend:

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

    r610 r611  
    210210
    211211#if DEBUG_PPM_ALLOC_PAGES
     212thread_t * this = CURRENT_THREAD;
    212213uint32_t cycle = (uint32_t)hal_get_cycles();
    213214if( DEBUG_PPM_ALLOC_PAGES < cycle )
    214 printk("\n[DBG] in %s : thread %x in process %x enter for %d page(s) / cycle %d\n",
    215 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, 1<<order, cycle );
     215printk("\n[%s] thread[%x,%x] enter for %d page(s) / cycle %d\n",
     216__FUNCTION__, this->process->pid, this->trdid, 1<<order, cycle );
    216217#endif
    217218
    218219#if(DEBUG_PPM_ALLOC_PAGES & 0x1)
    219220if( DEBUG_PPM_ALLOC_PAGES < cycle )
    220 ppm_print();
     221ppm_print("enter ppm_alloc_pages");
    221222#endif
    222223
    223224        ppm_t    * ppm = &LOCAL_CLUSTER->ppm;
    224225
    225         assert( (order < CONFIG_PPM_MAX_ORDER) ,
    226     "illegal order argument = %x\n" , order );
     226// check order
     227assert( (order < CONFIG_PPM_MAX_ORDER) , "illegal order argument = %d\n" , order );
    227228
    228229        page_t * block = NULL; 
     
    250251cycle = (uint32_t)hal_get_cycles();
    251252if( DEBUG_PPM_ALLOC_PAGES < cycle )
    252 printk("\n[DBG] in %s : thread %x in process %x cannot allocate %d page(s) / cycle %d\n",
    253 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, 1<<order, cycle );
     253printk("\n[%s] thread[%x,%x] cannot allocate %d page(s) / cycle %d\n",
     254__FUNCTION__, this->process->pid, this->trdid, 1<<order, cycle );
    254255#endif
    255256
     
    289290cycle = (uint32_t)hal_get_cycles();
    290291if( DEBUG_PPM_ALLOC_PAGES < cycle )
    291 printk("\n[DBG] in %s : thread %x in process %x exit for %d page(s) / ppn = %x / cycle %d\n",
    292 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid,
     292printk("\n[%s] thread[%x,%x] exit for %d page(s) / ppn = %x / cycle %d\n",
     293__FUNCTION__, this->process->pid, this->trdid,
    2932941<<order, ppm_page2ppn(XPTR( local_cxy , block )), cycle );
     295#endif
     296
     297#if(DEBUG_PPM_ALLOC_PAGES & 0x1)
     298if( DEBUG_PPM_ALLOC_PAGES < cycle )
     299ppm_print("exit ppm_alloc_pages");
    294300#endif
    295301
     
    307313uint32_t cycle = (uint32_t)hal_get_cycles();
    308314if( DEBUG_PPM_FREE_PAGES < cycle )
    309 printk("\n[DBG] in %s : thread %x in process %x enter for %d page(s) / ppn %x / cycle %d\n",
    310 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid,
     315printk("\n[%s] thread[%x,%x] enter for %d page(s) / ppn %x / cycle %d\n",
     316__FUNCTION__, this->process->pid, this->trdid,
    3113171<<page->order, ppm_page2ppn(XPTR(local_cxy , page)), cycle );
    312318#endif
     
    314320#if(DEBUG_PPM_FREE_PAGES & 0x1)
    315321if( DEBUG_PPM_FREE_PAGES < cycle )
    316 ppm_print();
     322ppm_print("enter ppm_free_pages");
    317323#endif
    318324
     
    331337cycle = (uint32_t)hal_get_cycles();
    332338if( DEBUG_PPM_FREE_PAGES < cycle )
    333 printk("\n[DBG] in %s : thread %x in process %x exit for %d page(s) / ppn %x / cycle %d\n",
    334 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid,
     339printk("\n[%s] thread[%x,%x] exit for %d page(s) / ppn %x / cycle %d\n",
     340__FUNCTION__, this->process->pid, this->trdid,
    3353411<<page->order, ppm_page2ppn(XPTR(local_cxy , page)), cycle );
    336342#endif
    337343
     344#if(DEBUG_PPM_FREE_PAGES & 0x1)
     345if( DEBUG_PPM_FREE_PAGES < cycle )
     346ppm_print("exit ppm_free_pages");
     347#endif
     348
    338349}  // end ppm_free_pages()
    339350
    340 //////////////////////
    341 void ppm_print( void )
     351///////////////////////////////
     352void ppm_print( char * string )
    342353{
    343354        uint32_t       order;
     
    350361        busylock_acquire( &ppm->free_lock );
    351362
    352         printk("\n***  PPM in cluster %x : %d pages ***\n", local_cxy , ppm->pages_nr );
     363        printk("\n***  PPM in cluster %x / %s / %d pages ***\n",
     364    local_cxy , string, ppm->pages_nr );
    353365
    354366        for( order = 0 ; order < CONFIG_PPM_MAX_ORDER ; order++ )
     
    413425    xptr_t dirty_lock_xp = XPTR( page_cxy , &ppm->dirty_lock );
    414426           
    415 // printk("\n@@@ %s : before dirty_list lock aquire\n", __FUNCTION__ );
    416 
    417427        // lock the remote PPM dirty_list
    418428        remote_queuelock_acquire( dirty_lock_xp );
    419429
    420 // printk("\n@@@ %s : after dirty_list lock aquire\n", __FUNCTION__ );
    421 
    422430    // lock the remote page
    423431    remote_busylock_acquire( page_lock_xp );
    424 
    425 // printk("\n@@@ %s : after page lock aquire\n", __FUNCTION__ );
    426432
    427433    // get remote page flags
     
    466472        }
    467473
    468 // printk("\n@@@ %s : before page lock release\n", __FUNCTION__ );
    469 
    470474    // unlock the remote page
    471475    remote_busylock_release( page_lock_xp );
    472476
    473 // printk("\n@@@ %s : after page lock release\n", __FUNCTION__ );
    474 
    475477        // unlock the remote PPM dirty_list
    476478        remote_queuelock_release( dirty_lock_xp );
    477 
    478 // printk("\n@@@ %s : after page lock aquire\n", __FUNCTION__ );
    479479
    480480        return done;
Note: See TracChangeset for help on using the changeset viewer.