Ignore:
Timestamp:
Apr 4, 2018, 2:49:02 PM (6 years ago)
Author:
alain
Message:

Fix a bug in scheduler related to RPC blocking.

File:
1 edited

Legend:

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

    r437 r438  
    4343
    4444/////////////////////////////////////////////////////////////////////////////////////////
    45 //        Debug macros for marshalling functions
    46 /////////////////////////////////////////////////////////////////////////////////////////
    47 
    48 #if CONFIG_DEBUG_RPC_MARSHALING
    49 
    50 #define RPC_DEBUG_ENTER                                                                \
    51 uint32_t cycle = (uint32_t)hal_get_cycles();                                           \
    52 if( cycle > CONFIG_DEBUG_RPC_MARSHALING )                                              \
    53 printk("\n[DBG] %s : enter thread %x on core[%x,%d] / cycle %d\n",                     \
    54 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
    55 
    56 #define RPC_DEBUG_EXIT                                                                 \
    57 cycle = (uint32_t)hal_get_cycles();                                                    \
    58 if( cycle > CONFIG_DEBUG_RPC_MARSHALING )                                              \
    59 printk("\n[DBG] %s : exit thread %x on core[%x,%d] / cycle %d\n",                      \
    60 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
    61 
    62 #else
    63 
    64 #define RPC_DEBUG_ENTER
    65 
    66 #define RPC_DEBUG_EXIT
    67 
    68 #endif
    69 
    70 /////////////////////////////////////////////////////////////////////////////////////////
    7145//      array of function pointers  (must be consistent with enum in rpc.h)
    7246/////////////////////////////////////////////////////////////////////////////////////////
     
    12296               rpc_desc_t * rpc )
    12397{
    124     volatile error_t   full = 0;
    125     thread_t         * this = CURRENT_THREAD;
    126     core_t           * core = this->core;
    127 
    128 #if CONFIG_DEBUG_RPC_SEND
     98    lid_t              server_core_lid;
     99    lid_t              client_core_lid;
     100    volatile error_t   full;
     101    thread_t         * this;
     102    cluster_t        * cluster;
     103
     104#if DEBUG_RPC_CLIENT_GENERIC
    129105uint32_t cycle = (uint32_t)hal_get_cycles();
    130 if( CONFIG_DEBUG_RPC_SEND < cycle )
     106if( DEBUG_RPC_CLIENT_GENERIC < cycle )
    131107printk("\n[DBG] %s : thread %x in cluster %x enter for rpc[%d] / rpc_ptr %x / cycle %d\n",
    132108__FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index, rpc, cycle );
    133109#endif
    134110
    135     // register client thread pointer and core lid in RPC descriptor
     111    full            = 0;
     112    this            = CURRENT_THREAD;
     113    cluster         = LOCAL_CLUSTER;
     114    client_core_lid = this->core->lid;
     115
     116    // select a server_core index:
     117    // use client core index if possible / core 0 otherwise
     118    if( client_core_lid < hal_remote_lw( XPTR( server_cxy , &cluster->cores_nr ) ) )
     119    {
     120        server_core_lid = client_core_lid;
     121    }
     122    else
     123    {   
     124        server_core_lid = 0;
     125    }
     126
     127    // register client_thread pointer and client_core lid in RPC descriptor
    136128    rpc->thread = this;
    137     rpc->lid    = core->lid;
    138 
    139     // build an extended pointer on the RPC descriptor
     129    rpc->lid    = client_core_lid;
     130
     131    // build extended pointer on the RPC descriptor
    140132        xptr_t   desc_xp = XPTR( local_cxy , rpc );
    141133
     
    160152    hal_fence();
    161153       
    162     // send IPI to the remote core corresponding to the client core
    163         dev_pic_send_ipi( server_cxy , core->lid );
     154    // send IPI to the selected server core
     155        dev_pic_send_ipi( server_cxy , server_core_lid );
    164156
    165157    // wait RPC completion before returning if blocking RPC
     
    171163        {
    172164
    173 #if CONFIG_DEBUG_RPC_SEND
    174 cycle = (uint32_t)hal_get_cycles();
    175 if( CONFIG_DEBUG_RPC_SEND < cycle )
     165#if DEBUG_RPC_CLIENT_GENERIC
     166cycle = (uint32_t)hal_get_cycles();
     167if( DEBUG_RPC_CLIENT_GENERIC < cycle )
    176168printk("\n[DBG] %s : thread %x in cluster %x busy waiting / rpc[%d] / cycle %d\n",
    177169__FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index , cycle );
    178170#endif
    179171
    180             while( rpc->response ) hal_fixed_delay( 100 );
     172            while( rpc->responses ) hal_fixed_delay( 100 );
    181173   
    182 #if CONFIG_DEBUG_RPC_SEND
    183 cycle = (uint32_t)hal_get_cycles();
    184 if( CONFIG_DEBUG_RPC_SEND < cycle )
    185 printk("\n[DBG] %s : thread % in cluster %x resume / rpc[%d] / cycle %d\n",
     174#if DEBUG_RPC_CLIENT_GENERIC
     175cycle = (uint32_t)hal_get_cycles();
     176if( DEBUG_RPC_CLIENT_GENERIC < cycle )
     177printk("\n[DBG] %s : thread %x in cluster %x resumes / rpc[%d] / cycle %d\n",
    186178__FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index, cycle );
    187179#endif
     
    190182        {
    191183
    192 #if CONFIG_DEBUG_RPC_SEND
    193 cycle = (uint32_t)hal_get_cycles();
    194 if( CONFIG_DEBUG_RPC_SEND < cycle )
    195 printk("\n[DBG] %s : thread %x in cluster %x deschedule / rpc[%d] / cycle %d\n",
     184#if DEBUG_RPC_CLIENT_GENERIC
     185cycle = (uint32_t)hal_get_cycles();
     186if( DEBUG_RPC_CLIENT_GENERIC < cycle )
     187printk("\n[DBG] %s : thread %x in cluster %x blocks & deschedules / rpc[%d] / cycle %d\n",
    196188__FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index , cycle );
    197189#endif
     
    199191            sched_yield("blocked on RPC");
    200192
    201 #if CONFIG_DEBUG_RPC_SEND
    202 cycle = (uint32_t)hal_get_cycles();
    203 if( CONFIG_DEBUG_RPC_SEND < cycle )
    204 printk("\n[DBG] %s : thread % in cluster %x resume / rpcr[%d] / cycle %d\n",
     193#if DEBUG_RPC_CLIENT_GENERIC
     194cycle = (uint32_t)hal_get_cycles();
     195if( DEBUG_RPC_CLIENT_GENERIC < cycle )
     196printk("\n[DBG] %s : thread %x in cluster %x resumes / rpcr[%d] / cycle %d\n",
    205197__FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index, cycle );
    206198#endif
     
    208200
    209201        // check response available
    210         assert( (rpc->response == 0) , __FUNCTION__, "illegal RPC response\n" );
    211 
    212         // acknowledge the IPI sent by the server
    213         dev_pic_ack_ipi();
     202        assert( (rpc->responses == 0) , __FUNCTION__, "illegal RPC response\n" );
    214203    }
    215     else
     204    else  // non blocking RPC
    216205    {
    217206
    218 #if CONFIG_DEBUG_RPC_SEND
    219 cycle = (uint32_t)hal_get_cycles();
    220 if( CONFIG_DEBUG_RPC_SEND < cycle )
     207#if DEBUG_RPC_CLIENT_GENERIC
     208cycle = (uint32_t)hal_get_cycles();
     209if( DEBUG_RPC_CLIENT_GENERIC < cycle )
    221210printk("\n[DBG] %s : non blocking rpc[%d] => thread %x return  / cycle %d\n",
    222211__FUNCTION__, rpc->index, CURRENT_THREAD, cycle );
     
    244233        remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo;
    245234
    246 #if CONFIG_DEBUG_RPC_SERVER
     235#if DEBUG_RPC_SERVER_GENERIC
    247236uint32_t cycle = (uint32_t)hal_get_cycles();
    248 if( CONFIG_DEBUG_RPC_SERVER < cycle )
     237if( DEBUG_RPC_SERVER_GENERIC < cycle )
    249238printk("\n[DBG] %s : thread %x interrupted in cluster %x / cycle %d\n",
    250239__FUNCTION__, this, local_cxy, cycle );
     
    254243        hal_disable_irq( &sr_save );
    255244
    256     // check RPC FIFO not empty and no RPC thread handling it 
     245    // activate (or create) RPC thread if RPC FIFO not empty 
    257246        if( (rpc_fifo->owner == 0) && (local_fifo_is_empty(rpc_fifo) == false) )
    258247    {
    259         // search one non blocked RPC thread   
     248
     249#if DEBUG_RPC_SERVER_GENERIC
     250cycle = (uint32_t)hal_get_cycles();
     251if( DEBUG_RPC_SERVER_GENERIC < cycle )
     252printk("\n[DBG] %s : RPC FIFO non empty in cluster %x / cycle %d\n",
     253__FUNCTION__, local_cxy, cycle );
     254#endif
     255
     256        // search one IDLE RPC thread   
    260257        list_entry_t * iter;
    261258        LIST_FOREACH( &sched->k_root , iter )
    262259        {
    263260            thread = LIST_ELEMENT( iter , thread_t , sched_list );
    264             if( (thread->type == THREAD_RPC) && (thread->blocked == 0 ) )
     261            if( (thread->type == THREAD_RPC) && (thread->blocked == THREAD_BLOCKED_IDLE ) )
    265262            {
     263                // unblock found RPC thread
     264                thread_unblock( XPTR( local_cxy , thread ) , THREAD_BLOCKED_IDLE );
     265
     266                // exit loop
    266267                found = true;
    267268                break;
     
    279280                if( error )
    280281            {
    281                 printk("\n[WARNING] in %s : no memory for new RPC thread in cluster %x\n",
    282                 __FUNCTION__ , local_cxy );
     282                assert( false , __FUNCTION__ ,
     283                "no memory to allocate a new RPC thread in cluster %x", local_cxy );
    283284            }
    284             else
    285             {
    286                 // unblock created RPC thread
    287                 thread->blocked = 0;
    288 
    289                 // update core descriptor counter 
    290                     hal_atomic_add( &LOCAL_CLUSTER->rpc_threads , 1 );
    291 
    292 #if CONFIG_DEBUG_RPC_SERVER
    293 cycle = (uint32_t)hal_get_cycles();
    294 if( CONFIG_DEBUG_RPC_SERVER < cycle )
     285
     286            // unblock created RPC thread
     287            thread->blocked = 0;
     288
     289            // update core descriptor counter 
     290            hal_atomic_add( &LOCAL_CLUSTER->rpc_threads , 1 );
     291
     292#if DEBUG_RPC_SERVER_GENERIC
     293cycle = (uint32_t)hal_get_cycles();
     294if( DEBUG_RPC_SERVER_GENERIC < cycle )
    295295printk("\n[DBG] %s : create a new RPC thread %x in cluster %x / cycle %d\n",
    296296__FUNCTION__, thread, local_cxy, cycle );
    297297#endif
    298             }
    299298        }
    300299    }
    301300
    302 #if CONFIG_DEBUG_RPC_SERVER
    303 cycle = (uint32_t)hal_get_cycles();
    304 if( CONFIG_DEBUG_RPC_SERVER < cycle )
     301#if DEBUG_RPC_SERVER_GENERIC
     302cycle = (uint32_t)hal_get_cycles();
     303if( DEBUG_RPC_SERVER_GENERIC < cycle )
    305304printk("\n[DBG] %s : interrupted thread %x deschedules in cluster %x / cycle %d\n",
    306305__FUNCTION__, this, local_cxy, cycle );
    307306#endif
    308307
    309     // interrupted thread deschedule always          
     308    // interrupted thread always deschedule         
    310309        sched_yield("IPI received");
    311310
    312 #if CONFIG_DEBUG_RPC_SERVER
    313 cycle = (uint32_t)hal_get_cycles();
    314 if( CONFIG_DEBUG_RPC_SERVER < cycle )
     311#if DEBUG_RPC_SERVER_GENERIC
     312cycle = (uint32_t)hal_get_cycles();
     313if( DEBUG_RPC_SERVER_GENERIC < cycle )
    315314printk("\n[DBG] %s : interrupted thread %x resumes in cluster %x / cycle %d\n",
    316315__FUNCTION__, this, local_cxy, cycle );
     
    346345    // - internal loop : handle up to CONFIG_RPC_PENDING_MAX RPC requests
    347346 
    348         while(1)  // external loop
     347        while(1)  // infinite loop
    349348        {
    350349        // try to take RPC_FIFO ownership
     
    352351        {
    353352
    354 #if CONFIG_DEBUG_RPC_SERVER
     353#if DEBUG_RPC_SERVER_GENERIC
    355354uint32_t cycle = (uint32_t)hal_get_cycles();
    356 if( CONFIG_DEBUG_RPC_SERVER < cycle )
     355if( DEBUG_RPC_SERVER_GENERIC < cycle )
    357356printk("\n[DBG] %s : RPC thread %x in cluster %x takes RPC fifo ownership / cycle %d\n",
    358357__FUNCTION__, this, local_cxy, cycle );
     
    360359            // initializes RPC requests counter
    361360            count = 0;
    362 
    363             // acknowledge local IPI
    364             dev_pic_ack_ipi();
    365361
    366362                    // exit internal loop in three cases:
     
    381377                    blocking = hal_remote_lw( XPTR( desc_cxy , &desc_ptr->blocking ) );
    382378
    383 #if CONFIG_DEBUG_RPC_SERVER
    384 cycle = (uint32_t)hal_get_cycles();
    385 if( CONFIG_DEBUG_RPC_SERVER < cycle )
    386 printk("\n[DBG] %s : RPC thread %x in cluster %x got rpc[%d] / rpc_ptr %x / cycle %d\n",
    387 __FUNCTION__, this, local_cxy, index, desc_ptr, cycle );
     379#if DEBUG_RPC_SERVER_GENERIC
     380cycle = (uint32_t)hal_get_cycles();
     381if( DEBUG_RPC_SERVER_GENERIC < cycle )
     382printk("\n[DBG] %s : RPC thread %x in cluster %x got rpc[%d] / rpc_cxy %x / rpc_ptr %x\n",
     383__FUNCTION__, this, local_cxy, index, desc_cxy, desc_ptr );
    388384#endif
    389385                    // call the relevant server function
    390386                    rpc_server[index]( desc_xp );
    391387
    392 #if CONFIG_DEBUG_RPC_SERVER
    393 cycle = (uint32_t)hal_get_cycles();
    394 if( CONFIG_DEBUG_RPC_SERVER < cycle )
     388#if DEBUG_RPC_SERVER_GENERIC
     389cycle = (uint32_t)hal_get_cycles();
     390if( DEBUG_RPC_SERVER_GENERIC < cycle )
    395391printk("\n[DBG] %s : RPC thread %x in cluster %x completes rpc[%d] / rpc_ptr %x / cycle %d\n",
    396 __FUNCTION__, this, local_cxy, index, cycle );
     392__FUNCTION__, this, local_cxy, index, desc_ptr, cycle );
    397393#endif
    398394                    // increment handled RPCs counter
     
    403399                    {
    404400                        // decrement responses counter in RPC descriptor
    405                         hal_remote_atomic_add(XPTR( desc_cxy, &desc_ptr->response ), -1);
     401                        hal_remote_atomic_add( XPTR( desc_cxy, &desc_ptr->responses ), -1 );
     402
     403                        // get client thread pointer and client core lid from RPC descriptor
     404                        thread_ptr = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->thread ) );
     405                        core_lid   = hal_remote_lw ( XPTR( desc_cxy , &desc_ptr->lid ) );
    406406
    407407                        // unblock client thread
    408                         thread_ptr = (thread_t *)hal_remote_lpt(XPTR(desc_cxy,&desc_ptr->thread));
    409                         thread_unblock( XPTR(desc_cxy,thread_ptr) , THREAD_BLOCKED_RPC );
     408                        thread_unblock( XPTR( desc_cxy , thread_ptr ) , THREAD_BLOCKED_RPC );
    410409
    411410                        hal_fence();
    412411
    413                         // get client core lid and send IPI
    414                         core_lid = hal_remote_lw(XPTR(desc_cxy, &desc_ptr->lid));
     412#if DEBUG_RPC_SERVER_GENERIC
     413cycle = (uint32_t)hal_get_cycles();
     414if( DEBUG_RPC_SERVER_GENERIC < cycle )
     415printk("\n[DBG] %s : RPC thread %x (cluster %x) unblocked client thread %x (cluster %x)\n",
     416__FUNCTION__, this, local_cxy, thread_ptr, desc_cxy, cycle );
     417#endif
     418                        // send IPI to client core
    415419                            dev_pic_send_ipi( desc_cxy , core_lid );
    416420                    }
     
    432436            {
    433437
    434 #if CONFIG_DEBUG_RPC_SERVER
     438#if DEBUG_RPC_SERVER_GENERIC
    435439uint32_t cycle = (uint32_t)hal_get_cycles();
    436 if( CONFIG_DEBUG_RPC_SERVER < cycle )
     440if( DEBUG_RPC_SERVER_GENERIC < cycle )
    437441printk("\n[DBG] %s : RPC thread %x in cluster %x suicides / cycle %d\n",
    438442__FUNCTION__, this, local_cxy, cycle );
     
    447451            }
    448452
    449 #if CONFIG_DEBUG_RPC_SERVER
     453#if DEBUG_RPC_SERVER_GENERIC
    450454uint32_t cycle = (uint32_t)hal_get_cycles();
    451 if( CONFIG_DEBUG_RPC_SERVER < cycle )
     455if( DEBUG_RPC_SERVER_GENERIC < cycle )
    452456printk("\n[DBG] %s : RPC thread %x in cluster %x deschedules / cycle %d\n",
    453457__FUNCTION__, this, local_cxy, cycle );
    454458#endif
    455459
    456         // deschedule without blocking
     460        // Block and deschedule
     461        thread_block( XPTR( local_cxy , this ) , THREAD_BLOCKED_IDLE );
    457462        sched_yield("RPC fifo empty or too much work");
    458463
    459 #if CONFIG_DEBUG_RPC_SERVER
    460 cycle = (uint32_t)hal_get_cycles();
    461 if( CONFIG_DEBUG_RPC_SERVER < cycle )
     464#if DEBUG_RPC_SERVER_GENERIC
     465cycle = (uint32_t)hal_get_cycles();
     466if( DEBUG_RPC_SERVER_GENERIC < cycle )
    462467printk("\n[DBG] %s : RPC thread %x in cluster %x resumes / cycle %d\n",
    463468__FUNCTION__, this, local_cxy, cycle );
    464469#endif
    465470
    466         } // end external loop
     471        } // end infinite loop
    467472
    468473} // end rpc_thread_func()
     
    478483                                page_t  ** page )      // out
    479484{
    480 
    481     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    482 
    483     // initialise RPC descriptor header
    484     rpc_desc_t  rpc;
    485     rpc.index    = RPC_PMEM_GET_PAGES;
    486     rpc.response = 1;
    487     rpc.blocking = true;
     485#if DEBUG_RPC_PMEM_GET_PAGES
     486uint32_t cycle = (uint32_t)hal_get_cycles();
     487if( cycle > DEBUG_RPC_PMEM_GET_PAGES )
     488printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     489__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     490#endif
     491
     492    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
     493
     494    // initialise RPC descriptor header
     495    rpc_desc_t  rpc;
     496    rpc.index     = RPC_PMEM_GET_PAGES;
     497    rpc.blocking  = true;
     498    rpc.responses = 1;
    488499
    489500    // set input arguments in RPC descriptor
     
    496507    *page = (page_t *)(intptr_t)rpc.args[1];
    497508
     509#if DEBUG_RPC_PMEM_GET_PAGES
     510cycle = (uint32_t)hal_get_cycles();
     511if( cycle > DEBUG_RPC_PMEM_GET_PAGES )
     512printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     513__FUNCTION__ , CURRENT_THREAD , cycle );
     514#endif
    498515}
    499516
     
    501518void rpc_pmem_get_pages_server( xptr_t xp )
    502519{
     520#if DEBUG_RPC_PMEM_GET_PAGES
     521uint32_t cycle = (uint32_t)hal_get_cycles();
     522if( cycle > DEBUG_RPC_PMEM_GET_PAGES )
     523printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     524__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     525#endif
    503526
    504527    // get client cluster identifier and pointer on RPC descriptor
     
    515538    hal_remote_swd( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page );
    516539
     540#if DEBUG_RPC_PMEM_GET_PAGES
     541cycle = (uint32_t)hal_get_cycles();
     542if( cycle > DEBUG_RPC_PMEM_GET_PAGES )
     543printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     544__FUNCTION__ , CURRENT_THREAD , cycle );
     545#endif
    517546}
    518547
     
    525554                                    page_t  * page )      // out
    526555{
     556#if DEBUG_RPC_PMEM_RELEASE_PAGES
     557uint32_t cycle = (uint32_t)hal_get_cycles();
     558if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES )
     559printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     560__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     561#endif
    527562
    528563    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
     
    531566    rpc_desc_t  rpc;
    532567    rpc.index    = RPC_PMEM_RELEASE_PAGES;
    533     rpc.response = 1;
    534     rpc.blocking = true;
     568    rpc.blocking = true;
     569    rpc.responses = 1;
    535570
    536571    // set input arguments in RPC descriptor
     
    540575    rpc_send( cxy , &rpc );
    541576
     577#if DEBUG_RPC_PMEM_RELEASE_PAGES
     578cycle = (uint32_t)hal_get_cycles();
     579if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES )
     580printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     581__FUNCTION__ , CURRENT_THREAD , cycle );
     582#endif
    542583}
    543584
     
    545586void rpc_pmem_release_pages_server( xptr_t xp )
    546587{
     588#if DEBUG_RPC_PMEM_RELEASE_PAGES
     589uint32_t cycle = (uint32_t)hal_get_cycles();
     590if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES )
     591printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     592__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     593#endif
    547594
    548595    // get client cluster identifier and pointer on RPC descriptor
     
    559606    kmem_free( &req );
    560607
     608#if DEBUG_RPC_PMEM_RELEASE_PAGES
     609cycle = (uint32_t)hal_get_cycles();
     610if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES )
     611printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     612__FUNCTION__ , CURRENT_THREAD , cycle );
     613#endif
    561614}
    562615
     
    577630                                   error_t   * error )              // out
    578631{
     632#if DEBUG_RPC_PROCESS_MAKE_FORK
     633uint32_t cycle = (uint32_t)hal_get_cycles();
     634if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK )
     635printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     636__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     637#endif
     638
    579639    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    580640
     
    582642    rpc_desc_t  rpc;
    583643    rpc.index    = RPC_PROCESS_MAKE_FORK;
    584     rpc.response = 1;
    585     rpc.blocking = true;
     644    rpc.blocking = true;
     645    rpc.responses = 1;
    586646
    587647    // set input arguments in RPC descriptor 
     
    597657    *error             = (error_t)rpc.args[4];     
    598658
     659#if DEBUG_RPC_PROCESS_MAKE_FORK
     660cycle = (uint32_t)hal_get_cycles();
     661if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK )
     662printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     663__FUNCTION__ , CURRENT_THREAD , cycle );
     664#endif
    599665}
    600666
     
    602668void rpc_process_make_fork_server( xptr_t xp )
    603669{
     670#if DEBUG_RPC_PROCESS_MAKE_FORK
     671uint32_t cycle = (uint32_t)hal_get_cycles();
     672if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK )
     673printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     674__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     675#endif
    604676
    605677    xptr_t     ref_process_xp;     // extended pointer on reference parent process
     
    628700    hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error );
    629701
     702#if DEBUG_RPC_PROCESS_MAKE_FORK
     703cycle = (uint32_t)hal_get_cycles();
     704if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK )
     705printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     706__FUNCTION__ , CURRENT_THREAD , cycle );
     707#endif
    630708}
    631709
     
    656734    rpc_desc_t  rpc;
    657735    rpc.index    = RPC_THREAD_USER_CREATE;
    658     rpc.response = 1;
    659     rpc.blocking = true;
     736    rpc.blocking = true;
     737    rpc.responses = 1;
    660738
    661739    // set input arguments in RPC descriptor
     
    690768    // get client cluster identifier and pointer on RPC descriptor
    691769    cxy_t        client_cxy  = GET_CXY( xp );
    692     rpc_desc_t * desc = GET_PTR( xp );
     770    rpc_desc_t * desc        = GET_PTR( xp );
    693771
    694772    // get pointer on attributes structure in client cluster from RPC descriptor
     
    736814    rpc_desc_t  rpc;
    737815    rpc.index    = RPC_THREAD_KERNEL_CREATE;
    738     rpc.response = 1;
    739     rpc.blocking = true;
     816    rpc.blocking = true;
     817    rpc.responses = 1;
    740818
    741819    // set input arguments in RPC descriptor
     
    763841    // get client cluster identifier and pointer on RPC descriptor
    764842    cxy_t        client_cxy  = GET_CXY( xp );
    765     rpc_desc_t * desc = GET_PTR( xp );
     843    rpc_desc_t * desc        = GET_PTR( xp );
    766844
    767845    // get attributes from RPC descriptor
     
    797875{
    798876
    799 #if (CONFIG_DEBUG_PROCESS_SIGACTION & 1)
     877#if DEBUG_RPC_PROCESS_SIGACTION
    800878uint32_t  cycle  = (uint32_t)hal_get_cycles();
    801879uint32_t  action = rpc->args[0];
    802880pid_t     pid    = rpc->args[1];
    803 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     881if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    804882printk("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n",
    805883__FUNCTION__ , process_action_str( action ) , pid , cxy , cycle );
     
    813891    rpc_send( cxy , rpc );
    814892
    815 #if (CONFIG_DEBUG_PROCESS_SIGACTION & 1)
    816 cycle = (uint32_t)hal_get_cycles();
    817 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     893#if DEBUG_RPC_PROCESS_SIGACTION
     894cycle = (uint32_t)hal_get_cycles();
     895if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    818896printk("\n[DBG] %s : exit after requesting to %s process %x in cluster %x / cycle %d\n",
    819897__FUNCTION__ , process_action_str( action ) , pid , cxy , cycle );
     
    842920    pid      = (pid_t)   hal_remote_lwd( XPTR(client_cxy , &rpc->args[1]) );
    843921
    844 #if (CONFIG_DEBUG_PROCESS_SIGACTION & 1)
     922#if DEBUG_RPC_PROCESS_SIGACTION
    845923uint32_t cycle = (uint32_t)hal_get_cycles();
    846 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     924if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    847925printk("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n",
    848926__FUNCTION__ , process_action_str( action ) , pid , local_cxy , cycle );
     
    858936
    859937    // build extended pointer on response counter in RPC
    860     count_xp = XPTR( client_cxy , &rpc->response );
     938    count_xp = XPTR( client_cxy , &rpc->responses );
    861939
    862940    // decrement the responses counter in RPC descriptor,
     
    872950    }
    873951
    874 #if (CONFIG_DEBUG_PROCESS_SIGACTION & 1)
    875 cycle = (uint32_t)hal_get_cycles();
    876 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     952#if DEBUG_RPC_PROCESS_SIGACTION
     953cycle = (uint32_t)hal_get_cycles();
     954if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    877955printk("\n[DBG] %s : exit after %s process %x in cluster %x / cycle %d\n",
    878956__FUNCTION__ , process_action_str( action ) , pid , local_cxy , cycle );
     
    903981    rpc_desc_t  rpc;
    904982    rpc.index    = RPC_VFS_INODE_CREATE;
    905     rpc.response = 1;
    906     rpc.blocking = true;
     983    rpc.blocking = true;
     984    rpc.responses = 1;
    907985
    908986    // set input arguments in RPC descriptor
     
    9831061    rpc_desc_t  rpc;
    9841062    rpc.index    = RPC_VFS_INODE_DESTROY;
    985     rpc.response = 1;
    986     rpc.blocking = true;
     1063    rpc.blocking = true;
     1064    rpc.responses = 1;
    9871065
    9881066    // set input arguments in RPC descriptor
     
    10231101                                   error_t              * error )       // out
    10241102{
    1025     RPC_DEBUG_ENTER
     1103#if DEBUG_RPC_VFS_DENTRY_CREATE
     1104uint32_t cycle = (uint32_t)hal_get_cycles();
     1105if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE )
     1106printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     1107__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     1108#endif
    10261109
    10271110    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
     
    10301113    rpc_desc_t  rpc;
    10311114    rpc.index    = RPC_VFS_DENTRY_CREATE;
    1032     rpc.response = 1;
    1033     rpc.blocking = true;
     1115    rpc.blocking = true;
     1116    rpc.responses = 1;
    10341117
    10351118    // set input arguments in RPC descriptor
     
    10451128    *error     = (error_t)rpc.args[4];
    10461129
    1047     RPC_DEBUG_EXIT
     1130#if DEBUG_RPC_VFS_DENTRY_CREATE
     1131cycle = (uint32_t)hal_get_cycles();
     1132if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE )
     1133printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     1134__FUNCTION__ , CURRENT_THREAD , cycle );
     1135#endif
    10481136}
    10491137
     
    10511139void rpc_vfs_dentry_create_server( xptr_t xp )
    10521140{
     1141#if DEBUG_RPC_VFS_DENTRY_CREATE
     1142uint32_t cycle = (uint32_t)hal_get_cycles();
     1143if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE )
     1144printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     1145__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     1146#endif
     1147
    10531148    uint32_t      type;
    10541149    char        * name;
     
    10561151    xptr_t        dentry_xp;
    10571152    error_t       error;
    1058 
    1059     RPC_DEBUG_ENTER
    1060 
    10611153    char          name_copy[CONFIG_VFS_MAX_NAME_LENGTH];
    10621154
     
    10831175    hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error );
    10841176
    1085     RPC_DEBUG_EXIT
     1177#if DEBUG_RPC_VFS_DENTRY_CREATE
     1178cycle = (uint32_t)hal_get_cycles();
     1179if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE )
     1180printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     1181__FUNCTION__ , CURRENT_THREAD , cycle );
     1182#endif
    10861183}
    10871184
     
    11001197    rpc_desc_t  rpc;
    11011198    rpc.index    = RPC_VFS_DENTRY_DESTROY;
    1102     rpc.response = 1;
    1103     rpc.blocking = true;
     1199    rpc.blocking = true;
     1200    rpc.responses = 1;
    11041201
    11051202    // set input arguments in RPC descriptor
     
    11401237                                 error_t              * error )      // out
    11411238{
     1239#if DEBUG_RPC_VFS_FILE_CREATE
     1240uint32_t cycle = (uint32_t)hal_get_cycles();
     1241if( cycle > DEBUG_RPC_VFS_FILE_CREATE )
     1242printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     1243__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     1244#endif
     1245
    11421246    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    11431247
     
    11451249    rpc_desc_t  rpc;
    11461250    rpc.index    = RPC_VFS_FILE_CREATE;
    1147     rpc.response = 1;
    1148     rpc.blocking = true;
     1251    rpc.blocking = true;
     1252    rpc.responses = 1;
    11491253
    11501254    // set input arguments in RPC descriptor
     
    11591263    *error   = (error_t)rpc.args[3];
    11601264
     1265#if DEBUG_RPC_VFS_FILE_CREATE
     1266cycle = (uint32_t)hal_get_cycles();
     1267if( cycle > DEBUG_RPC_VFS_FILE_CREATE )
     1268printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     1269__FUNCTION__ , CURRENT_THREAD , cycle );
     1270#endif
    11611271}
    11621272
     
    11641274void rpc_vfs_file_create_server( xptr_t xp )
    11651275{
     1276#if DEBUG_RPC_VFS_FILE_CREATE
     1277uint32_t cycle = (uint32_t)hal_get_cycles();
     1278if( cycle > DEBUG_RPC_VFS_FILE_CREATE )
     1279printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
     1280__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
     1281#endif
     1282
    11661283    uint32_t      file_attr;
    11671284    vfs_inode_t * inode;
     
    11861303    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
    11871304
     1305#if DEBUG_RPC_VFS_FILE_CREATE
     1306cycle = (uint32_t)hal_get_cycles();
     1307if( cycle > DEBUG_RPC_VFS_FILE_CREATE )
     1308printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     1309__FUNCTION__ , CURRENT_THREAD , cycle );
     1310#endif
    11881311}
    11891312
     
    12011324    rpc_desc_t  rpc;
    12021325    rpc.index    = RPC_VFS_FILE_DESTROY;
    1203     rpc.response = 1;
    1204     rpc.blocking = true;
     1326    rpc.blocking = true;
     1327    rpc.responses = 1;
    12051328
    12061329    // set input arguments in RPC descriptor
     
    12451368    rpc_desc_t  rpc;
    12461369    rpc.index    = RPC_VFS_INODE_LOAD;
    1247     rpc.response = 1;
    1248     rpc.blocking = true;
     1370    rpc.blocking = true;
     1371    rpc.responses = 1;
    12491372
    12501373    // set input arguments in RPC descriptor
     
    13061429    rpc_desc_t  rpc;
    13071430    rpc.index    = RPC_VFS_MAPPER_LOAD_ALL;
    1308     rpc.response = 1;
    1309     rpc.blocking = true;
     1431    rpc.blocking = true;
     1432    rpc.responses = 1;
    13101433
    13111434    // set input arguments in RPC descriptor
     
    13581481    rpc_desc_t  rpc;
    13591482    rpc.index    = RPC_FATFS_GET_CLUSTER;
    1360     rpc.response = 1;
    1361     rpc.blocking = true;
     1483    rpc.blocking = true;
     1484    rpc.responses = 1;
    13621485
    13631486    // set input arguments in RPC descriptor
     
    13861509    // get client cluster identifier and pointer on RPC descriptor
    13871510    cxy_t        client_cxy  = GET_CXY( xp );
    1388     rpc_desc_t * desc = GET_PTR( xp );
     1511    rpc_desc_t * desc        = GET_PTR( xp );
    13891512
    13901513    // get input arguments
     
    14181541    rpc_desc_t  rpc;
    14191542    rpc.index    = RPC_VMM_GET_VSEG;
    1420     rpc.response = 1;
    1421     rpc.blocking = true;
     1543    rpc.blocking = true;
     1544    rpc.responses = 1;
    14221545
    14231546    // set input arguments in RPC descriptor
     
    14801603    rpc_desc_t  rpc;
    14811604    rpc.index    = RPC_VMM_GET_PTE;
    1482     rpc.response = 1;
    1483     rpc.blocking = true;
     1605    rpc.blocking = true;
     1606    rpc.responses = 1;
    14841607
    14851608    // set input arguments in RPC descriptor
     
    15411664    rpc_desc_t  rpc;
    15421665    rpc.index    = RPC_THREAD_USER_CREATE;
    1543     rpc.response = 1;
    1544     rpc.blocking = true;
     1666    rpc.blocking = true;
     1667    rpc.responses = 1;
    15451668
    15461669    // set input arguments in RPC descriptor
     
    15601683    // get client cluster identifier and pointer on RPC descriptor
    15611684    cxy_t        client_cxy  = GET_CXY( xp );
    1562     rpc_desc_t * desc = GET_PTR( xp );
     1685    rpc_desc_t * desc        = GET_PTR( xp );
    15631686
    15641687    // get input argument "kmem_type" from client RPC descriptor
     
    15911714    rpc_desc_t  rpc;
    15921715    rpc.index    = RPC_THREAD_USER_CREATE;
    1593     rpc.response = 1;
    1594     rpc.blocking = true;
     1716    rpc.blocking = true;
     1717    rpc.responses = 1;
    15951718
    15961719    // set input arguments in RPC descriptor
     
    16081731    // get client cluster identifier and pointer on RPC descriptor
    16091732    cxy_t        client_cxy  = GET_CXY( xp );
    1610     rpc_desc_t * desc = GET_PTR( xp );
     1733    rpc_desc_t * desc        = GET_PTR( xp );
    16111734
    16121735    // get input arguments "buf" and "kmem_type" from client RPC descriptor
     
    16411764    rpc_desc_t  rpc;
    16421765    rpc.index    = RPC_MAPPER_MOVE_BUFFER;
    1643     rpc.response = 1;
    1644     rpc.blocking = true;
     1766    rpc.blocking = true;
     1767    rpc.responses = 1;
    16451768
    16461769    // set input arguments in RPC descriptor
     
    17251848    rpc_desc_t  rpc;
    17261849    rpc.index    = RPC_MAPPER_GET_PAGE;
    1727     rpc.response = 1;
    1728     rpc.blocking = true;
     1850    rpc.blocking = true;
     1851    rpc.responses = 1;
    17291852
    17301853    // set input arguments in RPC descriptor
     
    17801903    rpc_desc_t  rpc;
    17811904    rpc.index    = RPC_VMM_CREATE_VSEG;
    1782     rpc.response = 1;
    1783     rpc.blocking = true;
     1905    rpc.blocking = true;
     1906    rpc.responses = 1;
    17841907
    17851908    // set input arguments in RPC descriptor
     
    18461969    rpc_desc_t  rpc;
    18471970    rpc.index    = RPC_SCHED_DISPLAY;
    1848     rpc.response = 1;
    1849     rpc.blocking = true;
     1971    rpc.blocking = true;
     1972    rpc.responses = 1;
    18501973
    18511974    // set input arguments in RPC descriptor
     
    18852008    rpc_desc_t  rpc;
    18862009    rpc.index    = RPC_VMM_SET_COW;
    1887     rpc.response = 1;
    1888     rpc.blocking = true;
     2010    rpc.blocking = true;
     2011    rpc.responses = 1;
    18892012
    18902013    // set input arguments in RPC descriptor
     
    19272050    rpc_desc_t  rpc;
    19282051    rpc.index    = RPC_VMM_DISPLAY;
    1929     rpc.response = 1;
    1930     rpc.blocking = true;
     2052    rpc.blocking = true;
     2053    rpc.responses = 1;
    19312054
    19322055    // set input arguments in RPC descriptor
Note: See TracChangeset for help on using the changeset viewer.