Changeset 635 for trunk/kernel/mm/vmm.h


Ignore:
Timestamp:
Jun 26, 2019, 11:42:37 AM (5 years ago)
Author:
alain
Message:

This version is a major evolution: The physical memory allocators,
defined in the kmem.c, ppm.c, and kcm.c files have been modified
to support remote accesses. The RPCs that were previously user
to allocate physical memory in a remote cluster have been removed.
This has been done to cure a dead-lock in case of concurrent page-faults.

This version 2.2 has been tested on a (4 clusters / 2 cores per cluster)
TSAR architecture, for both the "sort" and the "fft" applications.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/vmm.h

    r632 r635  
    5252 * - The allocator checks that the requested slot has not been already allocated, and set the
    5353 *   corresponding bit in the bitmap.
    54  * - The de-allocator function reset the corresponding bit in the bitmap.
     54 * - The de-allocator reset the corresponding bit in the bitmap.
    5555 ********************************************************************************************/
    5656
     
    112112typedef struct vmm_s
    113113{
    114         remote_rwlock_t  vsl_lock;           /*! lock protecting the local VSL                  */
    115         xlist_entry_t    vsegs_root;         /*! Virtual Segment List (complete in reference)   */
    116         uint32_t         vsegs_nr;           /*! total number of local vsegs                    */
    117 
    118     gpt_t            gpt;                /*! Generic Page Table (complete in reference)     */
    119 
    120     stack_mgr_t      stack_mgr;          /*! embedded STACK vsegs allocator                 */
    121     mmap_mgr_t       mmap_mgr;           /*! embedded MMAP vsegs allocator                  */
    122 
    123         uint32_t         pgfault_nr;         /*! page fault counter (instrumentation)           */
    124 
    125     vpn_t            args_vpn_base;      /*! args vseg first page                           */
    126     vpn_t            envs_vpn_base;      /*! envs vseg first page                           */
    127         vpn_t            code_vpn_base;      /*! code vseg first page                           */
    128         vpn_t            data_vpn_base;      /*! data vseg first page                           */
    129     vpn_t            heap_vpn_base;      /*! heap zone first page                           */
    130 
    131         intptr_t         entry_point;        /*! main thread entry point                        */
     114        remote_rwlock_t  vsl_lock;            /*! lock protecting the local VSL                 */
     115        xlist_entry_t    vsegs_root;          /*! Virtual Segment List (complete in reference)  */
     116        uint32_t         vsegs_nr;            /*! total number of local vsegs                   */
     117
     118    gpt_t            gpt;                 /*! Generic Page Table (complete in reference)    */
     119
     120    stack_mgr_t      stack_mgr;           /*! embedded STACK vsegs allocator                */
     121    mmap_mgr_t       mmap_mgr;            /*! embedded MMAP vsegs allocator                 */
     122
     123        uint32_t         false_pgfault_nr;    /*! false page fault counter (for all threads)    */
     124        uint32_t         local_pgfault_nr;    /*! false page fault counter (for all threads)    */
     125        uint32_t         global_pgfault_nr;   /*! false page fault counter (for all threads)    */
     126    uint32_t         false_pgfault_cost;  /*! cumulated cost (for all threads)              */
     127    uint32_t         local_pgfault_cost;  /*! cumulated cost (for all threads)              */
     128    uint32_t         global_pgfault_cost; /*! cumulated cost (for all threads)              */
     129
     130    vpn_t            args_vpn_base;       /*! args vseg first page                          */
     131    vpn_t            envs_vpn_base;       /*! envs vseg first page                          */
     132        vpn_t            code_vpn_base;       /*! code vseg first page                          */
     133        vpn_t            data_vpn_base;       /*! data vseg first page                          */
     134    vpn_t            heap_vpn_base;       /*! heap zone first page                          */
     135
     136        intptr_t         entry_point;         /*! main thread entry point                       */
    132137}
    133138vmm_t;
    134139
    135140/*********************************************************************************************
    136  * This function mkkes a partial initialisation of the VMM attached to an user process.
    137  * The GPT must have been previously created, with the hal_gpt_create() function.
    138  * - It registers "args", "envs" vsegs in the VSL.
    139  * - It initializes the STACK and MMAP allocators.
    140  * Note:
     141 * This function makes only a partial initialisation of the VMM attached to an user
     142 * process: It intializes the STACK and MMAP allocators, and the VSL lock.
     143 * - The GPT has been previously created, with the hal_gpt_create() function.
     144 * - The "kernel" vsegs are previously registered, by the hal_vmm_kernel_update() function.
    141145 * - The "code" and "data" vsegs are registered by the elf_load_process() function.
    142146 * - The "stack" vsegs are dynamically registered by the thread_user_create() function.
     
    165169 * This function is called by the process_make_fork() function. It partially copies
    166170 * the content of a remote parent process VMM to the local child process VMM:
     171 * - The KERNEL vsegs required by the architecture must have been previously
     172 *   created in the child VMM, using the hal_vmm_kernel_update() function.
    167173 * - The DATA, ANON, REMOTE vsegs registered in the parent VSL are registered in the
    168  *   child VSL. All valid PTEs in parent GPT are copied to the child GPT, but the
    169  *   WRITABLE flag is reset and the COW flag is set.
     174 *   child VSL. All valid PTEs in parent GPT are copied to the child GPT.
     175 *   The WRITABLE  and COW flags are not modified, as it will be done later for those
     176 *   shared pages by the vmm_set_cow() function.
    170177 * - The CODE vsegs registered in the parent VSL are registered in the child VSL, but the
    171178 *   GPT entries are not copied in the child GPT, and will be dynamically updated from
     
    173180 * - The FILE vsegs registered in the parent VSL are registered in the child VSL, and all
    174181 *   valid GPT entries in parent GPT are copied to the child GPT. The COW flag is not set.
    175  * - No STACK vseg is copied from  parent VMM to child VMM, because the child stack vseg
    176  *   must be copied later from the cluster containing the user thread requesting the fork().
    177  * - The KERNEL vsegs required by the target architecture are re-created in the child
    178  *   VMM, from the local kernel process VMM, using the hal_vmm_kernel_update() function.
     182 * - No STACK vseg is copied from  parent VMM to child VMM: the child stack vseg is copied
     183 *   later from the cluster containing the user thread requesting the fork().
    179184 *********************************************************************************************
    180185 * @ child_process     : local pointer on local child process descriptor.
     
    203208 * This function modifies one GPT entry identified by the <process> and <vpn> arguments
    204209 * in all clusters containing a process copy. It is used to maintain coherence in GPT
    205  * copies, using the list of copies stored in the owner process, and remote_write accesses.
     210 * copies, using remote_write accesses.
    206211 * It must be called by a thread running in the process owner cluster.
    207212 * Use the RPC_VMM_GLOBAL_UPDATE_PTE if required.
     
    248253 * - For the FILE, ANON, & REMOTE types, it does not use the <base> and <size> arguments,
    249254 *   but uses the specific MMAP virtual memory allocator.
    250  * - For the STACK type, it does not use the <size> argument, and the <base> argument
    251  *   defines the user thread LTID used by the specific STACK virtual memory allocator.
    252  * It checks collision with all pre-existing vsegs.
     255 * - For the STACK type, it does not use the <base> and <size> arguments,  but uses the
     256 *   and the <base> argument the specific STACK virtual memory allocator.
     257 * It checks collision with pre-existing vsegs.
    253258 * To comply with the "on-demand" paging policy, this function does NOT modify the GPT,
    254259 * and does not allocate physical memory for vseg data.
Note: See TracChangeset for help on using the changeset viewer.