Ignore:
Timestamp:
Jul 31, 2017, 1:59:52 PM (7 years ago)
Author:
alain
Message:

Several modifs in the generic scheduler and in the hal_context to
fix the context switch mechanism.

File:
1 edited

Legend:

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

    r279 r296  
    9999                                uint32_t * ppn )       // out
    100100{
    101     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    102 
    103     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     101    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     102
     103    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    104104
    105105    // initialise RPC descriptor header
     
    118118    *ppn    = (uint32_t)rpc.args[1];
    119119
    120     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     120    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    121121}
    122122
     
    127127    error_t  error;  // output
    128128    uint32_t ppn;    // output
     129
     130    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    129131
    130132    // get client cluster identifier and pointer on RPC descriptor
     
    143145    hal_remote_sw( XPTR( cxy , &desc->args[0] ) , error );
    144146    hal_remote_sw( XPTR( cxy , &desc->args[1] ) , ppn );
     147
     148    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    145149}
    146150
     
    155159                                   pid_t     * pid )     // out
    156160{
    157     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    158 
    159     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     161    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     162
     163    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    160164
    161165    // initialise RPC descriptor header
     
    174178    *error  = (error_t)rpc.args[2];     
    175179
    176     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     180    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    177181}
    178182
     
    183187    error_t     error;     // output : error status
    184188    pid_t       pid;       // output : process identifier
     189
     190    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    185191
    186192    // get client cluster identifier and pointer on RPC descriptor
     
    198204    hal_remote_sw( XPTR( client_cxy , &desc->args[0] ) , (uint64_t)error );
    199205    hal_remote_sw( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)pid );
     206
     207    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    200208}
    201209
     
    210218                              error_t     * error )   // out
    211219{
    212     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    213 
    214     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     220    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     221
     222    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    215223
    216224    // initialise RPC descriptor header
     
    228236    *error  = (error_t)rpc.args[1];     
    229237
    230     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     238    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    231239}
    232240
     
    237245    exec_info_t   info;      // local copy of exec_info structure
    238246    error_t       error;     // local error error status
     247
     248    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    239249
    240250    // get client cluster identifier and pointer on RPC descriptor
     
    255265    // set output argument into client RPC descriptor
    256266    hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
     267
     268    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    257269}
    258270
     
    265277void rpc_process_kill_client( process_t * process )
    266278{
     279    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     280
    267281    // only reference cluster can send this RPC
    268282    assert( (GET_CXY( process->ref_xp ) == local_cxy) , __FUNCTION__ ,
    269283            "caller must be reference process cluster\n");
    270 
    271     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
    272284
    273285    // get local process index in reference cluster
     
    297309    }
    298310
    299     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     311    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    300312
    301313
     
    305317    pid_t       pid;
    306318    process_t * process; 
     319
     320    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    307321
    308322    // get client cluster identifier and pointer on RPC descriptor
     
    325339        process_kill( process );
    326340    }
     341
     342    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    327343}
    328344
     
    341357                                    error_t        * error )      // out
    342358{
    343     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    344 
    345     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     359    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     360
     361    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    346362
    347363    // initialise RPC descriptor header
     
    363379    *error     = (error_t)rpc.args[5];
    364380
    365     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     381    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    366382}
    367383
     
    378394    void           * start_arg;
    379395    error_t          error;
     396
     397    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    380398
    381399    // get client cluster identifier and pointer on RPC descriptor
     
    409427    hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
    410428    hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)thread_xp );
     429
     430    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    411431}
    412432
     
    423443                                      error_t * error )      // out
    424444{
    425     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    426 
    427     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     445    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     446
     447    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    428448
    429449    // initialise RPC descriptor header
     
    444464    *error     = (error_t)rpc.args[4];
    445465
    446     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     466    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    447467}
    448468
     
    455475    error_t          error;   
    456476
     477    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     478
    457479    // get client cluster identifier and pointer on RPC descriptor
    458480    cxy_t        client_cxy  = (cxy_t)GET_CXY( xp );
     
    474496    hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
    475497    hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)thread_xp );
     498
     499    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    476500}
    477501
     
    485509                             uint32_t    sig_id )    // in
    486510{
    487     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    488 
    489     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     511    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     512
     513    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    490514
    491515    // initialise RPC descriptor header
     
    501525    rpc_send_sync( cxy , &rpc );
    502526
    503     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     527    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    504528}
    505529
     
    509533    process_t  * process;  // local pointer on process descriptor
    510534    uint32_t     sig_id;   // signal index
     535
     536    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    511537
    512538    // get client cluster identifier and pointer on RPC descriptor
     
    520546    // call local kernel function
    521547    signal_rise( process , sig_id );
     548
     549    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    522550}
    523551
     
    539567                                  error_t      * error )     // out
    540568{
    541     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    542 
    543     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     569    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     570
     571    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    544572
    545573    // initialise RPC descriptor header
     
    565593    *error    = (error_t)rpc.args[9];
    566594
    567     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     595    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    568596}
    569597
     
    582610    error_t          error;
    583611
     612    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     613
    584614    // get client cluster identifier and pointer on RPC descriptor
    585615    cxy_t        client_cxy  = (cxy_t)GET_CXY( xp );
     
    610640    hal_remote_swd( XPTR( client_cxy , &desc->args[8] ) , (uint64_t)inode_xp );
    611641    hal_remote_swd( XPTR( client_cxy , &desc->args[9] ) , (uint64_t)error );
     642
     643    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    612644}
    613645
     
    620652                                   struct vfs_inode_s * inode )
    621653{
    622     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    623 
    624     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     654    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     655
     656    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    625657
    626658    // initialise RPC descriptor header
     
    635667    rpc_send_sync( cxy , &rpc );
    636668
    637     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     669    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    638670}
    639671
     
    642674{
    643675    vfs_inode_t * inode;
     676
     677    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    644678
    645679    // get client cluster identifier and pointer on RPC descriptor
     
    652686    // call local kernel function
    653687    vfs_inode_destroy( inode );
     688
     689    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    654690}
    655691
     
    666702                                   error_t              * error )       // out
    667703{
    668     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    669 
    670     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     704    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     705
     706    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    671707
    672708    // initialise RPC descriptor header
     
    687723    *error     = (error_t)rpc.args[4];
    688724
    689     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     725    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    690726}
    691727
     
    701737    char          name_copy[CONFIG_VFS_MAX_NAME_LENGTH];
    702738
     739    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     740
    703741    // get client cluster identifier and pointer on RPC descriptor
    704742    cxy_t        client_cxy  = (cxy_t)GET_CXY( xp );
     
    709747    name   = (char *)(intptr_t)       hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) );
    710748    parent = (vfs_inode_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) );
    711                        
     749
    712750    // makes a local copy of  name
    713751    hal_remote_strcpy( XPTR( local_cxy , name_copy ),
     
    719757                               parent,
    720758                               &dentry_xp );
    721  
    722759    // set output arguments
    723760    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)dentry_xp );
    724761    hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error );
     762
     763    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    725764}
    726765
     
    728767// [13]          Marshaling functions attached to RPC_VFS_DENTRY_DESTROY
    729768/////////////////////////////////////////////////////////////////////////////////////////
     769
    730770
    731771///////////////////////////////////////////////////////
     
    733773                                    vfs_dentry_t * dentry )
    734774{
    735     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    736 
    737     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     775    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     776
     777    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    738778
    739779    // initialise RPC descriptor header
     
    748788    rpc_send_sync( cxy , &rpc );
    749789
    750     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     790    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    751791}
    752792
     
    755795{
    756796    vfs_dentry_t * dentry;
     797
     798    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    757799
    758800    // get client cluster identifier and pointer on RPC descriptor
     
    765807    // call local kernel function
    766808    vfs_dentry_destroy( dentry );
     809
     810    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    767811}
    768812
     
    779823                                 error_t              * error )      // out
    780824{
    781     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    782 
    783     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     825    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     826
     827    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    784828
    785829    // initialise RPC descriptor header
     
    799843    *error   = (error_t)rpc.args[3];
    800844
    801     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     845    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    802846}
    803847
     
    809853    xptr_t        file_xp;
    810854    error_t       error;
     855
     856    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    811857
    812858    // get client cluster identifier and pointer on RPC descriptor
     
    826872    hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)file_xp );
    827873    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
     874
     875    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    828876}
    829877
     
    836884                                  vfs_file_t * file )
    837885{
    838     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    839 
    840     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     886    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     887
     888    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    841889
    842890    // initialise RPC descriptor header
     
    851899    rpc_send_sync( cxy , &rpc );
    852900
    853     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     901    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    854902}
    855903
     
    858906{
    859907    vfs_file_t * file;
     908
     909    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    860910
    861911    // get client cluster identifier and pointer on RPC descriptor
     
    868918    // call local kernel function
    869919    vfs_file_destroy( file );
     920
     921    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    870922}
    871923
     
    881933                                error_t     * error )          // out
    882934{
    883     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    884 
    885     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     935    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     936
     937    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    886938
    887939    // initialise RPC descriptor header
     
    901953    *error   = (error_t)rpc.args[3];
    902954
    903     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     955    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    904956}
    905957
     
    914966    char          name_copy[CONFIG_VFS_MAX_NAME_LENGTH];
    915967
     968    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     969
    916970    // get client cluster identifier and pointer on RPC descriptor
    917971    cxy_t        client_cxy  = (cxy_t)GET_CXY( xp );
     
    932986    // set output argument
    933987    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
     988
     989    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    934990}
    935991
     
    943999                                     error_t     * error )     // out
    9441000{
    945     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    946 
    947     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     1001    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     1002
     1003    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    9481004
    9491005    // initialise RPC descriptor header
     
    9611017    *error   = (error_t)rpc.args[1];
    9621018
    963     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     1019    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    9641020}
    9651021
     
    9701026    vfs_inode_t * inode;
    9711027
     1028    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     1029
    9721030    // get client cluster identifier and pointer on RPC descriptor
    9731031    cxy_t        client_cxy  = (cxy_t)GET_CXY( xp );
     
    9821040    // set output argument
    9831041    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
     1042
     1043    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    9841044}
    9851045
     
    9961056                                   error_t  * error )    // out
    9971057{
    998     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    999 
    1000     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     1058    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     1059
     1060    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    10011061
    10021062    // initialise RPC descriptor header
     
    10171077    *error   = (error_t)rpc.args[4];
    10181078
    1019     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     1079    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    10201080}
    10211081
     
    10291089    error_t       error;
    10301090
     1091    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     1092
    10311093    // get client cluster identifier and pointer on RPC descriptor
    10321094    cxy_t        client_cxy  = (cxy_t)GET_CXY( xp );
     
    10441106    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)cluster );
    10451107    hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error );
     1108
     1109    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    10461110}
    10471111
     
    10561120                                  xptr_t    * vseg_xp )    // out
    10571121{
    1058     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    1059 
    1060     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     1122    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     1123
     1124    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    10611125
    10621126    // initialise RPC descriptor header
     
    10751139    *vseg_xp = rpc.args[2];
    10761140
    1077     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     1141    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    10781142}
    10791143
     
    10851149    vseg_t      * vseg_ptr;
    10861150    xptr_t        vseg_xp;
     1151
     1152    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    10871153
    10881154    // get client cluster identifier and pointer on RPC descriptor
     
    11011167    else                   vseg_xp = XPTR( local_cxy , vseg_ptr );
    11021168    hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)vseg_xp );
     1169
     1170    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    11031171}
    11041172
     
    11161184                             error_t   * error )   // out
    11171185{
    1118     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    1119 
    1120     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     1186    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     1187
     1188    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    11211189
    11221190    // initialise RPC descriptor header
     
    11371205    *error = (error_t)rpc.args[4];
    11381206
    1139     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     1207    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    11401208}
    11411209
     
    11481216    ppn_t         ppn;
    11491217    error_t       error;
     1218
     1219    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    11501220
    11511221    // get client cluster identifier and pointer on RPC descriptor
     
    11641234    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)ppn );
    11651235    hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error );
     1236
     1237    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    11661238}
    11671239
     
    11751247                           xptr_t *   buf_xp )     // out
    11761248{
    1177     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    1178 
    1179     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     1249    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     1250
     1251    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    11801252
    11811253    // initialise RPC descriptor header
     
    11931265    *buf_xp = (xptr_t)rpc.args[1];
    11941266
    1195     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     1267    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    11961268}
    11971269
     
    11991271void rpc_kcm_alloc_server( xptr_t xp )
    12001272{
     1273    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     1274
    12011275    // get client cluster identifier and pointer on RPC descriptor
    12021276    cxy_t        client_cxy  = (cxy_t)GET_CXY( xp );
     
    12151289    xptr_t buf_xp = XPTR( local_cxy , buf_ptr );
    12161290    hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)buf_xp );
     1291
     1292    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    12171293}   
    12181294
     
    12261302                          uint32_t   kmem_type )   // in
    12271303{
    1228     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    1229 
    1230     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     1304    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     1305
     1306    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    12311307
    12321308    // initialise RPC descriptor header
     
    12421318    rpc_send_sync( cxy , &rpc );
    12431319
    1244     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     1320    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    12451321}
    12461322
     
    12481324void rpc_kcm_free_server( xptr_t xp )
    12491325{
     1326    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     1327
    12501328    // get client cluster identifier and pointer on RPC descriptor
    12511329    cxy_t        client_cxy  = (cxy_t)GET_CXY( xp );
     
    12611339    req.ptr  = buf;
    12621340    kmem_free( &req );
     1341
     1342    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    12631343}   
    12641344
     
    12771357                                    error_t  * error )        // out
    12781358{
    1279     assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    1280 
    1281     rpc_dmsg("\n[INFO] %s : enter\n", __FUNCTION__ );
     1359    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     1360
     1361    assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n");
    12821362
    12831363    // initialise RPC descriptor header
     
    13001380    *error     = (error_t)rpc.args[6];
    13011381
    1302     rpc_dmsg("\n[INFO] %s : completed\n", __FUNCTION__ );
     1382    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    13031383}
    13041384
     
    13141394    error_t    error;
    13151395
     1396    rpc_dmsg("\n[INFO] %s : enter at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
     1397
    13161398    // get client cluster identifier and pointer on RPC descriptor
    13171399    cxy_t        client_cxy  = (cxy_t)GET_CXY( xp );
     
    13361418    // set output argument to client RPC descriptor
    13371419    hal_remote_swd( XPTR( client_cxy , &desc->args[6] ) , (uint64_t)error );
     1420
     1421    rpc_dmsg("\n[INFO] %s : completed at cycle %d\n", __FUNCTION__ , hal_time_stamp() );
    13381422}
    13391423
     
    13531437    thread_t * this = CURRENT_THREAD;
    13541438
    1355     rpc_dmsg("\n[INFO] %s : enter / client_cxy = %x / server_cxy = %x\n",
    1356              __FUNCTION__ , local_cxy , server_cxy );
     1439    rpc_dmsg("\n[INFO] %s : enter / client_cxy = %x / server_cxy = %x / cycle %d\n",
     1440    __FUNCTION__ , local_cxy , server_cxy , hal_time_stamp() );
    13571441
    13581442    // allocate and initialise an extended pointer on the RPC descriptor
     
    13741458        {
    13751459            printk("\n[WARNING] %s : cluster %x cannot post RPC to cluster %x\n",
    1376                    __FUNCTION__ , local_cxy , server_cxy );
    1377 
    1378             if( thread_can_yield() ) sched_yield();
    1379         }
    1380         else
    1381         {
     1460            __FUNCTION__ , local_cxy , server_cxy );
     1461
     1462            if( thread_can_yield() ) sched_yield( NULL );
    13821463        }
    13831464    }
    13841465    while( error );
    13851466 
    1386     rpc_dmsg("\n[INFO] %s : RPC registered / client_cxy = %x / server_cxy = %x\n",
    1387              __FUNCTION__ , local_cxy , server_cxy , first );
     1467    rpc_dmsg("\n[INFO] %s : RPC %l registered / server_cxy = %x / cycle %d\n",
     1468    __FUNCTION__ , desc_xp , server_cxy , hal_time_stamp() );
    13881469       
    13891470    // send IPI to remote CP0, if this is the first RPC in remote FIFO,
     
    13991480
    14001481                    rpc_dmsg("\n[INFO] %s : IPI sent / client_cxy = %x / server_cxy = %x\n",
    1401                      __FUNCTION__, local_cxy , server_cxy );
     1482            __FUNCTION__, local_cxy , server_cxy );
    14021483        }
    14031484        }
     
    14161497        if( this->type == THREAD_RPC ) hal_restore_irq( sr_save );
    14171498
    1418     rpc_dmsg("\n[INFO] %s : completed / client_cxy = %x / server_cxy = %x\n",
    1419              __FUNCTION__ , local_cxy , server_cxy );
     1499    rpc_dmsg("\n[INFO] %s : completed / client_cxy = %x / server_cxy = %x / cycle %d\n",
     1500    __FUNCTION__ , local_cxy , server_cxy , hal_time_stamp() );
    14201501
    14211502}  // end rpc_send_sync()
     
    14471528        error_t        error;
    14481529     
    1449         this = CURRENT_THREAD;
    1450     core = this->core;   
    1451 
    1452 
     1530        this  = CURRENT_THREAD;
     1531    core  = this->core;   
     1532        count = 0;
     1533
     1534    rpc_dmsg("\n[INFO] %s : enter / thread %x on core[%x,%d] / fifo = %x / cycle %d\n",
     1535    __FUNCTION__, this->trdid, local_cxy, core->lid , hal_time_stamp() );
     1536 
    14531537    // handle up to CONFIG_RPC_PENDING_MAX requests before exit
    1454         count = 0;
    14551538        do
    14561539    {
    1457             error = local_fifo_get_item( &rpc_fifo->fifo,
    1458                                      (uint64_t *)&xp );
     1540            error = local_fifo_get_item( &rpc_fifo->fifo, (uint64_t *)&xp );
    14591541
    14601542                if ( error == 0 )  // One RPC request successfully extracted from RPC_FIFO
    14611543        {
    1462             rpc_dmsg("\n[INFO] %s : RPC_THREAD %x on core %x in cluster %x handles RPC %d\n",
    1463                                      __FUNCTION__ , this->trdid , core->lid , local_cxy , count );
    1464 
    14651544            // get client cluster identifier and pointer on RPC descriptor
    14661545            client_cxy = (cxy_t)GET_CXY( xp );
     
    14681547
    14691548            // get rpc index from RPC descriptor
    1470                 index     = hal_remote_lw( XPTR( client_cxy , &desc->index ) );
     1549                index = hal_remote_lw( XPTR( client_cxy , &desc->index ) );
     1550
     1551            rpc_dmsg("\n[INFO] %s : thread %x on core [%x,%d] / index = %d / &rpc = %x\n",
     1552                     __FUNCTION__ , this->trdid , core->lid , local_cxy , index , rpc_server[index] );
    14711553
    14721554            // call the relevant server function
     
    15331615    if( found )                    // activate this idle RPC thread     
    15341616    {
     1617        // unblock it
    15351618        thread->blocked = 0;
    15361619
    1537         rpc_dmsg("\n[INFO] %s : activate RPC thread %x on core %x in cluster %x at cycle %d\n",
    1538                           __FUNCTION__ , thread , core->gid , local_cxy , hal_get_cycles() );
     1620        rpc_dmsg("\n[INFO] %s : activate RPC thread %x on core [%x,%d] / cycle %d\n",
     1621                          __FUNCTION__ , thread , core->gid , local_cxy , hal_time_stamp() );
    15391622    }
    15401623    else                           // create a new RPC thread
    15411624    {
     1625        // create new thread
    15421626        error = thread_kernel_create( &thread,
    15431627                                      THREAD_RPC,
     
    15531637        }
    15541638
    1555         rpc_dmsg("\n[INFO] %s : create RPC thread %x on core %x in cluster %x at cycle %d\n",
    1556                           __FUNCTION__ , thread , core->gid , local_cxy , hal_get_cycles() );
     1639        // unblock new thread
     1640        thread->blocked = 0;
    15571641
    15581642        // update core descriptor counter 
    15591643            hal_atomic_add( &LOCAL_CLUSTER->rpc_threads , 1 );
     1644
     1645        rpc_dmsg("\n[INFO] %s : create RPC thread %x on core [%x,%d] / cycle %d\n",
     1646                          __FUNCTION__ , thread->trdid, local_cxy, core->lid, hal_time_stamp() );
    15601647    }
    15611648
     
    15631650    rpc_fifo->owner = thread->trdid;
    15641651
    1565     // current thread deschedules / RPC thread start execution
    1566         sched_switch_to( thread );
     1652    // current thread switch to RPC thread
     1653        sched_yield( thread );
    15671654
    15681655    // restore IRQs for the calling thread
     
    15811668    error_t      error;
    15821669
     1670    rpc_dmsg("\n[INFO] %s : enter in cluster %x\n",
     1671             __FUNCTION__ , local_cxy );
     1672
    15831673    // calling thread does nothing if light lock already taken or FIFO empty 
    15841674        if( (rpc_fifo->owner != 0) || (local_fifo_is_empty( &rpc_fifo->fifo )) )
    15851675    {
     1676        rpc_dmsg("\n[INFO] %s : exit but do nothing in cluster %x\n",
     1677                 __FUNCTION__ , local_cxy );
     1678
    15861679        return false;
    15871680    }
     
    16011694        }
    16021695
     1696        rpc_dmsg("\n[INFO] %s : exit after activating an RPC thread in cluster %x\n",
     1697                 __FUNCTION__ , local_cxy );
     1698
    16031699        return true;
    16041700    }
    16051701    else  // light lock taken by another thread
    16061702    {
     1703        rpc_dmsg("\n[INFO] %s : exit but do nothing in cluster %x\n",
     1704                 __FUNCTION__ , local_cxy );
     1705
    16071706        return false;
    16081707    }
     
    16131712void rpc_thread_func()
    16141713{
    1615     // makes the calling thread not preemptable
     1714    // makes the RPC thread not preemptable
    16161715        hal_disable_irq( NULL );
    16171716 
     
    16191718        rpc_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo;
    16201719
    1621     rpc_dmsg("\n[INFO] RPC thread %x created on core %d in cluster %x at cycle %d\n",
    1622              this->trdid , this->core->lid , local_cxy , hal_get_cycles() );
     1720    rpc_dmsg("\n[INFO] %s : enter / thread %x on core[%x,%d] / cycle %d\n",
     1721             __FUNCTION__, this->trdid, local_cxy, this->core->lid, hal_time_stamp() );
    16231722
    16241723    // this infinite loop is not preemptable
     
    16291728        if( this->trdid != rpc_fifo->owner )
    16301729        {
    1631             printk("\n[PANIC] in %s : RPC_THREAD %x not owner of RPC_FIFO in cluster %x\n",
    1632                    __FUNCTION__ , this->trdid , local_cxy );
     1730            printk("\n[PANIC] in %s : thread %x on core[%x,%d] not owner of RPC_FIFO\n",
     1731            __FUNCTION__, this->trdid, local_cxy, this->core->lid );
    16331732            hal_core_sleep();
    16341733        }
     
    16441743                if( LOCAL_CLUSTER->rpc_threads >= CONFIG_RPC_THREADS_MAX )
    16451744                {
    1646             rpc_dmsg("\n[INFO] RPC thread %x suicide on core %d in cluster %x at cycle %d\n",
    1647                              this->trdid , this->core->lid , local_cxy , hal_get_cycles() );
     1745            rpc_dmsg("\n[INFO] thread %x on core[%x,%d] suicide / cycle %d\n",
     1746                    __FUNCTION__, this->trdid, local_cxy, this->core->lid, hal_time_stamp() );
    16481747
    16491748            // update core descriptor counter
     
    16551754        else
    16561755        {
    1657             rpc_dmsg("\n[INFO] RPC thread %x blocks on core %d in cluster %x at cycle %d\n",
    1658                                  this->trdid , this->core->lid , local_cxy , hal_get_cycles() );
    1659 
    1660                      thread_block( this , THREAD_BLOCKED_IDLE );
    1661              sched_yield();
    1662 
    1663                      rpc_dmsg("\n[INFO] RPC thread %x wake up on core %d in cluster %x at cycle %d\n",
    1664                           this->trdid , this->core->lid , local_cxy , hal_get_cycles() );
     1756            rpc_dmsg("\n[INFO] %s : thread %x on core[%x,%d] blocks / cycle %d\n",
     1757                        __FUNCTION__, this->trdid, local_cxy, this->core->lid, hal_time_stamp() );
     1758
     1759                    thread_block( this , THREAD_BLOCKED_IDLE );
     1760            sched_yield( NULL );
     1761
     1762                    rpc_dmsg("\n[INFO] RPC thread %x wake up on core[%x,%d] / cycle %d\n",
     1763                __FUNCTION__, this->trdid, local_cxy, this->core->lid, hal_time_stamp() );
    16651764        }
    16661765        } // end while
Note: See TracChangeset for help on using the changeset viewer.