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/mapper.c

    r408 r435  
    143143    error_t       error;
    144144
    145 mapper_dmsg("\n[DBG] %s : core[%x,%d] enters for page %d / mapper %x\n",
    146 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , index , mapper );
     145#if CONFIG_DEBUG_MAPPER_GET_PAGE
     146uint32_t cycle = (uint32_t)hal_get_cycles();
     147if( CONFIG_DEBUG_MAPPER_GET_PAGE < cycle )
     148printk("\n[DBG] %s : thread %x enter for page %d / mapper %x / cycle %d\n",
     149__FUNCTION__ , CURRENT_THREAD , index , mapper , cycle );
     150#endif
    147151
    148152    thread_t * this = CURRENT_THREAD;
     
    171175        {
    172176
    173 mapper_dmsg("\n[DBG] %s : core[%x,%d] missing page => load from device\n",
    174 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid );
    175 
     177#if (CONFIG_DEBUG_MAPPER_GET_PAGE & 1)
     178if( CONFIG_DEBUG_MAPPER_GET_PAGE < cycle )
     179printk("\n[DBG] %s : missing page => load from device\n", __FUNCTION__ );
     180#endif
    176181            // allocate one page from PPM
    177182            req.type  = KMEM_PAGE;
     
    230235            // reset the page INLOAD flag to make the page available to all readers
    231236            page_clear_flag( page , PG_INLOAD );
    232 
    233 mapper_dmsg("\n[DBG] %s : missing page loaded / ppn = %x\n",
    234 __FUNCTION__ , ppm_page2ppn(XPTR(local_cxy,page)) );
    235 
    236237        }
    237238        else if( page_is_flag( page , PG_INLOAD ) )   // page is loaded by another thread
     
    256257    }
    257258
    258 mapper_dmsg("\n[DBG] %s : exit for page %d / mapper %x / page_desc = %x\n",
    259 __FUNCTION__ , index , mapper , page );
     259#if CONFIG_DEBUG_MAPPER_GET_PAGE
     260cycle = (uint32_t)hal_get_cycles();
     261if( CONFIG_DEBUG_MAPPER_GET_PAGE < cycle )
     262printk("\n[DBG] %s : thread %x exit for page %d / ppn %x / cycle %d\n",
     263__FUNCTION__, CURRENT_THREAD, index, ppm_page2ppn(XPTR(local_cxy, page)), cycle );
     264#endif
    260265
    261266    return page;
     
    312317    uint8_t  * buf_ptr;        // current buffer  address
    313318
    314     mapper_dmsg("\n[DBG] %s : enters / to_buf = %d / buffer = %x\n",
    315                 __FUNCTION__ , to_buffer , buffer );
     319#if CONFIG_DEBUG_MAPPER_MOVE_USER
     320uint32_t cycle = (uint32_t)hal_get_cycles();
     321if( CONFIG_DEBUG_MAPPER_MOVE_USER < cycle )
     322printk("\n[DBG] %s : thread %x enter / to_buf %d / buffer %x / cycle %d\n",
     323__FUNCTION__ , CURRENT_THREAD , to_buffer , buffer , cycle );
     324#endif
    316325
    317326    // compute offsets of first and last bytes in file
     
    338347        else                       page_count = CONFIG_PPM_PAGE_SIZE;
    339348
    340         mapper_dmsg("\n[DBG] %s : index = %d / offset = %d / count = %d\n",
    341                     __FUNCTION__ , index , page_offset , page_count );
     349#if (CONFIG_DEBUG_MAPPER_MOVE_USER & 1)
     350if( CONFIG_DEBUG_MAPPER_MOVE_USER < cycle )
     351printk("\n[DBG] %s : index = %d / offset = %d / count = %d\n",
     352__FUNCTION__ , index , page_offset , page_count );
     353#endif
    342354
    343355        // get page descriptor
     
    353365        buf_ptr = (uint8_t *)buffer + done;
    354366
    355         mapper_dmsg("\n[DBG] %s : index = %d / buf_ptr = %x / map_ptr = %x\n",
    356                     __FUNCTION__ , index , buf_ptr , map_ptr );
    357 
    358367        // move fragment
    359368        if( to_buffer )
     
    370379    }
    371380
    372     mapper_dmsg("\n[DBG] %s : exit for buffer %x\n",
    373                 __FUNCTION__, buffer );
     381#if CONFIG_DEBUG_MAPPER_MOVE_USER
     382cycle = (uint32_t)hal_get_cycles();
     383if( CONFIG_DEBUG_MAPPER_MOVE_USER < cycle )
     384printk("\n[DBG] %s : thread %x exit / to_buf %d / buffer %x / cycle %d\n",
     385__FUNCTION__ , CURRENT_THREAD , to_buffer , buffer , cycle );
     386#endif
    374387
    375388    return 0;
     
    399412    uint8_t * buffer_ptr = (uint8_t *)GET_PTR( buffer_xp );
    400413
    401 mapper_dmsg("\n[DBG] %s : core[%x,%d] / to_buf = %d / buf_cxy = %x / buf_ptr = %x / size = %x\n",
    402 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, to_buffer, buffer_cxy, buffer_ptr, size );
     414#if CONFIG_DEBUG_MAPPER_MOVE_KERNEL
     415uint32_t cycle = (uint32_t)hal_get_cycles();
     416if( CONFIG_DEBUG_MAPPER_MOVE_KERNEL < cycle )
     417printk("\n[DBG] %s : thread %x enter / to_buf %d / buf_cxy %x / buf_ptr %x / cycle %d\n",
     418__FUNCTION__ , CURRENT_THREAD , to_buffer , buffer_cxy , buffer_ptr , cycle );
     419#endif
    403420
    404421    // compute offsets of first and last bytes in file
     
    410427    uint32_t last  = max_byte >> CONFIG_PPM_PAGE_SHIFT;
    411428
    412 mapper_dmsg("\n[DBG] %s : core[%x,%d] / first_page = %d / last_page = %d\n",
    413 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, first, last );
     429#if (CONFIG_DEBUG_MAPPER_MOVE_KERNEL & 1)
     430if( CONFIG_DEBUG_MAPPER_MOVE_KERNEL < cycle )
     431printk("\n[DBG] %s : first_page %d / last_page %d\n", __FUNCTION__, first, last );
     432#endif
    414433
    415434    // compute source and destination clusters
     
    440459        else                       page_count = CONFIG_PPM_PAGE_SIZE;
    441460
    442 mapper_dmsg("\n[DBG] %s : core[%x;%d] / page_index = %d / offset = %d / bytes = %d\n",
    443 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, index, page_offset, page_count );
     461#if (CONFIG_DEBUG_MAPPER_MOVE_KERNEL & 1)
     462if( CONFIG_DEBUG_MAPPER_MOVE_KERNEL < cycle )
     463printk("\n[DBG] %s : page_index = %d / offset = %d / bytes = %d\n",
     464__FUNCTION__ , index , page_offset , page_count );
     465#endif
    444466
    445467        // get page descriptor
     
    472494    }
    473495
    474 mapper_dmsg("\n[DBG] %s : core_cxy[%x,%d] / exit / buf_cxy = %x / buf_ptr = %x / size = %x\n",
    475 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, buffer_cxy, buffer_ptr, size );
     496#if CONFIG_DEBUG_MAPPER_MOVE_KERNEL
     497cycle = (uint32_t)hal_get_cycles();
     498if( CONFIG_DEBUG_MAPPER_MOVE_KERNEL < cycle )
     499printk("\n[DBG] %s : thread %x exit / to_buf %d / buf_cxy %x / buf_ptr %x / cycle %d\n",
     500__FUNCTION__ , CURRENT_THREAD , to_buffer , buffer_cxy , buffer_ptr , cycle );
     501#endif
    476502
    477503    return 0;
Note: See TracChangeset for help on using the changeset viewer.