Changeset 551 for trunk/kernel


Ignore:
Timestamp:
Sep 21, 2018, 10:24:34 PM (6 years ago)
Author:
nicolas.van.phan@…
Message:

Make locks before IDLE Init busy

Location:
trunk/kernel
Files:
5 edited

Legend:

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

    r500 r551  
    7878
    7979    // take lock protecting sheduler lists
    80     spinlock_lock( &sched->lock );
     80    uint32_t       irq_state;
     81    spinlock_lock_busy( &sched->lock, &irq_state );
    8182
    8283    if( type == THREAD_USER )
     
    9596    // release lock
    9697    hal_fence();
    97     spinlock_unlock( &sched->lock );
     98    spinlock_unlock_busy( &sched->lock, irq_state);
    9899
    99100}  // end sched_register_thread()
  • trunk/kernel/mm/kcm.c

    r492 r551  
    288288
    289289        // get lock
    290         spinlock_lock( &kcm->lock );
     290        uint32_t     irq_state;
     291        spinlock_lock_busy( &kcm->lock, &irq_state );
    291292
    292293        // get an active page
     
    298299                if( kcm_page == NULL )
    299300                {
    300                         spinlock_unlock( &kcm->lock );
     301                        spinlock_unlock_busy( &kcm->lock, irq_state );
    301302                        return NULL;
    302303                }
     
    318319
    319320        // release lock
    320         spinlock_unlock( &kcm->lock );
     321        spinlock_unlock_busy( &kcm->lock, irq_state );
    321322
    322323        return ptr;
  • trunk/kernel/mm/khm.c

    r492 r551  
    7878
    7979        // get lock protecting heap
    80         spinlock_lock( &khm->lock );
     80        uint32_t       irq_state;
     81        spinlock_lock_busy( &khm->lock, &irq_state );
    8182
    8283        // define a starting block to scan existing blocks
     
    9293                if( (intptr_t)current >= (khm->base + khm->size) )  // heap full
    9394                {
    94                         spinlock_unlock(&khm->lock);
     95                        spinlock_unlock_busy(&khm->lock, irq_state );
    9596
    9697                        printk("\n[ERROR] in %s : failed to allocate block of size %d\n",
     
    122123
    123124        // release lock protecting heap
    124         spinlock_unlock( &khm->lock );
     125        spinlock_unlock_busy( &khm->lock, irq_state );
    125126
    126127        return (char*)current + sizeof(khm_block_t);
  • trunk/kernel/mm/kmem.c

    r492 r551  
    192192        uint32_t    size;    // ln( pages ) if PPM / bytes if KHM / unused if KCM
    193193        void      * ptr;     // memory buffer if KHM or KCM / page descriptor if PPM
     194        uint32_t    irq_state;
    194195
    195196
     
    257258                if( cluster->kcm_tbl[type] == NULL )
    258259                {
    259                         spinlock_lock( &cluster->kcm_lock );
     260                        spinlock_lock_busy( &cluster->kcm_lock, &irq_state );
    260261                        error_t error = kmem_create_kcm( type );
    261                         spinlock_unlock( &cluster->kcm_lock );
     262                        spinlock_unlock_busy( &cluster->kcm_lock, irq_state );
    262263                        if ( error ) return NULL;
    263264                }
  • trunk/kernel/mm/ppm.c

    r492 r551  
    200200        page_t   * remaining_block;
    201201        uint32_t   current_size;
    202  
     202
    203203#if DEBUG_PPM_ALLOC_PAGES
    204204uint32_t cycle = (uint32_t)hal_get_cycles();
     
    221221
    222222        // take lock protecting free lists
    223         spinlock_lock( &ppm->free_lock );
     223        uint32_t       irq_state;
     224        spinlock_lock_busy( &ppm->free_lock, &irq_state );
    224225
    225226        // find a free block equal or larger to requested size
     
    237238        {
    238239                // release lock protecting free lists
    239                 spinlock_unlock( &ppm->free_lock );
     240                spinlock_unlock_busy( &ppm->free_lock, irq_state );
    240241
    241242#if DEBUG_PPM_ALLOC_PAGES
     
    273274
    274275        // release lock protecting free lists
    275         spinlock_unlock( &ppm->free_lock );
     276        spinlock_unlock_busy( &ppm->free_lock, irq_state );
    276277
    277278#if DEBUG_PPM_ALLOC_PAGES
Note: See TracChangeset for help on using the changeset viewer.