Changeset 611 for trunk/kernel/kern


Ignore:
Timestamp:
Jan 9, 2019, 3:02:51 PM (6 years ago)
Author:
alain
Message:

Introduce sigificant modifs in VFS to support the <ls> command,
and the . and .. directories entries.

Location:
trunk/kernel/kern
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/cluster.h

    r583 r611  
    264264/******************************************************************************************
    265265 * This function returns a pointer on the local process descriptor from the PID.
    266  * It uses the RPC
    267  * to create a local process descriptor copy if it does not exist yet.
    268266 ******************************************************************************************
    269267 * @ pid     : searched process identifier.
  • trunk/kernel/kern/kernel_init.c

    r610 r611  
    167167    "PROCESS_FDARRAY",       // 27
    168168    "FATFS_FREE",            // 28
    169 
    170     "PROCESS_THTBL",         // 29
    171 
    172     "MAPPER_STATE",          // 30
    173     "VFS_SIZE",              // 31
    174     "VFS_FILE",              // 32
    175     "VMM_VSL",               // 33
    176     "VMM_GPT",               // 34
    177     "VFS_MAIN",              // 35
     169    "PROCESS_DIR",           // 29
     170
     171    "PROCESS_THTBL",         // 30
     172
     173    "MAPPER_STATE",          // 31
     174    "VFS_SIZE",              // 32
     175    "VFS_FILE",              // 33
     176    "VMM_VSL",               // 34
     177    "VMM_GPT",               // 35
     178    "VFS_MAIN",              // 36
    178179};       
    179180
  • trunk/kernel/kern/process.c

    r610 r611  
    274274    remote_queuelock_init( XPTR( local_cxy , &process->children_lock ), LOCK_PROCESS_CHILDREN );
    275275
    276     // reset semaphore / mutex / barrier / condvar list roots
     276    // reset semaphore / mutex / barrier / condvar list roots and lock
    277277    xlist_root_init( XPTR( local_cxy , &process->sem_root ) );
    278278    xlist_root_init( XPTR( local_cxy , &process->mutex_root ) );
     
    280280    xlist_root_init( XPTR( local_cxy , &process->condvar_root ) );
    281281    remote_queuelock_init( XPTR( local_cxy , &process->sync_lock ), LOCK_PROCESS_USERSYNC );
     282
     283    // reset open directories root and lock
     284    xlist_root_init( XPTR( local_cxy , &process->dir_root ) );
     285    remote_queuelock_init( XPTR( local_cxy , &process->dir_lock ), LOCK_PROCESS_DIR );
    282286
    283287    // register new process in the local cluster manager pref_tbl[]
     
    546550    thread_block( client_xp , THREAD_BLOCKED_RPC );
    547551
    548     // take the lock protecting process copies
    549     remote_queuelock_acquire( lock_xp );
    550 
    551552    // initialize shared RPC descriptor
    552553    rpc.responses = 0;
     
    555556    rpc.thread    = client;
    556557    rpc.lid       = client->core->lid;
    557     rpc.args[0]   = type;
    558     rpc.args[1]   = pid;
     558    rpc.args[0]   = pid;
     559    rpc.args[1]   = type;
     560
     561    // take the lock protecting process copies
     562    remote_queuelock_acquire( lock_xp );
    559563
    560564    // scan list of process copies
    561     // to send RPCs to remote copies
    562565    XLIST_FOREACH( root_xp , iter_xp )
    563566    {
  • trunk/kernel/kern/process.h

    r610 r611  
    6060 ********************************************************************************************/
    6161
    62 typedef enum process_sigactions
     62typedef enum
    6363{
    6464    BLOCK_ALL_THREADS    = 0x11,
    6565    UNBLOCK_ALL_THREADS  = 0x22,
    6666    DELETE_ALL_THREADS   = 0x33,
    67 } process_sigactions_t;
     67}
     68process_sigactions_t;
    6869
    6970/*********************************************************************************************
     
    145146
    146147        struct thread_s  * th_tbl[CONFIG_THREADS_MAX_PER_CLUSTER];       /*! local threads       */
     148
    147149        uint32_t           th_nr;            /*! number of threads in this cluster               */
    148150    rwlock_t           th_lock;          /*! lock protecting th_tbl[]  i                     */
    149151
    150     xlist_entry_t      sem_root;         /*! root of the user definedsemaphore list          */
     152    xlist_entry_t      sem_root;         /*! root of the user defined semaphore list         */
    151153    xlist_entry_t      mutex_root;       /*! root of the user defined mutex list             */
    152154    xlist_entry_t      barrier_root;     /*! root of the user defined barrier list           */
    153155    xlist_entry_t      condvar_root;     /*! root of the user defined condvar list           */
    154156    remote_queuelock_t sync_lock;        /*! lock protecting user defined synchro lists      */
     157
     158    xlist_entry_t      dir_root;         /*! root of the user defined DIR list               */
     159    remote_queuelock_t dir_lock;         /*! lock protexting user defined DIR list           */
    155160
    156161    uint32_t           term_state;       /*! termination status (flags & exit status)        */
  • trunk/kernel/kern/rpc.c

    r610 r611  
    7777    &rpc_undefined,                        // 24   unused slot
    7878    &rpc_mapper_handle_miss_server,        // 25
    79     &rpc_undefined,                        // 26   unused slot
     79    &rpc_vmm_delete_vseg_server,           // 26
    8080    &rpc_vmm_create_vseg_server,           // 27
    8181    &rpc_vmm_set_cow_server,               // 28
     
    113113    "undefined",                 // 24
    114114    "MAPPER_HANDLE_MISS",        // 25
    115     "undefined",                 // 26
     115    "VMM_DELETE_VSEG",           // 26
    116116    "VMM_CREATE_VSEG",           // 27
    117117    "VMM_SET_COW",               // 28
     
    283283    bool_t          blocking;           // blocking RPC when true
    284284        remote_fifo_t * rpc_fifo;           // local pointer on RPC fifo
     285    uint32_t        count;              // current number of expected responses
    285286 
    286287    // makes RPC thread not preemptable
     
    302303uint32_t cycle = (uint32_t)hal_get_cycles();
    303304if( DEBUG_RPC_SERVER_GENERIC < cycle )
    304 printk("\n[%s] RPC thread %x on core[%d] takes RPC_FIFO ownership / cycle %d\n",
    305 __FUNCTION__, server_ptr->trdid, server_core_lid, cycle );
     305printk("\n[%s] RPC thread[%x,%x] on core[%d] takes RPC_FIFO ownership / cycle %d\n",
     306__FUNCTION__, server_ptr->process->pid, server_ptr->trdid, server_core_lid, cycle );
    306307#endif
    307308                // try to consume one RPC request 
     
    326327uint32_t items = remote_fifo_items( XPTR( local_cxy , rpc_fifo ) );
    327328if( DEBUG_RPC_SERVER_GENERIC < cycle )
    328 printk("\n[%s] RPC thread %x got rpc %s / client_cxy %x / items %d / cycle %d\n",
    329 __FUNCTION__, server_ptr->trdid, rpc_str[index], desc_cxy, items, cycle );
     329printk("\n[%s] RPC thread[%x,%x] got rpc %s / client_cxy %x / items %d / cycle %d\n",
     330__FUNCTION__, server_ptr->process->pid, server_ptr->trdid, rpc_str[index], desc_cxy, items, cycle );
    330331#endif
    331332                // register client thread in RPC thread descriptor
     
    338339cycle = (uint32_t)hal_get_cycles();
    339340if( DEBUG_RPC_SERVER_GENERIC < cycle )
    340 printk("\n[%s] RPC thread %x completes rpc %s / client_cxy %x / cycle %d\n",
    341 __FUNCTION__, server_ptr->trdid, rpc_str[index], desc_cxy, cycle );
    342 #endif
    343                 // decrement response counter in RPC descriptor if blocking RPC
    344                 if( blocking )
     341printk("\n[%s] RPC thread[%x,%x] completes rpc %s / client_cxy %x / cycle %d\n",
     342__FUNCTION__, server_ptr->process->pid, server_ptr->trdid, rpc_str[index], desc_cxy, cycle );
     343#endif
     344                // decrement expected responses counter in RPC descriptor
     345                count = hal_remote_atomic_add( XPTR( desc_cxy, &desc_ptr->responses ), -1 );
     346
     347                // decrement response counter in RPC descriptor if last response
     348                if( count == 1 )
    345349                {
    346                     // decrement responses counter in RPC descriptor
    347                     hal_remote_atomic_add( XPTR( desc_cxy, &desc_ptr->responses ), -1 );
    348 
    349350                    // get client thread pointer and client core lid from RPC descriptor
    350351                    client_ptr      = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->thread ) );
     
    359360cycle = (uint32_t)hal_get_cycles();
    360361if( DEBUG_RPC_SERVER_GENERIC < cycle )
    361 printk("\n[%s] RPC thread %x unblocked client thread %x / cycle %d\n",
    362 __FUNCTION__, server_ptr->trdid, client_ptr->trdid, cycle );
     362printk("\n[%s] RPC thread[%x,%x] unblocked client thread[%x,%x] / cycle %d\n",
     363__FUNCTION__, server_ptr->process->pid, server_ptr->trdid,
     364client_ptr->process->pid, client_ptr->trdid, cycle );
    363365#endif
    364366                    // send IPI to client core
    365367                    dev_pic_send_ipi( desc_cxy , client_core_lid );
    366 
    367                 }  // end if blocking RPC
     368                }
    368369            }  // end RPC handling if fifo non empty
    369370        }  // end if RPC_fIFO ownership successfully taken and released
     
    376377uint32_t cycle = (uint32_t)hal_get_cycles();
    377378if( DEBUG_RPC_SERVER_GENERIC < cycle )
    378 printk("\n[%s] RPC thread %x suicides / cycle %d\n",
    379 __FUNCTION__, server_ptr->trdid, cycle );
     379printk("\n[%s] RPC thread[%x,%x] suicides / cycle %d\n",
     380__FUNCTION__, server_ptr->process->pid, server_ptr->trdid, cycle );
    380381#endif
    381382            // update RPC threads counter
     
    395396uint32_t cycle = (uint32_t)hal_get_cycles();
    396397if( DEBUG_RPC_SERVER_GENERIC < cycle )
    397 printk("\n[%s] RPC thread %x block IDLE & deschedules / cycle %d\n",
    398 __FUNCTION__, server_ptr->trdid, cycle );
     398printk("\n[%s] RPC thread[%x,%x] block IDLE & deschedules / cycle %d\n",
     399__FUNCTION__, server_ptr->process->pid, server_ptr->trdid, cycle );
    399400#endif
    400401            // RPC thread blocks on IDLE
     
    425426#endif
    426427
    427     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     428    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    428429
    429430    // initialise RPC descriptor header
     
    498499#endif
    499500
    500     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     501    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    501502
    502503    // initialise RPC descriptor header
     
    576577#endif
    577578
    578     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     579    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    579580
    580581    // initialise RPC descriptor header
     
    677678#endif
    678679
    679     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     680    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    680681
    681682    // initialise RPC descriptor header
     
    784785#endif
    785786
    786     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     787    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    787788
    788789    // initialise RPC descriptor header
     
    862863
    863864/////////////////////////////////////////////////////////////////////////////////////////
    864 // [9] Marshaling functions attached to RPC_PROCESS_SIGACTION (multicast / non blocking)
     865// [9]   Marshaling functions attached to RPC_PROCESS_SIGACTION (non blocking)
    865866/////////////////////////////////////////////////////////////////////////////////////////
    866867
     
    869870                                   rpc_desc_t * rpc )
    870871{
    871 
    872872#if DEBUG_RPC_PROCESS_SIGACTION
    873 uint32_t  cycle  = (uint32_t)hal_get_cycles();
    874 uint32_t  action = rpc->args[0];
    875 pid_t     pid    = rpc->args[1];
     873uint32_t  cycle = (uint32_t)hal_get_cycles();
    876874thread_t * this = CURRENT_THREAD;
    877875if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    878 printk("\n[%s] thread[%x,%x] enter to request %s of process %x in cluster %x / cycle %d\n",
    879 __FUNCTION__, this->process->pid, this->trdid, process_action_str(action), pid, cxy, cycle );
    880 #endif
    881 
    882     // check some RPC arguments
    883     assert( (rpc->blocking == false) , "must be non-blocking\n");
    884     assert( (rpc->index == RPC_PROCESS_SIGACTION ) , "bad RPC index\n" );
     876printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     877__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     878#endif
     879
     880// check RPC "index" and "blocking" arguments
     881assert( (rpc->blocking == false) , "must be non-blocking\n");
     882assert( (rpc->index == RPC_PROCESS_SIGACTION ) , "bad RPC index\n" );
    885883
    886884    // register RPC request in remote RPC fifo and return
     
    890888cycle = (uint32_t)hal_get_cycles();
    891889if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    892 printk("\n[%s] thread[%x,%x] requested %s of process %x in cluster %x / cycle %d\n",
    893 __FUNCTION__, this->process->pid, this->trdid, process_action_str(action), pid, cxy, cycle );
    894 #endif
    895 
     890printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     891__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     892#endif
    896893}  // end rpc_process_sigaction_client()
    897894
     
    899896void rpc_process_sigaction_server( xptr_t xp )
    900897{
    901     pid_t        pid;             // target process identifier
    902     process_t  * process;         // pointer on local target process descriptor
    903     uint32_t     action;          // sigaction index
    904     thread_t   * client_ptr;      // pointer on client thread in client cluster
    905     xptr_t       client_xp;       // extended pointer client thread
    906     cxy_t        client_cxy;      // client cluster identifier
    907     rpc_desc_t * rpc;             // pointer on rpc descriptor in client cluster
    908     xptr_t       count_xp;        // extended pointer on responses counter
    909     uint32_t     count_value;     // responses counter value
    910     lid_t        client_lid;      // client core local index
     898#if DEBUG_RPC_PROCESS_SIGACTION
     899uint32_t cycle = (uint32_t)hal_get_cycles();
     900thread_t * this = CURRENT_THREAD;
     901if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
     902printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     903__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     904#endif
    911905
    912906    // get client cluster identifier and pointer on RPC descriptor
    913     client_cxy = GET_CXY( xp );
    914     rpc        = GET_PTR( xp );
     907    cxy_t        client_cxy = GET_CXY( xp );
     908    rpc_desc_t * desc       = GET_PTR( xp );
    915909
    916910    // get arguments from RPC descriptor
    917     action   = (uint32_t)hal_remote_l64( XPTR(client_cxy , &rpc->args[0]) );
    918     pid      = (pid_t)   hal_remote_l64( XPTR(client_cxy , &rpc->args[1]) );
    919 
    920 #if DEBUG_RPC_PROCESS_SIGACTION
    921 uint32_t cycle = (uint32_t)hal_get_cycles();
    922 thread_t * this = CURRENT_THREAD;
    923 if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    924 printk("\n[%s] thread[%x,%x] enter to %s process %x in cluster %x / cycle %d\n",
    925 __FUNCTION__, this->process->pid, this->trdid,
    926 process_action_str( action ), pid, local_cxy, cycle );
    927 #endif
     911    pid_t    pid    = (pid_t)   hal_remote_l64( XPTR(client_cxy , &desc->args[0]) );
     912    uint32_t action = (uint32_t)hal_remote_l64( XPTR(client_cxy , &desc->args[1]) );
    928913
    929914    // get client thread pointers
    930     client_ptr = (thread_t *)hal_remote_lpt( XPTR( client_cxy , &rpc->thread ) );
    931     client_xp  = XPTR( client_cxy , client_ptr );
     915    thread_t * client_ptr = hal_remote_lpt( XPTR( client_cxy , &desc->thread ) );
     916    xptr_t     client_xp  = XPTR( client_cxy , client_ptr );
    932917
    933918    // get local process descriptor
    934     process = cluster_get_local_process_from_pid( pid );
     919    process_t * process = cluster_get_local_process_from_pid( pid );
    935920
    936921    // call relevant kernel function
     
    939924    else if ( action == UNBLOCK_ALL_THREADS ) process_unblock_threads( process );
    940925
    941     // build extended pointer on response counter in RPC
    942     count_xp = XPTR( client_cxy , &rpc->responses );
    943 
    944     // decrement the responses counter in RPC descriptor,
    945     count_value = hal_remote_atomic_add( count_xp , -1 );
    946 
    947     // unblock the client thread only if it is the last response.
    948     if( count_value == 1 )
    949     {
    950         // get client core lid
    951         client_lid    = (lid_t)     hal_remote_l32 ( XPTR( client_cxy , &rpc->lid    ) );
    952 
    953         // unblock client thread
    954         thread_unblock( client_xp , THREAD_BLOCKED_RPC );
    955 
    956         // send an IPI to client core
    957         // dev_pic_send_ipi( client_cxy , client_lid );
    958     }
    959 
    960926#if DEBUG_RPC_PROCESS_SIGACTION
    961927cycle = (uint32_t)hal_get_cycles();
    962928if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    963 printk("\n[%s] thread[%x,%x] exit after %s process %x in cluster %x / cycle %d\n",
    964 __FUNCTION__, this->process->pid, this->trdid,
    965 process_action_str( action ), pid, local_cxy, cycle );
    966 #endif
    967 
     929printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     930__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     931#endif
    968932} // end rpc_process_sigaction_server()
    969933
     
    991955#endif
    992956
    993     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     957    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    994958
    995959    // initialise RPC descriptor header
     
    10911055#endif
    10921056
    1093     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     1057    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    10941058
    10951059    // initialise RPC descriptor header
     
    11631127#endif
    11641128
    1165     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     1129    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    11661130
    11671131    // initialise RPC descriptor header
     
    12511215#endif
    12521216
    1253     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     1217    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    12541218
    12551219    // initialise RPC descriptor header
     
    13241288#endif
    13251289
    1326     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     1290    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    13271291
    13281292    // initialise RPC descriptor header
     
    14081372#endif
    14091373
    1410     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     1374    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    14111375
    14121376    // initialise RPC descriptor header
     
    14801444#endif
    14811445
    1482     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     1446    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    14831447
    14841448    // initialise RPC descriptor header
     
    15691533#endif
    15701534
    1571     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     1535    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    15721536
    15731537    // initialise RPC descriptor header
     
    16491613#endif
    16501614
    1651     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     1615    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    16521616
    16531617    // initialise RPC descriptor header
     
    17291693#endif
    17301694
    1731     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     1695    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    17321696
    17331697    // initialise RPC descriptor header
     
    18081772#endif
    18091773
    1810     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     1774    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    18111775
    18121776    // initialise RPC descriptor header
     
    18961860#endif
    18971861
    1898     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     1862    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    18991863
    19001864    // initialise RPC descriptor header
     
    19751939#endif
    19761940
    1977     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     1941    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    19781942
    19791943    // initialise RPC descriptor header
     
    20532017#endif
    20542018
    2055     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     2019    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    20562020
    20572021    // initialise RPC descriptor header
     
    21252089{
    21262090#if DEBUG_RPC_MAPPER_HANDLE_MISS
     2091thread_t * this = CURRENT_THREAD;
    21272092uint32_t cycle = (uint32_t)hal_get_cycles();
    21282093if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS )
     
    21312096#endif
    21322097
    2133     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     2098    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    21342099
    21352100    // initialise RPC descriptor header
     
    21622127{
    21632128#if DEBUG_RPC_MAPPER_HANDLE_MISS
     2129thread_t * this = CURRENT_THREAD;
    21642130uint32_t cycle = (uint32_t)hal_get_cycles();
    21652131if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS )
     
    21992165
    22002166/////////////////////////////////////////////////////////////////////////////////////////
    2201 // [26]         undefined slot
    2202 /////////////////////////////////////////////////////////////////////////////////////////
     2167// [26]  Marshaling functions attached to RPC_VMM_DELETE_VSEG (parallel / non blocking)
     2168/////////////////////////////////////////////////////////////////////////////////////////
     2169
     2170//////////////////////////////////////////////////
     2171void rpc_vmm_delete_vseg_client( cxy_t        cxy,
     2172                                 rpc_desc_t * rpc )
     2173{
     2174#if DEBUG_RPC_VMM_DELETE_VSEG
     2175thread_t * this  = CURRENT_THREAD;
     2176uint32_t   cycle = (uint32_t)hal_get_cycles();
     2177if( cycle > DEBUG_RPC_VMM_DELETE_VSEG )
     2178printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2179__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     2180#endif
     2181
     2182// check RPC "index" and "blocking" arguments
     2183assert( (rpc->blocking == false) , "must be non-blocking\n");
     2184assert( (rpc->index == RPC_VMM_DELETE_VSEG ) , "bad RPC index\n" );
     2185
     2186    // register RPC request in remote RPC fifo
     2187    rpc_send( cxy , rpc );
     2188
     2189#if DEBUG_RPC_VMM_DELETE_VSEG
     2190cycle = (uint32_t)hal_get_cycles();
     2191if( cycle > DEBUG_RPC_VMM_DELETE_VSEG )
     2192printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2193__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     2194#endif
     2195}
     2196
     2197////////////////////////////////////////////
     2198void rpc_vmm_delete_vseg_server( xptr_t xp )
     2199{
     2200#if DEBUG_RPC_VMM_DELETE_VSEG
     2201uint32_t cycle = (uint32_t)hal_get_cycles();
     2202thread_t * this = CURRENT_THREAD;
     2203if( DEBUG_RPC_VMM_DELETE_VSEG < cycle )
     2204printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2205__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     2206#endif
     2207
     2208    // get client cluster identifier and pointer on RPC descriptor
     2209    cxy_t        client_cxy = GET_CXY( xp );
     2210    rpc_desc_t * desc       = GET_PTR( xp );
     2211
     2212    // get arguments from RPC descriptor
     2213    pid_t    pid   = (pid_t)   hal_remote_l64( XPTR(client_cxy , &desc->args[0]) );
     2214    intptr_t vaddr = (intptr_t)hal_remote_l64( XPTR(client_cxy , &desc->args[1]) );
     2215
     2216    // call relevant kernel function
     2217    vmm_delete_vseg( pid , vaddr );
     2218
     2219#if DEBUG_RPC_VMM_DELETE_VSEG
     2220cycle = (uint32_t)hal_get_cycles();
     2221if( DEBUG_RPC_VMM_DELETE_VSEG < cycle )
     2222printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2223__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     2224#endif
     2225}
    22032226
    22042227/////////////////////////////////////////////////////////////////////////////////////////
     
    22182241                                 struct vseg_s   ** vseg )
    22192242{
    2220     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     2243#if DEBUG_RPC_VMM_CREATE_VSEG
     2244thread_t * this = CURRENT_THREAD;
     2245uint32_t cycle = (uint32_t)hal_get_cycles();
     2246if( cycle > DEBUG_RPC_VMM_CREATE_VSEG )
     2247printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2248__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2249#endif
     2250
     2251    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    22212252
    22222253    // initialise RPC descriptor header
     
    22422273    *vseg = (vseg_t *)(intptr_t)rpc.args[8];
    22432274
     2275#if DEBUG_RPC_VMM_CREATE_VSEG
     2276cycle = (uint32_t)hal_get_cycles();
     2277if( cycle > DEBUG_RPC_VMM_CREATE_VSEG )
     2278printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2279__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2280#endif
    22442281}
    22452282
     
    22472284void rpc_vmm_create_vseg_server( xptr_t xp )
    22482285{
     2286#if DEBUG_RPC_VMM_CREATE_VSEG
     2287thread_t * this = CURRENT_THREAD;
     2288uint32_t cycle = (uint32_t)hal_get_cycles();
     2289if( cycle > DEBUG_RPC_VMM_CREATE_VSEG )
     2290printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2291__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2292#endif
     2293
    22492294    // get client cluster identifier and pointer on RPC descriptor
    22502295    cxy_t        cxy  = GET_CXY( xp );
     
    22742319    hal_remote_s64( XPTR( cxy , &desc->args[8] ) , (uint64_t)(intptr_t)vseg );
    22752320
     2321#if DEBUG_RPC_VMM_CREATE_VSEG
     2322cycle = (uint32_t)hal_get_cycles();
     2323if( cycle > DEBUG_RPC_VMM_CREATE_VSEG )
     2324printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2325__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2326#endif
    22762327}
    22772328
     
    22842335                             process_t * process )
    22852336{
    2286     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     2337    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    22872338
    22882339    // initialise RPC descriptor header
     
    23262377                             bool_t      detailed )
    23272378{
    2328     assert( (cxy != local_cxy) , "target cluster is not remote\n");
     2379    assert( (cxy != local_cxy) , "server cluster is not remote\n");
    23292380
    23302381    // initialise RPC descriptor header
  • trunk/kernel/kern/rpc.h

    r610 r611  
    5454/***********************************************************************************
    5555 * This enum defines all RPC indexes.
    56  * It must be consistent with the rpc_server[] array defined in in the rpc.c file.
     56 * It must be consistent with the rpc_server[] arrays defined in in the rpc.c file.
    5757 **********************************************************************************/
    5858
     
    6868    RPC_THREAD_KERNEL_CREATE      = 7,
    6969    RPC_UNDEFINED_8               = 8,
    70     RPC_PROCESS_SIGACTION         = 9,
     70    RPC_PROCESS_SIGACTION         = 9,       // non blocking
    7171
    7272    RPC_VFS_INODE_CREATE          = 10,
     
    8787    RPC_UNDEFINED_24              = 24,
    8888    RPC_MAPPER_HANDLE_MISS        = 25,
    89     RPC_UNDEFINED_26              = 26,
     89    RPC_VMM_DELETE_VSEG           = 26,      // non blocking
    9090    RPC_VMM_CREATE_VSEG           = 27,
    9191    RPC_VMM_SET_COW               = 28,
     
    281281
    282282/***********************************************************************************
    283  * [9] The RPC_PROCESS_SIGACTION allows a thread running in any cluster
    284  * to request a cluster identified by the <cxy> argument (local or remote)
    285  * to execute a given sigaction for a given cluster. The <action_type> and
    286  * the <pid> arguments are defined in the shared RPC descriptor, that must be
    287  * initialised by the client thread.
     283 * [9] The non blocking RPC_PROCESS_SIGACTION allows any client thread running in
     284 * any cluster to send parallel RPC requests to one or several servers (that can be
     285 * local or remote), to execute a given sigaction, defined by the <action_type>
     286 * argument[1], for a given process identified by the <pid> argument[0].
    288287 *
    289  * WARNING : It is implemented as a NON BLOCKING multicast RPC, that can be sent
    290  * in parallel to all process copies. The various RPC server threads atomically
    291  * decrement the <response> field in the shared RPC descriptor.
    292  * The last server thread unblock the client thread that blocked (after sending
    293  * all RPC requests) in the process_sigaction() function.
     288 * WARNING : It is implemented as a NON BLOCKING RPC, that can be sent in parallel
     289 * to several servers. The RPC descriptor, containing the <action_type> and <pid>
     290 * arguments, as well as the RPC <index>, <blocked>, and <response> fields, must
     291 * be allocated and initialised by the calling function itself.
     292 * Each RPC server thread atomically decrements the <response> field in this
     293 * shared RPC descriptor. The last server thread unblock the client thread,
     294 * that blocked only after sending all parallel RPC requests to all servers.
    294295 ***********************************************************************************
    295296 * @ cxy     : server cluster identifier.
    296  * @ rpc     : pointer on ishared RPC descriptor initialized by the client thread.
     297 * @ rpc     : pointer on shared RPC descriptor initialized by the client thread.
    297298 **********************************************************************************/
    298299void rpc_process_sigaction_client( cxy_t               cxy,
     
    550551 * On the server side, this RPC call the mapper_handle_miss() function and return
    551552 * an extended pointer on the allocated page descriptor and an error status.
     553 ***********************************************************************************
    552554 * @ cxy         : server cluster identifier.
    553555 * @ mapper      : [in]  local pointer on mapper.
     
    566568
    567569/***********************************************************************************
    568  * [26] undefined slot
    569  **********************************************************************************/
     570 * [26] The non blocking RPC_VMM_DELETE_VSEG allows any client thread running in
     571 * any cluster to send parallel RPC requests to one or several clusters (that can be
     572 * local or remote), to delete from a given VMM, identified by the <pid> argument[0]
     573 * a given vseg, identified by the <vaddr> argument[1].
     574 *
     575 * WARNING : It is implemented as a NON BLOCKING RPC, that can be sent in parallel
     576 * to several servers. The RPC descriptor, containing the <pid> and <vaddr>
     577 * arguments, as well as the RPC <index>, <blocked>, and <response> fields, must
     578 * be allocated and initialised by the calling function itself.
     579 * Each RPC server thread atomically decrements the the <response> field in this
     580 * shared RPC descriptor. The last server thread unblock the client thread,
     581 * that blocked only after sending all paralle RPC requests to all servers.
     582 ***********************************************************************************
     583 * @ cxy         : server cluster identifier.
     584 * @ rpc     : pointer on shared RPC descriptor initialized by the client thread.
     585 **********************************************************************************/
     586void rpc_vmm_delete_vseg_client( cxy_t               cxy,
     587                                 struct rpc_desc_s * rpc );
     588 
     589void rpc_vmm_delete_vseg_server( xptr_t xp );
    570590
    571591/***********************************************************************************
  • trunk/kernel/kern/thread.c

    r593 r611  
    326326    {
    327327            printk("\n[ERROR] in %s : cannot create new thread\n", __FUNCTION__ );
    328         vmm_remove_vseg( vseg );
     328        vmm_delete_vseg( process->pid , vseg->min );
    329329        return ENOMEM;
    330330    }
     
    348348    {
    349349            printk("\n[ERROR] in %s : cannot initialize new thread\n", __FUNCTION__ );
    350         vmm_remove_vseg( vseg );
     350        vmm_delete_vseg( process->pid , vseg->min );
    351351        thread_release( thread );
    352352        return EINVAL;
     
    369369    {
    370370            printk("\n[ERROR] in %s : cannot create CPU context\n", __FUNCTION__ );
    371         vmm_remove_vseg( vseg );
     371        vmm_delete_vseg( process->pid , vseg->min );
    372372        thread_release( thread );
    373373        return ENOMEM;
     
    379379    {
    380380            printk("\n[ERROR] in %s : cannot create FPU context\n", __FUNCTION__ );
    381         vmm_remove_vseg( vseg );
     381        vmm_delete_vseg( process->pid , vseg->min );
    382382        thread_release( thread );
    383383        return ENOMEM;
     
    538538
    539539    // register STACK vseg in local child VSL
    540     vmm_vseg_attach( &child_process->vmm , vseg );
     540    vmm_attach_vseg_to_vsl( &child_process->vmm , vseg );
    541541
    542542#if (DEBUG_THREAD_USER_FORK & 1)
     
    560560        if( error )
    561561        {
    562             vmm_vseg_detach( &child_process->vmm , vseg );
    563             vseg_free( vseg );
     562            vmm_detach_vseg_from_vsl( &child_process->vmm , vseg );
    564563            thread_release( child_ptr );
    565564            printk("\n[ERROR] in %s : cannot update child GPT\n", __FUNCTION__ );
Note: See TracChangeset for help on using the changeset viewer.