Ignore:
Timestamp:
Feb 20, 2018, 5:32:17 PM (6 years ago)
Author:
alain
Message:

Fix a bad bug in scheduler...

File:
1 edited

Legend:

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

    r433 r435  
    3939#include <vfs.h>
    4040#include <fatfs.h>
    41 #include <signal.h>
    4241#include <rpc.h>
    4342
     
    8079    &rpc_process_make_fork_server,      // 3
    8180    &rpc_undefined,                     // 4    unused slot
    82     &rpc_process_make_kill_server,      // 5
     81    &rpc_undefined,                     // 5    unused slot
    8382    &rpc_thread_user_create_server,     // 6
    8483    &rpc_thread_kernel_create_server,   // 7
     
    610609
    611610/////////////////////////////////////////////////////////////////////////////////////////
    612 // [5]      Marshaling functions attached to RPC_PROCESS_MAKE_KILL (blocking)
    613 /////////////////////////////////////////////////////////////////////////////////////////
    614 
    615 ///////////////////////////////////////////////////
    616 void rpc_process_make_kill_client( cxy_t       cxy,
    617                                    process_t * process,
    618                                    bool_t      is_exit,
    619                                    uint32_t    status )
    620 {
    621 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",
    622 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy,
    623 CURRENT_THREAD->core->lid , hal_time_stamp() );
    624 
    625     // initialise RPC descriptor header
    626     rpc_desc_t  rpc;
    627     rpc.index    = RPC_PROCESS_MAKE_KILL;
    628     rpc.response = 1;
    629     rpc.blocking = true;
    630 
    631     // set input arguments in RPC descriptor 
    632     rpc.args[0] = (uint64_t)(intptr_t)process;
    633     rpc.args[1] = (uint64_t)is_exit;
    634     rpc.args[2] = (uint64_t)status;
    635 
    636     // register RPC request in remote RPC fifo (blocking function)
    637     rpc_send( cxy , &rpc );
    638 
    639 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",
    640 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy,
    641 CURRENT_THREAD->core->lid , hal_time_stamp() );
    642 
    643 
    644 //////////////////////////////////////////////
    645 void rpc_process_make_kill_server( xptr_t xp )
    646 {
    647 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",
    648 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy,
    649 CURRENT_THREAD->core->lid , hal_time_stamp() );
    650 
    651     process_t * process;
    652     bool_t      is_exit;
    653     uint32_t    status;
    654 
    655     // get client cluster identifier and pointer on RPC descriptor
    656     cxy_t        client_cxy  = (cxy_t)GET_CXY( xp );
    657     rpc_desc_t * desc        = (rpc_desc_t *)GET_PTR( xp );
    658 
    659     // get arguments from RPC descriptor
    660     process = (process_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
    661     is_exit = (bool_t)               hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) );
    662     status  = (uint32_t)             hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) );
    663 
    664     // call local kernel function
    665     process_make_kill( process , is_exit , status );
    666 
    667 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",
    668 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy,
    669 CURRENT_THREAD->core->lid , hal_time_stamp() );
    670 }
     611// [5]      undefined slot
     612/////////////////////////////////////////////////////////////////////////////////////////
    671613
    672614/////////////////////////////////////////////////////////////////////////////////////////
     
    906848                                   rpc_desc_t * rpc_ptr )
    907849{
    908 sigaction_dmsg("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n",
     850rpc_dmsg("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n",
    909851__FUNCTION__ , process_action_str( (uint32_t)rpc_ptr->args[0] ) ,
    910852((process_t *)(intptr_t)rpc_ptr->args[1])->pid , cxy , (uint32_t)hal_get_cycles() );
     
    913855    rpc_send( cxy , rpc_ptr );
    914856
    915 sigaction_dmsg("\n[DBG] %s : exit after %s process %x in cluster %x / cycle %d\n",
     857rpc_dmsg("\n[DBG] %s : exit after %s process %x in cluster %x / cycle %d\n",
    916858__FUNCTION__ , process_action_str( (uint32_t)rpc_ptr->args[0] ) ,
    917859((process_t *)(intptr_t)rpc_ptr->args[1])->pid , cxy , (uint32_t)hal_get_cycles() );
     
    921863void rpc_process_sigaction_server( xptr_t xp )
    922864{
     865    pid_t        pid;              // target process identifier
    923866    process_t  * process;          // pointer on local process descriptor
    924867    uint32_t     action;           // sigaction index
     
    934877
    935878    // get arguments from RPC descriptor
    936     action      = (uint32_t)             hal_remote_lwd( XPTR( client_cxy , &rpc->args[0] ) );
    937     process     = (process_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &rpc->args[1] ) );
     879    action      = (uint32_t)  hal_remote_lwd( XPTR( client_cxy , &rpc->args[0] ) );
     880    pid         = (pid_t)     hal_remote_lwd( XPTR( client_cxy , &rpc->args[1] ) );
    938881    client_ptr  = (thread_t *)hal_remote_lpt( XPTR( client_cxy , &rpc->thread ) );
     882
     883rpc_dmsg("\n[DBG] %s : enter to %s process %x / cycle %d\n",
     884__FUNCTION__ , process_action_str( action ) , pid , (uint32_t)hal_get_cycles() );
     885
     886    // get local process descriptor
     887    process = process_get_local_copy( pid );
    939888
    940889    // build extended pointer on client thread
    941890    client_xp = XPTR( client_cxy , client_ptr );
    942 
    943 sigaction_dmsg("\n[DBG] %s : enter to %s process %x / cycle %d\n",
    944 __FUNCTION__ , process_action_str( action ) , process->pid , (uint32_t)hal_get_cycles() );
    945891
    946892    // call relevant kernel function
     
    958904    }
    959905
    960 sigaction_dmsg("\n[DBG] %s : exit after %s process %x / cycle %d\n",
    961 __FUNCTION__ , process_action_str( action ) , process->pid , (uint32_t)hal_get_cycles() );
     906rpc_dmsg("\n[DBG] %s : exit after %s process %x / cycle %d\n",
     907__FUNCTION__ , process_action_str( action ) , pid , (uint32_t)hal_get_cycles() );
    962908}
    963909
Note: See TracChangeset for help on using the changeset viewer.