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/libk/remote_sem.c

    r563 r635  
    22 * remote_sem.c - POSIX unnamed semaphore implementation.
    33 *
    4  * Author   Alain Greiner  (2016,2017,2018)
     4 * Author   Alain Greiner  (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    8686                           uint32_t   value )
    8787{
     88    kmem_req_t     req;   
    8889    remote_sem_t * sem_ptr;
    89     xptr_t         sem_xp;
    9090
    9191    // get pointer on local process descriptor
     
    100100
    101101    // allocate memory for new semaphore in reference cluster
    102     if( ref_cxy == local_cxy )  // local cluster is the reference
    103     {
    104         kmem_req_t req;   
    105         req.type  = KMEM_SEM;
    106         req.flags = AF_ZERO;
    107         sem_ptr   = kmem_alloc( &req );
    108         sem_xp    = XPTR( local_cxy , sem_ptr );
     102    req.type  = KMEM_KCM;
     103    req.order = bits_log2( sizeof(remote_sem_t) );
     104    req.flags = AF_ZERO | AF_KERNEL;
     105    sem_ptr   = kmem_remote_alloc( ref_cxy, &req );
     106
     107    if( sem_ptr == NULL )
     108    {
     109        printk("\n[ERROR] in %s : cannot create semaphore\n", __FUNCTION__ );
     110        return -1;
    109111    }
    110     else                         // reference is remote
    111     {
    112         rpc_kcm_alloc_client( ref_cxy , KMEM_SEM , &sem_xp );
    113         sem_ptr = GET_PTR( sem_xp );
    114     }
    115 
    116     if( sem_xp == XPTR_NULL ) return 0xFFFFFFFF;
    117112
    118113    // initialise semaphore
     
    149144void remote_sem_destroy( xptr_t sem_xp )
    150145{
     146    kmem_req_t  req;
     147
    151148    // get pointer on local process descriptor
    152149    process_t * process = CURRENT_THREAD->process;
     
    179176
    180177    // release memory allocated for semaphore descriptor
    181     if( sem_cxy == local_cxy )                            // reference is local
    182     {
    183         kmem_req_t  req;
    184         req.type = KMEM_SEM;
    185         req.ptr  = sem_ptr;
    186         kmem_free( &req );
    187     }
    188     else                                                  // reference is remote
    189     {
    190         rpc_kcm_free_client( sem_cxy , sem_ptr , KMEM_SEM );
    191     }
     178    req.type = KMEM_KCM;
     179    req.ptr  = sem_ptr;
     180    kmem_remote_free( sem_cxy , &req );
    192181
    193182}  // end remote_sem_destroy()
Note: See TracChangeset for help on using the changeset viewer.