Changeset 625 for trunk/kernel/syscalls


Ignore:
Timestamp:
Apr 10, 2019, 10:09:39 AM (6 years ago)
Author:
alain
Message:

Fix a bug in the vmm_remove_vseg() function: the physical pages
associated to an user DATA vseg were released to the kernel when
the target process descriptor was in the reference cluster.
This physical pages release should be done only when the page
forks counter value is zero.
All other modifications are cosmetic.

Location:
trunk/kernel/syscalls
Files:
20 edited

Legend:

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

    r624 r625  
    22 * sys_barrier.c - Access a POSIX barrier.
    33 *
    4  * authors       Alain Greiner (2016,2017,2018)
     4 * authors       Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2525#include <hal_special.h>
    2626#include <hal_uspace.h>
     27#include <hal_vmm.h>
    2728#include <errno.h>
    2829#include <thread.h>
     
    5657    process_t * process = this->process;
    5758
     59#if (DEBUG_SYS_BARRIER || CONFIG_INSTRUMENTATION_SYSCALLS)
     60uint64_t     tm_start = hal_get_cycles();
     61#endif
     62
    5863#if DEBUG_SYS_BARRIER
    59 uint64_t   tm_start;
    60 uint64_t   tm_end;
    61 tm_start = hal_get_cycles();
    6264if( DEBUG_SYS_BARRIER < tm_start )
    6365printk("\n[%s] thread[%x,%x] enters for %s / count %d / cycle %d\n",
     
    184186        }  // end switch
    185187
     188    hal_fence();
     189
     190#if (DEBUG_SYS_BARRIER || CONFIG_INSTRUMENTATION_SYSCALLS)
     191uint64_t     tm_end = hal_get_cycles();
     192#endif
     193
    186194#if DEBUG_SYS_BARRIER
    187 tm_end = hal_get_cycles();
    188195if( DEBUG_SYS_BARRIER < tm_end )
    189 printk("\n[%s] thread[%x,%x] exit for %s / cost %d / cycle %d\n",
    190 __FUNCTION__, process->pid, this->trdid, sys_barrier_op_str(operation),
    191 (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
     196printk("\n[%s] thread[%x,%x] exit for %s / cycle %d\n",
     197__FUNCTION__, process->pid, this->trdid, sys_barrier_op_str(operation), (uint32_t)tm_end );
     198#endif
     199
     200#if CONFIG_INSTRUMENTATION_SYSCALLS
     201hal_atomic_add( &syscalls_cumul_cost[SYS_BARRIER] , tm_end - tm_start );
     202hal_atomic_add( &syscalls_occurences[SYS_BARRIER] , 1 );
    192203#endif
    193204
  • trunk/kernel/syscalls/sys_close.c

    r594 r625  
    3535int sys_close ( uint32_t file_id )
    3636{
    37     error_t     error;
    38     xptr_t      file_xp;
     37    error_t            error;
     38    xptr_t             file_xp;
     39    cxy_t              file_cxy;
     40    vfs_file_t       * file_ptr;
     41    vfs_inode_type_t   file_type;
    3942
    4043        thread_t  * this    = CURRENT_THREAD;
     
    5457        if( file_id >= CONFIG_PROCESS_FILE_MAX_NR )
    5558        {
    56         printk("\n[ERROR] in %s : illegal file descriptor index = %d\n",
    57                __FUNCTION__ , file_id );
     59
     60#if DEBUG_SYSCALLS_ERROR
     61printk("\n[ERROR] in %s : illegal file descriptor index = %d\n",
     62__FUNCTION__ , file_id );
     63#endif
    5864                this->errno = EBADFD;
    5965                return -1;
     
    7379                return -1;
    7480    }
     81
     82    // get file type
     83    file_cxy  = GET_CXY( file_xp );
     84    file_ptr  = GET_PTR( file_xp );
     85    file_type = hal_remote_l32( XPTR( file_cxy , &file_ptr->type ) );
     86
     87    if( file_type == INODE_TYPE_DIR )
     88        {
     89
     90#if DEBUG_SYSCALLS_ERROR
     91printk("\n[ERROR] in %s : file descriptor %d is a directory\n",
     92__FUNCTION__ , file_id );
     93#endif
     94                this->errno = EBADFD;
     95                return -1;
     96        }
    7597
    7698    // call the relevant VFS function
  • trunk/kernel/syscalls/sys_display.c

    r624 r625  
    9696            // check string in user space
    9797            error = vmm_get_vseg( process , (intptr_t)arg0 , &vseg );
    98 
    9998            if( error )
    10099            {
     
    110109            // ckeck string length
    111110            length = hal_strlen_from_uspace( string );
    112 
    113111            if( length >= 512 )
    114112            {
     
    150148            // get extended pointer on process PID in cluster CXY
    151149            xptr_t process_xp = cluster_get_process_from_pid_in_cxy( cxy , pid );
    152 
    153150                if( process_xp == XPTR_NULL )
    154151            {
  • trunk/kernel/syscalls/sys_exec.c

    r584 r625  
    22 * sys_exec.c - Kernel function implementing the "exec" system call.
    33 *
    4  * Authors   Alain Greiner (2016,2017)
     4 * Authors   Alain Greiner (2016,2017,2017,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    208208#if DEBUG_SYS_EXEC
    209209if( DEBUG_SYS_EXEC < tm_start )
    210 printk("\n[DBG] %s : thread[%x,%x] enter for path <%s> / cycle = %d\n",
     210printk("\n[%s] thread[%x,%x] enter for path <%s> / cycle = %d\n",
    211211__FUNCTION__, pid, this->trdid, exec_info.path, (uint32_t)tm_start );
    212212#endif
     
    256256    }
    257257
    258     assert( false , "we should not execute this code" );
     258    assert( false , "we should never execute this code" );
    259259
    260260    return 0; 
  • trunk/kernel/syscalls/sys_exit.c

    r619 r625  
    22 * sys_exit.c - Kernel function implementing the "exit" system call.
    33 *
    4  * Author    Alain Greiner (2016,2017,2018)
     4 * Author    Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c)  UPMC Sorbonne Universites
     
    5353    pid_t       pid     = process->pid;
    5454
     55#if (DEBUG_SYS_EXIT || CONFIG_INSTRUMENTATION_SYSCALLS)
     56uint64_t     tm_start = hal_get_cycles();
     57#endif
     58
    5559#if DEBUG_SYS_EXIT
    56 uint64_t    tm_start;
    57 uint64_t    tm_end;
    58 tm_start = hal_get_cycles();
    5960if( DEBUG_SYS_EXIT < tm_start )
    6061printk("\n[%s] thread[%x,%x] enter / status %x / cycle %d\n",
    61 __FUNCTION__, process->pid, this->trdid , status , (uint32_t)tm_start );
     62__FUNCTION__, pid, this->trdid , status , (uint32_t)tm_start );
    6263#endif
    6364
     
    6667    owner_cxy = GET_CXY( owner_xp );
    6768    owner_ptr = GET_PTR( owner_xp );
    68 
    69 #if (DEBUG_SYS_EXIT & 1)
    70 if( DEBUG_SYS_EXIT < tm_start )
    71 printk("\n[%s] thread[%x,%x] get owner process in cluster %x\n",
    72 __FUNCTION__, process->pid, this->trdid, owner_cxy );
    73 #endif
    7469
    7570    // get local pointer on the main thread
     
    8075    parent_cxy = GET_CXY( parent_xp );
    8176    parent_ptr = GET_PTR( parent_xp );
    82 
    83 #if (DEBUG_SYS_EXIT & 1)
    84 if( DEBUG_SYS_EXIT < tm_start )
    85 printk("\n[%s] thread[%x,%x] get parent process in cluster %x\n",
    86 __FUNCTION__, process->pid, this->trdid, parent_cxy );
    87 #endif
    8877
    8978    // get pointers on the parent process main thread
     
    9685#if( DEBUG_SYS_EXIT & 1)
    9786if( DEBUG_SYS_EXIT < tm_start )
    98 printk("\n[%s] thread[%x,%x] detached process from TXT\n",
    99 __FUNCTION__, process->pid, this->trdid );
     87printk("\n[%s] thread[%x,%x] detached process %x from TXT\n",
     88__FUNCTION__, pid, this->trdid, pid );
    10089#endif
    10190
    10291    // mark for delete all process threads in all clusters,
    10392    // but the main thread and this calling thread
    104     process_sigaction( process->pid , DELETE_ALL_THREADS );
     93    process_sigaction( pid , DELETE_ALL_THREADS );
    10594
    10695#if( DEBUG_SYS_EXIT & 1)
    10796if( DEBUG_SYS_EXIT < tm_start )
    108 printk("\n[%s] thread[%x,%x] deleted all threads but itself\n",
    109 __FUNCTION__, process->pid, this->trdid );
     97printk("\n[%s] thread[%x,%x] deleted all threads in process %x (but itself)\n",
     98__FUNCTION__, pid, this->trdid, pid );
    11099#endif
    111100
     
    116105#if( DEBUG_SYS_EXIT & 1)
    117106if( tm_start > DEBUG_SYS_EXIT )
    118 printk("\n[%u] thread[%x,%x] marked iself for delete\n",
    119 __FUNCTION__, process->pid, this->trdid );
     107printk("\n[%s] thread[%x,%x] marked iself for delete\n",
     108__FUNCTION__, pid, this->trdid );
    120109#endif
    121110        thread_delete( XPTR( local_cxy , this ) , pid , true );
    122111    }
    123112
    124     // block this main thread
     113    // block the main thread
    125114    thread_block( XPTR( owner_cxy , main_ptr ) , THREAD_BLOCKED_GLOBAL );
    126115
    127116#if( DEBUG_SYS_EXIT & 1)
     117trdid_t main_trdid = hal_remote_l32( XPTR( owner_cxy , &main_ptr->trdid ) );
    128118if( tm_start > DEBUG_SYS_EXIT )
    129 printk("\n[%s] thread[%x,%x] blocked main thread\n",
    130 __FUNCTION__, process->pid, this->trdid );
     119printk("\n[%s] thread[%x,%x] blocked main thread[%x,%x]\n",
     120__FUNCTION__, pid, this->trdid, pid, main_trdid );
    131121#endif
    132122
    133     // atomically update owner process descriptor term_state to ask
    134     // the parent process sys_wait() function to delete the main thread
     123    // update term_state in owner process descriptor to ask
     124    // the parent process sys_wait() function to delete the process
    135125    term_state = (status & 0xFF) | PROCESS_TERM_EXIT;
    136126    hal_remote_atomic_or( XPTR( owner_cxy , &owner_ptr->term_state ) , term_state );
     
    139129if( tm_start > DEBUG_SYS_EXIT )
    140130printk("\n[%s] thread[%x,%x] set exit status %x in owner process\n",
    141 __FUNCTION__, process->pid, this->trdid, term_state );
     131__FUNCTION__, pid, this->trdid, term_state );
    142132#endif
    143133
     
    148138if( tm_start > DEBUG_SYS_EXIT )
    149139printk("\n[%s] thread[%x,%x] unblocked parent main thread in process %x\n",
    150 __FUNCTION__ , process->pid, this->trdid,
     140__FUNCTION__ , pid, this->trdid,
    151141hal_remote_l32( XPTR( parent_cxy , &parent_ptr->pid) ) );
    152142#endif
     
    154144    hal_fence();
    155145
     146#if (DEBUG_SYS_EXIT || CONFIG_INSTRUMENTATION_SYSCALLS)
     147uint64_t     tm_end = hal_get_cycles();
     148#endif
     149
    156150#if DEBUG_SYS_EXIT
    157 tm_end = hal_get_cycles();
    158151if( DEBUG_SYS_EXIT < tm_end )
    159 printk("\n[%s] thread[%x,%x] exit / status %x / cost = %d / cycle %d\n",
    160 __FUNCTION__, process->pid, this->trdid, status,
    161 (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
     152printk("\n[%s] thread[%x,%x] exit / term_state %x / cycle %d\n",
     153__FUNCTION__, pid, this->trdid, term_state,  (uint32_t)tm_end );
     154#endif
     155
     156#if CONFIG_INSTRUMENTATION_SYSCALLS
     157hal_atomic_add( &syscalls_cumul_cost[SYS_EXIT] , tm_end - tm_start );
     158hal_atomic_add( &syscalls_occurences[SYS_EXIT] , 1 );
    162159#endif
    163160
  • trunk/kernel/syscalls/sys_fork.c

    r594 r625  
    22 * sys_fork.c - Kernel function implementing the "fork" system call.
    33 *
    4  * Authors  Alain Greiner  (2016,2017)
     4 * Authors  Alain Greiner  (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    7373#if DEBUG_SYS_FORK
    7474if( DEBUG_SYS_FORK < tm_start )
    75 printk("\n[DBG] %s : thread[%x,%x] enter / cycle =  %d\n",
     75printk("\n[%s] thread[%x,%x] enter / cycle =  %d\n",
    7676__FUNCTION__, parent_pid, parent_thread_ptr->trdid, (uint32_t)tm_start );
    7777#endif
     
    151151
    152152    // set remote child CPU context from parent_thread register values
     153    // replicates the parent thread kernel stack to the child thread descriptor,
     154    // and finally unblock the child thread.
    153155    hal_cpu_context_fork( XPTR( child_cxy , child_thread_ptr ) );
    154156
    155157    // From this point, both parent and child threads execute the following code,
    156     // but they can be distinguished by the (CURRENT_THREAD,local_cxy) values.
    157     // - parent unblock child, and return child PID to user application.
    158     // - child thread does nothing, and return 0 to user pplication
    159     // The child thread will only execute it when it is unblocked by parent thread.
     158    // but child thread will only execute it after being unblocked by parent thread.
     159    // They can be distinguished by the (CURRENT_THREAD,local_cxy) values.
     160    // - parent return child PID to user application.
     161    // - child  return 0 to user application
    160162
    161163    thread_t * current = CURRENT_THREAD;
     
    165167#endif
    166168
     169    if( (current == parent_thread_ptr) && (local_cxy == parent_cxy) )   // parent thread
     170    {
     171
    167172#if DEBUG_SYS_FORK
    168173if( DEBUG_SYS_FORK < tm_end )
    169 printk("\n[%s] thread[%x,%x] exit / cycle %d\n",
    170 __FUNCTION__, current->process->pid, current->trdid, (uint32_t)tm_end );
     174printk("\n[%s] parent thread[%x,%x] exit / child_pid %x / cycle %d\n",
     175__FUNCTION__, current->process->pid, current->trdid, child_pid, (uint32_t)tm_end );
    171176#endif
    172177
    173     if( (current == parent_thread_ptr) && (local_cxy == parent_cxy) )   // parent thread
    174     {
    175         // parent_thread unblock child_thread
    176         thread_unblock( XPTR( child_cxy , child_thread_ptr ) , THREAD_BLOCKED_GLOBAL );
    177 
    178         // only parent contribute to instrumentation
    179 
     178// only parent contribute to instrumentation
    180179#if CONFIG_INSTRUMENTATION_SYSCALLS
    181180hal_atomic_add( &syscalls_cumul_cost[SYS_FORK] , tm_end - tm_start );
     
    186185        else                                                               // child_thread
    187186    {
     187
     188#if DEBUG_SYS_FORK
     189if( DEBUG_SYS_FORK < tm_end )
     190printk("\n[%s] child thread[%x,%x] exit / child_pid %x / cycle %d\n",
     191__FUNCTION__, current->process->pid, current->trdid, child_pid, (uint32_t)tm_end );
     192#endif
     193
    188194        return 0;
    189195    }
  • trunk/kernel/syscalls/sys_get_config.c

    r624 r625  
    22 * sys_get_config.c - get hardware platform parameters.
    33 *
    4  * Author    Alain Greiner (2016,2017,2018)
     4 * Author    Alain Greiner (2016,2017,2018,2019)
    55 * 
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2424#include <hal_kernel_types.h>
    2525#include <hal_uspace.h>
     26#include <hal_vmm.h>
    2627#include <hal_special.h>
    2728#include <errno.h>
     
    4849    process_t * process = this->process;
    4950
     51#if (DEBUG_SYS_GET_CONFIG || CONFIG_INSTRUMENTATION_SYSCALLS)
     52uint64_t     tm_start = hal_get_cycles();
     53#endif
     54
    5055#if DEBUG_SYS_GET_CONFIG
    51 uint64_t     tm_start;
    52 uint64_t     tm_end;
    5356tm_start = hal_get_cycles();
    5457if( DEBUG_SYS_GET_CONFIG < tm_start )
     
    114117    hal_fence();
    115118
     119#if (DEBUG_SYS_GET_CONFIG || CONFIG_INSTRUMENTATION_SYSCALLS)
     120uint64_t     tm_end = hal_get_cycles();
     121#endif
     122
    116123#if DEBUG_SYS_GET_CONFIG
    117 tm_end = hal_get_cycles();
    118124if( DEBUG_SYS_GET_CONFIG < tm_end )
    119125printk("\n[DBG] %s : thread %x exit / process %x / cost %d / cycle %d\n",
     
    121127#endif
    122128
     129#if CONFIG_INSTRUMENTATION_SYSCALLS
     130hal_atomic_add( &syscalls_cumul_cost[SYS_GET_CONFIG] , tm_end - tm_start );
     131hal_atomic_add( &syscalls_occurences[SYS_GET_CONFIG] , 1 );
     132#endif
     133
    123134        return 0;
    124135
  • trunk/kernel/syscalls/sys_get_core.c

    r624 r625  
    2424#include <hal_kernel_types.h>
    2525#include <hal_uspace.h>
     26#include <hal_vmm.h>
    2627#include <hal_special.h>
    2728#include <errno.h>
  • trunk/kernel/syscalls/sys_get_cycle.c

    r624 r625  
    2424#include <hal_kernel_types.h>
    2525#include <hal_uspace.h>
     26#include <hal_vmm.h>
    2627#include <hal_special.h>
    2728#include <errno.h>
  • trunk/kernel/syscalls/sys_is_fg.c

    r624 r625  
    22 * sys_fg.c - Kernel function implementing the "is_fg" system call.
    33 *
    4  * Author    Alain Greiner (2016,2017,2018)
     4 * Author    Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c)  UPMC Sorbonne Universites
     
    2525#include <hal_kernel_types.h>
    2626#include <hal_uspace.h>
     27#include <hal_vmm.h>
    2728#include <hal_special.h>
    2829#include <errno.h>
  • trunk/kernel/syscalls/sys_mmap.c

    r624 r625  
    22 * sys_mmap.c - map files, memory or devices into process virtual address space
    33 *
    4  * Authors       Ghassan Almaless (2008,2009,2010,2011,2012)
    5  *               Alain Greiner (2016,2017,2018)
     4 * Authors       Alain Greiner (2016,2017,2018,2019)
    65 *
    76 * Copyright (c) UPMC Sorbonne Universites
     
    2524#include <hal_kernel_types.h>
    2625#include <hal_uspace.h>
     26#include <hal_vmm.h>
    2727#include <hal_irqmask.h>
    2828#include <shared_syscalls.h>
  • trunk/kernel/syscalls/sys_munmap.c

    r624 r625  
    22 * sys_munmap.c - unmap a mapping from process virtual address space
    33 *
    4  * Authors       Ghassan Almaless (2008,2009,2010,2011,2012)
    5  *               Alain Greiner (2016,2017,2018)
     4 * Authors       Alain Greiner (2016,2017,2018,2019)
    65 *
    76 * Copyright (c) UPMC Sorbonne Universites
     
    2524#include <hal_kernel_types.h>
    2625#include <hal_uspace.h>
     26#include <hal_vmm.h>
    2727#include <hal_irqmask.h>
    2828#include <shared_syscalls.h>
  • trunk/kernel/syscalls/sys_mutex.c

    r624 r625  
    22 * sys_mutex.c - Access a POSIX mutex.
    33 *
    4  * Author    Alain Greiner (2016,2017,2018)
     4 * Author    Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2424#include <hal_kernel_types.h>
    2525#include <hal_special.h>
     26#include <hal_vmm.h>
    2627#include <errno.h>
    2728#include <thread.h>
     
    5657    process_t * process = this->process;
    5758
     59#if (DEBUG_SYS_MUTEX || CONFIG_INSTRUMENTATION_SYSCALLS)
     60uint64_t     tm_start = hal_get_cycles();
     61#endif
     62
    5863#if DEBUG_SYS_MUTEX
    59 uint64_t    tm_start;
    60 uint64_t    tm_end;
    61 tm_start = hal_get_cycles();
    6264if( DEBUG_SYS_MUTEX < tm_start )
    63 printk("\n[DBG] %s : thread %x in process %x enter for %s / cycle %d\n",
     65printk("\n[%s] thread[%x,%x] enter for %s / cycle %d\n",
    6466__FUNCTION__, this->trdid, process->pid, sys_mutex_op_str( operation ), (uint32_t)tm_start );
    6567#endif
     
    221223    hal_fence();
    222224
     225#if (DEBUG_SYS_MUTEX || CONFIG_INSTRUMENTATION_SYSCALLS)
     226uint64_t     tm_end = hal_get_cycles();
     227#endif
     228
    223229#if DEBUG_SYS_MUTEX
    224 tm_end = hal_get_cycles();
    225 if( DEBUG_SYS_MUTEX < tm_start )
    226 printk("\n[DBG] %s : thread %x in process %x exit for %s / cost %d / cycle %d\n",
    227 __FUNCTION__, this->trdid, process->pid, sys_mutex_op_str( operation ),
    228 (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
     230if( DEBUG_SYS_MUTEX < tm_end )
     231printk("\n[%s] thread[%x,%x] exit for %s / cycle %d\n",
     232__FUNCTION__, this->trdid, process->pid, sys_mutex_op_str( operation ), (uint32_t)tm_end );
     233#endif
     234
     235#if CONFIG_INSTRUMENTATION_SYSCALLS
     236hal_atomic_add( &syscalls_cumul_cost[SYS_MUTEX] , tm_end - tm_start );
     237hal_atomic_add( &syscalls_occurences[SYS_MUTEX] , 1 );
    229238#endif
    230239
  • trunk/kernel/syscalls/sys_open.c

    r610 r625  
    22 * sys_open.c - open a file.
    33 *
    4  * Author        Alain Greiner (2016,2017)
     4 * Author        Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
  • trunk/kernel/syscalls/sys_opendir.c

    r624 r625  
    22 * sys_opendir.c - Open an user accessible VFS directory.
    33 *
    4  * Author        Alain Greiner (2016,2017,2018)
     4 * Author        Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2525#include <hal_kernel_types.h>
    2626#include <hal_uspace.h>
     27#include <hal_vmm.h>
    2728#include <thread.h>
    2829#include <process.h>
  • trunk/kernel/syscalls/sys_read.c

    r624 r625  
    11/*
    2  * sys_read.c - read bytes from a file
     2 * sys_read.c - Kernel function implementing the "read" system call.
    33 *
    4  * Author     Alain Greiner (2016,2017,2018)
     4 * Author     Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2424#include <kernel_config.h>
    2525#include <hal_kernel_types.h>
     26#include <hal_vmm.h>
    2627#include <hal_uspace.h>
    2728#include <hal_irqmask.h>
  • trunk/kernel/syscalls/sys_readdir.c

    r624 r625  
    2525#include <hal_kernel_types.h>
    2626#include <hal_uspace.h>
     27#include <hal_vmm.h>
    2728#include <errno.h>
    2829#include <thread.h>
  • trunk/kernel/syscalls/sys_thread_exit.c

    r619 r625  
    6464uint64_t     tm_start = hal_get_cycles();
    6565if( DEBUG_SYS_THREAD_EXIT < tm_start )
    66 printk("\n[%s] thread[%x,%x] / main => delete process / cycle %d\n",
     66printk("\n[%s] thread[%x,%x] is main => delete process / cycle %d\n",
    6767__FUNCTION__ , pid , trdid , (uint32_t)tm_start );
    6868#endif
     
    7676uint64_t     tm_start = hal_get_cycles();
    7777if( DEBUG_SYS_THREAD_EXIT < tm_start )
    78 printk("\n[%s] thread[%x,%x] / not main => delete thread / cycle %d\n",
     78printk("\n[%s] thread[%x,%x] is not main => delete thread / cycle %d\n",
    7979__FUNCTION__ , pid , trdid , (uint32_t)tm_start );
    8080#endif
  • trunk/kernel/syscalls/sys_wait.c

    r624 r625  
    22 * sys_wait.c - wait termination or blocking of a child process.
    33 *
    4  * Author    Alain Greiner (2016,2017,2018)
     4 * Author    Alain Greiner (2016,2017,2018,2019)
    55 * 
    66 * Copyright (c) UPMC Sorbonne Universites
     
    5656uint64_t    cycle = hal_get_cycles();
    5757if( DEBUG_SYS_WAIT < cycle )
    58 printk("\n[DBG] %s : thread %x in process %x enter / cycle %d\n",
    59 __FUNCTION__, this, process->pid, (uint32_t)cycle );
     58printk("\n[%s] thread[%x,%x] enter / cycle %d\n",
     59__FUNCTION__, pid, this->trdid, (uint32_t)cycle );
    6060#endif
    6161
     
    6767
    6868#if DEBUG_SYSCALLS_ERROR
    69 printk("\n[ERROR] in %s : status buffer %x unmapped for thread %x in process %x\n",
    70 __FUNCTION__ , (intptr_t)status, this->trdid , process->pid );
     69printk("\n[ERROR] in %s : status buffer %x unmapped for thread[%x,%x]\n",
     70__FUNCTION__ , (intptr_t)status, pid, this->trdid );
    7171hal_vmm_display( process , false );
    7272#endif
     
    8686
    8787#if DEBUG_SYSCALLS_ERROR
    88 printk("\n[ERROR] in %s : calling thread %x is not thread 0 in owner cluster %x\n",
    89 __FUNCTION__ , trdid , owner_cxy );
     88printk("\n[ERROR] in %s : calling thread[%x,%x] is not thread 0 in owner cluster %x\n",
     89__FUNCTION__ , pid, this->trdid , owner_cxy );
    9090#endif
    9191        this->errno = EINVAL;
     
    119119            child_thread = hal_remote_lpt(XPTR( child_cxy , &child_ptr->th_tbl[0] ));
    120120
    121 #if (DEBUG_SYS_WAIT & 1)
    122 cycle = hal_get_cycles();
    123 if( DEBUG_SYS_WAIT < cycle )
    124 printk("\n[DBG] %s : thread %x in process %x check child %x / state %x\n",
    125 __FUNCTION__, this, process->pid, child_pid, child_state );
    126 #endif
    127121            // test if this child process is terminated,
    128122            // but termination not yet reported to parent process
     
    148142if( DEBUG_SYS_WAIT < cycle )
    149143{
    150     if     ( child_state & PROCESS_TERM_EXIT )
    151         printk("\n[DBG] %s : thread %x in process %x exit / child %x exit / cycle %d\n",
    152         __FUNCTION__, this, process->pid, child_pid, (uint32_t)cycle );
     144    if( child_state & PROCESS_TERM_EXIT )
     145        printk("\n[%s] thread[%x,%x] exit : child process %x terminated / cycle %d\n",
     146        __FUNCTION__, pid, this->trdid, child_pid, (uint32_t)cycle );
    153147    if( child_state & PROCESS_TERM_KILL )
    154         printk("\n[DBG] %s : thread %x in process %x exit / child %x killed / cycle %d\n",
    155         __FUNCTION__, this, process->pid, child_pid, (uint32_t)cycle );
     148        printk("\n[%s] thread[%x,%x] exit : child process %x killed / cycle %d\n",
     149        __FUNCTION__, pid, this->trdid, child_pid, (uint32_t)cycle );
    156150    if( child_state & PROCESS_TERM_STOP )
    157         printk("\n[DBG] %s : thread %x in process %x exit / child %x stopped / cycle %d\n",
    158         __FUNCTION__, this, process->pid, child_pid, (uint32_t)cycle );
     151        printk("\n[%s] thread[%x,%x] exit : child process %x stopped / cycle %d\n",
     152        __FUNCTION__, pid, this->trdid, child_pid, (uint32_t)cycle );
    159153}
    160154#endif
     
    165159        }  // end loop on children
    166160       
    167         // we execute this code when no child terminated:
     161        // we execute this code when no child change detected
    168162        // - release the lock protecting children list,
    169163        // - block on the WAIT condition
     
    179173cycle = hal_get_cycles();
    180174if( DEBUG_SYS_WAIT < cycle )
    181 printk("\n[DBG] %s : thread %x in process %x block & deschedule / cycle %d\n",
    182 __FUNCTION__, this, process->pid, (uint32_t)cycle );
     175printk("\n[%s] thread[%x,%x] block & deschedule / cycle %d\n",
     176__FUNCTION__, pid, this->trdid, (uint32_t)cycle );
    183177#endif
    184178
     
    189183cycle = hal_get_cycles();
    190184if( DEBUG_SYS_WAIT < cycle )
    191 printk("\n[DBG] %s : thread %x in process %x unblock & resume / cycle %d\n",
    192 __FUNCTION__, this, process->pid, (uint32_t)cycle );
     185printk("\n[%s] thread[%x,%x] resume / cycle %d\n",
     186__FUNCTION__, pid, this->trdid, (uint32_t)cycle );
    193187#endif
    194188
  • trunk/kernel/syscalls/sys_write.c

    r624 r625  
    22 * sys_write.c - Kernel function implementing the "write" system call.
    33 *
    4  * Author        Alain Greiner (2016,2017,2018)
     4 * Author        Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    7676
    7777#if DEBUG_SYS_WRITE
    78 tm_start = hal_get_cycles();
    7978if( DEBUG_SYS_WRITE < tm_start )
    80 printk("\n[%s] thread[%x,%x] enter / vaddr %x / count %d / cycle %d\n",
     79printk("\n[%s] thread[%x,%x] enter / vaddr %x / %d bytes / cycle %d\n",
    8180__FUNCTION__, process->pid, this->trdid, vaddr, count, (uint32_t)tm_start );
    8281#endif
     
    140139    hal_enable_irq( &save_sr );
    141140
    142    // action depend on file type
    143     if( file_type == INODE_TYPE_FILE )  // write to file mapper
     141    // action depend on file type
     142    if( file_type == INODE_TYPE_FILE )  // write to a file mapper
    144143    {
    145144        // check file writable
     
    180179        xptr_t inode_xp = XPTR( file_cxy , inode_ptr );
    181180        vfs_inode_update_size( inode_xp , file_offset + count );
    182 
    183181    }
    184182    else if( file_type == INODE_TYPE_DEV )  // write to TXT device
Note: See TracChangeset for help on using the changeset viewer.