Changeset 629 for trunk/kernel/kern


Ignore:
Timestamp:
May 17, 2019, 9:27:04 AM (6 years ago)
Author:
alain
Message:

Remove the "giant" rwlock protecting the GPT, and
use the GPT_LOCKED attribute in each PTE to prevent
concurrent modifications of one GPT entry.
The version number has been incremented to 2.1.

Location:
trunk/kernel/kern
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/kernel_init.c

    r628 r629  
    171171    "VFS_FILE",              // 33
    172172    "VMM_VSL",               // 34
    173     "VMM_GPT",               // 35
    174     "VFS_MAIN",              // 36
    175     "FATFS_FAT",             // 37
     173    "VFS_MAIN",              // 35
     174    "FATFS_FAT",             // 36
    176175};       
    177176
  • trunk/kernel/kern/process.c

    r626 r629  
    166166#endif
    167167
    168     // initialize GPT and VSL locks
    169     remote_rwlock_init( XPTR( local_cxy , &vmm->gpt_lock ) , LOCK_VMM_GPT );
     168    // initialize VSL locks
    170169        remote_rwlock_init( XPTR( local_cxy , &vmm->vsl_lock ) , LOCK_VMM_VSL );
    171170
     
    426425
    427426    // initialize GPT and VSL locks
    428     remote_rwlock_init( XPTR( local_cxy , &vmm->gpt_lock ) , LOCK_VMM_GPT );
    429427        remote_rwlock_init( XPTR( local_cxy , &vmm->vsl_lock ) , LOCK_VMM_VSL );
    430428
     
    14821480
    14831481    // set COW flag in DATA, ANON, REMOTE vsegs for parent process VMM
    1484     // this includes all parnet process copies in all clusters
     1482    // this includes all parent process copies in all clusters
    14851483    if( parent_process_cxy == local_cxy )   // reference is local
    14861484    {
     
    17071705
    17081706    // initialize VSL and GPT locks
    1709         remote_rwlock_init( XPTR( local_cxy , &vmm->vsl_lock ) , LOCK_VMM_VSL );
    1710     remote_rwlock_init( XPTR( local_cxy , &vmm->gpt_lock ) , LOCK_VMM_GPT );
     1707    remote_rwlock_init( XPTR( local_cxy , &vmm->vsl_lock ) , LOCK_VMM_VSL );
    17111708   
    17121709    // create kernel vsegs in GPT and VSL, as required by the hardware architecture
  • trunk/kernel/kern/rpc.c

    r628 r629  
    104104    "VFS_FILE_CREATE",           // 14
    105105    "VFS_FILE_DESTROY",          // 15
    106     "VFS_FS_GET_DENTRY",         // 16
     106    "VFS_FS_NEW_DENTRY",         // 16
    107107    "VFS_FS_ADD_DENTRY",         // 17
    108108    "VFS_FS_REMOVE_DENTRY",      // 18
  • trunk/kernel/kern/scheduler.c

    r625 r629  
    6363// @ returns pointer on selected thread descriptor
    6464////////////////////////////////////////////////////////////////////////////////////////////
    65 thread_t * sched_select( scheduler_t * sched )
     65static thread_t * sched_select( scheduler_t * sched )
    6666{
    6767    thread_t     * thread;
     
    248248uint32_t cycle = (uint32_t)hal_get_cycles();
    249249if( DEBUG_SCHED_HANDLE_SIGNALS < cycle )
    250 printk("\n[%s] thread[%x,%x] on core[%x,%d] deleted / %d threads / cycle %d\n",
     250printk("\n[%s] thread[%x,%x] on core[%x,%d] deleted (still %d threads) / cycle %d\n",
    251251__FUNCTION__, process->pid, thread->trdid, local_cxy, thread->core->lid, count, cycle );
     252#endif
     253
     254#if CONFIG_INSTRUMENTATION_PGFAULTS
     255uint32_t local_nr    = thread->info.local_pgfault_nr;
     256uint32_t local_cost  = (local_nr == 0)  ? 0 : (thread->info.local_pgfault_cost / local_nr);
     257uint32_t global_nr   = thread->info.global_pgfault_nr;
     258uint32_t global_cost = (global_nr == 0) ? 0 : (thread->info.global_pgfault_cost / global_nr);
     259uint32_t false_nr    = thread->info.false_pgfault_nr;
     260uint32_t false_cost  = (false_nr == 0)  ? 0 : (thread->info.false_pgfault_cost / false_nr);
     261printk("***** page faults for thread[%x,%x]\n"
     262       "  - %d local  : %d cycles\n"
     263       "  - %d global : %d cycles\n"
     264       "  - %d false  : %d cycles\n",
     265       process->pid, thread->trdid,
     266       local_nr,  local_cost,
     267       global_nr, global_cost,
     268       false_nr,  false_cost );
    252269#endif
    253270            // destroy process descriptor if last thread
     
    481498 
    482499#if (DEBUG_SCHED_YIELD & 0x1)
    483 // if( sched->trace )
    484 if( (uint32_t)hal_get_cycles() > DEBUG_SCHED_YIELD )
     500if( sched->trace )
    485501sched_display( lid );
    486502#endif
     
    535551
    536552#if DEBUG_SCHED_YIELD
    537 // if( sched->trace )
    538 if( (uint32_t)hal_get_cycles() > DEBUG_SCHED_YIELD )
     553if( sched->trace )
    539554printk("\n[%s] core[%x,%d] / cause = %s\n"
    540555"      thread %x (%s) (%x,%x) => thread %x (%s) (%x,%x) / cycle %d\n",
     
    553568
    554569#if (DEBUG_SCHED_YIELD & 1)
    555 // if( sched->trace )
    556 if( (uint32_t)hal_get_cycles() > DEBUG_SCHED_YIELD )
     570if( sched->trace )
    557571printk("\n[%s] core[%x,%d] / cause = %s\n"
    558572"      thread %x (%s) (%x,%x) continue / cycle %d\n",
  • trunk/kernel/kern/thread.c

    r625 r629  
    907907
    908908    // update target process instrumentation counter
    909         process->vmm.pgfault_nr += thread->info.pgfault_nr;
     909        // process->vmm.pgfault_nr += thread->info.pgfault_nr;
    910910
    911911    // remove thread from process th_tbl[]
  • trunk/kernel/kern/thread.h

    r625 r629  
    100100typedef struct thread_info_s
    101101{
    102         uint32_t              pgfault_nr;    /*! cumulated number of page fault           */
    103         cycle_t               last_cycle;    /*! last cycle counter value (date)          */
    104         cycle_t               usr_cycles;    /*! user execution duration (cycles)         */
    105         cycle_t               sys_cycles;    /*! system execution duration (cycles)       */
     102        uint32_t     false_pgfault_nr;       /*! number of local page fault               */
     103    uint32_t     false_pgfault_cost;     /*! cumulated cost                           */
     104        uint32_t     local_pgfault_nr;       /*! number of local page fault               */
     105    uint32_t     local_pgfault_cost;     /*! cumulated cost                           */
     106        uint32_t     global_pgfault_nr;      /*! number of global page fault              */
     107    uint32_t     global_pgfault_cost;    /*! cumulated cost                           */
     108
     109        cycle_t      last_cycle;             /*! last cycle counter value (date)          */
     110        cycle_t      usr_cycles;             /*! user execution duration (cycles)         */
     111        cycle_t      sys_cycles;             /*! system execution duration (cycles)       */
    106112}
    107113thread_info_t;
Note: See TracChangeset for help on using the changeset viewer.