Ignore:
Timestamp:
Mar 6, 2019, 4:37:15 PM (5 years ago)
Author:
alain
Message:

Introduce three new types of vsegs (KCODE,KDATA,KDEV)
to map the kernel vsegs in the process VSL and GPT.
This now used by both the TSAR and the I86 architectures.

File:
1 edited

Legend:

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

    r619 r623  
    22 * rpc.c - RPC operations implementation.
    33 *
    4  * Author    Alain Greiner (2016,2017,2018)
     4 * Author    Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c)  UPMC Sorbonne Universites
     
    5858    &rpc_thread_user_create_server,        // 6
    5959    &rpc_thread_kernel_create_server,      // 7
    60     &rpc_undefined,                        // 8    unused slot       
     60    &rpc_vfs_fs_update_dentry_server,      // 8
    6161    &rpc_process_sigaction_server,         // 9
    6262
     
    6767    &rpc_vfs_file_create_server,           // 14
    6868    &rpc_vfs_file_destroy_server,          // 15
    69     &rpc_vfs_fs_get_dentry_server,         // 16
     69    &rpc_vfs_fs_new_dentry_server,         // 16
    7070    &rpc_vfs_fs_add_dentry_server,         // 17
    7171    &rpc_vfs_fs_remove_dentry_server,      // 18
     
    7676    &rpc_kcm_alloc_server,                 // 22
    7777    &rpc_kcm_free_server,                  // 23
    78     &rpc_undefined,                        // 24   unused slot
     78    &rpc_mapper_sync_server,               // 24
    7979    &rpc_mapper_handle_miss_server,        // 25
    8080    &rpc_vmm_delete_vseg_server,           // 26
     
    9494    "THREAD_USER_CREATE",        // 6
    9595    "THREAD_KERNEL_CREATE",      // 7
    96     "undefined",                 // 8
     96    "VFS_FS_UPDATE_DENTRY",      // 8
    9797    "PROCESS_SIGACTION",         // 9
    9898
     
    112112    "KCM_ALLOC",                 // 22
    113113    "KCM_FREE",                  // 23
    114     "undefined",                 // 24
     114    "MAPPER_SYNC",               // 24
    115115    "MAPPER_HANDLE_MISS",        // 25
    116116    "VMM_DELETE_VSEG",           // 26
     
    921921
    922922/////////////////////////////////////////////////////////////////////////////////////////
    923 // [7]      Marshaling functions attached to RPC_THREAD_KERNEL_CREATE (blocking)
     923// [7]      Marshaling functions attached to RPC_THREAD_KERNEL_CREATE
    924924/////////////////////////////////////////////////////////////////////////////////////////
    925925
     
    10131013
    10141014/////////////////////////////////////////////////////////////////////////////////////////
    1015 // [8]   undefined slot
    1016 /////////////////////////////////////////////////////////////////////////////////////////
    1017 
     1015// [8]   Marshaling functions attached to RPC_VRS_FS_UPDATE_DENTRY
     1016/////////////////////////////////////////////////////////////////////////////////////////
     1017
     1018/////////////////////////////////////////////////////////
     1019void rpc_vfs_fs_update_dentry_client( cxy_t          cxy,
     1020                                      vfs_inode_t  * inode,
     1021                                      vfs_dentry_t * dentry,
     1022                                      uint32_t       size,
     1023                                      error_t      * error )
     1024{
     1025#if DEBUG_RPC_VFS_FS_UPDATE_DENTRY
     1026thread_t * this = CURRENT_THREAD;
     1027uint32_t cycle = (uint32_t)hal_get_cycles();
     1028if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY )
     1029printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     1030__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     1031#endif
     1032
     1033    uint32_t responses = 1;
     1034
     1035    // initialise RPC descriptor header
     1036    rpc_desc_t  rpc;
     1037    rpc.index    = RPC_VFS_FS_UPDATE_DENTRY;
     1038    rpc.blocking = true;
     1039    rpc.rsp      = &responses;
     1040
     1041    // set input arguments in RPC descriptor
     1042    rpc.args[0] = (uint64_t)(intptr_t)inode;
     1043    rpc.args[1] = (uint64_t)(intptr_t)dentry;
     1044    rpc.args[2] = (uint64_t)size;
     1045
     1046    // register RPC request in remote RPC fifo
     1047    rpc_send( cxy , &rpc );
     1048
     1049    // get output values from RPC descriptor
     1050    *error   = (error_t)rpc.args[3];
     1051
     1052#if DEBUG_RPC_VFS_FS_UPDATE_DENTRY
     1053cycle = (uint32_t)hal_get_cycles();
     1054if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY )
     1055printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     1056__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     1057#endif
     1058}
     1059
     1060/////////////////////////////////////////////////
     1061void rpc_vfs_fs_update_dentry_server( xptr_t xp )
     1062{
     1063#if DEBUG_RPC_VFS_FS_UPDATE_DENTRY
     1064thread_t * this = CURRENT_THREAD;
     1065uint32_t cycle = (uint32_t)hal_get_cycles();
     1066if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY )
     1067printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     1068__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     1069#endif
     1070
     1071    error_t        error;
     1072    vfs_inode_t  * inode;
     1073    vfs_dentry_t * dentry;
     1074    uint32_t       size;
     1075
     1076    // get client cluster identifier and pointer on RPC descriptor
     1077    cxy_t        client_cxy  = GET_CXY( xp );
     1078    rpc_desc_t * desc        = GET_PTR( xp );
     1079
     1080    // get input arguments
     1081    inode  = (vfs_inode_t*)(intptr_t) hal_remote_l64(XPTR(client_cxy , &desc->args[0]));
     1082    dentry = (vfs_dentry_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[1]));
     1083    size   = (uint32_t)               hal_remote_l64(XPTR(client_cxy , &desc->args[2]));
     1084
     1085    // call the kernel function
     1086    error = vfs_fs_update_dentry( inode , dentry , size );
     1087
     1088    // set output argument
     1089    hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
     1090
     1091#if DEBUG_RPC_VFS_FS_UPDATE_DENTRY
     1092cycle = (uint32_t)hal_get_cycles();
     1093if( cycle > DEBUG_RPC_VFS_FS_UPDATE_DENTRY )
     1094printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     1095__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     1096#endif
     1097}
    10181098
    10191099/////////////////////////////////////////////////////////////////////////////////////////
     
    11101190void rpc_vfs_inode_create_client( cxy_t          cxy,     
    11111191                                  uint32_t       fs_type,    // in
    1112                                   uint32_t       inode_type, // in
    11131192                                  uint32_t       attr,       // in
    11141193                                  uint32_t       rights,     // in
     
    11361215    // set input arguments in RPC descriptor
    11371216    rpc.args[0] = (uint64_t)fs_type;
    1138     rpc.args[1] = (uint64_t)inode_type;
    1139     rpc.args[2] = (uint64_t)attr;
    1140     rpc.args[3] = (uint64_t)rights;
    1141     rpc.args[4] = (uint64_t)uid;
    1142     rpc.args[5] = (uint64_t)gid;
     1217    rpc.args[1] = (uint64_t)attr;
     1218    rpc.args[2] = (uint64_t)rights;
     1219    rpc.args[3] = (uint64_t)uid;
     1220    rpc.args[4] = (uint64_t)gid;
    11431221
    11441222    // register RPC request in remote RPC fifo
     
    11461224
    11471225    // get output values from RPC descriptor
    1148     *inode_xp = (xptr_t)rpc.args[6];
    1149     *error    = (error_t)rpc.args[7];
     1226    *inode_xp = (xptr_t)rpc.args[5];
     1227    *error    = (error_t)rpc.args[6];
    11501228
    11511229#if DEBUG_RPC_VFS_INODE_CREATE
     
    11691247
    11701248    uint32_t         fs_type;
    1171     uint32_t         inode_type;
    11721249    uint32_t         attr;
    11731250    uint32_t         rights;
     
    11831260    // get input arguments from client rpc descriptor
    11841261    fs_type    = (uint32_t)  hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
    1185     inode_type = (uint32_t)  hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
    1186     attr       = (uint32_t)  hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) );
    1187     rights     = (uint32_t)  hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) );
    1188     uid        = (uid_t)     hal_remote_l64( XPTR( client_cxy , &desc->args[4] ) );
    1189     gid        = (gid_t)     hal_remote_l64( XPTR( client_cxy , &desc->args[5] ) );
     1262    attr       = (uint32_t)  hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
     1263    rights     = (uint32_t)  hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) );
     1264    uid        = (uid_t)     hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) );
     1265    gid        = (gid_t)     hal_remote_l64( XPTR( client_cxy , &desc->args[4] ) );
    11901266
    11911267    // call local kernel function
    11921268    error = vfs_inode_create( fs_type,
    1193                               inode_type,
    11941269                              attr,
    11951270                              rights,
     
    11991274
    12001275    // set output arguments
    1201     hal_remote_s64( XPTR( client_cxy , &desc->args[6] ) , (uint64_t)inode_xp );
    1202     hal_remote_s64( XPTR( client_cxy , &desc->args[7] ) , (uint64_t)error );
     1276    hal_remote_s64( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)inode_xp );
     1277    hal_remote_s64( XPTR( client_cxy , &desc->args[6] ) , (uint64_t)error );
    12031278
    12041279#if DEBUG_RPC_VFS_INODE_CREATE
     
    16011676
    16021677/////////////////////////////////////////////////////////
    1603 void rpc_vfs_fs_get_dentry_client( cxy_t         cxy,
     1678void rpc_vfs_fs_new_dentry_client( cxy_t         cxy,
    16041679                                   vfs_inode_t * parent_inode,    // in
    16051680                                   char        * name,            // in
     
    16431718
    16441719//////////////////////////////////////////////
    1645 void rpc_vfs_fs_get_dentry_server( xptr_t xp )
     1720void rpc_vfs_fs_new_dentry_server( xptr_t xp )
    16461721{
    16471722#if DEBUG_RPC_VFS_FS_GET_DENTRY
     
    16741749
    16751750    // call the kernel function
    1676     error = vfs_fs_get_dentry( parent , name_copy , child_xp );
     1751    error = vfs_fs_new_dentry( parent , name_copy , child_xp );
    16771752
    16781753    // set output argument
     
    22452320
    22462321/////////////////////////////////////////////////////////////////////////////////////////
    2247 // [24]          undefined slot
    2248 /////////////////////////////////////////////////////////////////////////////////////////
     2322// [25]          Marshaling functions attached to RPC_MAPPER_SYNC
     2323/////////////////////////////////////////////////////////////////////////////////////////
     2324
     2325///////////////////////////////////////////////////
     2326void rpc_mapper_sync_client( cxy_t             cxy,
     2327                             struct mapper_s * mapper,
     2328                             error_t         * error )
     2329{
     2330#if DEBUG_RPC_MAPPER_SYNC
     2331thread_t * this = CURRENT_THREAD;
     2332uint32_t cycle = (uint32_t)hal_get_cycles();
     2333if( cycle > DEBUG_RPC_MAPPER_SYNC )
     2334printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2335__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2336#endif
     2337
     2338    uint32_t responses = 1;
     2339
     2340    // initialise RPC descriptor header
     2341    rpc_desc_t  rpc;
     2342    rpc.index    = RPC_MAPPER_SYNC;
     2343    rpc.blocking = true;
     2344    rpc.rsp      = &responses;
     2345
     2346    // set input arguments in RPC descriptor
     2347    rpc.args[0] = (uint64_t)(intptr_t)mapper;
     2348
     2349    // register RPC request in remote RPC fifo
     2350    rpc_send( cxy , &rpc );
     2351
     2352    // get output values from RPC descriptor
     2353    *error   = (error_t)rpc.args[1];
     2354
     2355#if DEBUG_RPC_MAPPER_SYNC
     2356cycle = (uint32_t)hal_get_cycles();
     2357if( cycle > DEBUG_RPC_MAPPER_SYNC )
     2358printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2359__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2360#endif
     2361}
     2362
     2363////////////////////////////////////////
     2364void rpc_mapper_sync_server( xptr_t xp )
     2365{
     2366#if DEBUG_RPC_MAPPER_SYNC
     2367thread_t * this = CURRENT_THREAD;
     2368uint32_t cycle = (uint32_t)hal_get_cycles();
     2369if( cycle > DEBUG_RPC_MAPPER_SYNC )
     2370printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2371__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2372#endif
     2373
     2374    mapper_t * mapper;
     2375    error_t    error;
     2376
     2377    // get client cluster identifier and pointer on RPC descriptor
     2378    cxy_t        client_cxy  = GET_CXY( xp );
     2379    rpc_desc_t * desc        = GET_PTR( xp );
     2380
     2381    // get arguments from client RPC descriptor
     2382    mapper  = (mapper_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
     2383
     2384    // call local kernel function
     2385    error = mapper_sync( mapper );
     2386
     2387    // set output argument to client RPC descriptor
     2388    hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
     2389
     2390#if DEBUG_RPC_MAPPER_SYNC
     2391cycle = (uint32_t)hal_get_cycles();
     2392if( cycle > DEBUG_RPC_MAPPER_SYNC )
     2393printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2394__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2395#endif
     2396}
    22492397
    22502398/////////////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.