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


Ignore:
Timestamp:
Feb 14, 2018, 3:40:19 PM (4 years ago)
Author:
alain
Message:

blip

File:
1 edited

Legend:

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

    r429 r433  
    9999 *    a remote_rwlock, because it can be accessed by a thread running in a remote cluster.
    100100 *    An exemple is the vmm_fork_copy() function.
    101  * 2. In most custers, the VSL and GPT are only partial copies of the reference VSL and GPT
     101 * 2. In most clusters, the VSL and GPT are only partial copies of the reference VSL and GPT
    102102 *    structures, stored in the reference cluster.
    103103 ********************************************************************************************/
     
    155155
    156156/*********************************************************************************************
    157  * This function is called by the process_fork_create() function. It partially copies
     157 * This function is called by the process_make_fork() function. It partially copies
    158158 * the content of a remote parent process VMM to the local child process VMM:
    159159 * - all DATA, MMAP, REMOTE vsegs registered in the parent VSL are registered in the child
     
    176176
    177177/*********************************************************************************************
    178  * This function is called by the process_make_fork() function to handle the fork syscall.
     178 * This function is called by the process_make_fork() function executing the fork syscall.
    179179 * It set the COW flag, and reset the WRITABLE flag of all GPT entries of the DATA, MMAP,
    180180 * and REMOTE vsegs of a process identified by the <process> argument.
    181181 * It must be called by a thread running in the reference cluster, that contains the complete
    182  * list of vsegs. Use the rpc_vmm_set_cow_client() when the calling thread client is remote.
     182 * VSL and GPT (use the rpc_vmm_set_cow_client() when the calling thread client is remote).
    183183 * It updates all copies of the process in all clusters, to maintain coherence in GPT copies,
    184184 * using the list of copies stored in the owner process, and using remote_write accesses to
    185  * update the remote GPTs. It cannot fail, as only mapped entries in GPT copies are updated.
     185 * update the remote GPTs. It atomically increment the pending_fork counter, in all involved
     186 * physical page descriptors. It cannot fail, as only mapped entries in GPTs are updated.
    186187 *********************************************************************************************
    187188 * @ process   : local pointer on local reference process descriptor.
     
    190191
    191192/*********************************************************************************************
    192  * This function is called by the vmm_get_pte() function in case of COW exception.
    193  * It modifies both the PPN an the attributes for a GPT entry identified by the <process>
    194  * and <vpn> arguments.
     193 * This global function modifies a GPT entry identified  by the <process> and <vpn>
     194 * arguments in all clusters containing a process copy.
     195 * It must be called by a thread running in the reference cluster.
    195196 * It updates all copies of the process in all clusters, to maintain coherence in GPT copies,
    196197 * using the list of copies stored in the owner process, and using remote_write accesses to
     
    202203 * @ ppn       : PTE / physical page index.
    203204 ********************************************************************************************/
    204 void vmm_update_pte( struct process_s * process,
    205                      vpn_t              vpn,
    206                      uint32_t           attr,
    207                      ppn_t              ppn );
    208 
    209 /*********************************************************************************************
    210  * This function scan the list of vsegs registered in the VSL of the process
    211  * identified by the <process> argument, and for each vseg:
    212  * - it unmap from the GPT and releases all mapped pages in vseg.
    213  * - it removes the vseg from the process VSL.
    214  * - It releases the memory allocated to the vseg descriptor.
     205void vmm_global_update_pte( struct process_s * process,
     206                            vpn_t              vpn,
     207                            uint32_t           attr,
     208                            ppn_t              ppn );
     209
     210/*********************************************************************************************
     211 * This function unmaps from the local GPT all mapped PTEs of a vseg identified by the
     212 * <process> and <vseg> arguments. It can be used for any type of vseg.
     213 * If this function is executed in the reference cluster, it handles for each referenced
     214 * physical pages the pending forks counter :
     215 * - if counter is non-zero, it decrements it.
     216 * - if counter is zero, it releases the physical page to local kmem allocator.
     217 *********************************************************************************************
     218 * @ process  : pointer on process descriptor.
     219 * @ vseg     : pointer on the vseg to be unmapped.
     220 ********************************************************************************************/
     221void vmm_unmap_vseg( struct process_s * process,
     222                     vseg_t           * vseg );
     223
     224/*********************************************************************************************
     225 * This function deletes, in the local cluster, all vsegs registered in the VSL
     226 * of the process identified by the <process> argument. For each vseg:
     227 * - it unmaps all vseg PTEs from the GPT (release the physical pages when required).
     228 * - it removes the vseg from the local VSL.
     229 * - it releases the memory allocated to the local vseg descriptors.
    215230 * Finally, it releases the memory allocated to the GPT itself.
    216231 *********************************************************************************************
     
    291306
    292307/*********************************************************************************************
    293  * This function unmaps all mapped PTEs of a given vseg, from the generic page table
    294  * associated to a given process descriptor, and releases the physical memory allocated
    295  * to all mapped GPT entries.  It can be used for any type of vseg.
    296  *********************************************************************************************
    297  * @ process  : pointer on process descriptor.
    298  * @ vseg     : pointer on the vseg to be unmapped.
    299  ********************************************************************************************/
    300 void vmm_unmap_vseg( struct process_s * process,
    301                      vseg_t           * vseg );
    302 
    303 /*********************************************************************************************
    304308 * This function removes a given region (defined by a base address and a size) from
    305309 * the VMM of a given process descriptor. This can modify the number of vsegs:
     
    340344/*********************************************************************************************
    341345 * This function is called by the generic exception handler when a page-fault event
    342  * has been detected in a given cluster.
     346 * has been detected for a given process in a given cluster.
    343347 * - If the local cluster is the reference, it call directly the vmm_get_pte() function.
    344348 * - If the local cluster is not the reference cluster, it send a RPC_VMM_GET_PTE
     
    355359/*********************************************************************************************
    356360 * This function is called by the generic exception handler when a copy-on-write event
    357  * has been detected in a given cluster.
    358  * - If the local cluster is the reference, it call directly the vmm_get_pte() function.
    359  * - If the local cluster is not the reference cluster, it send a RPC_VMM_GET_PTE
    360  *   to the reference cluster to get the missing PTE attributes and PPN,
    361  *   and update the local page table.
     361 * has been detected for a given process in a given cluster.
     362 * It takes the lock protecting the physical page, and test the pending forks counter.
     363 * If no pending fork:
     364 * - it reset the COW flag and set the WRITE flag in the reference GPT entry, and in all
     365 *   the GPT copies
     366
     367 * If there is a pending forkon the
     368 * - It get the involved vseg pointer.
     369 * - It allocates a new physical page from the cluster defined by the vseg type.
     370 * - It copies the old physical page content to the new physical page.
     371 * - It decrements the pending_fork counter in old physical page descriptor.
     372
    362373 *********************************************************************************************
    363374 * @ process   : pointer on process descriptor.
     
    369380
    370381/*********************************************************************************************
    371  * This function is called when a new PTE (GPT entry) is required because a "page-fault",
    372  * or "copy-on_write" event has been detected for a given <vpn> in a given <process>.
    373  * The <cow> argument defines the type of event to be handled.
     382 * This function handle both the "page-fault" and "copy-on_write" events for a given <vpn>
     383 * in a given <process>.  The <cow> argument defines the type of event to be handled.
    374384 * This function must be called by a thread running in reference cluster, and the vseg
    375  * containing the searched VPN should be registered in the reference VMM.
    376  * - for an actual page-fault, it allocates the missing physical page from the target cluster
    377  *   defined by the vseg type, initialize it, and update the reference page table.
     385 * containing the searched VPN must be registered in the reference VMM.
     386 * - for an page-fault, it allocates the missing physical page from the target cluster
     387 *   defined by the vseg type, initializes it, and updates the reference GPT, but not
     388 *   the copies GPT, that will be updated on demand.
    378389 * - for a copy-on-write, it allocates a new physical page from the target cluster,
    379  *   initialise it from the old physical page, and update the reference page table.
    380  * In both cases, it calls the RPC_PMEM_GET_PAGES to get the new physical page if the
    381  * target cluster is not the reference cluster.
     390 *   initialise it from the old physical page, and updates the reference GPT and all
     391 *   the GPT copies, for coherence.
     392 * In both cases, it calls the RPC_PMEM_GET_PAGES to get the new physical page when
     393 * the target cluster is not the reference cluster.
    382394 * It returns in the <attr> and <ppn> arguments the accessed or modified PTE.
    383395 *********************************************************************************************
     
    400412 * (Physical Page Number) associated to a missing page defined by the <vpn> argument.
    401413 * - For the FILE type, it returns directly the physical page from the file mapper.
    402  * - For the CODE and DATA types, it allocates a new phsical page from the cluster defined
     414 * - For the CODE and DATA types, it allocates a new physical page from the cluster defined
    403415 *   by the <vseg->cxy> field, or by the <vpn> MSB bits for a distributed vseg,
    404416 *   and initialize this page from the .elf file mapper.
Note: See TracChangeset for help on using the changeset viewer.