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_mutex.c

    r619 r635  
    22 * remote_mutex.c - POSIX mutex implementation.
    33 *
    4  * Authors   Alain   Greiner (2016,2017,2018)
     4 * Authors   Alain   Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    8484error_t remote_mutex_create( intptr_t ident )
    8585{
    86     xptr_t           mutex_xp;
    8786    remote_mutex_t * mutex_ptr;
     87    kmem_req_t       req;   
    8888
    8989    // get pointer on local process descriptor
     
    9797    process_t * ref_ptr = (process_t *)GET_PTR( ref_xp );
    9898
    99     // allocate memory for mutex descriptor
    100     if( ref_cxy == local_cxy )                  // local cluster is the reference
    101     {
    102         kmem_req_t req;   
    103         req.type    = KMEM_MUTEX;
    104         req.flags   = AF_ZERO;
    105         mutex_ptr   = kmem_alloc( &req );
    106         mutex_xp    = XPTR( local_cxy , mutex_ptr );
    107     }
    108     else                                       // reference is remote
    109     {
    110         rpc_kcm_alloc_client( ref_cxy , KMEM_MUTEX , &mutex_xp );
    111         mutex_ptr = GET_PTR( mutex_xp );
    112     }
    113 
    114     if( mutex_ptr == NULL ) return 0xFFFFFFFF;
     99    // allocate memory for mutex descriptor in reference cluster
     100    req.type    = KMEM_KCM;
     101    req.order   = bits_log2( sizeof(remote_mutex_t) );
     102    req.flags   = AF_ZERO | AF_KERNEL;
     103    mutex_ptr   = kmem_remote_alloc( ref_cxy , &req );
     104
     105    if( mutex_ptr == NULL )
     106    {
     107       printk("\n[ERROR] in %s : cannot create mutex\n", __FUNCTION__);
     108       return -1;
     109    }
    115110
    116111    // initialise mutex
     
    150145void remote_mutex_destroy( xptr_t mutex_xp )
    151146{
     147    kmem_req_t  req;
     148
    152149    // get pointer on local process descriptor
    153150    process_t * process = CURRENT_THREAD->process;
     
    174171
    175172    // release memory allocated for mutex descriptor
    176     if( mutex_cxy == local_cxy )                            // reference is local
    177     {
    178         kmem_req_t  req;
    179         req.type = KMEM_MUTEX;
    180         req.ptr  = mutex_ptr;
    181         kmem_free( &req );
    182     }
    183     else                                                  // reference is remote
    184     {
    185         rpc_kcm_free_client( mutex_cxy , mutex_ptr , KMEM_MUTEX );
    186     }
     173    req.type = KMEM_KCM;
     174    req.ptr  = mutex_ptr;
     175    kmem_remote_free( mutex_cxy , &req );
    187176
    188177}  // end remote_mutex_destroy()
Note: See TracChangeset for help on using the changeset viewer.