Changeset 438 for trunk/kernel/syscalls


Ignore:
Timestamp:
Apr 4, 2018, 2:49:02 PM (7 years ago)
Author:
alain
Message:

Fix a bug in scheduler related to RPC blocking.

Location:
trunk/kernel/syscalls
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/sys_display.c

    r436 r438  
    3838{
    3939
    40 #if CONFIG_DEBUG_SYS_DISPLAY
     40#if DEBUG_SYS_DISPLAY
    4141uint64_t    tm_start;
    4242uint64_t    tm_end;
     
    4444this     = CURRENT_THREAD;
    4545tm_start = hal_get_cycles();
    46 if( CONFIG_DEBUG_SYS_DISPLAY < tm_start )
     46if( DEBUG_SYS_DISPLAY < tm_start )
    4747printk("\n[DBG] %s : thread %d enter / process %x / type  %d / cycle = %d\n",
    4848__FUNCTION__, this, this->process->pid, type, (uint32_t)tm_start );
     
    183183    }
    184184
    185 #if CONFIG_DEBUG_SYS_DISPLAY
     185#if DEBUG_SYS_DISPLAY
    186186tm_end = hal_get_cycles();
    187 if( CONFIG_DEBUG_SYS_DISPLAY < tm_end )
     187if( DEBUG_SYS_DISPLAY < tm_end )
    188188printk("\n[DBG] %s : thread %x exit / process %x / cost = %d / cycle %d\n",
    189189__FUNCTION__, this, this->process->pid, (uint32_t)(tm_end - tm_start) , (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_exec.c

    r435 r438  
    193193    {
    194194
    195 #if CONFIG_DEBUG_SYSCALLS_ERROR
     195#if DEBUG_SYSCALLS_ERROR
    196196printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ );
    197197#endif
     
    203203    hal_strcpy_from_uspace( exec_info.path , pathname , CONFIG_VFS_MAX_PATH_LENGTH );
    204204
    205 #if CONFIG_DEBUG_SYS_EXEC
     205#if DEBUG_SYS_EXEC
    206206uint64_t      tm_start;
    207207uint64_t      tm_end;
    208208tm_start = hal_get_cycles();
    209 if( CONFIG_DEBUG_SYS_EXEC < tm_start )
     209if( DEBUG_SYS_EXEC < tm_start )
    210210printk("\n[DBG] %s : thread %x enter / process %x / path %s / cycle = %d\n",
    211211__FUNCTION__, this, pid, exec_info.path, (uint32_t)tm_start );
     
    218218        {
    219219
    220 #if CONFIG_DEBUG_SYSCALLS_ERROR
     220#if DEBUG_SYSCALLS_ERROR
    221221printk("\n[ERROR] in %s : cannot access args\n", __FUNCTION__ );
    222222#endif
     
    232232        {
    233233
    234 #if CONFIG_DEBUG_SYCALLS_ERROR
     234#if DEBUG_SYCALLS_ERROR
    235235printk("\n[ERROR] in %s : cannot access envs\n", __FUNCTION__ );
    236236#endif
     
    246246    {
    247247
    248 #if CONFIG_DEBUG_SYSCALLS_ERROR
     248#if DEBUG_SYSCALLS_ERROR
    249249printk("\n[ERROR] in %s : cannot create process %x in cluster %x\n",
    250250__FUNCTION__, pid, CXY_FROM_PID(pid) );
     
    254254    }
    255255
    256 #if CONFIG_DEBUG_SYS_EXEC
     256#if DEBUG_SYS_EXEC
    257257tm_end = hal_get_cycles();
    258 if( CONFIG_DEBUG_SYS_EXEC < tm_end )
     258if( DEBUG_SYS_EXEC < tm_end )
    259259printk("\n[DBG] %s : thread %x exit / process %x / cost = %d / cycle %d\n",
    260260__FUNCTION__, this, pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_exit.c

    r436 r438  
    4343    trdid_t     trdid   = this->trdid;
    4444
    45 #if CONFIG_DEBUG_SYS_EXIT
     45#if DEBUG_SYS_EXIT
    4646uint64_t    tm_start;
    4747uint64_t    tm_end;
    4848tm_start = hal_get_cycles();
    49 if( CONFIG_DEBUG_SYS_EXIT < tm_start )
     49if( DEBUG_SYS_EXIT < tm_start )
    5050printk("\n[DBG] %s : thread %x enter / process %x / status %x / cycle %d\n",
    5151__FUNCTION__ , this, pid , status , (uint32_t)tm_start );
     
    5959    {
    6060
    61 #if CONFIG_DEBUG_SYSCALLS_ERROR
     61#if DEBUG_SYSCALLS_ERROR
    6262printk("\n[ERROR] in %s : calling thread %x is not thread 0 in owner cluster %x\n",
    6363__FUNCTION__, trdid, owner_cxy );
     
    7373    process->term_state = status;
    7474
    75 #if( CONFIG_DEBUG_SYS_EXIT & 1)
     75#if( DEBUG_SYS_EXIT & 1)
    7676printk("\n[DBG] %s : set exit status in process term_state\n", __FUNCTION__);
    7777#endif
     
    8080    process_txt_detach( XPTR( local_cxy , process ) );
    8181
    82 #if( CONFIG_DEBUG_SYS_EXIT & 1)
     82#if( DEBUG_SYS_EXIT & 1)
    8383printk("\n[DBG] %s : removed from TXT list\n", __FUNCTION__);
    8484#endif
     
    8787    process_sigaction( pid , DELETE_ALL_THREADS );
    8888
    89 #if( CONFIG_DEBUG_SYS_EXIT & 1)
     89#if( DEBUG_SYS_EXIT & 1)
    9090printk("\n[DBG] %s : deleted all other threads than main\n", __FUNCTION__);
    9191#endif
     
    9797    thread_block( XPTR( local_cxy , this ) , THREAD_BLOCKED_GLOBAL );
    9898
    99 #if( CONFIG_DEBUG_SYS_EXIT & 1)
     99#if( DEBUG_SYS_EXIT & 1)
    100100printk("\n[DBG] %s : blocked the main thread\n", __FUNCTION__);
    101101#endif
     
    106106                          PROCESS_TERM_EXIT );
    107107
    108 #if( CONFIG_DEBUG_SYS_EXIT & 1)
     108#if( DEBUG_SYS_EXIT & 1)
    109109printk("\n[DBG] %s : set EXIT flag in process term_state\n", __FUNCTION__);
    110110#endif
     
    112112    hal_fence();
    113113
    114 #if CONFIG_DEBUG_SYS_EXIT
     114#if DEBUG_SYS_EXIT
    115115tm_end = hal_get_cycles();
    116 if( CONFIG_DEBUG_SYS_EXIT < tm_end )
     116if( DEBUG_SYS_EXIT < tm_end )
    117117printk("\n[DBG] %s : thread %x exit / process %x / status %x / cost = %d / cycle %d\n",
    118118__FUNCTION__, this, pid, status, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_fg.c

    r436 r438  
    4545    thread_t  * this    = CURRENT_THREAD;
    4646
    47 #if CONFIG_DEBUG_SYS_FG
     47#if DEBUG_SYS_FG
    4848uint64_t    tm_start;
    4949uint64_t    tm_end;
    5050tm_start = hal_get_cycles();
    51 if( CONFIG_DEBUG_SYS_FG < tm_start )
     51if( DEBUG_SYS_FG < tm_start )
    5252printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n",
    5353__FUNCTION__ , CURRENT_THREAD , pid, (uint32_t)tm_start );
     
    6060    {
    6161
    62 #if CONFIG_DEBUG_SYSCALLS_ERROR
     62#if DEBUG_SYSCALLS_ERROR
    6363printk("\n[ERROR] in %s : process %x not found\n", __FUNCTION__ , pid );
    6464#endif
     
    8383    hal_fence();
    8484
    85 #if CONFIG_DEBUG_SYS_FG
     85#if DEBUG_SYS_FG
    8686tm_end = hal_get_cycles();
    87 if( CONFIG_DEBUG_SYS_FG < tm_end )
     87if( DEBUG_SYS_FG < tm_end )
    8888printk("\n[DBG] %s : thread %x exit / process %x get TXT_%d ownership / cycle %d\n",
    8989__FUNCTION__ , CURRENT_THREAD , pid,
  • trunk/kernel/syscalls/sys_fork.c

    r435 r438  
    4545    pid_t             parent_pid;           // parent process identifier
    4646    thread_t        * parent_thread_ptr;    // local pointer on local parent thread descriptor
     47    cxy_t             parent_cxy;           // parent thread cluster
    4748
    4849    pid_t             child_pid;            // child process identifier
    4950    thread_t        * child_thread_ptr;     // local pointer on remote child thread descriptor
    50     cxy_t             target_cxy;           // target cluster for forked child process
     51    cxy_t             child_cxy;            // target cluster for forked child process
    5152 
    5253    xptr_t            ref_process_xp;       // extended pointer on reference parent process
     
    6263        parent_process_ptr = parent_thread_ptr->process;
    6364    parent_pid         = parent_process_ptr->pid;
    64 
    65 #if CONFIG_DEBUG_SYS_FORK
     65    parent_cxy         = local_cxy;
     66
     67#if DEBUG_SYS_FORK
    6668uint64_t          tm_start;
    6769uint64_t          tm_end;
    6870tm_start = hal_get_cycles();
    69 if( CONFIG_DEBUG_SYS_FORK < tm_start )
    70 printk("\n[DBG] %s : thread %x enter / parent %x / cycle =  %d\n",
     71if( DEBUG_SYS_FORK < tm_start )
     72printk("\n[DBG] %s : parent_thread %x enter / parent_pid %x / cycle =  %d\n",
    7173__FUNCTION__, parent_thread_ptr, parent_pid, (uint32_t)tm_start );
    7274#endif
    7375
    74     // get infos on reference process
     76    // get infos on reference parent process
    7577    ref_process_xp  = parent_process_ptr->ref_xp;
    7678    ref_process_cxy = GET_CXY( ref_process_xp );
     
    8284        {
    8385
    84 #if CONFIG_DEBUG_SYSCALLS_ERROR
     86#if DEBUG_SYSCALLS_ERROR
    8587printk("\n[ERROR] in %s : too much children processes\n", __FUNCTION__);
    8688#endif
     
    9193
    9294    // Select target cluster for child process and main thread.
    93     // If placement is not user-defined, the placement is defined by the DQDT.
    94         if( parent_thread_ptr->fork_user )    // user defined placement
    95         {
    96         target_cxy = parent_thread_ptr->fork_cxy;
     95    // If placement is not user-defined, it is defined by the DQDT.
     96        if( parent_thread_ptr->fork_user )
     97        {
     98        child_cxy = parent_thread_ptr->fork_cxy;
    9799        parent_thread_ptr->fork_user = false;
    98100        }
    99101        else                                  // DQDT placement
    100102        {
    101                 target_cxy = dqdt_get_cluster_for_process();
    102         }
     103                child_cxy = dqdt_get_cluster_for_process();
     104        }
     105
     106#if( DEBUG_SYS_FORK & 1)
     107
     108// dqdt_display();
     109
     110if( local_cxy == 0 )
     111{
     112    sched_display( 0 );
     113    rpc_sched_display_client( 1 , 0 );
     114}
     115else
     116{
     117    sched_display( 0 );
     118    rpc_sched_display_client( 0 , 0 );
     119}
     120
     121if( DEBUG_SYS_FORK < tm_start )
     122printk("\n[DBG] %s : parent_thread %x selected cluster %x\n",
     123__FUNCTION__, parent_thread_ptr, child_cxy );
     124#endif
    103125
    104126    // call process_make_fork in target cluster
    105     if( target_cxy == local_cxy )
     127    if( child_cxy == local_cxy )
    106128    {
    107129        error = process_make_fork( ref_process_xp,
     
    112134    else
    113135    {
    114         rpc_process_make_fork_client( target_cxy,
     136        rpc_process_make_fork_client( child_cxy,
    115137                                      ref_process_xp,
    116138                                      parent_thread_xp,
     
    123145    {
    124146
    125 #if CONFIG_DEBUG_SYSCALLS_ERROR
     147#if DEBUG_SYSCALLS_ERROR
    126148printk("\n[ERROR] in %s : cannot fork process %x in cluster %x\n",
    127149__FUNCTION__, parent_pid, local_cxy );
     
    135157        if( CURRENT_THREAD->core->fpu_owner == parent_thread_ptr )
    136158        {
    137                 hal_fpu_context_save( XPTR( target_cxy , child_thread_ptr ) );
    138         }
    139 
    140     // set remote child CPU context from  parent_thread register values
    141     hal_cpu_context_fork( XPTR( target_cxy , child_thread_ptr ) );
    142 
    143     // From this point, both parent and child threads execute the following code.
    144     // They can be distinguished by the CURRENT_THREAD value, and child will only
    145     // execute it when it is unblocked by parent.
     159                hal_fpu_context_save( XPTR( child_cxy , child_thread_ptr ) );
     160        }
     161
     162    // set remote child CPU context from parent_thread register values
     163    hal_cpu_context_fork( XPTR( child_cxy , child_thread_ptr ) );
     164
     165    // From this point, both parent and child threads execute the following code,
     166    // but they can be distinguished by the (CURRENT_THREAD,local_cxy) values.
    146167    // - parent unblock child, and return child PID to user application.
    147168    // - child thread does nothing, and return 0 to user pplication
     169    // The child thread will only execute it when it is unblocked by parent thread.
    148170
    149171    thread_t * current = CURRENT_THREAD;
    150172
    151     if( current == parent_thread_ptr )    // current == parent thread
     173    if( (current == parent_thread_ptr) && (local_cxy == parent_cxy) )   // parent thread
    152174    {
    153175        // parent_thread unblock child_thread
    154         thread_unblock( XPTR( target_cxy , child_thread_ptr ) , THREAD_BLOCKED_GLOBAL );
    155 
    156 #if CONFIG_DEBUG_SYS_FORK
     176        thread_unblock( XPTR( child_cxy , child_thread_ptr ) , THREAD_BLOCKED_GLOBAL );
     177
     178#if DEBUG_SYS_FORK
    157179tm_end = hal_get_cycles();
    158 if( CONFIG_DEBUG_SYS_FORK < tm_end )
    159 printk("\n[DBG] %s : parent_thread %x exit / cost = %d / cycle %d\n",
    160 __FUNCTION__ , parent_thread_ptr, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
     180if( DEBUG_SYS_FORK < tm_end )
     181printk("\n[DBG] %s : parent_thread %x on cluster %x exit / cost = %d / cycle %d\n",
     182__FUNCTION__, parent_thread_ptr, parent_cxy, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
    161183#endif
    162184
    163185        return child_pid;
    164186    }
    165         else                                   // current == child_thread
    166     {
    167 
    168 #if CONFIG_DEBUG_SYS_FORK
     187        else                                                               // child_thread
     188    {
     189
     190#if DEBUG_SYS_FORK
    169191tm_end = hal_get_cycles();
    170 if( CONFIG_DEBUG_SYS_FORK < tm_end )
    171 printk("\n[DBG] %s : child_thread %x exit / cost = %d / cycle %d\n",
    172 __FUNCTION__ , child_thread_ptr, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
     192if( DEBUG_SYS_FORK < tm_end )
     193printk("\n[DBG] %s : child_thread %x on cluster %x exit / cost = %d / cycle %d\n",
     194__FUNCTION__, child_thread_ptr, child_cxy, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
    173195#endif
    174196
  • trunk/kernel/syscalls/sys_get_config.c

    r436 r438  
    4747    process_t * process = this->process;
    4848
    49 #if CONFIG_DEBUG_SYS_GET_CONFIG
     49#if DEBUG_SYS_GET_CONFIG
    5050uint64_t     tm_start;
    5151uint64_t     tm_end;
    5252tm_start = hal_get_cycles();
    53 if( CONFIG_DEBUG_SYS_GET_CONFIG < tm_start )
     53if( DEBUG_SYS_GET_CONFIG < tm_start )
    5454printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n",
    5555__FUNCTION__, this, process->pid, (uint32_t)tm_start );
     
    6464        {
    6565
    66 #if CONFIG_DEBUG_SYSCALLS_ERROR
     66#if DEBUG_SYSCALLS_ERROR
    6767printk("\n[ERROR] in %s : user buffer unmapped for thread %x in process %x\n",
    6868__FUNCTION__ , this->trdid , process->pid );
     
    8484    hal_fence();
    8585
    86 #if CONFIG_DEBUG_SYS_GET_CONFIG
     86#if DEBUG_SYS_GET_CONFIG
    8787tm_end = hal_get_cycles();
    88 if( CONFIG_DEBUG_SYS_GET_CONFIG < tm_end )
     88if( DEBUG_SYS_GET_CONFIG < tm_end )
    8989printk("\n[DBG] %s : thread %x exit / process %x / cost %d / cycle %d\n",
    9090__FUNCTION__, this, process->pid, (uint32_t)(tm_end-tm_start), (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_isatty.c

    r437 r438  
    4848        process_t *  process = this->process;
    4949 
    50 #if CONFIG_DEBUG_SYS_ISATTY
     50#if DEBUG_SYS_ISATTY
    5151uint64_t tm_start;
    5252uint64_t tm_end;
    5353tm_start = hal_get_cycles();
    54 if( CONFIG_DEBUG_SYS_ISATTY < tm_start )
     54if( DEBUG_SYS_ISATTY < tm_start )
    5555printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n"
    5656__FUNCTION__ , this, process->pid, (uint32_t)tm_start );
     
    6161        {
    6262
    63 #if CONFIG_DEBUG_SYSCALLS_ERROR
     63#if DEBUG_SYSCALLS_ERROR
    6464printk("\n[ERROR] in %s : illegal file descriptor index = %d\n", __FUNCTION__ , file_id );
    6565#endif
     
    7474    {
    7575
    76 #if CONFIG_DEBUG_SYSCALLS_ERROR
     76#if DEBUG_SYSCALLS_ERROR
    7777printk("\n[ERROR] in %s : undefined fd_id %d in process %x\n",
    7878__FUNCTION__ , file_id , process->pid );
     
    108108    }
    109109
    110 #if CONFIG_DEBUG_SYS_ISATTY
     110#if DEBUG_SYS_ISATTY
    111111tm_end = hal_get_cycles();
    112 if( CONFIG_DEBUG_SYS_ISATTY < tm_end )
     112if( DEBUG_SYS_ISATTY < tm_end )
    113113printk("\n[DBG] %s : thread %x exit / process %x / cost %d / cycle %d\n",
    114114__FUNCTION__, this, process->pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_kill.c

    r436 r438  
    5050    trdid_t     trdid   = this->trdid;
    5151
    52 #if CONFIG_DEBUG_SYS_KILL
     52#if DEBUG_SYS_KILL
    5353uint64_t    tm_start;
    5454uint64_t    tm_end;
    5555tm_start = hal_get_cycles();
    56 if( CONFIG_DEBUG_SYS_KILL < tm_start )
     56if( DEBUG_SYS_KILL < tm_start )
    5757printk("\n[DBG] %s : thread %x enter / process %x / sig %d / cycle %d\n",
    5858__FUNCTION__ , this, pid, sig_id, (uint32_t)tm_start );
     
    6868    {
    6969
    70 #if CONFIG_DEBUG_SYSCALLS_ERROR
     70#if DEBUG_SYSCALLS_ERROR
    7171printk("\n[ERROR] in %s : process %x not found\n", __FUNCTION__, pid );
    7272#endif
     
    7979    {
    8080
    81 #if CONFIG_DEBUG_SYSCALLS_ERROR
     81#if DEBUG_SYSCALLS_ERROR
    8282printk("\n[ERROR] in %s : only main thread can kill itself\n", __FUNCTION__ );
    8383#endif
     
    9696    {
    9797
    98 #if CONFIG_DEBUG_SYSCALLS_ERROR
     98#if DEBUG_SYSCALLS_ERROR
    9999printk("\n[ERROR] in %s : process_init cannot be killed\n", __FUNCTION__ );
    100100#endif
     
    167167        {
    168168
    169 #if CONFIG_DEBUG_SYSCALLS_ERROR
     169#if DEBUG_SYSCALLS_ERROR
    170170printk("\n[ERROR] in %s : illegal signal %d / process %x\n", __FUNCTION__, sig_id, pid );
    171171#endif
     
    178178    hal_fence();
    179179
    180 #if CONFIG_DEBUG_SYS_KILL
     180#if DEBUG_SYS_KILL
    181181tm_end = hal_get_cycles();
    182 if( CONFIG_DEBUG_SYS_KILL < tm_end )
     182if( DEBUG_SYS_KILL < tm_end )
    183183printk("\n[DBG] %s : thread %x exit / process %x / sig %d / cost = %d / cycle %d\n",
    184184__FUNCTION__ , this, pid, sig_id, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_mmap.c

    r435 r438  
    5050        process_t   * process = this->process;
    5151
    52 #if CONFIG_DEBUG_SYS_MMAP
     52#if DEBUG_SYS_MMAP
    5353uint64_t      tm_start;
    5454uint64_t      tm_end;
    5555tm_start = hal_get_cycles();
    56 if ( CONFIG_DEBUG_SYS_MMAP < tm_start )
     56if ( DEBUG_SYS_MMAP < tm_start )
    5757printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n",
    5858__FUNCTION__, this, process->pid, (uint32_t)tm_start );
     
    6565    {
    6666
    67 #if CONFIG_DEBUG_SYSCALLS_ERROR
     67#if DEBUG_SYSCALLS_ERROR
    6868printk("\n[ERROR] in %s : arguments not in used space = %x\n", __FUNCTION__ , (intptr_t)attr );
    6969#endif
     
    9191    {
    9292
    93 #if CONFIG_DEBUG_SYSCALLS_ERROR
     93#if DEBUG_SYSCALLS_ERROR
    9494printk("\n[ERROR] in %s : MAP_FIXED not supported\n", __FUNCTION__ );
    9595#endif
     
    101101    {
    102102
    103 #if CONFIG_DEBUG_SYSCALLS_ERROR
     103#if DEBUG_SYSCALLS_ERROR
    104104printk("\n[ERROR] in %s : MAP_SHARED xor MAP_PRIVATE\n", __FUNCTION__ );
    105105#endif
     
    123123                {
    124124
    125 #if CONFIG_DEBUG_SYSCALLS_ERROR
     125#if DEBUG_SYSCALLS_ERROR
    126126printk("\n[ERROR] in %s: bad file descriptor = %d\n", __FUNCTION__ , fdid );
    127127#endif
     
    136136        {
    137137
    138 #if CONFIG_DEBUG_SYSCALLS_ERROR
     138#if DEBUG_SYSCALLS_ERROR
    139139printk("\n[ERROR] in %s: file %d not found\n", __FUNCTION__ , fdid );
    140140#endif
     
    159159                {
    160160
    161 #if CONFIG_DEBUG_SYSCALLS_ERROR
     161#if DEBUG_SYSCALLS_ERROR
    162162printk("\n[ERROR] in %s: offset (%d) + len (%d) >= file's size (%d)\n",
    163163__FUNCTION__, k_attr.offset, k_attr.length, size );
     
    172172                {
    173173
    174 #if CONFIG_DEBUG_SYSCALLS_ERROR
     174#if DEBUG_SYSCALLS_ERROR
    175175printk("\n[ERROR] in %s: prot = %x / file_attr = %x)\n",
    176176__FUNCTION__ , k_attr.prot , file_attr );
     
    205205            {
    206206
    207 #if CONFIG_DEBUG_SYSCALLS_ERROR
     207#if DEBUG_SYSCALLS_ERROR
    208208printk("\n[ERROR] in %s : illegal cxy for MAP_REMOTE\n", __FUNCTION__ );
    209209#endif
     
    254254    {
    255255
    256 #if CONFIG_DEBUG_SYSCALLS_ERROR
     256#if DEBUG_SYSCALLS_ERROR
    257257printk("\n[ERROR] in %s : cannot create vseg\n", __FUNCTION__ );
    258258#endif
     
    266266    hal_fence();
    267267
    268 #if CONFIG_DEBUG_SYS_MMAP
     268#if DEBUG_SYS_MMAP
    269269tm_end = hal_get_cycles();
    270 if ( CONFIG_DEBUG_SYS_MMAP < tm_start )
     270if ( DEBUG_SYS_MMAP < tm_start )
    271271printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n"
    272272"vseg %s / cluster %x / base %x / size %x / cost %d\n",
  • trunk/kernel/syscalls/sys_munmap.c

    r437 r438  
    4343        process_t   * process = this->process;
    4444
    45 #if CONFIG_DEBUG_SYS_MUNMAP
     45#if DEBUG_SYS_MUNMAP
    4646uint64_t tm_start;
    4747uint64_t tm_end;
    4848tm_start = hal_get_cycles();
    49 if( CONFIG_DEBUG_SYS_MUNMAP < tm_start )
     49if( DEBUG_SYS_MUNMAP < tm_start )
    5050printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n"
    5151__FUNCTION__ , this, process->pid, (uint32_t)tm_start );
     
    5858    {
    5959
    60 #if CONFIG_DEBUG_SYSCALLS_ERROR
     60#if DEBUG_SYSCALLS_ERROR
    6161printk("\n[ERROR] in %s : cannot remove mapping\n", __FUNCTION__ );
    6262#endif
     
    6565    }
    6666
    67 #if CONFIG_DEBUG_SYS_MUNMAP
     67#if DEBUG_SYS_MUNMAP
    6868tm_end = hal_get_cycles();
    69 if( CONFIG_DEBUG_SYS_MUNMAP < tm_start )
     69if( DEBUG_SYS_MUNMAP < tm_start )
    7070printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n"
    7171__FUNCTION__ , this, process->pid, (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_read.c

    r436 r438  
    6666        process_t *  process = this->process;
    6767 
    68 #if CONFIG_DEBUG_SYS_READ
     68#if DEBUG_SYS_READ
    6969uint64_t     tm_start;
    7070uint64_t     tm_end;
    7171tm_start = hal_get_cycles();
    72 if( CONFIG_DEBUG_SYS_READ < tm_start )
     72if( DEBUG_SYS_READ < tm_start )
    7373printk("\n[DBG] %s : thread %x enter / process %x / vaddr = %x / count %d / cycle %d\n",
    7474__FUNCTION__, this, process->pid, vaddr, count, (uint32_t)tm_start );
    7575#endif
    7676
    77 #if (CONFIG_DEBUG_SYS_READ & 1)
     77#if (DEBUG_SYS_READ & 1)
    7878enter_sys_read = (uint32_t)tm_start;
    7979#endif
     
    8383        {
    8484
    85 #if CONFIG_DEBUG_SYSCALLS_ERROR
     85#if DEBUG_SYSCALLS_ERROR
    8686printk("\n[ERROR] in %s : illegal file descriptor index = %d\n", __FUNCTION__ , file_id );
    8787#endif
     
    9696    {
    9797
    98 #if CONFIG_DEBUG_SYSCALLS_ERROR
     98#if DEBUG_SYSCALLS_ERROR
    9999printk("\n[ERROR] in %s : user buffer unmapped = %x\n",
    100100__FUNCTION__ , (intptr_t)vaddr );
     
    113113    {
    114114
    115 #if CONFIG_DEBUG_SYSCALLS_ERROR
     115#if DEBUG_SYSCALLS_ERROR
    116116printk("\n[ERROR] in %s : undefined fd_id %d in process %x\n",
    117117__FUNCTION__ , file_id , process->pid );
     
    130130        {
    131131
    132 #if CONFIG_DEBUG_SYSCALLS_ERROR
     132#if DEBUG_SYSCALLS_ERROR
    133133printk("\n[ERROR] in %s : file %d not readable in process %x\n",
    134134__FUNCTION__ , file_id , process->pid );
     
    149149            {
    150150
    151 #if CONFIG_DEBUG_SYSCALLS_ERROR
     151#if DEBUG_SYSCALLS_ERROR
    152152printk("\n[ERROR] in %s : file %d not readable in process %x\n",
    153153__FUNCTION__ , file_id , process->pid );
     
    205205    {
    206206
    207 #if CONFIG_DEBUG_SYSCALLS_ERROR
     207#if DEBUG_SYSCALLS_ERROR
    208208printk("\n[ERROR] in %s cannot read data from file %d in process %x\n",
    209209__FUNCTION__ , file_id , process->pid );
     
    218218    hal_fence();
    219219
    220 #if CONFIG_DEBUG_SYS_READ
     220#if DEBUG_SYS_READ
    221221tm_end = hal_get_cycles();
    222 if( CONFIG_DEBUG_SYS_READ < tm_end )
     222if( DEBUG_SYS_READ < tm_end )
    223223printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n"
    224224"nbytes = %d / first byte = %c / file_id = %d / cost = %d\n",
     
    228228#endif
    229229
    230 #if (CONFIG_DEBUG_SYS_READ & 1)
     230#if (DEBUG_SYS_READ & 1)
    231231exit_sys_read = (uint32_t)tm_end;
    232232
  • trunk/kernel/syscalls/sys_thread_cancel.c

    r436 r438  
    4545    {
    4646
    47 #if CONFIG_DEBUG_SYSCALLS_ERROR
     47#if DEBUG_SYSCALLS_ERROR
    4848printk("\n[ERROR] in %s : target thread %x not found\n", __FUNCTION__, trdid );
    4949#endif
     
    5252    }
    5353
    54 #if CONFIG_DEBUG_SYS_THREAD_CANCEL
     54#if DEBUG_SYS_THREAD_CANCEL
    5555uint64_t     tm_start;
    5656uint64_t     tm_end;
    5757tm_start = hal_get_cycles();
    58 if( CONFIG_DEBUG_SYS_THREAD_CANCEL < tm_start )
     58if( DEBUG_SYS_THREAD_CANCEL < tm_start )
    5959printk("\n[DBG] %s : thread %x enter to kill thread %x / cycle %d\n",
    6060__FUCTION__, this, GET_PTR( target_xp ), (uint32_t)tm_start );
     
    6666                 0 );         // is forced
    6767
    68 #if CONFIG_DEBUG_SYS_THREAD_CANCEL
     68#if DEBUG_SYS_THREAD_CANCEL
    6969tm_end = hal_get_cycles();
    70 if( CONFIG_DEBUG_SYS_THREAD_CANCEL < tm_end )
     70if( DEBUG_SYS_THREAD_CANCEL < tm_end )
    7171printk("\n[DBG] %s : thread %x exit after kill thread %x / cycle %d\n",
    7272__FUCTION__, this, GET_PTR( target_xp ), (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_thread_create.c

    r437 r438  
    6262        process    = parent->process;
    6363
    64 #if CONFIG_DEBUG_SYS_THREAD_CREATE
     64#if DEBUG_SYS_THREAD_CREATE
    6565uint64_t tm_start;
    6666uint64_t tm_end;
    6767tm_start = hal_get_cycles();
    68 if( CONFIG_DEBUG_SYS_THREAD_CREATE < tm_start )
     68if( DEBUG_SYS_THREAD_CREATE < tm_start )
    6969printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n"
    7070__FUNCTION__ , parent , process->pid, (uint32_t)tm_start );
     
    7979            {
    8080
    81 #if CONFIG_DEBUG_SYSCALLS_ERROR
     81#if DEBUG_SYSCALLS_ERROR
    8282printk("\n[ERROR] in %s : user_attr unmapped\n", __FUNCTION__ );
    8383#endif
     
    9595        {
    9696
    97 #if CONFIG_DEBUG_SYSCALLS_ERROR
     97#if DEBUG_SYSCALLS_ERROR
    9898printk("\n[ERROR] in %s : start_func unmapped\n", __FUNCTION__ );
    9999#endif
     
    108108        {
    109109
    110 #if CONFIG_DEBUG_SYSCALLS_ERROR
     110#if DEBUG_SYSCALLS_ERROR
    111111printk("\n[ERROR] in %s : start_arg unmapped\n", __FUNCTION__ );
    112112#endif
     
    124124                    {
    125125
    126 #if CONFIG_DEBUG_SYSCALLS_ERROR
     126#if DEBUG_SYSCALLS_ERROR
    127127printk("\n[ERROR] in %s : illegal target cluster = %x\n", __FUNCTION__ , kern_attr.cxy );
    128128#endif
     
    174174        {
    175175
    176 #if CONFIG_DEBUG_SYSCALLS_ERROR
     176#if DEBUG_SYSCALLS_ERROR
    177177printk("\n[ERROR] in %s : cannot create thread\n", __FUNCTION__ );
    178178#endif
     
    196196    hal_fence();
    197197
    198 #if CONFIG_DEBUG_SYS_THREAD_CREATE
     198#if DEBUG_SYS_THREAD_CREATE
    199199tm_end = hal_get_cycles();
    200 if( CONFIG_DEBUG_SYS_THREAD_CREATE < tm_end )
     200if( DEBUG_SYS_THREAD_CREATE < tm_end )
    201201printk("\n[DBG] %s : thread %x created thread %x for process %x in cluster %x / cycle %d\n"
    202202__FUNCTION__, parent, child_ptr, process->pid, target_cxy, (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_thread_exit.c

    r436 r438  
    3939    {
    4040
    41 #if CONFIG_DEBUG_SYSCALLS_ERROR
     41#if DEBUG_SYSCALLS_ERROR
    4242printk("\n[ERROR] in %s : exit_value argument must be NULL for thread %x in process %x\n",
    4343__FUNCTION__ , exit_value, this->trdid , process->pid );
     
    4747    }
    4848
    49 #if CONFIG_DEBUG_SYS_THREAD_EXIT
     49#if DEBUG_SYS_THREAD_EXIT
    5050uint64_t     tm_start;
    5151uint64_t     tm_end;
    5252tm_start = hal_get_cycles();
    53 if( CONFIG_DEBUG_SYS_THREAD_EXIT < tm_start )
     53if( DEBUG_SYS_THREAD_EXIT < tm_start )
    5454printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n",
    5555__FUNCTION__ , this, process->pid , (uint32_t)tm_start );
     
    6161                 0 );         // is forced
    6262
    63 #if CONFIG_DEBUG_SYS_THREAD_EXIT
     63#if DEBUG_SYS_THREAD_EXIT
    6464tm_end = hal_get_cycles();
    65 if( CONFIG_DEBUG_SYS_THREAD_EXIT < tm_end )
     65if( DEBUG_SYS_THREAD_EXIT < tm_end )
    6666printk("\n[DBG] %s : thread %x exit / process %x / cost %d / cycle %d\n",
    6767__FUNCTION__, this, this->process->pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_thread_join.c

    r436 r438  
    6060    target_cxy  = CXY_FROM_TRDID( trdid );
    6161
    62 #if CONFIG_DEBUG_SYS_THREAD_JOIN
     62#if DEBUG_SYS_THREAD_JOIN
    6363uint64_t     tm_start;
    6464uint64_t     tm_end;
    6565tm_start = hal_get_cycles();
    66 if( CONFIG_DEBUG_SYS_THREAD_JOIN < tm_start )
     66if( DEBUG_SYS_THREAD_JOIN < tm_start )
    6767printk("\n[DBG] %s : parent thread %x enter / process %x / target trdid %x / cycle %d\n",
    6868__FUNCTION__ , joining_ptr , process->pid , trdid , (uint32_t)tm_start );
     
    7373        {
    7474
    75 #if CONFIG_DEBUG_SYSCALLS_ERROR
     75#if DEBUG_SYSCALLS_ERROR
    7676printk("\n[ERROR] in %s : illegal trdid argument %x\n", __FUNCTION__, trdid );
    7777#endif
     
    8484        {
    8585
    86 #if CONFIG_DEBUG_SYSCALLS_ERROR
     86#if DEBUG_SYSCALLS_ERROR
    8787printk("\n[ERROR] in %s : exit_value argument must be NULL\n", __FUNCTION__ );
    8888#endif
     
    9595    {
    9696
    97 #if CONFIG_DEBUG_SYSCALLS_ERROR
     97#if DEBUG_SYSCALLS_ERROR
    9898printk("\n[ERROR] in %s : this thread == target thread\n", __FUNCTION__ );
    9999#endif
     
    109109    {
    110110
    111 #if CONFIG_DEBUG_SYSCALLS_ERROR
     111#if DEBUG_SYSCALLS_ERROR
    112112printk("\n[ERROR] in %s : target thread %x not found\n", __FUNCTION__, trdid );
    113113#endif
     
    126126    {
    127127
    128 #if CONFIG_DEBUG_SYSCALLS_ERROR
     128#if DEBUG_SYSCALLS_ERROR
    129129printk("\n[ERROR] in %s : target thread %x not joinable\n", __FUNCTION__, trdid );
    130130#endif
     
    178178    }
    179179
    180 #if CONFIG_DEBUG_SYS_THREAD_JOIN
     180#if DEBUG_SYS_THREAD_JOIN
    181181tm_end = hal_get_cycles();
    182 if( CONFIG_DEBUG_SYS_THREAD_JOIN < tm_end )
     182if( DEBUG_SYS_THREAD_JOIN < tm_end )
    183183printk("\n[DBG] %s : parent thread %x exit / process %x / target trdid %x / cycle %d\n",
    184184__FUNCTION__, joining_ptr, process->pid, trdid, (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_thread_sleep.c

    r436 r438  
    3333    thread_t * this = CURRENT_THREAD;
    3434
    35 #if CONFIG_DEBUG_SYS_THREAD_SLEEP
     35#if DEBUG_SYS_THREAD_SLEEP
    3636uint64_t     tm_start;
    3737uint64_t     tm_end;
    3838tm_start = hal_get_cycles();
    39 if( CONFIG_DEBUG_SYS_THREAD_SLEEP < tm_start )
     39if( DEBUG_SYS_THREAD_SLEEP < tm_start )
    4040printk("\n[DBG] %s : thread %x blocked / process %x / cycle %d\n",
    4141__FUNCTION__ , this, this->process->pid , (uint32_t)tm_start );
     
    4545    sched_yield("blocked on sleep");
    4646
    47 #if CONFIG_DEBUG_SYS_THREAD_SLEEP
     47#if DEBUG_SYS_THREAD_SLEEP
    4848tm_end = hal_get_cycles();
    49 if( CONFIG_DEBUG_SYS_THREAD_SLEEP < tm_end )
     49if( DEBUG_SYS_THREAD_SLEEP < tm_end )
    5050printk("\n[DBG] %s : thread %x resume / process %x / cycle %d\n",
    5151__FUNCTION__ , this, this->process->pid , (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_thread_wakeup.c

    r436 r438  
    3434    process_t * process = this->process;
    3535
    36 #if CONFIG_DEBUG_SYS_THREAD_WAKEUP
     36#if DEBUG_SYS_THREAD_WAKEUP
    3737uint64_t     tm_start;
    3838uint64_t     tm_end;
    3939tm_start = hal_get_cycles();
    40 if( CONFIG_DEBUG_SYS_THREAD_WAKEUP < tm_start )
     40if( DEBUG_SYS_THREAD_WAKEUP < tm_start )
    4141printk("\n[DBG] %s : thread %x enter / activate thread %x in process %x / cycle %d\n",
    4242__FUNCTION__ , this, trdid, this->process->pid, (uint32_t)tm_start );
     
    5151        {
    5252
    53 #if CONFIG_DEBUG_SISCALLS_ERROR
     53#if DEBUG_SISCALLS_ERROR
    5454printk("\n[ERROR] in %s : illegal trdid argument %x\n", __FUNCTION__, trdid );
    5555#endif
     
    6464    {
    6565
    66 #if CONFIG_DEBUG_SISCALLS_ERROR
     66#if DEBUG_SISCALLS_ERROR
    6767printk("\n[ERROR] in %s : cannot find thread %x in process %x/n",
    6868__FUNCTION__ , trdid , this->process->pid );
     
    7575    thread_unblock( thread_xp , THREAD_BLOCKED_GLOBAL );
    7676
    77 #if CONFIG_DEBUG_SYS_THREAD_WAKEUP
     77#if DEBUG_SYS_THREAD_WAKEUP
    7878tm_end = hal_get_cycles();
    79 if( CONFIG_DEBUG_SYS_THREAD_WAKEUP < tm_end )
     79if( DEBUG_SYS_THREAD_WAKEUP < tm_end )
    8080printk("\n[DBG] %s : thread %x exit / thread %x in process %x activated / cycle %d\n",
    8181__FUNCTION__ , this, trdid, this->process->pid, (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_wait.c

    r436 r438  
    4949    pid_t       pid     = process->pid;
    5050
    51 #if CONFIG_DEBUG_SYS_WAIT
     51#if DEBUG_SYS_WAIT
    5252uint64_t    tm_start;
    5353uint64_t    tm_end;
    5454tm_start = hal_get_cycles();
    55 if( CONFIG_DEBUG_SYS_WAIT < tm_start )
     55if( DEBUG_SYS_WAIT < tm_start )
    5656printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n",
    5757__FUNCTION__, this, process->pid, (uint32_t)tm_start );
     
    6464        {
    6565
    66 #if CONFIG_DEBUG_SYSCALLS_ERROR
     66#if DEBUG_SYSCALLS_ERROR
    6767printk("\n[ERROR] in %s : status buffer unmapped for thread %x in process %x\n",
    6868__FUNCTION__ , this->trdid , process->pid );
     
    8080    {
    8181
    82 #if CONFIG_DEBUG_SYSCALL_ERROR
     82#if DEBUG_SYSCALL_ERROR
    8383printk("\n[ERROR] in %s : calling thread %x is not thread 0 in owner cluster %x\n",
    8484__FUNCTION__ , trdid , owner_cxy );
     
    135135                remote_spinlock_unlock( children_lock_xp );
    136136
    137 #if CONFIG_DEBUG_SYS_WAIT
     137#if DEBUG_SYS_WAIT
    138138tm_end = hal_get_cycles();
    139 if( CONFIG_DEBUG_SYS_WAIT < tm_end )
     139if( DEBUG_SYS_WAIT < tm_end )
    140140printk("\n[DBG] %s : thread %x exit / parent %x / child %x / cycle %d\n",
    141141__FUNCTION__, this, process->pid, child_pid, (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_write.c

    r435 r438  
    4646    reg_t        save_sr;         // required to enable IRQs during syscall
    4747
    48 #if (CONFIG_DEBUG_SYS_WRITE_DEBUG & 1)
     48#if (DEBUG_SYS_WRITE_DEBUG & 1)
    4949enter_sys_read = (uint32_t)tm_start;
    5050#endif
     
    5353        process_t  * process = this->process;
    5454
    55 #if CONFIG_DEBUG_SYS_WRITE
     55#if DEBUG_SYS_WRITE
    5656uint32_t     tm_start;
    5757uint32_t     tm_end;
    5858tm_start = hal_get_cycles();
    59 if( CONFIG_DEBUG_SYS_WRITE < tm_start )
     59if( DEBUG_SYS_WRITE < tm_start )
    6060printk("\n[DBG] %s : thread %x enter / process %x / vaddr %x / count %d / cycle %d\n",
    6161__FUNCTION__, this, process->pid, vaddr, count, (uint32_t)tm_start );
     
    6666        {
    6767
    68 #if CONFIG_DEBUG_SYSCALLS_ERROR
     68#if DEBUG_SYSCALLS_ERROR
    6969printk("\n[ERROR] in %s : illegal file descriptor index\n", __FUNCTION__ );
    7070#endif
     
    7979    {
    8080
    81 #if CONFIG_DEBUG_SYSCALLS_ERROR
     81#if DEBUG_SYSCALLS_ERROR
    8282printk("\n[ERROR] in %s : user buffer unmapped = %x\n", __FUNCTION__ , (intptr_t)vaddr );
    8383#endif
     
    9595    {
    9696
    97 #if CONFIG_DEBUG_SYSCALLS_ERROR
     97#if DEBUG_SYSCALLS_ERROR
    9898printk("\n[ERROR] in %s : undefined file descriptor index = %d in process %x\n",
    9999__FUNCTION__ , file_id , process->pid );
     
    119119            {
    120120
    121 #if CONFIG_DEBUG_SYSCALLS_ERROR
     121#if DEBUG_SYSCALLS_ERROR
    122122printk("\n[ERROR] in %s : file %d not writable in process %x\n",
    123123__FUNCTION__ , file_id , process->pid );
     
    150150    {
    151151
    152 #if CONFIG_DEBUG_SYSCALLS_ERROR
     152#if DEBUG_SYSCALLS_ERROR
    153153printk("\n[ERROR] in %s cannot write data to file %d in process %x\n",
    154154__FUNCTION__ , file_id , process->pid );
     
    163163    hal_fence();
    164164
    165 #if CONFIG_DEBUG_SYS_WRITE
     165#if DEBUG_SYS_WRITE
    166166tm_end = hal_get_cycles();
    167 if( CONFIG_DEBUG_SYS_WRITE < tm_end )
     167if( DEBUG_SYS_WRITE < tm_end )
    168168printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n"
    169169"nbytes = %d / first byte = %c / file_id = %d / cost = %d\n",
     
    172172#endif
    173173 
    174 #if (CONFIG_DEBUG_SYS_WRITE & 1)
     174#if (DEBUG_SYS_WRITE & 1)
    175175exit_sys_write = (uint32_t)tm_end;
    176176
Note: See TracChangeset for help on using the changeset viewer.