Ignore:
Timestamp:
Aug 2, 2018, 11:47:13 AM (3 years ago)
Author:
alain
Message:

This version modifies the exec syscall and fixes a large number of small bugs.
The version number has been updated (0.1)

File:
1 edited

Legend:

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

    r450 r457  
    2323
    2424#include <kernel_config.h>
    25 #include <hal_types.h>
     25#include <hal_kernel_types.h>
    2626#include <hal_atomic.h>
    2727#include <hal_remote.h>
     
    100100    volatile error_t   full;
    101101    thread_t         * this;
    102     cluster_t        * cluster;
    103 
    104 #if DEBUG_RPC_CLIENT_GENERIC
    105 uint32_t cycle = (uint32_t)hal_get_cycles();
    106 if( DEBUG_RPC_CLIENT_GENERIC < cycle )
    107 printk("\n[DBG] %s : thread %x in cluster %x enter for rpc[%d] / rpc_ptr %x / cycle %d\n",
    108 __FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index, rpc, cycle );
    109 #endif
    110102
    111103    full            = 0;
    112104    this            = CURRENT_THREAD;
    113     cluster         = LOCAL_CLUSTER;
    114105    client_core_lid = this->core->lid;
    115106
     107#if DEBUG_RPC_CLIENT_GENERIC
     108uint32_t cycle = (uint32_t)hal_get_cycles();
     109if( DEBUG_RPC_CLIENT_GENERIC < cycle )
     110printk("\n[DBG] %s : thread %x in process %x enter for rpc[%d] / cycle %d\n",
     111__FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle );
     112#endif
     113
    116114    // select a server_core : use client core index if possible / core 0 otherwise
    117     if( client_core_lid < hal_remote_lw( XPTR( server_cxy , &cluster->cores_nr ) ) )
     115    if( client_core_lid < hal_remote_lw( XPTR( server_cxy , &LOCAL_CLUSTER->cores_nr ) ) )
    118116    {
    119117        server_core_lid = client_core_lid;
     
    150148 
    151149    hal_fence();
     150
     151#if DEBUG_RPC_CLIENT_GENERIC
     152cycle = (uint32_t)hal_get_cycles();
     153if( DEBUG_RPC_CLIENT_GENERIC < cycle )
     154printk("\n[DBG] %s : thread %x in process %x / rpc[%d] / rpc_ptr %x / cycle %d\n",
     155__FUNCTION__, this->trdid, this->process->pid, rpc->index, rpc, cycle );
     156#endif
    152157       
    153     // send IPI to the selected server core
    154         dev_pic_send_ipi( server_cxy , server_core_lid );
     158   // send IPI to the selected server core
     159   dev_pic_send_ipi( server_cxy , server_core_lid );
    155160
    156161    // wait RPC completion before returning if blocking RPC
     
    165170cycle = (uint32_t)hal_get_cycles();
    166171if( DEBUG_RPC_CLIENT_GENERIC < cycle )
    167 printk("\n[DBG] %s : thread %x in cluster %x busy waiting / rpc[%d] / cycle %d\n",
    168 __FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index , cycle );
     172printk("\n[DBG] %s : thread %x in process %x busy waiting for rpc[%d] / cycle %d\n",
     173__FUNCTION__, this->trdid, this->process->pid, rpc->index , cycle );
    169174#endif
    170175
     
    174179cycle = (uint32_t)hal_get_cycles();
    175180if( DEBUG_RPC_CLIENT_GENERIC < cycle )
    176 printk("\n[DBG] %s : thread %x in cluster %x resumes / rpc[%d] / cycle %d\n",
    177 __FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index, cycle );
     181printk("\n[DBG] %s : thread %x in process %x resumes for rpc[%d] / cycle %d\n",
     182__FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle );
    178183#endif
    179184        }
     
    184189cycle = (uint32_t)hal_get_cycles();
    185190if( DEBUG_RPC_CLIENT_GENERIC < cycle )
    186 printk("\n[DBG] %s : thread %x in cluster %x blocks & deschedules / rpc[%d] / cycle %d\n",
    187 __FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index , cycle );
     191printk("\n[DBG] %s : thread %x in process %x blocks & deschedules for rpc[%d] / cycle %d\n",
     192__FUNCTION__, this->trdid, this->process->pid, rpc->index , cycle );
    188193#endif
    189194            thread_block( XPTR( local_cxy , this ) , THREAD_BLOCKED_RPC );
     
    193198cycle = (uint32_t)hal_get_cycles();
    194199if( DEBUG_RPC_CLIENT_GENERIC < cycle )
    195 printk("\n[DBG] %s : thread %x in cluster %x resumes / rpcr[%d] / cycle %d\n",
    196 __FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index, cycle );
     200printk("\n[DBG] %s : thread %x in process %x resumes for rpc[%d] / cycle %d\n",
     201__FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle );
    197202#endif
    198203        }
     
    207212cycle = (uint32_t)hal_get_cycles();
    208213if( DEBUG_RPC_CLIENT_GENERIC < cycle )
    209 printk("\n[DBG] %s : non blocking rpc[%d] => thread %x return / cycle %d\n",
    210 __FUNCTION__, rpc->index, CURRENT_THREAD, cycle );
     214printk("\n[DBG] %s : thread %x in process %x returns for non blocking rpc[%d] / cycle %d\n",
     215__FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle );
    211216#endif
    212217
     
    225230    thread_t      * thread; 
    226231    uint32_t        sr_save;
     232
     233#if DEBUG_RPC_SERVER_GENERIC
     234uint32_t cycle;
     235#endif
    227236
    228237    bool_t          found    = false;
     
    232241        remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo[core->lid];
    233242
    234 #if DEBUG_RPC_SERVER_GENERIC
    235 uint32_t cycle = (uint32_t)hal_get_cycles();
    236 if( DEBUG_RPC_SERVER_GENERIC < cycle )
    237 printk("\n[DBG] %s : thread %x interrupted in cluster %x / cycle %d\n",
    238 __FUNCTION__, this, local_cxy, cycle );
    239 #endif
    240 
    241243    // interrupted thread not preemptable during RPC chek
    242244        hal_disable_irq( &sr_save );
     
    249251cycle = (uint32_t)hal_get_cycles();
    250252if( DEBUG_RPC_SERVER_GENERIC < cycle )
    251 printk("\n[DBG] %s : RPC FIFO non empty in cluster %x / cycle %d\n",
    252 __FUNCTION__, local_cxy, cycle );
     253printk("\n[DBG] %s : RPC FIFO non empty for core[%x,%d] / cycle %d\n",
     254__FUNCTION__, local_cxy, core->lid, cycle );
    253255#endif
    254256
     
    290292cycle = (uint32_t)hal_get_cycles();
    291293if( DEBUG_RPC_SERVER_GENERIC < cycle )
    292 printk("\n[DBG] %s : create a new RPC thread %x in cluster %x / cycle %d\n",
    293 __FUNCTION__, thread, local_cxy, cycle );
     294printk("\n[DBG] %s : new RPC thread %x created for core[%x,%d] / cycle %d\n",
     295__FUNCTION__, thread, local_cxy, core->lid, cycle );
    294296#endif
    295297        }
     
    299301cycle = (uint32_t)hal_get_cycles();
    300302if( DEBUG_RPC_SERVER_GENERIC < cycle )
    301 printk("\n[DBG] %s : interrupted thread %x deschedules in cluster %x / cycle %d\n",
    302 __FUNCTION__, this, local_cxy, cycle );
     303printk("\n[DBG] %s : interrupted thread %x deschedules on core[%x,%d] / cycle %d\n",
     304__FUNCTION__, this, local_cxy, core->lid, cycle );
    303305#endif
    304306
     
    309311cycle = (uint32_t)hal_get_cycles();
    310312if( DEBUG_RPC_SERVER_GENERIC < cycle )
    311 printk("\n[DBG] %s : interrupted thread %x resumes in cluster %x / cycle %d\n",
    312 __FUNCTION__, this, local_cxy, cycle );
     313printk("\n[DBG] %s : interrupted thread %x resumes on core[%x,%d] / cycle %d\n",
     314__FUNCTION__, this, local_cxy, core->lid, cycle );
    313315#endif
    314316
     
    410412#endif
    411413                        // send IPI to client core
    412                             dev_pic_send_ipi( desc_cxy , client_core_lid );
     414                            // dev_pic_send_ipi( desc_cxy , client_core_lid );
    413415                    }
    414416                        }
     
    872874pid_t     pid    = rpc->args[1];
    873875if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
    874 printk("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n",
     876printk("\n[DBG] %s : enter to request %s of process %x in cluster %x / cycle %d\n",
    875877__FUNCTION__ , process_action_str( action ) , pid , cxy , cycle );
    876878#endif
     
    949951
    950952        // send an IPI to client core
    951         dev_pic_send_ipi( client_cxy , client_lid );
     953        // dev_pic_send_ipi( client_cxy , client_lid );
    952954    }
    953955
Note: See TracChangeset for help on using the changeset viewer.