Ignore:
Timestamp:
Mar 7, 2018, 9:02:03 AM (6 years ago)
Author:
alain
Message:

1) improve the threads and process destruction mechanism.
2) introduce FIFOs in the soclib_tty driver.

File:
1 edited

Legend:

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

    r433 r436  
    237237{
    238238    xptr_t      root_xp;       // xptr on root of list of processes in owner cluster
    239     xptr_t      lock_xp;       // xptrr on lock protecting this list
     239    xptr_t      lock_xp;       // xptr on lock protecting this list
    240240    xptr_t      iter_xp;       // iterator
    241241    xptr_t      current_xp;    // xptr on current process descriptor
     
    277277    if( found ) return current_xp;
    278278    else        return XPTR_NULL;
    279 }
     279
     280}  // end cluster_get_owner_process_from_pid()
    280281
    281282//////////////////////////////////////////////////////////
     
    440441void cluster_process_copies_link( process_t * process )
    441442{
    442     uint32_t irq_state;
     443    reg_t    irq_state;
    443444    pmgr_t * pm = &LOCAL_CLUSTER->pmgr;
     445
     446#if CONFIG_DEBUG_CLUSTER_PROCESS_COPIES
     447uint32_t cycle = (uint32_t)hal_get_cycles();
     448if( CONFIG_DEBUG_CLUSTER_PROCESS_COPIES < cycle )
     449printk("\n[DBG] %s enters / cluster %x / process %x / cycle %d\n",
     450__FUNCTION__ , local_cxy , process , cycle );
     451#endif
    444452
    445453    // get owner cluster identifier CXY and process LPID
     
    460468    remote_spinlock_lock_busy( copies_lock , &irq_state );
    461469
     470    // add copy to copies_list
    462471    xlist_add_first( copies_root , copies_entry );
    463472    hal_remote_atomic_add( XPTR( owner_cxy , &pm->copies_nr[lpid] ) , 1 );
     
    465474    // release lock protecting copies_list[lpid]
    466475    remote_spinlock_unlock_busy( copies_lock , irq_state );
    467 }
     476
     477#if CONFIG_DEBUG_CLUSTER_PROCESS_COPIES
     478cycle = (uint32_t)hal_get_cycles();
     479if( CONFIG_DEBUG_CLUSTER_PROCESS_COPIES < cycle )
     480printk("\n[DBG] %s exit / cluster %x / process %x / cycle %d\n",
     481__FUNCTION__ , local_cxy , process , cycle );
     482#endif
     483
     484}  // end cluster_process_copies_link()
    468485
    469486/////////////////////////////////////////////////////////
     
    472489    uint32_t irq_state;
    473490    pmgr_t * pm = &LOCAL_CLUSTER->pmgr;
     491
     492#if CONFIG_DEBUG_CLUSTER_PROCESS_COPIES
     493uint32_t cycle = (uint32_t)hal_get_cycles();
     494if( CONFIG_DEBUG_CLUSTER_PROCESS_COPIES < cycle )
     495printk("\n[DBG] %s enters / cluster %x / process %x / cycle %d\n",
     496__FUNCTION__ , local_cxy , process , cycle );
     497#endif
    474498
    475499    // get owner cluster identifier CXY and process LPID
     
    479503
    480504    // get extended pointer on lock protecting copies_list[lpid]
    481     xptr_t copies_lock  = hal_remote_lwd( XPTR( owner_cxy , &pm->copies_lock[lpid] ) );
     505    xptr_t copies_lock  = XPTR( owner_cxy , &pm->copies_lock[lpid] );
    482506
    483507    // get extended pointer on the local copies_list entry
     
    487511    remote_spinlock_lock_busy( copies_lock , &irq_state );
    488512
     513    // remove copy from copies_list
    489514    xlist_unlink( copies_entry );
    490515    hal_remote_atomic_add( XPTR( owner_cxy , &pm->copies_nr[lpid] ) , -1 );
     
    492517    // release lock protecting copies_list[lpid]
    493518    remote_spinlock_unlock_busy( copies_lock , irq_state );
    494 }
     519
     520#if CONFIG_DEBUG_CLUSTER_PROCESS_COPIES
     521cycle = (uint32_t)hal_get_cycles();
     522if( CONFIG_DEBUG_CLUSTER_PROCESS_COPIES < cycle )
     523printk("\n[DBG] %s exit / cluster %x / process %x / cycle %d\n",
     524__FUNCTION__ , local_cxy , process , cycle );
     525#endif
     526
     527}  // end cluster_process_copies_unlink()
    495528
    496529///////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.