Changeset 619 for trunk/kernel/kern


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.


Location:
trunk/kernel/kern
Files:
9 edited

Legend:

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

    r601 r619  
    168168
    169169#if (DEBUG_CHDEV_CMD_RX || DEBUG_CHDEV_CMD_TX)
    170 bool_t is_rx = hal_remote_l32( XPTR( chdev_cxy , &chdev_ptr->is_rx ) );
     170bool_t      is_rx        = hal_remote_l32( XPTR( chdev_cxy , &chdev_ptr->is_rx ) );
     171trdid_t     server_trdid = hal_remote_l32( XPTR( chdev_cxy , &server_ptr->trdid ) );
     172process_t * process_ptr  = hal_remote_lpt( XPTR( chdev_cxy , &server_ptr->process ) );
     173pid_t       server_pid   = hal_remote_l32( XPTR( chdev_cxy , &process_ptr->pid ) );
    171174#endif
    172175   
     
    175178if( (is_rx) && (DEBUG_CHDEV_CMD_RX < rx_cycle) )
    176179printk("\n[%s] client[%x,%x] enter for RX / server[%x,%x] / cycle %d\n",
    177 __FUNCTION__, this->process->pid, this->trdid,
    178 server_ptr->process->pid, server_ptr->trdid, rx_cycle );
     180__FUNCTION__, this->process->pid, this->trdid, server_pid, server_trdid, rx_cycle );
    179181#endif
    180182
     
    183185if( (is_rx == 0) && (DEBUG_CHDEV_CMD_TX < tx_cycle) )
    184186printk("\n[%s] client[%x,%x] enter for TX / server[%x,%x] / cycle %d\n",
    185 __FUNCTION__, this->process->pid, this->trdid,
    186 server_ptr->process->pid, server_ptr->trdid, tx_cycle );
     187__FUNCTION__, this->process->pid, this->trdid, server_pid, server_trdid, tx_cycle );
    187188#endif
    188189
     
    241242if( (is_rx == 0) && (DEBUG_CHDEV_CMD_TX < tx_cycle) )
    242243printk("\n[%s] TX server thread[%x,%x] unblocked\n",
    243 __FUNCTION__, server_ptr->process->pid, server_ptr->trdid );
     244__FUNCTION__, server_pid, server_trdid );
    244245#endif
    245246
     
    247248if( (is_rx) && (DEBUG_CHDEV_CMD_RX < rx_cycle) )
    248249printk("\n[%s] RX server thread[%x,%x] unblocked\n",
    249 __FUNCTION__, server_ptr->process->pid, server_ptr->trdid );
     250__FUNCTION__, server_pid, server_trdid );
    250251#endif
    251252
     
    273274if( (is_rx == 0)  && (DEBUG_CHDEV_CMD_TX < tx_cycle) )
    274275printk("\n[%s] client thread[%x,%x] sent IPI to TX server thread[%x,%x]\n",
    275 __FUNCTION__, this->process->pid, this->trdid, server_ptr->process->pid, server_ptr->trdid );
     276__FUNCTION__, this->process->pid, this->trdid, server_pid, server_trdid );
    276277#endif
    277278
     
    279280if( (is_rx)  && (DEBUG_CHDEV_CMD_RX < rx_cycle) )
    280281printk("\n[%s] client thread[%x,%x] sent IPI to RX server thread[%x,%x]\n",
    281 __FUNCTION__, this->process->pid, this->trdid, server_ptr->process->pid, server_ptr->trdid );
     282__FUNCTION__, this->process->pid, this->trdid, server_pid, server_trdid );
    282283#endif
    283284
     
    317318}  // end chdev_register_command()
    318319
    319 ///////////////////////////////////////////////
    320 void chdev_sequencial_server( chdev_t * chdev )
     320/////////////////////////////////////////
     321void chdev_server_func( chdev_t * chdev )
    321322{
    322323    xptr_t          client_xp;    // extended pointer on waiting thread
     
    340341    {
    341342
    342 #if DEBUG_CHDEV_SERVER_RX
     343#if( DEBUG_CHDEV_SERVER_RX || DEBUG_CHDEV_SERVER_TX )
    343344uint32_t rx_cycle = (uint32_t)hal_get_cycles();
    344345if( (chdev->is_rx) && (DEBUG_CHDEV_SERVER_RX < rx_cycle) )
    345 printk("\n[%s] thread[%x,%x] start RX / cycle %d\n",
    346 __FUNCTION__ , server->process->pid, server->trdid, rx_cycle );
     346printk("\n[%s] DEV thread[%x,%x] check TXT_RX channel %d / cycle %d\n",
     347__FUNCTION__ , server->process->pid, server->trdid, chdev->channel, rx_cycle );
    347348#endif
    348349
     
    350351uint32_t tx_cycle = (uint32_t)hal_get_cycles();
    351352if( (chdev->is_rx == 0) && (DEBUG_CHDEV_SERVER_TX < tx_cycle) )
    352 printk("\n[%s] thread[%x,%x] start TX / cycle %d\n",
    353 __FUNCTION__ , server->process->pid, server->trdid, tx_cycle );
     353printk("\n[%s] thread[%x,%x] check TXT_TX channel %d / cycle %d\n",
     354__FUNCTION__ , server->process->pid, server->trdid, chdev->channel, tx_cycle );
    354355#endif
    355356
     
    397398            client_ptr = GET_PTR( client_xp );
    398399
    399 #if( DDEBUG_CHDEV_SERVER_TX || DEBUG_CHDEV_SERVER_RX )
     400#if( DEBUG_CHDEV_SERVER_TX || DEBUG_CHDEV_SERVER_RX )
    400401process_t * process      = hal_remote_lpt( XPTR( client_cxy , &client_ptr->process ) );
    401402pid_t       client_pid   = hal_remote_l32( XPTR( client_cxy , &process->pid ) );
    402 process_t   client_trdid = hal_remote_l32( XPTR( client_cxy , &client_ptr->trdid ) );
     403trdid_t     client_trdid = hal_remote_l32( XPTR( client_cxy , &client_ptr->trdid ) );
    403404#endif
    404405
     
    407408if( (chdev->is_rx) && (DEBUG_CHDEV_SERVER_RX < rx_cycle) )
    408409printk("\n[%s] thread[%x,%x] for RX get client thread[%x,%x] / cycle %d\n",
    409 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, cycle );
     410__FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, rx_cycle );
    410411#endif
    411412
     
    414415if( (chdev->is_rx == 0) && (DEBUG_CHDEV_SERVER_TX < tx_cycle) )
    415416printk("\n[%s] thread[%x,%x] for TX get client thread[%x,%x] / cycle %d\n",
    416 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, cycle );
     417__FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, tx_cycle );
    417418#endif
    418419
     
    445446if( (chdev->is_rx) && (DEBUG_CHDEV_SERVER_RX < rx_cycle) )
    446447printk("\n[%s] thread[%x,%x] completes RX for client thread[%x,%x] / cycle %d\n",
    447 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, cycle );
     448__FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, rx_cycle );
    448449#endif
    449450
     
    452453if( (chdev->is_rx == 0) && (DEBUG_CHDEV_SERVER_TX < tx_cycle) )
    453454printk("\n[%s] thread[%x,%x] completes TX for client thread[%x,%x] / cycle %d\n",
    454 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, cycle );
     455__FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, tX_cycle );
    455456#endif
    456457
     
    465466        }
    466467    }  // end while
    467 }  // end chdev_sequencial_server()
     468}  // end chdev_server_func()
    468469
    469470////////////////////////////////////////
  • trunk/kernel/kern/chdev.h

    r564 r619  
    240240 * @ chdev   : local pointer on device descriptor.
    241241 *****************************************************************************************/
    242 void chdev_sequencial_server( chdev_t * chdev );
     242void chdev_server_func( chdev_t * chdev );
    243243
    244244/******************************************************************************************
  • trunk/kernel/kern/kernel_init.c

    r614 r619  
    154154    "CONDVAR_STATE",         // 17
    155155    "SEM_STATE",             // 18
    156     "RPOCESS_CWD",           // 19
    157 
    158     "unused_20",             // 20
     156    "PROCESS_CWD",           // 19
     157    "BARRIER_STATE",         // 20
    159158
    160159    "CLUSTER_PREFTBL",       // 21
  • trunk/kernel/kern/process.c

    r618 r619  
    528528    process_t        * process_ptr;       // local pointer on process copy
    529529    reg_t              save_sr;           // for critical section
    530     rpc_desc_t         rpc;               // shared RPC descriptor
    531530    thread_t         * client;            // pointer on client thread
    532531    xptr_t             client_xp;         // extended pointer on client thread
    533532    process_t        * local;             // pointer on process copy in local cluster
    534533    uint32_t           remote_nr;         // number of remote process copies
     534    rpc_desc_t         rpc;               // shared RPC descriptor
     535    uint32_t           responses;         // shared RPC responses counter
    535536
    536537    client    = CURRENT_THREAD;
     
    579580    thread_block( client_xp , THREAD_BLOCKED_RPC );
    580581
     582    // initialize RPC responses counter
     583    responses = 0;
     584
    581585    // initialize shared RPC descriptor
    582     rpc.responses = 0;
     586    // can be shared, because no out arguments
     587    rpc.rsp       = &responses;
    583588    rpc.blocking  = false;
    584589    rpc.index     = RPC_PROCESS_SIGACTION;
     
    608613            remote_nr++;
    609614
    610             // atomically increment responses counter
    611             hal_atomic_add( (void *)&rpc.responses , 1 );
     615            // atomically increment RPC responses counter
     616            hal_atomic_add( &responses , 1 );
    612617
    613618#if DEBUG_PROCESS_SIGACTION
     
    617622#endif
    618623            // call RPC in target cluster
    619             rpc_process_sigaction_client( process_cxy , &rpc );
     624            rpc_send( process_cxy , &rpc );
    620625        }
    621626    }  // end list of copies
     
    685690
    686691// check target process is an user process
    687 assert( (LPID_FROM_PID( process->pid ) != 0 ), "target process must be an user process" );
     692assert( (LPID_FROM_PID( process->pid ) != 0 ),
     693"process %x is not an user process\n", process->pid );
    688694
    689695    // get target process owner cluster
     
    773779
    774780// check target process is an user process
    775 assert( (LPID_FROM_PID( process->pid ) != 0), "process %x not an user process", process->pid );
     781assert( (LPID_FROM_PID( process->pid ) != 0),
     782"process %x is not an user process\n", process->pid );
    776783
    777784    // get lock protecting process th_tbl[]
     
    831838
    832839// check target process is an user process
    833 assert( ( process->pid != 0 ),
    834 "target process must be an user process" );
     840assert( ( LPID_FROM_PID( process->pid ) != 0 ),
     841"process %x is not an user process\n", process->pid );
    835842
    836843    // get lock protecting process th_tbl[]
  • 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
  • trunk/kernel/kern/rpc.h

    r614 r619  
    6969    RPC_THREAD_KERNEL_CREATE      = 7,
    7070    RPC_UNDEFINED_8               = 8,
    71     RPC_PROCESS_SIGACTION         = 9,       // non blocking
     71    RPC_PROCESS_SIGACTION         = 9,
    7272
    7373    RPC_VFS_INODE_CREATE          = 10,
     
    8888    RPC_UNDEFINED_24              = 24,
    8989    RPC_MAPPER_HANDLE_MISS        = 25,
    90     RPC_VMM_DELETE_VSEG           = 26,      // non blocking
     90    RPC_VMM_DELETE_VSEG           = 26,
    9191    RPC_VMM_CREATE_VSEG           = 27,
    9292    RPC_VMM_SET_COW               = 28,
     
    105105
    106106/***********************************************************************************
    107  *  This structure defines the RPC descriptor
     107 *  This structure defines the RPC descriptor (100 bytes on a 32bits core)
    108108 **********************************************************************************/
    109109
    110110typedef struct rpc_desc_s
    111111{
    112         rpc_index_t         index;       /*! index of requested RPC service          */
    113         volatile uint32_t   responses;   /*! number of expected responses            */
    114     struct thread_s   * thread;      /*! local pointer on client thread          */
    115     uint32_t            lid;         /*! index of core running the calling thread */
    116     bool_t              blocking;    /*! blocking RPC when true                  */
    117     uint64_t            args[10];    /*! input/output arguments buffer           */
     112        rpc_index_t         index;       /*! index of requested RPC service      ( 4) */
     113        uint32_t          * rsp;         /*! local pointer ond responses counter ( 4) */
     114    struct thread_s   * thread;      /*! local pointer on client thread      ( 4) */
     115    uint32_t            lid;         /*! index of core running client thread ( 4) */
     116    bool_t              blocking;    /*! simple RPC mode when true           ( 4) */
     117    uint64_t            args[10];    /*! input/output arguments buffer       (80) */
    118118}
    119119rpc_desc_t;
     
    161161 * - it block on IDLE and deschedule otherwise. 
    162162 **********************************************************************************/
    163 void rpc_thread_func( void );
     163void rpc_server_func( void );
    164164
    165165/***********************************************************************************
     
    309309
    310310/***********************************************************************************
    311  * [9] The non blocking RPC_PROCESS_SIGACTION allows any client thread running in
    312  * any cluster to send parallel RPC requests to one or several servers (that can be
    313  * local or remote), to execute a given sigaction, defined by the <action_type>
    314  * argument[1], for a given process identified by the <pid> argument[0].
    315  *
    316  * WARNING : It is implemented as a NON BLOCKING RPC, that can be sent in parallel
    317  * to several servers. The RPC descriptor, containing the <action_type> and <pid>
    318  * arguments, as well as the RPC <index>, <blocked>, and <response> fields, must
    319  * be allocated and initialised by the calling function itself.
    320  * Each RPC server thread atomically decrements the <response> field in this
    321  * shared RPC descriptor. The last server thread unblock the client thread,
    322  * that blocked only after sending all parallel RPC requests to all servers.
     311 * [9] The RPC_PROCESS_SIGACTION allows any client thread to request to any cluster
     312 * execute a given sigaction, defined by the <action_type> for a given process,
     313 * identified by the <pid> argument.
    323314 ***********************************************************************************
    324315 * @ cxy     : server cluster identifier.
    325  * @ rpc     : pointer on shared RPC descriptor initialized by the client thread.
    326  **********************************************************************************/
    327 void rpc_process_sigaction_client( cxy_t               cxy,
    328                                    struct rpc_desc_s * rpc );
     316 * @ pid     : [in] target process identifier.
     317 * @ action  : [in] sigaction index.
     318 **********************************************************************************/
     319void rpc_process_sigaction_client( cxy_t     cxy,
     320                                   pid_t     pid,
     321                                   uint32_t  action );
    329322                             
    330323void rpc_process_sigaction_server( xptr_t xp );
     
    596589
    597590/***********************************************************************************
    598  * [26] The non blocking RPC_VMM_DELETE_VSEG allows any client thread running in
    599  * any cluster to send parallel RPC requests to one or several clusters (that can be
    600  * local or remote), to delete from a given VMM, identified by the <pid> argument[0]
    601  * a given vseg, identified by the <vaddr> argument[1].
    602  *
    603  * WARNING : It is implemented as a NON BLOCKING RPC, that can be sent in parallel
    604  * to several servers. The RPC descriptor, containing the <pid> and <vaddr>
    605  * arguments, as well as the RPC <index>, <blocked>, and <response> fields, must
    606  * be allocated and initialised by the calling function itself.
    607  * Each RPC server thread atomically decrements the the <response> field in this
    608  * shared RPC descriptor. The last server thread unblock the client thread,
    609  * that blocked only after sending all paralle RPC requests to all servers.
     591 * [26] The RPC_VMM_DELETE_VSEG allows any client thread  to request a remote
     592 * cluster to delete from a given VMM, identified by the <pid> argument
     593 * a given vseg, identified by the <vaddr> argument.
    610594 ***********************************************************************************
    611595 * @ cxy         : server cluster identifier.
    612  * @ rpc     : pointer on shared RPC descriptor initialized by the client thread.
    613  **********************************************************************************/
    614 void rpc_vmm_delete_vseg_client( cxy_t               cxy,
    615                                  struct rpc_desc_s * rpc );
     596 * @ pid         : [in] target process identifier.
     597 * @ vaddr       : [in] vseg base address.
     598 **********************************************************************************/
     599void rpc_vmm_delete_vseg_client( cxy_t       cxy,
     600                                 pid_t       pid,
     601                                 intptr_t    vaddr );
    616602 
    617603void rpc_vmm_delete_vseg_server( xptr_t xp );
  • trunk/kernel/kern/scheduler.c

    r614 r619  
    2929#include <printk.h>
    3030#include <list.h>
     31#include <rpc.h>
    3132#include <core.h>
    3233#include <thread.h>
     
    146147////////////////////////////////////////////////////////////////////////////////////////////
    147148// This static function is the only function that can actually delete a thread,
    148 // and the associated process descriptor, if required.
    149 // It is private, because it is called by the sched_yield() public function.
     149// (and the associated process descriptor if required).
     150// It is private, because it is only called by the sched_yield() public function.
    150151// It scan all threads attached to a given scheduler, and executes the relevant
    151152// actions for two types of pending requests:
     
    376377        error = thread_kernel_create( &thread,
    377378                                      THREAD_RPC,
    378                                               &rpc_thread_func,
     379                                              &rpc_server_func,
    379380                                      NULL,
    380381                                          lid );
  • trunk/kernel/kern/thread.c

    r611 r619  
    13781378}  // end thread_assert_can yield()
    13791379
    1380 //////////////////////////////////////////////////
    1381 void thread_display_busylocks( xptr_t  thread_xp )
    1382 {
    1383     // get cluster and local pointer of target thread
     1380//////////////////////////////////////////////////////
     1381void thread_display_busylocks( xptr_t       thread_xp,
     1382                               const char * string )
     1383{
    13841384    cxy_t      thread_cxy = GET_CXY( thread_xp );
    13851385    thread_t * thread_ptr = GET_PTR( thread_xp );
     
    13891389    xptr_t    iter_xp;
    13901390
    1391     // get target thread TRDID and busylocks
    1392     trdid_t  trdid = hal_remote_l32(XPTR( thread_cxy , &thread_ptr->trdid ));
    1393     uint32_t locks = hal_remote_l32(XPTR( thread_cxy , &thread_ptr->busylocks ));
    1394 
    1395     // get target thread process and PID;
    1396     process_t * process = hal_remote_lpt(XPTR( thread_cxy , &thread_ptr->process ));
    1397     pid_t       pid     = hal_remote_l32(XPTR( thread_cxy , &process->pid ));
     1391    // get relevant info from target trhead descriptor
     1392    uint32_t    locks   = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->busylocks ) );
     1393    trdid_t     trdid   = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
     1394    process_t * process = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) );
     1395    pid_t       pid     = hal_remote_l32( XPTR( thread_cxy , &process->pid ) );
    13981396
    13991397    // get extended pointer on root of busylocks
    1400     xptr_t    root_xp = XPTR( thread_cxy , &thread_ptr->busylocks_root );
     1398    xptr_t root_xp = XPTR( thread_cxy , &thread_ptr->busylocks_root );
    14011399
    14021400    // get pointers on TXT0 chdev
     
    14121410
    14131411    // display header
    1414     nolock_printk("\n***** thread %x in process %x : %d busylocks at cycle %d\n",
    1415     trdid, pid, locks, (uint32_t)hal_get_cycles() );
     1412    nolock_printk("\n***** thread[%x,%x] in <%s> : %d busylocks *****\n",
     1413    pid, trdid, string, locks );
    14161414
    14171415    // scan the xlist of busylocks when required
     
    14361434
    14371435    // display a warning
    1438     printk("\n[WARNING] set the DEBUG_BUSYLOCK parmeter in kernel_config.h"
    1439     " to display busylocks for thread %x/%x\n", thread_cxy, thread_ptr );
     1436    printk("\n[WARNING] set the DEBUG_BUSYLOCK parameter in kernel_config.h"
     1437    " to display busylocks for thread(%x,%x)\n", pid, trdid );
    14401438
    14411439}  // end thread_display_busylock()
  • trunk/kernel/kern/thread.h

    r610 r619  
    143143typedef struct thread_s
    144144{
    145         void              * cpu_context;     /*! pointer on CPU context switch            */
    146         void              * fpu_context;     /*! pointer on FPU context switch            */
     145        void              * cpu_context;     /*! CPU context used by sched_yield          */
     146        void              * fpu_context;     /*! FPU context used by sched_yield          */
    147147    void              * uzone_current;   /*! used by hal_do_syscall & hal_do_except   */
    148148    void              * uzone_previous;  /*! used by hal_do_syscall & hal_do_except   */
     
    465465
    466466/***************************************************************************************
    467  * This debug function display the list of busylocks (local or remote) currently owned
    468  * by a thread identified by the <thread_xp> argument.
    469  * WARNING : it can be called by the idbg tool, but the DEBUG_BUSYLOCK parameter
    470  * must be set in the kernel_config.h file.
     467 * This debug function display the list of busylocks (local or remote)
     468 * currently owned by a the thread identified by the <thead_xp> argument.
     469 * The <string> argument is printed in header (can be the calling function name).
     470 * WARNING : the DEBUG_BUSYLOCK parameter must be set in the kernel_config.h file.
    471471 ***************************************************************************************
    472472 * @ thread_xp  : extended pointer on target thread.
    473  **************************************************************************************/
    474 void thread_display_busylocks( xptr_t  thread_xp );
     473 * @ string     : defines the calling context.
     474 **************************************************************************************/
     475void thread_display_busylocks( xptr_t       thread_xp,
     476                               const char * string );
    475477
    476478
Note: See TracChangeset for help on using the changeset viewer.