Ignore:
Timestamp:
Feb 12, 2019, 1:15:47 PM (5 years ago)
Author:
alain
Message:

1) Fix a bug in KSH : after the "load" command,

the [ksh] prompt is now printed after completion
of the loaded application.

2) Fix a bug in vmm_handle_cow() : the copy-on-write

use now a hal_remote_memcpy() to replicate the page content.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/rpc.c

    r614 r619  
    143143    client_core_lid = this->core->lid;
    144144
    145     // check calling thread can yield when client thread is not the IDLE thread
     145    // check calling thread can yield when is not the IDLE thread
    146146    // RPCs executed by the IDLE thread during kernel_init do not deschedule
    147147    if( this->type != THREAD_IDLE ) thread_assert_can_yield( this , __FUNCTION__ );
     
    184184    while( full );
    185185 
    186     hal_fence();
    187 
    188186#if DEBUG_RPC_CLIENT_GENERIC
    189187uint32_t cycle = (uint32_t)hal_get_cycles();
     
    199197
    200198    // wait RPC completion before returning if blocking RPC :
    201     // - descheduling without blocking if thread idle (in kernel init)
     199    // - deschedule without blocking if thread idle (in kernel init)
    202200    // - block and deschedule policy for any other thread
    203201    if ( rpc->blocking )
     
    212210__FUNCTION__, this->process->pid, this->trdid, rpc_str[rpc->index], cycle );
    213211#endif
    214 
    215              while( rpc->responses ) sched_yield( "busy waiting on RPC");
    216    
     212             while( 1 )
     213             {
     214                 // check responses counter
     215                 if( hal_remote_l32( XPTR( local_cxy , rpc->rsp ) ) == 0 ) break;
     216                   
     217                 // deschedule
     218                 sched_yield("busy_waiting RPC completion");
     219             }
     220
    217221#if DEBUG_RPC_CLIENT_GENERIC
    218222cycle = (uint32_t)hal_get_cycles();
     
    242246cycle = (uint32_t)hal_get_cycles();
    243247if( DEBUG_RPC_CLIENT_GENERIC < cycle )
    244 printk("\n[%s] thread[%x,%x] resumes for rpc %s / cycle %d\n",
     248printk("\n[%s] thread[%x,%x] resumes after rpc %s / cycle %d\n",
    245249__FUNCTION__, this->process->pid, this->trdid, rpc_str[rpc->index], cycle );
    246250#endif
     
    248252
    249253// response must be available for a blocking RPC
    250 assert( (rpc->responses == 0) , "illegal response for RPC %s\n", rpc_str[rpc->index] );
     254assert( (*rpc->rsp == 0) , "illegal response for RPC %s\n", rpc_str[rpc->index] );
    251255
    252256    }
     
    270274
    271275////////////////////////////
    272 void rpc_thread_func( void )
     276void rpc_server_func( void )
    273277{
    274278    error_t         empty;              // local RPC fifo state
     
    278282    uint32_t        index;              // RPC request index
    279283    thread_t      * client_ptr;         // local pointer on client thread
     284    xptr_t          client_xp;          // extended pointer on client thread
     285    lid_t           client_lid;         // local index of client core
    280286        thread_t      * server_ptr;         // local pointer on server thread
    281287    xptr_t          server_xp;          // extended pointer on server thread
    282     lid_t           client_core_lid;    // local index of client core
    283     lid_t           server_core_lid;    // local index of server core
    284     bool_t          blocking;           // blocking RPC when true
     288    lid_t           server_lid;         // local index of server core
    285289        remote_fifo_t * rpc_fifo;           // local pointer on RPC fifo
    286     uint32_t        count;              // current number of expected responses
    287  
     290    uint32_t      * rsp_ptr;            // local pointer on responses counter
     291    xptr_t          rsp_xp;             // extended pointer on responses counter
     292    uint32_t        responses;          // number of expected responses
     293
    288294    // makes RPC thread not preemptable
    289295        hal_disable_irq( NULL );
     
    291297        server_ptr      = CURRENT_THREAD;
    292298    server_xp       = XPTR( local_cxy , server_ptr );
    293     server_core_lid = server_ptr->core->lid;
    294         rpc_fifo        = &LOCAL_CLUSTER->rpc_fifo[server_core_lid];
     299    server_lid      = server_ptr->core->lid;
     300        rpc_fifo        = &LOCAL_CLUSTER->rpc_fifo[server_lid];
    295301
    296302    // "infinite" RPC thread loop
     
    305311if( DEBUG_RPC_SERVER_GENERIC < cycle )
    306312printk("\n[%s] RPC thread[%x,%x] on core[%d] takes RPC_FIFO ownership / cycle %d\n",
    307 __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, server_core_lid, cycle );
     313__FUNCTION__, server_ptr->process->pid, server_ptr->trdid, server_lid, cycle );
    308314#endif
    309315                // try to consume one RPC request 
     
    320326                desc_ptr = GET_PTR( desc_xp );
    321327
     328                // get relevant infos from RPC descriptor
    322329                    index      = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->index ) );
    323                 blocking   = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->blocking ) );
    324330                client_ptr = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->thread ) );
     331                rsp_ptr    = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->rsp ) );
     332                client_lid = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->lid ) );
     333
     334                rsp_xp     = XPTR( desc_cxy , rsp_ptr );
     335                client_xp  = XPTR( desc_cxy , client_ptr );
    325336
    326337#if DEBUG_RPC_SERVER_GENERIC
     
    332343#endif
    333344                // register client thread in RPC thread descriptor
    334                 server_ptr->rpc_client_xp = XPTR( desc_cxy , client_ptr );
     345                server_ptr->rpc_client_xp = client_xp;
    335346 
    336347                // call the relevant server function
     
    343354__FUNCTION__, server_ptr->process->pid, server_ptr->trdid, rpc_str[index], desc_cxy, cycle );
    344355#endif
    345                 // decrement expected responses counter in RPC descriptor
    346                 count = hal_remote_atomic_add( XPTR( desc_cxy, &desc_ptr->responses ), -1 );
    347 
    348                 // decrement response counter in RPC descriptor if last response
    349                 if( count == 1 )
     356                // decrement expected responses counter
     357                responses = hal_remote_atomic_add( rsp_xp , -1 );
     358
     359                // unblock client thread if last response
     360                if( responses == 1 )
    350361                {
    351                     // get client thread pointer and client core lid from RPC descriptor
    352                     client_ptr      = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->thread ) );
    353                     client_core_lid = hal_remote_l32 ( XPTR( desc_cxy , &desc_ptr->lid ) );
    354 
    355362                    // unblock client thread
    356                     thread_unblock( XPTR( desc_cxy , client_ptr ) , THREAD_BLOCKED_RPC );
     363                    thread_unblock( client_xp , THREAD_BLOCKED_RPC );
    357364
    358365                    hal_fence();
     
    360367#if DEBUG_RPC_SERVER_GENERIC
    361368cycle = (uint32_t)hal_get_cycles();
     369trdid_t     client_trdid = hal_remote_l32( XPTR( desc_cxy , &client_ptr->trdid ) );
     370process_t * process      = hal_remote_lpt( XPTR( desc_cxy , &client_ptr->process ) );
     371pid_t       client_pid   = hal_remote_l32( XPTR( desc_cxy , &process->pid ) );
    362372if( DEBUG_RPC_SERVER_GENERIC < cycle )
    363373printk("\n[%s] RPC thread[%x,%x] unblocked client thread[%x,%x] / cycle %d\n",
    364374__FUNCTION__, server_ptr->process->pid, server_ptr->trdid,
    365 client_ptr->process->pid, client_ptr->trdid, cycle );
     375client_pid, client_trdid, cycle );
    366376#endif
    367377                    // send IPI to client core
    368                     dev_pic_send_ipi( desc_cxy , client_core_lid );
     378                    dev_pic_send_ipi( desc_cxy , client_lid );
    369379                }
    370380            }  // end RPC handling if fifo non empty
     
    372382
    373383        // sucide if too many RPC threads
    374         if( LOCAL_CLUSTER->rpc_threads[server_core_lid] >= CONFIG_RPC_THREADS_MAX )
     384        if( LOCAL_CLUSTER->rpc_threads[server_lid] >= CONFIG_RPC_THREADS_MAX )
    375385            {
    376386
     
    382392#endif
    383393            // update RPC threads counter
    384                 hal_atomic_add( &LOCAL_CLUSTER->rpc_threads[server_core_lid] , -1 );
     394                hal_atomic_add( &LOCAL_CLUSTER->rpc_threads[server_lid] , -1 );
    385395
    386396            // RPC thread blocks on GLOBAL
     
    397407uint32_t cycle = (uint32_t)hal_get_cycles();
    398408if( DEBUG_RPC_SERVER_GENERIC < cycle )
    399 printk("\n[%s] RPC thread[%x,%x] block IDLE & deschedules / cycle %d\n",
     409printk("\n[%s] RPC thread[%x,%x] blocks & deschedules / cycle %d\n",
    400410__FUNCTION__, server_ptr->process->pid, server_ptr->trdid, cycle );
    401411#endif
     
    407417        }
    408418        } // end infinite loop
    409 } // end rpc_thread_func()
     419
     420} // end rpc_server_func()
    410421
    411422
     
    427438#endif
    428439
    429     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     440    uint32_t responses = 1;
    430441
    431442    // initialise RPC descriptor header
     
    433444    rpc.index     = RPC_PMEM_GET_PAGES;
    434445    rpc.blocking  = true;
    435     rpc.responses = 1;
     446    rpc.rsp       = &responses;
    436447
    437448    // set input arguments in RPC descriptor
     
    485496
    486497/////////////////////////////////////////////////////////////////////////////////////////
    487 // [1]       Marshaling functions attached to RPC_PMEM_RELEASE_PAGES (blocking)
     498// [1]       Marshaling functions attached to RPC_PMEM_RELEASE_PAGES
    488499/////////////////////////////////////////////////////////////////////////////////////////
    489500
     
    500511#endif
    501512
    502     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     513    uint32_t responses = 1;
    503514
    504515    // initialise RPC descriptor header
     
    506517    rpc.index    = RPC_PMEM_RELEASE_PAGES;
    507518    rpc.blocking = true;
    508     rpc.responses = 1;
     519    rpc.rsp      = &responses;
    509520
    510521    // set input arguments in RPC descriptor
     
    559570
    560571/////////////////////////////////////////////////////////////////////////////////////////
    561 // [3]           Marshaling functions attached to RPC_PROCESS_MAKE_FORK (blocking)
     572// [3]           Marshaling functions attached to RPC_PROCESS_MAKE_FORK
    562573/////////////////////////////////////////////////////////////////////////////////////////
    563574
     
    578589#endif
    579590
    580     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     591    uint32_t responses = 1;
    581592
    582593    // initialise RPC descriptor header
     
    584595    rpc.index    = RPC_PROCESS_MAKE_FORK;
    585596    rpc.blocking = true;
    586     rpc.responses = 1;
     597    rpc.rsp      = &responses;
    587598
    588599    // set input arguments in RPC descriptor 
     
    651662
    652663/////////////////////////////////////////////////////////////////////////////////////////
    653 // [4]      Marshaling functions attached to RPC_USER_DIR_CREATE (blocking)
     664// [4]      Marshaling functions attached to RPC_USER_DIR_CREATE
    654665/////////////////////////////////////////////////////////////////////////////////////////
    655666
     
    668679#endif
    669680
    670     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     681    uint32_t responses = 1;
    671682
    672683    // initialise RPC descriptor header
     
    674685    rpc.index    = RPC_USER_DIR_CREATE;
    675686    rpc.blocking = true;
    676     rpc.responses = 1;
     687    rpc.rsp      = &responses;
    677688
    678689    // set input arguments in RPC descriptor
     
    732743
    733744/////////////////////////////////////////////////////////////////////////////////////////
    734 // [5]      Marshaling functions attached to RPC_USER_DIR_DESTROY (blocking)
     745// [5]      Marshaling functions attached to RPC_USER_DIR_DESTROY
    735746/////////////////////////////////////////////////////////////////////////////////////////
    736747
     
    748759#endif
    749760
    750     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     761    uint32_t responses = 1;
    751762
    752763    // initialise RPC descriptor header
     
    754765    rpc.index    = RPC_USER_DIR_DESTROY;
    755766    rpc.blocking = true;
    756     rpc.responses = 1;
     767    rpc.rsp      = &responses;
    757768
    758769    // set input arguments in RPC descriptor
     
    805816
    806817/////////////////////////////////////////////////////////////////////////////////////////
    807 // [6]      Marshaling functions attached to RPC_THREAD_USER_CREATE (blocking) 
     818// [6]      Marshaling functions attached to RPC_THREAD_USER_CREATE  
    808819/////////////////////////////////////////////////////////////////////////////////////////
    809820
     
    824835__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
    825836#endif
    826 
    827     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     837   
     838    uint32_t responses = 1;
    828839
    829840    // initialise RPC descriptor header
     
    831842    rpc.index    = RPC_THREAD_USER_CREATE;
    832843    rpc.blocking = true;
    833     rpc.responses = 1;
     844    rpc.rsp      = &responses;
    834845
    835846    // set input arguments in RPC descriptor
     
    929940#endif
    930941
    931     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     942    uint32_t responses = 1;
    932943
    933944    // initialise RPC descriptor header
     
    935946    rpc.index    = RPC_THREAD_KERNEL_CREATE;
    936947    rpc.blocking = true;
    937     rpc.responses = 1;
     948    rpc.rsp      = &responses;
    938949
    939950    // set input arguments in RPC descriptor
     
    10071018
    10081019/////////////////////////////////////////////////////////////////////////////////////////
    1009 // [9]   Marshaling functions attached to RPC_PROCESS_SIGACTION (non blocking)
     1020// [9]   Marshaling functions attached to RPC_PROCESS_SIGACTION
    10101021/////////////////////////////////////////////////////////////////////////////////////////
    10111022
    10121023////////////////////////////////////////////////////
    10131024void rpc_process_sigaction_client( cxy_t        cxy,
    1014                                    rpc_desc_t * rpc )
     1025                                   pid_t        pid,
     1026                                   uint32_t     action )
    10151027{
    10161028#if DEBUG_RPC_PROCESS_SIGACTION
     
    10181030thread_t * this = CURRENT_THREAD;
    10191031if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    1020 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
    1021 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
    1022 #endif
    1023 
    1024 // check RPC "index" and "blocking" arguments
    1025 assert( (rpc->blocking == false) , "must be non-blocking\n");
    1026 assert( (rpc->index == RPC_PROCESS_SIGACTION ) , "bad RPC index\n" );
    1027 
    1028     // register RPC request in remote RPC fifo and return
    1029     rpc_send( cxy , rpc );
     1032printk("\n[%s] thread[%x,%x] on core %d : enter to %s process %x / cycle %d\n",
     1033__FUNCTION__, this->process->pid, this->trdid, this->core->lid,
     1034process_action_str( action ), pid, cycle );
     1035#endif
     1036
     1037    uint32_t    responses = 1;
     1038    rpc_desc_t  rpc;
     1039
     1040    // initialise RPC descriptor header
     1041    rpc.index    = RPC_PROCESS_SIGACTION;
     1042    rpc.blocking = true;
     1043    rpc.rsp      = &responses;
     1044
     1045    // set input arguments in RPC descriptor
     1046    rpc.args[0] = (uint64_t)pid;
     1047    rpc.args[1] = (uint64_t)action;
     1048
     1049    // register RPC request in remote RPC fifo
     1050    rpc_send( cxy , &rpc );
    10301051
    10311052#if DEBUG_RPC_PROCESS_SIGACTION
    10321053cycle = (uint32_t)hal_get_cycles();
    10331054if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    1034 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
    1035 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     1055printk("\n[%s] thread[%x,%x] on core %d : exit after %s process %x / cycle %d\n",
     1056__FUNCTION__, this->process->pid, this->trdid, this->core->lid,
     1057process_action_str( action ), pid, cycle );
    10361058#endif
    10371059}  // end rpc_process_sigaction_client()
     
    10401062void rpc_process_sigaction_server( xptr_t xp )
    10411063{
    1042 #if DEBUG_RPC_PROCESS_SIGACTION
    1043 uint32_t cycle = (uint32_t)hal_get_cycles();
    1044 thread_t * this = CURRENT_THREAD;
    1045 if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    1046 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
    1047 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
    1048 #endif
    1049 
    10501064    // get client cluster identifier and pointer on RPC descriptor
    10511065    cxy_t        client_cxy = GET_CXY( xp );
     
    10561070    uint32_t action = (uint32_t)hal_remote_l64( XPTR(client_cxy , &desc->args[1]) );
    10571071
     1072#if DEBUG_RPC_PROCESS_SIGACTION
     1073uint32_t cycle = (uint32_t)hal_get_cycles();
     1074thread_t * this = CURRENT_THREAD;
     1075if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
     1076printk("\n[%s] thread[%x,%x] on core %d : enter to %s process %x / cycle %d\n",
     1077__FUNCTION__, this->process->pid, this->trdid, this->core->lid,
     1078process_action_str( action ), pid, cycle );
     1079#endif
     1080
    10581081    // get client thread pointers
    10591082    thread_t * client_ptr = hal_remote_lpt( XPTR( client_cxy , &desc->thread ) );
     
    10631086    process_t * process = cluster_get_local_process_from_pid( pid );
    10641087
    1065     // call relevant kernel function
    1066     if      ( action == DELETE_ALL_THREADS  ) process_delete_threads ( process , client_xp );
    1067     else if ( action == BLOCK_ALL_THREADS   ) process_block_threads  ( process );
    1068     else if ( action == UNBLOCK_ALL_THREADS ) process_unblock_threads( process );
     1088    // call relevant kernel function if found / does nothing if not found
     1089    if( process != NULL )
     1090    {
     1091        if ( action == DELETE_ALL_THREADS  ) process_delete_threads ( process , client_xp );
     1092        if ( action == BLOCK_ALL_THREADS   ) process_block_threads  ( process );
     1093        if ( action == UNBLOCK_ALL_THREADS ) process_unblock_threads( process );
     1094    }
    10691095
    10701096#if DEBUG_RPC_PROCESS_SIGACTION
    10711097cycle = (uint32_t)hal_get_cycles();
    10721098if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    1073 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
    1074 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     1099printk("\n[%s] thread[%x,%x] on core %d : exit after %s process %x / cycle %d\n",
     1100__FUNCTION__, this->process->pid, this->trdid, this->core->lid,
     1101process_action_str( action ), pid, cycle );
    10751102#endif
    10761103} // end rpc_process_sigaction_server()
    10771104
    10781105/////////////////////////////////////////////////////////////////////////////////////////
    1079 // [10]     Marshaling functions attached to RPC_VFS_INODE_CREATE  (blocking)
     1106// [10]     Marshaling functions attached to RPC_VFS_INODE_CREATE
    10801107/////////////////////////////////////////////////////////////////////////////////////////
    10811108
     
    10991126#endif
    11001127
    1101     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     1128    uint32_t responses = 1;
    11021129
    11031130    // initialise RPC descriptor header
     
    11051132    rpc.index    = RPC_VFS_INODE_CREATE;
    11061133    rpc.blocking = true;
    1107     rpc.responses = 1;
     1134    rpc.rsp      = &responses;
    11081135
    11091136    // set input arguments in RPC descriptor
     
    11841211
    11851212/////////////////////////////////////////////////////////////////////////////////////////
    1186 // [11]          Marshaling functions attached to RPC_VFS_INODE_DESTROY  (blocking)
     1213// [11]          Marshaling functions attached to RPC_VFS_INODE_DESTROY
    11871214/////////////////////////////////////////////////////////////////////////////////////////
    11881215
     
    11991226#endif
    12001227
    1201     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     1228    uint32_t responses = 1;
    12021229
    12031230    // initialise RPC descriptor header
     
    12051232    rpc.index    = RPC_VFS_INODE_DESTROY;
    12061233    rpc.blocking = true;
    1207     rpc.responses = 1;
     1234    rpc.rsp      = &responses;
    12081235
    12091236    // set input arguments in RPC descriptor
     
    12531280
    12541281/////////////////////////////////////////////////////////////////////////////////////////
    1255 // [12]          Marshaling functions attached to RPC_VFS_DENTRY_CREATE  (blocking)
     1282// [12]          Marshaling functions attached to RPC_VFS_DENTRY_CREATE
    12561283/////////////////////////////////////////////////////////////////////////////////////////
    12571284
     
    12711298#endif
    12721299
    1273     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     1300    uint32_t responses = 1;
    12741301
    12751302    // initialise RPC descriptor header
     
    12771304    rpc.index    = RPC_VFS_DENTRY_CREATE;
    12781305    rpc.blocking = true;
    1279     rpc.responses = 1;
     1306    rpc.rsp      = &responses;
    12801307
    12811308    // set input arguments in RPC descriptor
     
    13441371
    13451372/////////////////////////////////////////////////////////////////////////////////////////
    1346 // [13]          Marshaling functions attached to RPC_VFS_DENTRY_DESTROY  (blocking)
     1373// [13]          Marshaling functions attached to RPC_VFS_DENTRY_DESTROY
    13471374/////////////////////////////////////////////////////////////////////////////////////////
    13481375
     
    13591386#endif
    13601387
    1361     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     1388    uint32_t responses = 1;
    13621389
    13631390    // initialise RPC descriptor header
     
    13651392    rpc.index    = RPC_VFS_DENTRY_DESTROY;
    13661393    rpc.blocking = true;
    1367     rpc.responses = 1;
     1394    rpc.rsp      = &responses;
    13681395
    13691396    // set input arguments in RPC descriptor
     
    14141441
    14151442/////////////////////////////////////////////////////////////////////////////////////////
    1416 // [14]          Marshaling functions attached to RPC_VFS_FILE_CREATE  (blocking)
     1443// [14]          Marshaling functions attached to RPC_VFS_FILE_CREATE 
    14171444/////////////////////////////////////////////////////////////////////////////////////////
    14181445
     
    14321459#endif
    14331460
    1434     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     1461    uint32_t responses = 1;
    14351462
    14361463    // initialise RPC descriptor header
     
    14381465    rpc.index    = RPC_VFS_FILE_CREATE;
    14391466    rpc.blocking = true;
    1440     rpc.responses = 1;
     1467    rpc.rsp      = &responses;
    14411468
    14421469    // set input arguments in RPC descriptor
     
    15011528
    15021529/////////////////////////////////////////////////////////////////////////////////////////
    1503 // [15]          Marshaling functions attached to RPC_VFS_FILE_DESTROY  (blocking)
     1530// [15]          Marshaling functions attached to RPC_VFS_FILE_DESTROY 
    15041531/////////////////////////////////////////////////////////////////////////////////////////
    15051532
     
    15161543#endif
    15171544
    1518     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     1545    uint32_t responses = 1;
    15191546
    15201547    // initialise RPC descriptor header
     
    15221549    rpc.index    = RPC_VFS_FILE_DESTROY;
    15231550    rpc.blocking = true;
    1524     rpc.responses = 1;
     1551    rpc.rsp      = &responses;
    15251552
    15261553    // set input arguments in RPC descriptor
     
    15701597
    15711598/////////////////////////////////////////////////////////////////////////////////////////
    1572 // [16]      Marshaling functions attached to RPC_VFS_FS_GET_DENTRY  (blocking)
     1599// [16]      Marshaling functions attached to RPC_VFS_FS_GET_DENTRY
    15731600/////////////////////////////////////////////////////////////////////////////////////////
    15741601
     
    15881615#endif
    15891616
    1590     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     1617    uint32_t responses = 1;
    15911618
    15921619    // initialise RPC descriptor header
     
    15941621    rpc.index    = RPC_VFS_FS_GET_DENTRY;
    15951622    rpc.blocking = true;
    1596     rpc.responses = 1;
     1623    rpc.rsp      = &responses;
    15971624
    15981625    // set input arguments in RPC descriptor
     
    16611688
    16621689/////////////////////////////////////////////////////////////////////////////////////////
    1663 // [17]      Marshaling function attached to RPC_VFS_FS_ADD_DENTRY  (blocking)
     1690// [17]      Marshaling function attached to RPC_VFS_FS_ADD_DENTRY 
    16641691/////////////////////////////////////////////////////////////////////////////////////////
    16651692
     
    16771704#endif
    16781705
    1679     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     1706    uint32_t responses = 1;
    16801707
    16811708    // initialise RPC descriptor header
     
    16831710    rpc.index    = RPC_VFS_FS_ADD_DENTRY;
    16841711    rpc.blocking = true;
    1685     rpc.responses = 1;
     1712    rpc.rsp      = &responses;
    16861713
    16871714    // set input arguments in RPC descriptor
     
    17031730}
    17041731
    1705 /////////////////////////////////////////////////
     1732//////////////////////////////////////////////
    17061733void rpc_vfs_fs_add_dentry_server( xptr_t xp )
    17071734{
     
    17411768
    17421769/////////////////////////////////////////////////////////////////////////////////////////
    1743 // [18]      Marshaling function attached to RPC_VFS_FS_REMOVE_DENTRY  (blocking)
     1770// [18]      Marshaling function attached to RPC_VFS_FS_REMOVE_DENTRY
    17441771/////////////////////////////////////////////////////////////////////////////////////////
    17451772
     
    17571784#endif
    17581785
    1759     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     1786    uint32_t responses = 1;
    17601787
    17611788    // initialise RPC descriptor header
     
    17631790    rpc.index    = RPC_VFS_FS_REMOVE_DENTRY;
    17641791    rpc.blocking = true;
    1765     rpc.responses = 1;
     1792    rpc.rsp      = &responses;
    17661793
    17671794    // set input arguments in RPC descriptor
     
    18211848
    18221849/////////////////////////////////////////////////////////////////////////////////////////
    1823 // [19]     Marshaling functions attached to RPC_VFS_INODE_LOAD_ALL_PAGES  (blocking)
     1850// [19]     Marshaling functions attached to RPC_VFS_INODE_LOAD_ALL_PAGES
    18241851/////////////////////////////////////////////////////////////////////////////////////////
    18251852
     
    18371864#endif
    18381865
    1839     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     1866    uint32_t responses = 1;
    18401867
    18411868    // initialise RPC descriptor header
     
    18431870    rpc.index    = RPC_VFS_INODE_LOAD_ALL_PAGES;
    18441871    rpc.blocking = true;
    1845     rpc.responses = 1;
     1872    rpc.rsp      = &responses;
    18461873
    18471874    // set input arguments in RPC descriptor
     
    18981925
    18991926/////////////////////////////////////////////////////////////////////////////////////////
    1900 // [20]          Marshaling functions attached to RPC_VMM_GET_VSEG  (blocking)
     1927// [20]          Marshaling functions attached to RPC_VMM_GET_VSEG
    19011928/////////////////////////////////////////////////////////////////////////////////////////
    19021929
     
    19161943#endif
    19171944
    1918     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     1945    uint32_t responses = 1;
    19191946
    19201947    // initialise RPC descriptor header
     
    19221949    rpc.index    = RPC_VMM_GET_VSEG;
    19231950    rpc.blocking = true;
    1924     rpc.responses = 1;
     1951    rpc.rsp      = &responses;
    19251952
    19261953    // set input arguments in RPC descriptor
     
    19862013
    19872014/////////////////////////////////////////////////////////////////////////////////////////
    1988 // [21]    Marshaling functions attached to RPC_VMM_GLOBAL_UPDATE_PTE  (blocking)
     2015// [21]    Marshaling functions attached to RPC_VMM_GLOBAL_UPDATE_PTE
    19892016/////////////////////////////////////////////////////////////////////////////////////////
    19902017
     
    20042031#endif
    20052032
    2006     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     2033    uint32_t responses = 1;
    20072034
    20082035    // initialise RPC descriptor header
     
    20102037    rpc.index    = RPC_VMM_GLOBAL_UPDATE_PTE;
    20112038    rpc.blocking = true;
    2012     rpc.responses = 1;
     2039    rpc.rsp      = &responses;
    20132040
    20142041    // set input arguments in RPC descriptor
     
    20672094
    20682095/////////////////////////////////////////////////////////////////////////////////////////
    2069 // [22]          Marshaling functions attached to RPC_KCM_ALLOC  (blocking)
     2096// [22]          Marshaling functions attached to RPC_KCM_ALLOC
    20702097/////////////////////////////////////////////////////////////////////////////////////////
    20712098
     
    20732100void rpc_kcm_alloc_client( cxy_t      cxy,
    20742101                           uint32_t   kmem_type,   // in
    2075                            xptr_t buf_xp )     // out
     2102                           xptr_t   * buf_xp )     // out
    20762103{
    20772104#if DEBUG_RPC_KCM_ALLOC
     
    20832110#endif
    20842111
    2085     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     2112    uint32_t responses = 1;
    20862113
    20872114    // initialise RPC descriptor header
     
    20892116    rpc.index    = RPC_KCM_ALLOC;
    20902117    rpc.blocking = true;
    2091     rpc.responses = 1;
     2118    rpc.rsp      = &responses;
    20922119
    20932120    // set input arguments in RPC descriptor
     
    21452172
    21462173/////////////////////////////////////////////////////////////////////////////////////////
    2147 // [23]          Marshaling functions attached to RPC_KCM_FREE  (blocking)
     2174// [23]          Marshaling functions attached to RPC_KCM_FREE
    21482175/////////////////////////////////////////////////////////////////////////////////////////
    21492176
     
    21612188#endif
    21622189
    2163     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     2190    uint32_t responses = 1;
    21642191
    21652192    // initialise RPC descriptor header
     
    21672194    rpc.index    = RPC_KCM_FREE;
    21682195    rpc.blocking = true;
    2169     rpc.responses = 1;
     2196    rpc.rsp      = &responses;
    21702197
    21712198    // set input arguments in RPC descriptor
     
    22222249
    22232250/////////////////////////////////////////////////////////////////////////////////////////
    2224 // [25]          Marshaling functions attached to RPC_MAPPER_HANDLE_MISS (blocking)
     2251// [25]          Marshaling functions attached to RPC_MAPPER_HANDLE_MISS
    22252252/////////////////////////////////////////////////////////////////////////////////////////
    22262253
     
    22402267#endif
    22412268
    2242     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     2269    uint32_t responses = 1;
    22432270
    22442271    // initialise RPC descriptor header
     
    22462273    rpc.index    = RPC_MAPPER_HANDLE_MISS;
    22472274    rpc.blocking = true;
    2248     rpc.responses = 1;
     2275    rpc.rsp      = &responses;
    22492276
    22502277    // set input arguments in RPC descriptor
     
    23092336
    23102337/////////////////////////////////////////////////////////////////////////////////////////
    2311 // [26]  Marshaling functions attached to RPC_VMM_DELETE_VSEG (parallel / non blocking)
     2338// [26]  Marshaling functions attached to RPC_VMM_DELETE_VSEG
    23122339/////////////////////////////////////////////////////////////////////////////////////////
    23132340
    23142341//////////////////////////////////////////////////
    23152342void rpc_vmm_delete_vseg_client( cxy_t        cxy,
    2316                                  rpc_desc_t * rpc )
     2343                                 pid_t        pid,
     2344                                 intptr_t     vaddr )
    23172345{
    23182346#if DEBUG_RPC_VMM_DELETE_VSEG
     
    23242352#endif
    23252353
    2326 // check RPC "index" and "blocking" arguments
    2327 assert( (rpc->blocking == false) , "must be non-blocking\n");
    2328 assert( (rpc->index == RPC_VMM_DELETE_VSEG ) , "bad RPC index\n" );
     2354    uint32_t    responses = 1;
     2355    rpc_desc_t  rpc;
     2356
     2357    // initialise RPC descriptor header
     2358    rpc.index    = RPC_VMM_DELETE_VSEG;
     2359    rpc.blocking = true;
     2360    rpc.rsp      = &responses;
     2361
     2362    // set input arguments in RPC descriptor
     2363    rpc.args[0] = (uint64_t)pid;
     2364    rpc.args[1] = (uint64_t)vaddr;
    23292365
    23302366    // register RPC request in remote RPC fifo
    2331     rpc_send( cxy , rpc );
     2367    rpc_send( cxy , &rpc );
    23322368
    23332369#if DEBUG_RPC_VMM_DELETE_VSEG
     
    23702406
    23712407/////////////////////////////////////////////////////////////////////////////////////////
    2372 // [27]          Marshaling functions attached to RPC_VMM_CREATE_VSEG (blocking)
     2408// [27]          Marshaling functions attached to RPC_VMM_CREATE_VSEG
    23732409/////////////////////////////////////////////////////////////////////////////////////////
    23742410
     
    23932429#endif
    23942430
    2395     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     2431    uint32_t responses = 1;
    23962432
    23972433    // initialise RPC descriptor header
     
    23992435    rpc.index    = RPC_VMM_CREATE_VSEG;
    24002436    rpc.blocking = true;
    2401     rpc.responses = 1;
     2437    rpc.rsp      = &responses;
    24022438
    24032439    // set input arguments in RPC descriptor
     
    24722508
    24732509/////////////////////////////////////////////////////////////////////////////////////////
    2474 // [28]          Marshaling functions attached to RPC_VMM_SET_COW (blocking)
     2510// [28]          Marshaling functions attached to RPC_VMM_SET_COW
    24752511/////////////////////////////////////////////////////////////////////////////////////////
    24762512
     
    24792515                             process_t * process )
    24802516{
    2481     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     2517#if DEBUG_RPC_VMM_SET_COW
     2518thread_t * this = CURRENT_THREAD;
     2519uint32_t cycle = (uint32_t)hal_get_cycles();
     2520if( cycle > DEBUG_RPC_VMM_SET_COW )
     2521printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2522__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2523#endif
     2524
     2525    uint32_t responses = 1;
    24822526
    24832527    // initialise RPC descriptor header
     
    24852529    rpc.index    = RPC_VMM_SET_COW;
    24862530    rpc.blocking = true;
    2487     rpc.responses = 1;
     2531    rpc.rsp      = &responses;
    24882532
    24892533    // set input arguments in RPC descriptor
     
    24932537    rpc_send( cxy , &rpc );
    24942538
     2539#if DEBUG_RPC_VMM_SET_COW
     2540cycle = (uint32_t)hal_get_cycles();
     2541if( cycle > DEBUG_RPC_VMM_SET_COW )
     2542printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2543__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2544#endif
    24952545}
    24962546
     
    24982548void rpc_vmm_set_cow_server( xptr_t xp )
    24992549{
     2550#if DEBUG_RPC_VMM_SET_COW
     2551thread_t * this = CURRENT_THREAD;
     2552uint32_t cycle = (uint32_t)hal_get_cycles();
     2553if( cycle > DEBUG_RPC_VMM_SET_COW )
     2554printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2555__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2556#endif
     2557
    25002558    process_t * process;
    25012559
     
    25102568    vmm_set_cow( process );
    25112569
    2512 }
    2513 
    2514 /////////////////////////////////////////////////////////////////////////////////////////
    2515 // [29]          Marshaling functions attached to RPC_VMM_DISPLAY (blocking)
     2570#if DEBUG_RPC_VMM_SET_COW
     2571cycle = (uint32_t)hal_get_cycles();
     2572if( cycle > DEBUG_RPC_VMM_SET_COW )
     2573printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2574__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2575#endif
     2576}
     2577
     2578/////////////////////////////////////////////////////////////////////////////////////////
     2579// [29]          Marshaling functions attached to RPC_VMM_DISPLAY
    25162580/////////////////////////////////////////////////////////////////////////////////////////
    25172581
     
    25212585                             bool_t      detailed )
    25222586{
    2523     assert( (cxy != local_cxy) , "server cluster is not remote\n");
     2587#if DEBUG_RPC_VMM_DISPLAY
     2588thread_t * this = CURRENT_THREAD;
     2589uint32_t cycle = (uint32_t)hal_get_cycles();
     2590if( cycle > DEBUG_RPC_VMM_DISPLAY )
     2591printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2592__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2593#endif
     2594
     2595    uint32_t responses = 1;
    25242596
    25252597    // initialise RPC descriptor header
     
    25272599    rpc.index    = RPC_VMM_DISPLAY;
    25282600    rpc.blocking = true;
    2529     rpc.responses = 1;
     2601    rpc.rsp      = &responses;
    25302602
    25312603    // set input arguments in RPC descriptor
     
    25362608    rpc_send( cxy , &rpc );
    25372609
     2610#if DEBUG_RPC_VMM_DISPLAY
     2611cycle = (uint32_t)hal_get_cycles();
     2612if( cycle > DEBUG_RPC_VMM_DISPLAY )
     2613printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2614__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2615#endif
    25382616}
    25392617
     
    25412619void rpc_vmm_display_server( xptr_t xp )
    25422620{
     2621#if DEBUG_RPC_VMM_DISPLAY
     2622thread_t * this = CURRENT_THREAD;
     2623uint32_t cycle = (uint32_t)hal_get_cycles();
     2624if( cycle > DEBUG_RPC_VMM_DISPLAY )
     2625printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2626__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2627#endif
     2628
    25432629    process_t * process;
    25442630    bool_t      detailed;
     
    25552641    vmm_display( process , detailed );
    25562642
    2557 }
    2558 
    2559 
     2643#if DEBUG_RPC_VMM_DISPLAY
     2644cycle = (uint32_t)hal_get_cycles();
     2645if( cycle > DEBUG_RPC_VMM_DISPLAY )
     2646printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2647__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2648#endif
     2649}
     2650
     2651
Note: See TracChangeset for help on using the changeset viewer.