Changeset 435 for trunk/kernel/mm/kmem.c


Ignore:
Timestamp:
Feb 20, 2018, 5:32:17 PM (6 years ago)
Author:
alain
Message:

Fix a bad bug in scheduler...

File:
1 edited

Legend:

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

    r433 r435  
    145145        assert( ((type > 1) && (type < KMEM_TYPES_NR) ) , __FUNCTION__ , "illegal KCM type" );
    146146
    147         kmem_dmsg("\n[DBG] %s : enters / KCM type %s missing in cluster %x\n",
    148                   __FUNCTION__ , kmem_type_str( type ) , local_cxy );
     147#if CONFIG_DEBUG_KMEM
     148uint32_t cycle = (uint32_t)hal_get_cycles();
     149if( CONFIG_DEBUG_KMEM < cycle )
     150printk("\n[DBG] %s : thread %x enter / KCM type %s missing in cluster %x / cycle %d\n",
     151__FUNCTION__, CURRENT_THREAD, kmem_type_str( type ), local_cxy, cycle );
     152#endif
    149153
    150154        cluster_t * cluster = LOCAL_CLUSTER;
     
    169173        hal_fence();
    170174
    171         kmem_dmsg("\n[DBG] %s : exit / KCM type %s created in cluster %x\n",
    172                   __FUNCTION__ , kmem_type_str( type ) , local_cxy );
     175#if CONFIG_DEBUG_KMEM
     176cycle = (uint32_t)hal_get_cycles();
     177if( CONFIG_DEBUG_KMEM < cycle )
     178printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     179__FUNCTION__, CURRENT_THREAD, cycle );
     180#endif
    173181
    174182        return 0;
     
    192200        assert( (type < KMEM_TYPES_NR) , __FUNCTION__ , "illegal KMEM request type" );
    193201
    194         kmem_dmsg("\n[DBG] %s : enters in cluster %x for type %s\n",
    195                       __FUNCTION__ , local_cxy , kmem_type_str( type ) );
     202#if CONFIG_DEBUG_KMEM
     203uint32_t cycle = (uint32_t)hal_get_cycles();
     204if( CONFIG_DEBUG_KMEM < cycle )
     205printk("\n[DBG] %s : thread %x enter / type %s / cluster %x / cycle %d\n",
     206__FUNCTION__, CURRENT_THREAD, kmem_type_str( type ), local_cxy, cycle );
     207#endif
    196208
    197209        // analyse request type
    198210        if( type == KMEM_PAGE )                        // PPM allocator
    199211        {
    200 
    201 #if CONFIG_DEBUG_KMEM_ALLOC
    202 if( CONFIG_DEBUG_KMEM_ALLOC < (uint32_t)hal_get_cycles() )
    203 printk("\n[DBG] in %s : thread %x enter for %d page(s)\n",
    204 __FUNCTION__ , CURRENT_THREAD , 1<<size );
    205 #endif
    206 
    207212                // allocate the number of requested pages
    208213                ptr = (void *)ppm_alloc_pages( size );
     
    217222                if( flags & AF_ZERO ) page_zero( (page_t *)ptr );
    218223
    219                 kmem_dmsg("\n[DBG] %s : exit in cluster %x for type %s / page = %x / base = %x\n",
    220                           __FUNCTION__, local_cxy , kmem_type_str( type ) ,
    221                           (intptr_t)ptr , (intptr_t)ppm_page2base( ptr ) );
    222 
    223 #if CONFIG_DEBUG_KMEM_ALLOC
    224 if( CONFIG_DEBUG_KMEM_ALLOC < (uint32_t)hal_get_cycles() )
    225 printk("\n[DBG] in %s : thread %x exit / %d page(s) allocated / ppn = %x\n",
    226 __FUNCTION__ , CURRENT_THREAD , 1<<size , ppm_page2ppn( XPTR( local_cxy , ptr ) ) );
     224#if CONFIG_DEBUG_KMEM
     225cycle = (uint32_t)hal_get_cycles();
     226if( CONFIG_DEBUG_KMEM < cycle )
     227printk("\n[DBG] %s : thread %x exit / %d page(s) allocated / ppn %x / cycle %d\n",
     228__FUNCTION__, CURRENT_THREAD, 1<<size, ppm_page2ppn(XPTR(local_cxy,ptr)), cycle );
    227229#endif
    228230
     
    242244                if( flags & AF_ZERO ) memset( ptr , 0 , size );
    243245
    244                 kmem_dmsg("\n[DBG] %s : exit in cluster %x for type %s / base = %x / size = %d\n",
    245                           __FUNCTION__, local_cxy , kmem_type_str( type ) ,
    246                           (intptr_t)ptr , req->size );
     246#if CONFIG_DEBUG_KMEM
     247cycle = (uint32_t)hal_get_cycles();
     248if( CONFIG_DEBUG_KMEM < cycle )
     249printk("\n[DBG] %s : thread %x exit / type %s allocated / base %x / size %d / cycle %d\n",
     250__FUNCTION__, CURRENT_THREAD, kmem_type_str( type ), (intptr_t)ptr, size, cycle );
     251#endif
     252
    247253        }
    248254        else                                           // KCM allocator
     
    269275                if( flags & AF_ZERO ) memset( ptr , 0 , kmem_type_size( type ) );
    270276
    271                 kmem_dmsg("\n[DBG] %s : exit in cluster %x for type %s / base = %x / size = %d\n",
    272                           __FUNCTION__, local_cxy , kmem_type_str( type ) ,
    273                           (intptr_t)ptr , kmem_type_size( type ) );
     277#if CONFIG_DEBUG_KMEM
     278cycle = (uint32_t)hal_get_cycles();
     279if( CONFIG_DEBUG_KMEM < cycle )
     280printk("\n[DBG] %s : thread %x exit / type %s allocated / base %x / size %d / cycle %d\n",
     281__FUNCTION__, CURRENT_THREAD, kmem_type_str(type), (intptr_t)ptr,
     282kmem_type_size(type), cycle );
     283#endif
     284
    274285        }
    275286
Note: See TracChangeset for help on using the changeset viewer.