Changeset 818 for soft


Ignore:
Timestamp:
Apr 28, 2016, 1:12:23 PM (8 years ago)
Author:
cfuguet
Message:

Optimization: When doing a context switch between threads of the
same vspace and cluster, do not rewrite the PTPR register.

Location:
soft/giet_vm/giet_kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/ctx_handler.c

    r725 r818  
    180180        // makes context switch
    181181        _thread_switch( curr_ctx_vaddr , next_ctx_vaddr );
     182
     183        // only modify the PTPR when necessary, in order to avoid unnecessary
     184        // TLBs flush.
     185        if (curr_ctx_vaddr->slot[CTX_PTPR_ID] !=
     186            next_ctx_vaddr->slot[CTX_PTPR_ID])
     187        {
     188            _set_mmu_ptpr(next_ctx_vaddr->slot[CTX_PTPR_ID]);
     189        }
    182190    }
    183191} //end _ctx_switch()
     
    195203    while(1)
    196204    {
    197         // initialize counter
    198         unsigned int count = GIET_IDLE_THREAD_PERIOD;
    199 
    200         // decounting loop
    201         asm volatile(
    202                 "move   $3,   %0              \n"
    203                 "_idle_thread_loop:             \n"
    204                 "addi   $3,   $3,   -1        \n"
    205                 "bnez   $3,   _idle_thread_loop \n"
    206                 "nop                          \n"
    207                 :
    208                 : "r"(count)
    209                 : "$3" );
     205        _sleep( GIET_IDLE_THREAD_PERIOD );
    210206
    211207        // warning message
    212         _printf("\n[GIET WARNING] Processor[%d,%d,%d] still idle at cycle %d",
     208        _printf("\n[GIET WARNING] Processor[%d,%d,%d] still idle at cycle %u",
    213209                x , y , p , _get_proctime() );
    214210    }
  • soft/giet_vm/giet_kernel/switch.s

    r709 r818  
    116116    lw      $26,    35*4($27)
    117117    mtc0    $26,    $8          /* restore BVAR */
    118     lw      $26,    39*4($27)
    119     mtc2    $26,    $0          /* restore PTPR */
    120118
    121119    /* returns to caller */
Note: See TracChangeset for help on using the changeset viewer.