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.

File:
1 edited

Legend:

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

    r633 r635  
    7272process_t * process_alloc( void )
    7373{
    74         kmem_req_t   req;
    75 
    76     req.type  = KMEM_PROCESS;
    77         req.size  = sizeof(process_t);
     74        kmem_req_t req;
     75
     76    req.type  = KMEM_KCM;
     77        req.order = bits_log2( sizeof(process_t) );
    7878        req.flags = AF_KERNEL;
    7979
    80     return (process_t *)kmem_alloc( &req );
     80    return kmem_alloc( &req );
    8181}
    8282
     
    8686    kmem_req_t  req;
    8787
    88         req.type = KMEM_PROCESS;
     88        req.type = KMEM_KCM;
    8989        req.ptr  = process;
    9090        kmem_free( &req );
     
    166166#endif
    167167
    168     // initialize VSL locks
     168    // initialize VSL lock
    169169        remote_rwlock_init( XPTR( local_cxy , &vmm->vsl_lock ) , LOCK_VMM_VSL );
    170170
    171     // register kernel vsegs in VMM as required by the architecture
     171    // register kernel vsegs in user process VMM as required by the architecture
    172172    error = hal_vmm_kernel_update( process );
    173173    if( error )
     
    179179#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
    180180if( DEBUG_PROCESS_REFERENCE_INIT < cycle )
    181 printk("\n[%s] thread[%x,%x] registered kernel vsegs for process %x\n",
     181printk("\n[%s] thread[%x,%x] registered kernel vsegs in VSL for process %x\n",
    182182__FUNCTION__, parent_pid, this->trdid, pid );
    183183#endif
     
    374374printk("\n[%s] thread[%x,%x] exit for process %x / cycle %d\n",
    375375__FUNCTION__, parent_pid, this->trdid, pid, cycle );
     376#endif
     377
     378#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
     379hal_vmm_display( parent_xp , false );
     380hal_vmm_display( XPTR( local_cxy , process ) , false );
    376381#endif
    377382
     
    10881093    }
    10891094}
     1095
    10901096////////////////////////////////////////////////////
    10911097error_t process_fd_register( xptr_t      process_xp,
     
    13561362
    13571363#if DEBUG_PROCESS_MAKE_FORK
    1358 uint32_t cycle   = (uint32_t)hal_get_cycles();
     1364uint32_t   cycle;
    13591365thread_t * this  = CURRENT_THREAD;
    13601366trdid_t    trdid = this->trdid;
    13611367pid_t      pid   = this->process->pid;
     1368#endif
     1369
     1370#if( DEBUG_PROCESS_MAKE_FORK & 1 )
     1371cycle   = (uint32_t)hal_get_cycles();
    13621372if( DEBUG_PROCESS_MAKE_FORK < cycle )
    13631373printk("\n[%s] thread[%x,%x] enter / cluster %x / cycle %d\n",
     
    13671377    // allocate a process descriptor
    13681378    process = process_alloc();
     1379
    13691380    if( process == NULL )
    13701381    {
     
    14271438printk("\n[%s] thread[%x,%x] copied VMM from parent to child / cycle %d\n",
    14281439__FUNCTION__, pid, trdid, cycle );
     1440hal_vmm_display( XPTR( local_cxy , process ) , true );
    14291441#endif
    14301442
     
    14381450cycle = (uint32_t)hal_get_cycles();
    14391451if( DEBUG_PROCESS_MAKE_FORK < cycle )
    1440 printk("\n[%s] thread[%x,%x] / child takes TXT ownership / cycle %d\n",
    1441 __FUNCTION__ , pid, trdid, cycle );
     1452printk("\n[%s] thread[%x,%x] / child_process %x takes TXT ownership / cycle %d\n",
     1453__FUNCTION__ , pid, trdid, new_pid, cycle );
    14421454#endif
    14431455
     
    14711483#endif
    14721484
    1473     // set COW flag in DATA, ANON, REMOTE vsegs for parent process VMM
     1485    // set COW flag in DATA, ANON, REMOTE vsegs in parent process VMM
    14741486    // this includes all parent process copies in all clusters
    14751487    if( parent_process_cxy == local_cxy )   // reference is local
     
    14891501cycle = (uint32_t)hal_get_cycles();
    14901502if( DEBUG_PROCESS_MAKE_FORK < cycle )
    1491 printk("\n[%s] thread[%x,%x] set COW in parent and child / cycle %d\n",
     1503printk("\n[%s] thread[%x,%x] set COW in DATA / ANON / REMOTE for parent and child / cycle %d\n",
    14921504__FUNCTION__, pid, trdid, cycle );
    14931505#endif
     
    15461558#if DEBUG_PROCESS_MAKE_EXEC
    15471559uint32_t cycle = (uint32_t)hal_get_cycles();
    1548 if( local_cxy == 0x11 )
     1560if( DEBUG_PROCESS_MAKE_EXEC < cycle )
    15491561printk("\n[%s] thread[%x,%x] enters for %s / cycle %d\n",
    15501562__FUNCTION__, pid, thread->trdid, path, cycle );
     
    15691581#if (DEBUG_PROCESS_MAKE_EXEC & 1)
    15701582cycle = (uint32_t)hal_get_cycles();
    1571 if( local_cxy == 0x11 )
     1583if( DEBUG_PROCESS_MAKE_EXEC < cycle )
    15721584printk("\n[%s] thread[%x,%x] opened file <%s> / cycle %d\n",
    15731585__FUNCTION__, pid, thread->trdid, path, cycle );
     
    15791591#if (DEBUG_PROCESS_MAKE_EXEC & 1)
    15801592cycle = (uint32_t)hal_get_cycles();
    1581 if( local_cxy == 0x11 )
     1593if( DEBUG_PROCESS_MAKE_EXEC < cycle )
    15821594printk("\n[%s] thread[%x,%x] deleted existing threads / cycle %d\n",
    15831595__FUNCTION__, pid, thread->trdid, cycle );
     
    15891601#if( DEBUG_PROCESS_MAKE_EXEC & 1 )
    15901602cycle = (uint32_t)hal_get_cycles();
    1591 if( local_cxy == 0x11 )
     1603if( DEBUG_PROCESS_MAKE_EXEC < cycle )
    15921604printk("\n[%s] thread[%x,%x] completed VMM reset / cycle %d\n",
    15931605__FUNCTION__, pid, thread->trdid, cycle );
     
    16061618#if( DEBUG_PROCESS_MAKE_EXEC & 1 )
    16071619cycle = (uint32_t)hal_get_cycles();
    1608 if( local_cxy == 0x11 )
     1620if( DEBUG_PROCESS_MAKE_EXEC < cycle )
    16091621printk("\n[%s] thread[%x,%x] registered args/envs vsegs / cycle %d\n",
    16101622__FUNCTION__, pid, thread->trdid, cycle );
     
    16241636#if( DEBUG_PROCESS_MAKE_EXEC & 1 )
    16251637cycle = (uint32_t)hal_get_cycles();
    1626 if( local_cxy == 0x11 )
     1638if( DEBUG_PROCESS_MAKE_EXEC < cycle )
    16271639printk("\n[%s] thread[%x,%x] registered code/data vsegs / cycle %d\n",
    16281640__FUNCTION__, pid, thread->trdid, cycle );
     
    16741686        hal_core_sleep();
    16751687    }
     1688
     1689#if (DEBUG_PROCESS_ZERO_CREATE & 1)
     1690if( DEBUG_PROCESS_ZERO_CREATE < cycle )
     1691printk("\n[%s] allocated pid %x in cluster %x\n", __FUNCTION__, pid, local_cxy );
     1692#endif
    16761693
    16771694    // initialize PID, REF_XP, PARENT_XP, and STATE
     
    16841701    process->term_state = 0;
    16851702
    1686     // initilise VSL as empty
     1703    // initialize VSL as empty
    16871704    vmm->vsegs_nr = 0;
    16881705        xlist_root_init( XPTR( local_cxy , &vmm->vsegs_root ) );
    16891706
    1690     // initialise GPT as empty
     1707#if (DEBUG_PROCESS_ZERO_CREATE & 1)
     1708if( DEBUG_PROCESS_ZERO_CREATE < cycle )
     1709printk("\n[%s] initialized VSL empty in cluster %x\n", __FUNCTION__, local_cxy );
     1710#endif
     1711
     1712    // initialize GPT as empty
    16911713    error = hal_gpt_create( &vmm->gpt );
     1714
    16921715    if( error )
    16931716    {
     
    16951718        hal_core_sleep();
    16961719    }
     1720
     1721#if (DEBUG_PROCESS_ZERO_CREATE & 1)
     1722if( DEBUG_PROCESS_ZERO_CREATE < cycle )
     1723printk("\n[%s] initialized GPT empty in cluster %x\n", __FUNCTION__, local_cxy );
     1724#endif
    16971725
    16981726    // initialize VSL and GPT locks
     
    17011729    // create kernel vsegs in GPT and VSL, as required by the hardware architecture
    17021730    error = hal_vmm_kernel_init( info );
     1731
    17031732    if( error )
    17041733    {
     
    17061735        hal_core_sleep();
    17071736    }
     1737
     1738#if (DEBUG_PROCESS_ZERO_CREATE & 1)
     1739if( DEBUG_PROCESS_ZERO_CREATE < cycle )
     1740printk("\n[%s] initialized hal specific VMM in cluster%x\n", __FUNCTION__, local_cxy );
     1741#endif
    17081742
    17091743    // reset th_tbl[] array and associated fields
     
    17161750    rwlock_init( &process->th_lock , LOCK_PROCESS_THTBL );
    17171751
     1752#if (DEBUG_PROCESS_ZERO_CREATE & 1)
     1753if( DEBUG_PROCESS_ZERO_CREATE < cycle )
     1754printk("\n[%s] initialized th_tbl[] in cluster%x\n", __FUNCTION__, local_cxy );
     1755#endif
    17181756
    17191757    // reset children list as empty
     
    17221760    remote_queuelock_init( XPTR( local_cxy , &process->children_lock ),
    17231761                           LOCK_PROCESS_CHILDREN );
     1762
     1763#if (DEBUG_PROCESS_ZERO_CREATE & 1)
     1764if( DEBUG_PROCESS_ZERO_CREATE < cycle )
     1765printk("\n[%s] initialized children list in cluster%x\n", __FUNCTION__, local_cxy );
     1766#endif
    17241767
    17251768    // register kernel process in cluster manager local_list
     
    17591802    // allocates memory for process descriptor from local cluster
    17601803        process = process_alloc();
     1804
     1805
    17611806    if( process == NULL )
    17621807    {
     
    18401885
    18411886#if (DEBUG_PROCESS_INIT_CREATE & 1)
    1842 hal_vmm_display( process , true );
     1887hal_vmm_display( XPTR( local_cxy , process ) , true );
    18431888#endif
    18441889
Note: See TracChangeset for help on using the changeset viewer.