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


Ignore:
Timestamp:
Feb 14, 2018, 3:40:19 PM (7 years ago)
Author:
alain
Message:

blip

File:
1 edited

Legend:

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

    r407 r433  
    193193        list_add_first( &ppm->free_pages_root[current_order] , &current->list );
    194194        ppm->free_pages_nr[current_order] ++;
    195 }
     195
     196}  // end ppm_free_pages_nolock()
    196197
    197198////////////////////////////////////////////
     
    201202        page_t   * remaining_block;
    202203        uint32_t   current_size;
     204 
     205#if CONFIG_DEBUG_PPM_ALLOC_PAGES
     206uint32_t cycle = (uint32_t)hal_get_cycles();
     207if( CONFIG_DEBUG_PPM_ALLOC_PAGES < cycle )
     208printk("\n[DBG] in %s : thread %x enter for %d page(s) / cycle %d\n",
     209__FUNCTION__ , CURRENT_THREAD , 1<<order, cycle );
     210#endif
     211
     212#if(CONFIG_DEBUG_PPM_ALLOC_PAGES & 0x1)
     213if( CONFIG_DEBUG_PPM_ALLOC_PAGES < cycle )
     214ppm_print();
     215#endif
    203216
    204217        ppm_t    * ppm = &LOCAL_CLUSTER->ppm;
     
    208221
    209222        page_t * block = NULL; 
    210 
    211         ppm_dmsg("\n[DBG] %s : enters / order = %d\n",
    212                  __FUNCTION__ , order );
    213223
    214224        // take lock protecting free lists
     
    231241                spinlock_unlock( &ppm->free_lock );
    232242
     243#if CONFIG_DEBUG_PPM_ALLOC_PAGES
     244cycle = (uint32_t)hal_get_cycles();
     245if( CONFIG_DEBUG_PPM_ALLOC_PAGES < cycle )
     246printk("\n[DBG] in %s : thread %x cannot allocate %d page(s) at cycle %d\n",
     247__FUNCTION__ , CURRENT_THREAD , 1<<order, cycle );
     248#endif
     249
    233250                return NULL;
    234251        }
     
    260277        spinlock_unlock( &ppm->free_lock );
    261278
    262         ppm_dmsg("\n[DBG] %s : base = %x / order = %d\n",
    263                  __FUNCTION__ , (uint32_t)ppm_page2base( block ) , order );
     279#if CONFIG_DEBUG_PPM_ALLOC_PAGES
     280cycle = (uint32_t)hal_get_cycles();
     281if( CONFIG_DEBUG_PPM_ALLOC_PAGES < cycle )
     282printk("\n[DBG] in %s : thread %x exit / %d page(s) allocated / ppn = %x / cycle %d\n",
     283__FUNCTION__, CURRENT_THREAD, 1<<order, ppm_page2ppn(XPTR( local_cxy , block )), cycle );
     284#endif
    264285
    265286        return block;
    266 }
     287
     288}  // end ppm_alloc_pages()
    267289
    268290
     
    272294        ppm_t * ppm = &LOCAL_CLUSTER->ppm;
    273295
     296#if CONFIG_DEBUG_PPM_FREE_PAGES
     297uint32_t cycle = (uint32_t)hal_get_cycles();
     298if( CONFIG_DEBUG_PPM_FREE_PAGES < cycle )
     299printk("\n[DBG] in %s : thread %x enter for %d page(s) / cycle %d\n",
     300__FUNCTION__ , CURRENT_THREAD , 1<<page->order , cycle );
     301#endif
     302
     303#if(CONFIG_DEBUG_PPM_FREE_PAGES & 0x1)
     304if( CONFIG_DEBUG_PPM_FREE_PAGES < cycle )
     305ppm_print();
     306#endif
     307
    274308        // get lock protecting free_pages[] array
    275309        spinlock_lock( &ppm->free_lock );
     
    279313        // release lock protecting free_pages[] array
    280314        spinlock_unlock( &ppm->free_lock );
     315
     316#if CONFIG_DEBUG_PPM_FREE_PAGES
     317cycle = (uint32_t)hal_get_cycles();
     318if( CONFIG_DEBUG_PPM_FREE_PAGES < cycle )
     319printk("\n[DBG] in %s : thread %x exit / %d page(s) released / ppn = %x / cycle %d\n",
     320__FUNCTION__, CURRENT_THREAD, 1<<page->order, ppm_page2ppn(XPTR(local_cxy , page)), cycle );
     321#endif
     322
    281323}
    282324
    283 ////////////////////////////
    284 void ppm_print( ppm_t * ppm,
    285                 char  * string )
     325////////////////
     326void ppm_print()
    286327{
    287328        uint32_t       order;
     
    289330        page_t       * page;
    290331
     332    ppm_t * ppm = &LOCAL_CLUSTER->ppm;
     333
    291334        // get lock protecting free lists
    292335        spinlock_lock( &ppm->free_lock );
    293336
    294         printk("\n***  PPM in cluster %x : %d pages / &pages_tbl = %x / vaddr_base = %x ***\n",
    295     local_cxy , ppm->pages_nr , (intptr_t)ppm->pages_tbl , (intptr_t)ppm->vaddr_base );
     337        printk("\n***  PPM in cluster %x : %d pages ***\n", local_cxy , ppm->pages_nr );
    296338
    297339        for( order = 0 ; order < CONFIG_PPM_MAX_ORDER ; order++ )
    298340        {
    299                 printk("- order = %d / free_pages = %d  [",
     341                printk("- order = %d / free_pages = %d\t: ",
    300342                       order , ppm->free_pages_nr[order] );
    301343
     
    303345                {
    304346                        page = LIST_ELEMENT( iter , page_t , list );
    305                         printk("%d," , page - ppm->pages_tbl );
     347                        printk("%x," , page - ppm->pages_tbl );
    306348                }
    307349
    308                 printk("]\n", NULL );
     350                printk("\n");
    309351        }
    310352
Note: See TracChangeset for help on using the changeset viewer.