Changeset 635 for trunk/kernel/syscalls


Ignore:
Timestamp:
Jun 26, 2019, 11:42:37 AM (5 years ago)
Author:
alain
Message:

This version is a major evolution: The physical memory allocators,
defined in the kmem.c, ppm.c, and kcm.c files have been modified
to support remote accesses. The RPCs that were previously user
to allocate physical memory in a remote cluster have been removed.
This has been done to cure a dead-lock in case of concurrent page-faults.

This version 2.2 has been tested on a (4 clusters / 2 cores per cluster)
TSAR architecture, for both the "sort" and the "fft" applications.

Location:
trunk/kernel/syscalls
Files:
22 edited

Legend:

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

    r629 r635  
    7676printk("\n[ERROR] in %s : unmapped barrier %x / thread %x / process %x\n",
    7777__FUNCTION__ , vaddr , this->trdid , process->pid );
    78 hal_vmm_display( process , false );
    7978#endif
    8079        this->errno = error;
     
    9796printk("\n[ERROR] in %s : unmapped barrier attributes %x / thread %x / process %x\n",
    9897__FUNCTION__ , attr , this->trdid , process->pid );
    99 hal_vmm_display( process , false );
    10098#endif
    10199                    this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_condvar.c

    r624 r635  
    7676printk("\n[ERROR] in %s : unmapped condvar %x / thread %x / process %x\n",
    7777__FUNCTION__ , (intptr_t)condvar , this->trdid , process->pid );
    78 hal_vmm_display( process , false );
    7978#endif
    8079        this->errno = error;
  • trunk/kernel/syscalls/sys_display.c

    r626 r635  
    160160            }
    161161
    162             // get local pointer on process
    163             process_t * process = (process_t *)GET_PTR( process_xp );
    164 
    165162            // call kernel function
    166             if( cxy == local_cxy )
    167             {
    168                     hal_vmm_display( process , true );
    169             }
    170             else
    171             {
    172                 rpc_hal_vmm_display_client( cxy , process , true );
    173             }
     163                hal_vmm_display( process_xp , true );
    174164
    175165            break;
  • trunk/kernel/syscalls/sys_exec.c

    r626 r635  
    6363    uint32_t     length;      // string length
    6464    kmem_req_t   req;         // kmem request
    65     page_t     * page;        // page descriptor
    66     xptr_t       base_xp;     // extended pointer on page base
    6765    uint32_t     order;       // ln2( number of pages to store strings )
    6866    char      ** k_pointers;  // base of kernel array of pointers
     67    char       * k_buf_base;  // base address of the kernel strings buffer
    6968    char       * k_buf_ptr;   // pointer on first empty slot in kernel strings buffer
    70     char       * k_buf_base;  // base address of the kernel strings buffer
    7169
    7270    // compute ln2( number of pages for kernel strings buffer )
     
    7472    else          order = bits_log2( CONFIG_VMM_ENVS_SIZE );
    7573
    76     req.type   = KMEM_PAGE;
     74    // allocate one physical page for kernel array of pointers
     75    req.type   = KMEM_PPM;
     76    req.order  = 0;
    7777    req.flags  = AF_KERNEL | AF_ZERO;
    78 
    79     // allocate one physical page for kernel array of pointers
    80     req.type   = 0;
    81     page       = kmem_alloc( &req );
    82 
    83     if( page == NULL ) return ENOMEM;
    84 
    85     base_xp = ppm_page2base( XPTR( local_cxy , page ) );
    86     k_pointers = (char **)GET_PTR( base_xp );
     78    k_pointers = kmem_alloc( &req );
     79
     80    if( k_pointers == NULL ) return ENOMEM;
    8781
    8882    // allocate several physical pages to store the strings themselve
    89     req.type   = order;
    90     page       = kmem_alloc( &req );
    91 
    92     if( page == NULL ) return ENOMEM;
    93 
    94     base_xp = ppm_page2base( XPTR( local_cxy , page ) );
    95     k_buf_base = (char *)GET_PTR( base_xp );
     83    req.type   = KMEM_PPM;
     84    req.order  = order;
     85    req.flags  = AF_KERNEL | AF_ZERO;
     86    k_buf_base = kmem_alloc( &req );
     87
     88    if( k_buf_base == NULL ) return ENOMEM;
    9689
    9790    // copy the array of pointers to kernel buffer
  • trunk/kernel/syscalls/sys_fork.c

    r625 r635  
    7272
    7373#if DEBUG_SYS_FORK
    74 if( DEBUG_SYS_FORK < tm_start )
     74if( DEBUG_SYS_FORK < (uint32_t)tm_start )
    7575printk("\n[%s] thread[%x,%x] enter / cycle =  %d\n",
    7676__FUNCTION__, parent_pid, parent_thread_ptr->trdid, (uint32_t)tm_start );
     
    109109
    110110#if (DEBUG_SYS_FORK & 1 )
    111 if( DEBUG_SYS_FORK < tm_start )
     111if( DEBUG_SYS_FORK < (uint32_t)tm_start )
    112112printk("\n[%s] thread[%x,%x] selected cluster %x\n",
    113113__FUNCTION__, parent_pid, parent_thread_ptr->trdid, child_cxy );
     
    150150        }
    151151
    152     // set remote child CPU context from parent_thread register values
     152    // set the remote child CPU context from parent register values,
     153    // set the remote child uzone from
    153154    // replicates the parent thread kernel stack to the child thread descriptor,
    154155    // and finally unblock the child thread.
     
    171172
    172173#if DEBUG_SYS_FORK
    173 if( DEBUG_SYS_FORK < tm_end )
     174if( DEBUG_SYS_FORK < (uint32_t)tm_end )
    174175printk("\n[%s] parent thread[%x,%x] exit / child_pid %x / cycle %d\n",
    175176__FUNCTION__, current->process->pid, current->trdid, child_pid, (uint32_t)tm_end );
    176177#endif
    177178
    178 // only parent contribute to instrumentation
     179// only parent display the parent and child VMM
     180#if (DEBUG_SYS_FORK & 1 )
     181if( DEBUG_SYS_FORK < (uint32_t)tm_end )
     182{
     183    process_t * child_process_ptr = hal_remote_lpt( XPTR( child_cxy ,
     184                                                          &child_thread_ptr->process ) );
     185    xptr_t      child_process_xp  = XPTR( child_cxy , child_process_ptr );
     186
     187    hal_vmm_display( ref_process_xp , true );
     188    hal_vmm_display( child_process_xp , true );
     189}
     190#endif
     191
     192// only parent contribute to syscalls instrumentation
    179193#if CONFIG_INSTRUMENTATION_SYSCALLS
    180194hal_atomic_add( &syscalls_cumul_cost[SYS_FORK] , tm_end - tm_start );
     
    187201
    188202#if DEBUG_SYS_FORK
    189 if( DEBUG_SYS_FORK < tm_end )
     203if( DEBUG_SYS_FORK < (uint32_t)tm_end )
    190204printk("\n[%s] child thread[%x,%x] exit / child_pid %x / cycle %d\n",
    191205__FUNCTION__, current->process->pid, current->trdid, child_pid, (uint32_t)tm_end );
  • trunk/kernel/syscalls/sys_get_config.c

    r626 r635  
    6969printk("\n[ERROR] in %s : x_size buffer unmapped / thread %x / process %x\n",
    7070__FUNCTION__ , (intptr_t)x_size , this->trdid , process->pid );
    71 hal_vmm_display( process , false );
    7271#endif
    7372        this->errno = EINVAL;
     
    8483printk("\n[ERROR] in %s : y_size buffer unmapped / thread %x / process %x\n",
    8584__FUNCTION__ , (intptr_t)y_size , this->trdid , process->pid );
    86 hal_vmm_display( process , false );
    8785#endif
    8886        this->errno = EINVAL;
     
    9997printk("\n[ERROR] in %s : ncores buffer unmapped / thread %x / process %x\n",
    10098__FUNCTION__ , (intptr_t)ncores , this->trdid , process->pid );
    101 hal_vmm_display( process , false );
    10299#endif
    103100        this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_get_core.c

    r626 r635  
    5656printk("\n[ERROR] in %s : cxy buffer unmapped %x / thread %x / process %x\n",
    5757__FUNCTION__ , (intptr_t)cxy , this->trdid , process->pid );
    58 hal_vmm_display( process , false );
    5958#endif
    6059        this->errno = EFAULT;
     
    7170printk("\n[ERROR] in %s : lid buffer unmapped %x / thread %x / process %x\n",
    7271__FUNCTION__ , (intptr_t)lid , this->trdid , process->pid );
    73 hal_vmm_display( process , false );
    7472#endif
    7573        this->errno = EFAULT;
  • trunk/kernel/syscalls/sys_get_cycle.c

    r626 r635  
    5454printk("\n[ERROR] in %s : user buffer unmapped %x / thread %x / process %x\n",
    5555__FUNCTION__ , (intptr_t)cycle , this->trdid , process->pid );
    56 hal_vmm_display( process , false );
    5756#endif
    5857        this->errno = EFAULT;
  • trunk/kernel/syscalls/sys_is_fg.c

    r626 r635  
    6868printk("\n[ERROR] in %s : unmapped owner buffer %x / thread %x in process %x\n",
    6969__FUNCTION__ , (intptr_t)is_fg, this->trdid, process->pid );
    70 hal_vmm_display( process , false );
    7170#endif
    7271         this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_mmap.c

    r626 r635  
    7070printk("\n[ERROR] in %s : thread[%x,%x] / mmap attributes unmapped %x\n",
    7171__FUNCTION__ , process->pid, this->trdid, (intptr_t)attr );
    72 hal_vmm_display( process , false );
    7372#endif
    7473                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_munmap.c

    r625 r635  
    6767printk("\n[ERROR] in %s : thread[%x,%x] / user buffer unmapped %x\n",
    6868__FUNCTION__ , process->pid, this->trdid, (intptr_t)vaddr );
    69 hal_vmm_display( process , false );
    7069#endif
    7170                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_mutex.c

    r625 r635  
    7676printk("\n[ERROR] in %s : mutex unmapped %x / thread %x / process %x\n",
    7777__FUNCTION__ , (intptr_t)vaddr , this->trdid , process->pid );
    78 hal_vmm_display( process , false );
    7978#endif
    8079        this->errno = error;
  • trunk/kernel/syscalls/sys_opendir.c

    r626 r635  
    6767printk("\n[ERROR] in %s / thread[%x,%x] : DIR buffer %x unmapped\n",
    6868__FUNCTION__ , process->pid , this->trdid, dirp );
    69 hal_vmm_display( process , false );
    7069#endif
    7170                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_read.c

    r633 r635  
    106106printk("\n[ERROR] in %s : thread[%x,%x] user buffer unmapped %x\n",
    107107__FUNCTION__ , process->pid, this->trdid, (intptr_t)vaddr );
    108 hal_vmm_display( process , false );
    109108#endif
    110109                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_readdir.c

    r626 r635  
    7070printk("\n[ERROR] in %s / thread[%x,%x] : user buffer %x unmapped\n",
    7171__FUNCTION__ , process->pid , this->trdid, buffer );
    72 hal_vmm_display( process , false );
    7372#endif
    7473                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_sem.c

    r626 r635  
    7575printk("\n[ERROR] in %s : unmapped semaphore pointer %x / thread %x in process %x / cycle %d\n",
    7676__FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    77 hal_vmm_display( process , false );
    7877#endif
    7978        this->errno = EINVAL;
     
    113112printk("\n[ERROR] in %s GETVALUE: unmapped buffer %x / thread %x in process %x / cycle %d\n",
    114113__FUNCTION__ , (intptr_t)current_value, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    115 hal_vmm_display( process , false );
    116114#endif
    117115                this->errno = EINVAL;
     
    158156printk("\n[ERROR] in %s WAIT: semaphore %x not found / thread %x in process %x / cycle %d\n",
    159157__FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    160 hal_vmm_display( process , true );
    161158#endif
    162159                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_stat.c

    r626 r635  
    6262printk("\n[ERROR] in %s / thread[%x,%x] : stat structure %x unmapped\n",
    6363__FUNCTION__ , process->pid , this->trdid, u_stat );
    64 hal_vmm_display( process , false );
    6564#endif
    6665                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_thread_create.c

    r633 r635  
    8181printk("\n[ERROR] in %s : thread[%x,%x] / trdid buffer %x unmapped %x\n",
    8282__FUNCTION__, process->pid, parent->trdid, (intptr_t)trdid_ptr );
    83 hal_vmm_display( process , false );
    8483#endif
    8584                parent->errno = EINVAL;
     
    9897printk("\n[ERROR] in %s : thread[%x,%x] / user_attr buffer unmapped %x\n",
    9998__FUNCTION__, process->pid, parent->trdid, (intptr_t)user_attr );
    100 hal_vmm_display( process , false );
    10199#endif
    102100                    parent->errno = EINVAL;
     
    119117printk("\n[ERROR] in %s : thread[%x,%x] / start_func unmapped %x\n",
    120118__FUNCTION__, process->pid, parent->trdid, (intptr_t)start_func );
    121 hal_vmm_display( process , false );
    122119#endif
    123120        parent->errno = EINVAL;
     
    136133printk("\n[ERROR] in %s : thread[%x,%x] / start_args buffer unmapped %x\n",
    137134__FUNCTION__, process->pid, parent->trdid, (intptr_t)start_args );
    138 hal_vmm_display( process , false );
    139135#endif
    140136                    parent->errno = EINVAL;
  • trunk/kernel/syscalls/sys_thread_exit.c

    r625 r635  
    22 * sys_thread_exit.c - terminates the execution of calling thread
    33 *
    4  * Authors   Alain Greiner (2016,2017,2018)
     4 * Authors   Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    4646
    4747#if DEBUG_SYSCALLS_ERROR
    48 printk("\n[ERROR] in %s : exit_value argument must be NULL / thread %x in process %x\n",
    49 __FUNCTION__ , this , pid );
     48printk("\n[ERROR] in %s : thread[%x,%x] / exit_value argument %x must be NULL\n",
     49__FUNCTION__ , pid, trdid , exit_value );
    5050#endif
    5151        this->errno = EINVAL;
    5252        return -1;
    5353    }
    54 
    5554
    5655    // If calling thread is the main thread, the process must be deleted.
  • trunk/kernel/syscalls/sys_timeofday.c

    r626 r635  
    7171printk("\n[ERROR] in %s : user buffer tz unmapped / thread %x / process %x\n",
    7272__FUNCTION__ , (intptr_t)tz , this->trdid , process->pid );
    73 hal_vmm_display( process , false );
    7473#endif
    7574        this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_wait.c

    r626 r635  
    6969printk("\n[ERROR] in %s : status buffer %x unmapped for thread[%x,%x]\n",
    7070__FUNCTION__ , (intptr_t)status, pid, this->trdid );
    71 hal_vmm_display( process , false );
    7271#endif
    7372        this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_write.c

    r625 r635  
    106106printk("\n[ERROR] in %s : thread[%x,%x] user buffer unmapped %x\n",
    107107__FUNCTION__ , process->pid, this->trdid, (intptr_t)vaddr );
    108 hal_vmm_display( process , false );
    109108#endif
    110109                this->errno = EINVAL;
Note: See TracChangeset for help on using the changeset viewer.