Changeset 640 for trunk/kernel/kern


Ignore:
Timestamp:
Oct 1, 2019, 1:19:00 PM (4 years ago)
Author:
alain
Message:

Remove all RPCs in page-fault handling.

Location:
trunk/kernel/kern
Files:
6 edited

Legend:

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

    r637 r640  
    163163    "PROCESS_FDARRAY",       // 27
    164164    "PROCESS_DIR",           // 28
    165     "unused_29",             // 29
     165    "VMM_VSL",               // 29
    166166
    167167    "PROCESS_THTBL",         // 30
     
    170170    "VFS_SIZE",              // 32
    171171    "VFS_FILE",              // 33
    172     "VMM_VSL",               // 34
    173     "VFS_MAIN",              // 35
    174     "FATFS_FAT",             // 36
     172    "VFS_MAIN",              // 34
     173    "FATFS_FAT",             // 35
    175174};       
    176175
     
    14181417#endif
    14191418
    1420 #if (DEBUG_KERNEL_INIT & 1)
    1421 if( (core_lid ==  0) & (local_cxy == 0) )
    1422 sched_display( 0 );
    1423 #endif
    1424 
    14251419    if( (core_lid == 0) && (local_cxy == 0) )
    14261420    {
     
    14451439                   " - khm manager        : %d bytes\n"
    14461440                   " - vmm manager        : %d bytes\n"
    1447                    " - gpt root           : %d bytes\n"
    14481441                   " - vfs inode          : %d bytes\n"
    14491442                   " - vfs dentry         : %d bytes\n"
     
    14731466                   sizeof( khm_t              ),
    14741467                   sizeof( vmm_t              ),
    1475                    sizeof( gpt_t              ),
    14761468                   sizeof( vfs_inode_t        ),
    14771469                   sizeof( vfs_dentry_t       ),
  • trunk/kernel/kern/rpc.c

    r637 r640  
    7373    &rpc_vfs_inode_load_all_pages_server,  // 19
    7474
    75     &rpc_vmm_get_vseg_server,              // 20
    76     &rpc_vmm_global_update_pte_server,     // 21
     75    &rpc_undefined,                        // 20
     76    &rpc_undefined,                        // 21
    7777    &rpc_undefined,                        // 22
    7878    &rpc_undefined,                        // 23
    7979    &rpc_mapper_sync_server,               // 24
    80     &rpc_undefined,                        // 25
    81     &rpc_vmm_delete_vseg_server,           // 26
     80    &rpc_vmm_resize_vseg_server,           // 25
     81    &rpc_vmm_remove_vseg_server,           // 26
    8282    &rpc_vmm_create_vseg_server,           // 27
    8383    &rpc_vmm_set_cow_server,               // 28
     
    109109    "VFS_INODE_LOAD_ALL_PAGES",  // 19
    110110
    111     "GET_VSEG",                  // 20
    112     "GLOBAL_UPDATE_PTE",         // 21
     111    "VMM_GLOBAL_RESIZE_VSEG",    // 20
     112    "VMM_GLOBAL_UPDATE_PTE",     // 21
    113113    "undefined_22",              // 22
    114114    "undefined_23",              // 23
    115115    "MAPPER_SYNC",               // 24
    116116    "undefined_25",              // 25
    117     "VMM_DELETE_VSEG",           // 26
     117    "VMM_REMOVE_VSEG",           // 26
    118118    "VMM_CREATE_VSEG",           // 27
    119119    "VMM_SET_COW",               // 28
     
    10721072
    10731073/////////////////////////////////////////////////////////////////////////////////////////
    1074 // [8]   Marshaling functions attached to RPC_VRS_FS_UPDATE_DENTRY
     1074// [8]   Marshaling functions attached to RPC_VFS_FS_UPDATE_DENTRY
    10751075/////////////////////////////////////////////////////////////////////////////////////////
    10761076
     
    20592059
    20602060/////////////////////////////////////////////////////////////////////////////////////////
    2061 // [20]          Marshaling functions attached to RPC_VMM_GET_VSEG
    2062 /////////////////////////////////////////////////////////////////////////////////////////
    2063 
     2061// [20]          RPC_VMM_GET_VSEG deprecated [AG] sept 2019
     2062/////////////////////////////////////////////////////////////////////////////////////////
     2063
     2064/*
    20642065//////////////////////////////////////////////////
    20652066void rpc_vmm_get_vseg_client( cxy_t       cxy,     
     
    21442145#endif
    21452146}
    2146 
    2147 
    2148 /////////////////////////////////////////////////////////////////////////////////////////
    2149 // [21]    Marshaling functions attached to RPC_VMM_GLOBAL_UPDATE_PTE
    2150 /////////////////////////////////////////////////////////////////////////////////////////
    2151 
    2152 ///////////////////////////////////////////////////////
    2153 void rpc_vmm_global_update_pte_client( cxy_t       cxy,   
    2154                                        process_t * process,  // in
    2155                                        vpn_t       vpn,      // in
    2156                                        uint32_t    attr,     // in
    2157                                        ppn_t       ppn )     // in
    2158 {
    2159 #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE
    2160 thread_t * this = CURRENT_THREAD;
    2161 uint32_t cycle = (uint32_t)hal_get_cycles();
    2162 if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE )
    2163 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
    2164 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
    2165 #endif
    2166 
    2167     uint32_t responses = 1;
    2168 
    2169     // initialise RPC descriptor header
    2170     rpc_desc_t  rpc;
    2171     rpc.index    = RPC_VMM_GLOBAL_UPDATE_PTE;
    2172     rpc.blocking = true;
    2173     rpc.rsp      = &responses;
    2174 
    2175     // set input arguments in RPC descriptor
    2176     rpc.args[0] = (uint64_t)(intptr_t)process;
    2177     rpc.args[1] = (uint64_t)vpn;
    2178     rpc.args[2] = (uint64_t)attr;
    2179     rpc.args[3] = (uint64_t)ppn;
    2180 
    2181     // register RPC request in remote RPC fifo
    2182     rpc_send( cxy , &rpc );
    2183 
    2184 #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE
    2185 cycle = (uint32_t)hal_get_cycles();
    2186 if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE )
    2187 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
    2188 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
    2189 #endif
    2190 }
    2191 
    2192 //////////////////////////////////////////////////
    2193 void rpc_vmm_global_update_pte_server( xptr_t xp )
    2194 {
    2195 #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE
    2196 thread_t * this = CURRENT_THREAD;
    2197 uint32_t cycle = (uint32_t)hal_get_cycles();
    2198 if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE )
    2199 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
    2200 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
    2201 #endif
    2202 
    2203     process_t   * process;
    2204     vpn_t         vpn;
    2205     uint32_t      attr;
    2206     ppn_t         ppn;
    2207 
    2208     // get client cluster identifier and pointer on RPC descriptor
    2209     cxy_t        client_cxy  = GET_CXY( xp );
    2210     rpc_desc_t * desc        = GET_PTR( xp );
    2211 
    2212     // get input argument "process" & "vpn" from client RPC descriptor
    2213     process = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
    2214     vpn     = (vpn_t)                hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
    2215     attr    = (uint32_t)             hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) );
    2216     ppn     = (ppn_t)                hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) );
    2217    
    2218     // call local kernel function
    2219     vmm_global_update_pte( process , vpn , attr , ppn );
    2220 
    2221 #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE
    2222 cycle = (uint32_t)hal_get_cycles();
    2223 if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE )
    2224 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
    2225 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
    2226 #endif
    2227 }
    2228 
    2229 /////////////////////////////////////////////////////////////////////////////////////////
    2230 // [22]          Marshaling functions attached to RPC_KCM_ALLOC
     2147*/
     2148
     2149/////////////////////////////////////////////////////////////////////////////////////////
     2150// [21]    undefined
     2151/////////////////////////////////////////////////////////////////////////////////////////
     2152
     2153/////////////////////////////////////////////////////////////////////////////////////////
     2154// [22]          RPC_KCM_ALLOC deprecated [AG] sept 2019
    22312155/////////////////////////////////////////////////////////////////////////////////////////
    22322156
     
    23082232
    23092233/////////////////////////////////////////////////////////////////////////////////////////
    2310 // [23]          Marshaling functions attached to RPC_KCM_FREE
     2234// [23]          RPC_KCM_FREE deprecated [AG] sept 2019
    23112235/////////////////////////////////////////////////////////////////////////////////////////
    23122236
     
    24602384
    24612385/////////////////////////////////////////////////////////////////////////////////////////
    2462 // [25]          Marshaling functions attached to RPC_MAPPER_HANDLE_MISS
    2463 /////////////////////////////////////////////////////////////////////////////////////////
    2464 
    2465 /*
     2386// [25]          Marshaling functions attached to RPC_VMM_RESIZE_VSEG
     2387/////////////////////////////////////////////////////////////////////////////////////////
     2388
    24662389//////////////////////////////////////////////////////////
    2467 void rpc_mapper_handle_miss_client( cxy_t             cxy,
    2468                                     struct mapper_s * mapper,
    2469                                     uint32_t          page_id,
    2470                                     xptr_t          * page_xp,
    2471                                     error_t         * error )
    2472 {
    2473 #if DEBUG_RPC_MAPPER_HANDLE_MISS
    2474 thread_t * this = CURRENT_THREAD;
    2475 uint32_t cycle = (uint32_t)hal_get_cycles();
    2476 if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS )
     2390void rpc_vmm_resize_vseg_client( cxy_t             cxy,
     2391                                 struct process_s * process,
     2392                                 struct vseg_s    * vseg,
     2393                                 intptr_t           new_base,
     2394                                 intptr_t           new_size )
     2395{
     2396#if DEBUG_RPC_VMM_RESIZE_VSEG
     2397thread_t * this = CURRENT_THREAD;
     2398uint32_t cycle = (uint32_t)hal_get_cycles();
     2399if( cycle > DEBUG_RPC_VMM_RESIZE_VSEG )
    24772400printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
    24782401__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     
    24832406    // initialise RPC descriptor header
    24842407    rpc_desc_t  rpc;
    2485     rpc.index    = RPC_MAPPER_HANDLE_MISS;
     2408    rpc.index    = RPC_VMM_RESIZE_VSEG;
    24862409    rpc.blocking = true;
    24872410    rpc.rsp      = &responses;
    24882411
    24892412    // set input arguments in RPC descriptor
    2490     rpc.args[0] = (uint64_t)(intptr_t)mapper;
    2491     rpc.args[1] = (uint64_t)page_id;
     2413    rpc.args[0] = (uint64_t)(intptr_t)process;
     2414    rpc.args[1] = (uint64_t)(intptr_t)vseg;
     2415    rpc.args[2] = (uint64_t)new_base;
     2416    rpc.args[3] = (uint64_t)new_size;
    24922417
    24932418    // register RPC request in remote RPC fifo
    24942419    rpc_send( cxy , &rpc );
    24952420
    2496     // get output values from RPC descriptor
    2497     *page_xp = (xptr_t)rpc.args[2];
    2498     *error   = (error_t)rpc.args[3];
    2499 
    2500 #if DEBUG_RPC_MAPPER_HANDLE_MISS
    2501 cycle = (uint32_t)hal_get_cycles();
    2502 if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS )
    2503 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
    2504 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
    2505 #endif
    2506 }
    2507 
    2508 ///////////////////////////////////////////////
    2509 void rpc_mapper_handle_miss_server( xptr_t xp )
    2510 {
    2511 #if DEBUG_RPC_MAPPER_HANDLE_MISS
    2512 thread_t * this = CURRENT_THREAD;
    2513 uint32_t cycle = (uint32_t)hal_get_cycles();
    2514 if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS )
    2515 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
    2516 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
    2517 #endif
    2518 
    2519     mapper_t * mapper;
    2520     uint32_t   page_id;
    2521     xptr_t     page_xp;
    2522     error_t    error;
     2421#if DEBUG_RPC_VMM_RESIZE_VSEG
     2422cycle = (uint32_t)hal_get_cycles();
     2423if( cycle > DEBUG_RPC_VMM_RESIZE_VSEG )
     2424printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2425__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2426#endif
     2427}
     2428
     2429////////////////////////////////////////////
     2430void rpc_vmm_resize_vseg_server( xptr_t xp )
     2431{
     2432#if DEBUG_RPC_VMM_RESIZE_VSEG
     2433thread_t * this = CURRENT_THREAD;
     2434uint32_t cycle = (uint32_t)hal_get_cycles();
     2435if( cycle > DEBUG_RPC_VMM_RESIZE_VSEG )
     2436printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2437__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2438#endif
     2439
     2440    process_t * process;
     2441    vseg_t    * vseg;
     2442    intptr_t    new_base;
     2443    intptr_t    new_size;
    25232444
    25242445    // get client cluster identifier and pointer on RPC descriptor
     
    25272448
    25282449    // get arguments from client RPC descriptor
    2529     mapper  = (mapper_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
    2530     page_id =                       hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
    2531 
    2532     // call local kernel function
    2533     error = mapper_handle_miss( mapper,
    2534                                 page_id,
    2535                                 &page_xp );
    2536 
    2537     // set output argument to client RPC descriptor
    2538     hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)page_xp );
    2539     hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
    2540 
    2541 #if DEBUG_RPC_MAPPER_HANDLE_MISS
    2542 cycle = (uint32_t)hal_get_cycles();
    2543 if( cycle > DEBUG_RPC_MAPPER_HANDLE_MISS )
    2544 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
    2545 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
    2546 #endif
    2547 }
    2548 */
    2549 
    2550 /////////////////////////////////////////////////////////////////////////////////////////
    2551 // [26]  Marshaling functions attached to RPC_VMM_DELETE_VSEG
    2552 /////////////////////////////////////////////////////////////////////////////////////////
    2553 
    2554 //////////////////////////////////////////////////
    2555 void rpc_vmm_delete_vseg_client( cxy_t        cxy,
    2556                                  pid_t        pid,
    2557                                  intptr_t     vaddr )
    2558 {
    2559 #if DEBUG_RPC_VMM_DELETE_VSEG
     2450    process  = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
     2451    vseg     = (vseg_t    *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
     2452    new_base =              (intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) );
     2453    new_size =              (intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) );
     2454
     2455    // call relevant kernel function
     2456    vmm_resize_vseg( process,
     2457                     vseg,
     2458                     new_base,
     2459                     new_size );
     2460
     2461#if DEBUG_RPC_VMM_RESIZE_VSEG
     2462cycle = (uint32_t)hal_get_cycles();
     2463if( cycle > DEBUG_RPC_VMM_RESIZE_VSEG )
     2464printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
     2465__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
     2466#endif
     2467}
     2468
     2469
     2470/////////////////////////////////////////////////////////////////////////////////////////
     2471// [26]  Marshaling functions attached to RPC_VMM_REMOVE_VSEG
     2472/////////////////////////////////////////////////////////////////////////////////////////
     2473
     2474/////////////////////////////////////////////////
     2475void rpc_vmm_remove_vseg_client( cxy_t       cxy,
     2476                                 process_t * process,
     2477                                 vseg_t    * vseg )
     2478{
     2479#if DEBUG_RPC_VMM_REMOVE_VSEG
    25602480thread_t * this  = CURRENT_THREAD;
    25612481uint32_t   cycle = (uint32_t)hal_get_cycles();
    2562 if( cycle > DEBUG_RPC_VMM_DELETE_VSEG )
     2482if( cycle > DEBUG_RPC_VMM_REMOVE_VSEG )
    25632483printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
    25642484__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     
    25692489
    25702490    // initialise RPC descriptor header
    2571     rpc.index    = RPC_VMM_DELETE_VSEG;
     2491    rpc.index    = RPC_VMM_REMOVE_VSEG;
    25722492    rpc.blocking = true;
    25732493    rpc.rsp      = &responses;
    25742494
    25752495    // set input arguments in RPC descriptor
    2576     rpc.args[0] = (uint64_t)pid;
    2577     rpc.args[1] = (uint64_t)vaddr;
     2496    rpc.args[0] = (uint64_t)(intptr_t)process;
     2497    rpc.args[1] = (uint64_t)(intptr_t)vseg;
    25782498
    25792499    // register RPC request in remote RPC fifo
    25802500    rpc_send( cxy , &rpc );
    25812501
    2582 #if DEBUG_RPC_VMM_DELETE_VSEG
    2583 cycle = (uint32_t)hal_get_cycles();
    2584 if( cycle > DEBUG_RPC_VMM_DELETE_VSEG )
     2502#if DEBUG_RPC_VMM_REMOVE_VSEG
     2503cycle = (uint32_t)hal_get_cycles();
     2504if( cycle > DEBUG_RPC_VMM_REMOVE_VSEG )
    25852505printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
    25862506__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     
    25892509
    25902510////////////////////////////////////////////
    2591 void rpc_vmm_delete_vseg_server( xptr_t xp )
    2592 {
    2593 #if DEBUG_RPC_VMM_DELETE_VSEG
    2594 uint32_t cycle = (uint32_t)hal_get_cycles();
    2595 thread_t * this = CURRENT_THREAD;
    2596 if( DEBUG_RPC_VMM_DELETE_VSEG < cycle )
    2597 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
    2598 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
    2599 #endif
     2511void rpc_vmm_remove_vseg_server( xptr_t xp )
     2512{
     2513#if DEBUG_RPC_VMM_REMOVE_VSEG
     2514uint32_t cycle = (uint32_t)hal_get_cycles();
     2515thread_t * this = CURRENT_THREAD;
     2516if( DEBUG_RPC_VMM_REMOVE_VSEG < cycle )
     2517printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
     2518__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
     2519#endif
     2520
     2521    process_t * process;
     2522    vseg_t    * vseg;
    26002523
    26012524    // get client cluster identifier and pointer on RPC descriptor
     
    26042527
    26052528    // get arguments from RPC descriptor
    2606     pid_t    pid   = (pid_t)   hal_remote_l64( XPTR(client_cxy , &desc->args[0]) );
    2607     intptr_t vaddr = (intptr_t)hal_remote_l64( XPTR(client_cxy , &desc->args[1]) );
     2529    process  = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
     2530    vseg     = (vseg_t    *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
    26082531
    26092532    // call relevant kernel function
    2610     vmm_delete_vseg( pid , vaddr );
    2611 
    2612 #if DEBUG_RPC_VMM_DELETE_VSEG
    2613 cycle = (uint32_t)hal_get_cycles();
    2614 if( DEBUG_RPC_VMM_DELETE_VSEG < cycle )
     2533    vmm_remove_vseg( process,
     2534                     vseg );
     2535
     2536#if DEBUG_RPC_VMM_REMOVE_VSEG
     2537cycle = (uint32_t)hal_get_cycles();
     2538if( DEBUG_RPC_VMM_REMOVE_VSEG < cycle )
    26152539printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
    26162540__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
  • trunk/kernel/kern/rpc.h

    r635 r640  
    6060typedef enum
    6161{
    62     RPC_UNDEFINED_0               = 0,   // RPC_PMEM_GET_PAGES       deprecated [AG]
    63     RPC_UNDEFINED_1               = 1,   // RPC_PMEM_RELEASE_PAGES   deprecated [AG]
    64     RPC_UNDEFINED_2               = 2,   // RPC_PMEM_DISPLAY         deprecated [AG]     
     62    RPC_UNDEFINED_0               = 0,   //
     63    RPC_UNDEFINED_1               = 1,   //
     64    RPC_UNDEFINED_2               = 2,   //      
    6565    RPC_PROCESS_MAKE_FORK         = 3,
    6666    RPC_USER_DIR_CREATE           = 4,
     
    8282    RPC_VFS_INODE_LOAD_ALL_PAGES  = 19,
    8383
    84     RPC_VMM_GET_VSEG              = 20,
    85     RPC_VMM_GLOBAL_UPDATE_PTE     = 21,
    86     RPC_UNDEFINED_22              = 22,   // RPC_KCM_ALLOC           deprecated [AG]
    87     RPC_UNDEFINED_23              = 23,   // RPC_KCM_FREE            deprecated [AG]
     84    RPC_UNDEFINED_20              = 20,   //
     85    RPC_UNDEFINED_21              = 21,   //
     86    RPC_UNDEFINED_22              = 22,   //
     87    RPC_UNDEFINED_23              = 23,   //
    8888    RPC_MAPPER_SYNC               = 24,
    89     RPC_UNDEFUNED_25              = 25,   // RPC_MAPPER_HANDLE_MISS  deprecated [AG]
    90     RPC_VMM_DELETE_VSEG           = 26,
     89    RPC_VMM_RESIZE_VSEG           = 25,
     90    RPC_VMM_REMOVE_VSEG           = 26,
    9191    RPC_VMM_CREATE_VSEG           = 27,
    9292    RPC_VMM_SET_COW               = 28,
    93     RPC_UNDEFINED_29              = 29,   // RPC_VMM_DISPLAY         deprecated [AG]
     93    RPC_UNDEFINED_29              = 29,   //
    9494
    9595    RPC_MAX_INDEX                 = 30,
     
    175175
    176176/***********************************************************************************
    177  * [0] The RPC_PMEM_GET_PAGES allocates one or several pages in a remote cluster,
    178  * and returns the local pointer on the page descriptor.
    179  *         deprecated [AG] may 2019
    180  ***********************************************************************************
    181  * @ cxy     : server cluster identifier
    182  * @ order   : [in]  ln2( number of requested pages )
    183  * @ page    : [out] local pointer on page descriptor / NULL if failure
    184  **********************************************************************************/
    185 
    186 /*
    187 void rpc_pmem_get_pages_client( cxy_t             cxy,
    188                                 uint32_t          order,
    189                                 struct page_s  ** page );
    190 
    191 void rpc_pmem_get_pages_server( xptr_t xp );
    192 */
    193 
    194 /***********************************************************************************
    195  * [1] The RPC_PMEM_RELEASE_PAGES release one or several pages to a remote cluster.
    196  *         deprecated [AG] may 2019
    197  ***********************************************************************************
    198  * @ cxy     : server cluster identifier
    199  * @ page    : [in] local pointer on page descriptor to release.
    200  **********************************************************************************/
    201 
    202 /*
    203 void rpc_pmem_release_pages_client( cxy_t            cxy,
    204                                     struct page_s  * page );
    205 
    206 void rpc_pmem_release_pages_server( xptr_t xp );
    207 */
    208 
    209 /***********************************************************************************
    210  * [2] The RPC_PPM_DISPLAY allows any client thread to require any remote cluster
    211  * identified by the <cxy> argumentto display the physical memory allocator state.
    212  *         deprecated [AG] may 2019
    213  **********************************************************************************/
    214 
    215 /*
    216 void rpc_ppm_display_client( cxy_t  cxy );
    217 
    218 void rpc_ppm_display_server( xptr_t xp );
    219 */
     177 * [0] undefined
     178 **********************************************************************************/
     179
     180/***********************************************************************************
     181 * [1] undefined
     182 **********************************************************************************/
     183
     184/***********************************************************************************
     185 * [2] undefined
     186 **********************************************************************************/
    220187
    221188/***********************************************************************************
     
    523490
    524491/***********************************************************************************
    525  * [20] The RPC_VMM_GET_VSEG returns an extended pointer
    526  * on the vseg containing a given virtual address in a given process.
    527  * The server cluster is supposed to be the reference cluster.
    528  * It returns a non zero error value if no vseg has been founded.
    529  ***********************************************************************************
    530  * @ cxy     : server cluster identifier.
    531  * @ process : [in]   pointer on process descriptor in server cluster.
    532  * @ vaddr   : [in]   virtual address to be searched.
    533  * @ vseg_xp : [out]  buffer for extended pointer on vseg in client cluster.
    534  * @ error   : [out] local pointer on buffer for error code (in client cluster).
    535  **********************************************************************************/
    536 void rpc_vmm_get_vseg_client( cxy_t              cxy,
    537                               struct process_s * process,
    538                               intptr_t           vaddr,
    539                               xptr_t           * vseg_xp,
    540                               error_t          * error );
    541 
    542 void rpc_vmm_get_vseg_server( xptr_t xp );
    543 
    544 /***********************************************************************************
    545  * [21] The RPC_VMM_GLOBAL_UPDATE_PTE can be used by a thread that is not running
    546  * in reference cluster, to ask the reference cluster to update a specific entry,
    547  * identified by the <vpn> argument in all GPT copies of a process identified by
    548  * the <process> argument, using the values defined by <attr> and <ppn> arguments.
    549  * The server cluster is supposed to be the reference cluster.
    550  * It does not return any error code as the called function vmm_global_update_pte()
    551  * cannot fail.
    552  ***********************************************************************************
    553  * @ cxy     : server cluster identifier.
    554  * @ process : [in]  pointer on process descriptor in server cluster.
    555  * @ vpn     : [in]  virtual address to be searched.
    556  * @ attr    : [in]  PTE attributes.
    557  * @ ppn     : [it]  PTE PPN.
    558  **********************************************************************************/
    559 void rpc_vmm_global_update_pte_client( cxy_t              cxy,
    560                                        struct process_s * process,
    561                                        vpn_t              vpn,
    562                                        uint32_t           attr,
    563                                        ppn_t              ppn );
    564 
    565 void rpc_vmm_global_update_pte_server( xptr_t xp );
    566 
    567 /***********************************************************************************
    568  * [22] The RPC_KCM_ALLOC allocates memory from a given KCM in a remote cluster,
    569  * and returns an extended pointer on the allocated object.
    570   It returns XPTR_NULL if physical memory cannot be allocated.
    571  ***********************************************************************************
    572  * @ cxy       : server cluster identifier.
    573  * @ kmem_type : [in]  KCM object type (as defined in kmem.h).
    574  * @ buf_xp    : [out] buffer for extended pointer on allocated buffer.
    575  **********************************************************************************/
    576 
    577 /*
    578 void rpc_kcm_alloc_client( cxy_t      cxy,
    579                            uint32_t   kmem_type,
    580                            xptr_t   * buf_xp ); 
    581 
    582 void rpc_kcm_alloc_server( xptr_t xp );
    583 */
    584 
    585 /***********************************************************************************
    586  * [23] The RPC_KCM_FREE releases memory allocated for a KCM object of a given type,
    587  * in a remote cluster.
    588  ***********************************************************************************
    589  * @ cxy       : server cluster identifier.
    590  * @ buf       : [in] local pointer on allocated buffer.
    591  * @ kmem_type : [in]  KCM object type (as defined in kmem.h).
    592  **********************************************************************************/
    593 
    594 /*
    595 void rpc_kcm_free_client( cxy_t     cxy,
    596                           void    * buf,
    597                           uint32_t  kmem_type );
    598 
    599 void rpc_kcm_free_server( xptr_t xp );
    600 */
     492 * [20] undefined
     493 **********************************************************************************/
     494
     495/***********************************************************************************
     496 * [21] undefined
     497 **********************************************************************************/
     498
     499/***********************************************************************************
     500 * [22] undefined
     501 **********************************************************************************/
     502
     503/***********************************************************************************
     504 * [23] undefined
     505 **********************************************************************************/
    601506
    602507/***********************************************************************************
     
    615520
    616521/***********************************************************************************
    617  * [25] The RPC__MAPPER_HANDLE_MISS allows a client thread to request a remote
    618  * mapper to load a missing page from the IOC device.
    619  * On the server side, this RPC call the mapper_handle_miss() function and return
    620  * an extended pointer on the allocated page descriptor and an error status.
     522 * [25] The RPC_VMM_RESIZE_VSEG allows a client thread to request a remote vseg
     523 * resize. Both the VSL and the GPT are updated in the remote cluster.
    621524 ***********************************************************************************
    622525 * @ cxy         : server cluster identifier.
    623  * @ mapper      : [in]  local pointer on mapper.
    624  * @ page_id     : [in]  missing page index in mapper
    625  * @ buffer      : [in]  user space pointer / kernel extended pointer
    626  * @ page_xp     : [out] pointer on buffer for extended pointer on page descriptor.
    627  * @ error       : [out] error status (0 if success).
    628  **********************************************************************************/
    629 /*
    630 void rpc_mapper_handle_miss_client( cxy_t             cxy,
    631                                     struct mapper_s * mapper,
    632                                     uint32_t          page_id,
    633                                     xptr_t          * page_xp,
    634                                     error_t         * error );
     526 * @ process     : [in] local pointer on remote process.
     527 * @ vseg        : [in] local pointer on remote vseg.
     528 * @ new_base    : [in] new vseg base address.
     529 * @ new_size    : [in] new vseg size.
     530 **********************************************************************************/
     531void rpc_vmm_resize_vseg_client( cxy_t              cxy,
     532                                 struct process_s * process,
     533                                 struct vseg_s    * vseg,
     534                                 intptr_t           new_base,
     535                                 intptr_t           new_size );
    635536 
    636 void rpc_mapper_handle_miss_server( xptr_t xp );
    637 */
    638 /***********************************************************************************
    639  * [26] The RPC_VMM_DELETE_VSEG allows any client thread  to request a remote
    640  * cluster to delete from a given VMM, identified by the <pid> argument
    641  * a given vseg, identified by the <vaddr> argument.
     537void rpc_vmm_resize_vseg_server( xptr_t xp );
     538
     539/***********************************************************************************
     540 * [26] The RPC_VMM_REMOVE_VSEG allows a client thread  to request a remote vseg
     541 * delete. Bothe the VSL and the GPT are updated in the remote cluster.
    642542 ***********************************************************************************
    643543 * @ cxy         : server cluster identifier.
    644  * @ pid         : [in] target process identifier.
    645  * @ vaddr       : [in] vseg base address.
    646  **********************************************************************************/
    647 void rpc_vmm_delete_vseg_client( cxy_t       cxy,
    648                                  pid_t       pid,
    649                                  intptr_t    vaddr );
     544 * @ process     : [in] local pointer on remote process.
     545 * @ vseg        : [in] local pointer on remote vseg.
     546 **********************************************************************************/
     547void rpc_vmm_remove_vseg_client( cxy_t              cxy,
     548                                 struct process_s * process,
     549                                 struct vseg_s    * vseg );
    650550 
    651 void rpc_vmm_delete_vseg_server( xptr_t xp );
     551void rpc_vmm_remove_vseg_server( xptr_t xp );
    652552
    653553/***********************************************************************************
     
    698598
    699599/***********************************************************************************
    700  * [29] The RPC_VMM_DISPLAY allows any client thread to display the VMM state
    701  * of a remote reference process identified by the <cxy> and <process> arguments.
    702  * The type of display is defined by the <detailed> boolean argument.
    703  ***********************************************************************************
    704  * @ cxy         : server cluster identifier.
    705  * @ process     : [in]  local pointer on reference process descriptor.
    706  * @ detailed    : [in]  detailed display if true.
    707  **********************************************************************************/
    708 
    709 /*
    710 void rpc_hal_vmm_display_client( cxy_t              cxy,
    711                              struct process_s * process,
    712                              bool_t             detailed );
    713 
    714 void rpc_hal_vmm_display_server( xptr_t xp );
    715 */
     600 * [29] undefined
     601 **********************************************************************************/
     602
    716603
    717604#endif
  • trunk/kernel/kern/scheduler.c

    r635 r640  
    507507#if (DEBUG_SCHED_YIELD & 0x1)
    508508if( sched->trace || (cycle > DEBUG_SCHED_YIELD) )
    509 sched_display( lid );
     509sched_remote_display( local_cxy , lid );
    510510#endif
    511511
     
    593593}  // end sched_yield()
    594594
    595 
    596 ///////////////////////////////
    597 void sched_display( lid_t lid )
    598 {
    599     list_entry_t * iter;
    600     thread_t     * thread;
    601 
    602     core_t       * core    = &LOCAL_CLUSTER->core_tbl[lid];
    603     scheduler_t  * sched   = &core->scheduler;
    604    
    605     // get pointers on TXT0 chdev
    606     xptr_t    txt0_xp  = chdev_dir.txt_tx[0];
    607     cxy_t     txt0_cxy = GET_CXY( txt0_xp );
    608     chdev_t * txt0_ptr = GET_PTR( txt0_xp );
    609 
    610     // get extended pointer on remote TXT0 lock
    611     xptr_t  lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock );
    612 
    613     // get TXT0 lock
    614     remote_busylock_acquire( lock_xp );
    615 
    616     nolock_printk("\n***** threads on core[%x,%d] / current %x / rpc_threads %d / cycle %d\n",
    617     local_cxy , lid, sched->current, LOCAL_CLUSTER->rpc_threads[lid],
    618     (uint32_t)hal_get_cycles() );
    619 
    620     // display kernel threads
    621     LIST_FOREACH( &sched->k_root , iter )
    622     {
    623         thread = LIST_ELEMENT( iter , thread_t , sched_list );
    624         if (thread->type == THREAD_DEV)
    625         {
    626             nolock_printk(" - %s / pid %X / trdid %X / desc %X / block %X / flags %X / %s\n",
    627             thread_type_str( thread->type ), thread->process->pid, thread->trdid,
    628             thread, thread->blocked, thread->flags, thread->chdev->name );
    629         }
    630         else
    631         {
    632             nolock_printk(" - %s / pid %X / trdid %X / desc %X / block %X / flags %X\n",
    633             thread_type_str( thread->type ), thread->process->pid, thread->trdid,
    634             thread, thread->blocked, thread->flags );
    635         }
    636     }
    637 
    638     // display user threads
    639     LIST_FOREACH( &sched->u_root , iter )
    640     {
    641         thread = LIST_ELEMENT( iter , thread_t , sched_list );
    642         nolock_printk(" - %s / pid %X / trdid %X / desc %X / block %X / flags %X\n",
    643         thread_type_str( thread->type ), thread->process->pid, thread->trdid,
    644         thread, thread->blocked, thread->flags );
    645     }
    646 
    647     // release TXT0 lock
    648     remote_busylock_release( lock_xp );
    649 
    650 }  // end sched_display()
    651595
    652596/////////////////////////////////////
     
    684628    nolock_printk("\n***** threads on core[%x,%d] / current %x / rpc_threads %d / cycle %d\n",
    685629    cxy , lid, current, rpcs, (uint32_t)hal_get_cycles() );
     630    nolock_printk("  type | pid        | trdid      | desc       | block      | flags      | func\n");
    686631
    687632    // display kernel threads
     
    706651            hal_remote_strcpy( XPTR( local_cxy , name ), XPTR( cxy , chdev->name ) );
    707652
    708             nolock_printk(" - %s / pid %X / trdid %X / desc %X / block %X / flags %X / %s\n",
     653            nolock_printk(" - %s | %X | %X | %X | %X | %X | %s\n",
    709654            thread_type_str( type ), pid, trdid, thread, blocked, flags, name );
    710655        }
    711656        else
    712657        {
    713             nolock_printk(" - %s / pid %X / trdid %X / desc %X / block %X / flags %X\n",
     658            nolock_printk(" - %s | %X | %X | %X | %X | %X |\n",
    714659            thread_type_str( type ), pid, trdid, thread, blocked, flags );
    715660        }
     
    732677        process_t *   process = hal_remote_lpt ( XPTR( cxy , &thread->process ) );
    733678        pid_t         pid     = hal_remote_l32 ( XPTR( cxy , &process->pid ) );
    734 
    735         nolock_printk(" - %s / pid %X / trdid %X / desc %X / block %X / flags %X\n",
    736         thread_type_str( type ), pid, trdid, thread, blocked, flags );
     679        void      *   func    = hal_remote_lpt ( XPTR( cxy , &thread->entry_func ) );
     680
     681        nolock_printk(" - %s | %X | %X | %X | %X | %X | %x\n",
     682        thread_type_str( type ), pid, trdid, thread, blocked, flags, (uint32_t)func );
    737683
    738684        // get next user thread list_entry
  • trunk/kernel/kern/scheduler.h

    r637 r640  
    8989
    9090/*********************************************************************************************
    91  * This debug function displays on TXT0 the internal state of a local scheduler,
    92  * identified by the core local index <lid>. It must be called by a local thread.
    93  *********************************************************************************************
    94  * @ lid      : local index of target core.
    95  ********************************************************************************************/
    96 void sched_display( lid_t lid );
    97 
    98 /*********************************************************************************************
    9991 * This debug function displays on TXT0 the internal state of a scheduler,
    10092 * identified by the target cluster identifier <cxy> and the core local index <lid>.
  • trunk/kernel/kern/thread.c

    r637 r640  
    890890    core_t        * core    = thread->core;
    891891
    892 #if DEBUG_THREAD_DESTROY
    893 uint32_t   cycle = (uint32_t)hal_get_cycles();
     892
     893#if DEBUG_THREAD_DESTROY || CONFIG_INSTRUMENTATION_PGFAULTS
     894uint32_t   cycle;
    894895thread_t * this  = CURRENT_THREAD;
     896#endif
     897
     898#if (DEBUG_THREAD_DESTROY & 1)
     899cycle = (uint32_t)hal_get_cycles();
    895900if( DEBUG_THREAD_DESTROY < cycle )
    896901printk("\n[%s] thread[%x,%x] enter to destroy thread[%x,%x] / cycle %d\n",
     
    902907
    903908#if CONFIG_INSTRUMENTATION_PGFAULTS
    904         process->vmm.false_pgfault_nr    += thread->info.false_pgfault_nr;
    905         process->vmm.local_pgfault_nr    += thread->info.local_pgfault_nr;
    906         process->vmm.global_pgfault_nr   += thread->info.global_pgfault_nr;
    907         process->vmm.false_pgfault_cost  += thread->info.false_pgfault_cost;
    908         process->vmm.local_pgfault_cost  += thread->info.local_pgfault_cost;
    909         process->vmm.global_pgfault_cost += thread->info.global_pgfault_cost;
     909process->vmm.false_pgfault_nr    += thread->info.false_pgfault_nr;
     910process->vmm.local_pgfault_nr    += thread->info.local_pgfault_nr;
     911process->vmm.global_pgfault_nr   += thread->info.global_pgfault_nr;
     912process->vmm.false_pgfault_cost  += thread->info.false_pgfault_cost;
     913process->vmm.local_pgfault_cost  += thread->info.local_pgfault_cost;
     914process->vmm.global_pgfault_cost += thread->info.global_pgfault_cost;
     915#endif
     916
     917#if (CONFIG_INSTRUMENTATION_PGFAULTS & 1)
     918uint32_t false_nr    = thread->info.false_pgfault_nr;
     919uint32_t local_nr    = thread->info.local_pgfault_nr;
     920uint32_t global_nr   = thread->info.global_pgfault_nr;
     921uint32_t false_cost  = thread->info.false_pgfault_cost;
     922uint32_t local_cost  = thread->info.local_pgfault_cost;
     923uint32_t global_cost = thread->info.global_pgfault_cost;
     924printk("***** thread[%x,%x] page-faults\n"
     925       " - false    %d ( %d cycles )\n"
     926       " - local    %d ( %d cycles )\n"
     927       " - global   %d ( %d cycles )\n",
     928       this->process->pid, this->trdid,
     929       false_nr , false_cost / false_nr,
     930       local_nr , local_cost / local_nr,
     931       global_nr, global_cost / global_nr );
    910932#endif
    911933
     
    12701292cycle = (uint32_t)hal_get_cycles();
    12711293if( DEBUG_THREAD_IDLE < cycle )
    1272 sched_display( CURRENT_THREAD->core->lid );
     1294sched_remote_display( local_cxy , CURRENT_THREAD->core->lid );
    12731295#endif     
    12741296        // search a runable thread
Note: See TracChangeset for help on using the changeset viewer.