Changeset 567 for trunk/kernel/mm/kmem.c


Ignore:
Timestamp:
Oct 5, 2018, 12:01:52 AM (6 years ago)
Author:
alain
Message:

Complete restructuration of kernel locks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/kmem.c

    r551 r567  
    33 *
    44 * Authors  Ghassan Almaless (2008,2009,2010,2011,2012)
    5  *          Mohamed Lamine Karaoui (2015)
    6  *          Alain Greiner (2016)
     5 *          Alain Greiner (2016,2017,2018)
    76 *
    87 * Copyright (c) UPMC Sorbonne Universites
     
    2827#include <hal_special.h>
    2928#include <printk.h>
    30 #include <spinlock.h>
    31 #include <readlock.h>
     29#include <busylock.h>
    3230#include <memcpy.h>
    3331#include <khm.h>
     
    5149#include <kmem.h>
    5250
    53 ///////////////////////////
     51/////////////////////////////////
    5452void kmem_print_kcm_table( void )
    5553{
     
    168166        kcm_init( kcm , type );
    169167
    170         // register it if the KCM pointers Table
     168        // register it in the KCM pointers Table
    171169        cluster->kcm_tbl[type] = kcm;
    172170
     
    258256                if( cluster->kcm_tbl[type] == NULL )
    259257                {
    260                         spinlock_lock_busy( &cluster->kcm_lock, &irq_state );
     258            // get lock protecting local kcm_tbl[] array
     259                        busylock_acquire( &cluster->kcm_lock );
     260
     261            // create missing KCM
    261262                        error_t error = kmem_create_kcm( type );
    262                         spinlock_unlock_busy( &cluster->kcm_lock, irq_state );
    263                         if ( error ) return NULL;
     263
     264            // release lock protecting local kcm_tbl[] array
     265                        busylock_release( &cluster->kcm_lock );
     266
     267                        if ( error )
     268            {
     269                 printk("\n[ERROR] in %s : cannot create KCM type %d in cluster %x\n",
     270                 __FUNCTION__, type, local_cxy );
     271                 return NULL;
     272            }
    264273                }
    265274
     
    269278                {
    270279                        printk("\n[ERROR] in %s : failed for type %d / size %d in cluster %x\n",
    271                             __FUNCTION__ , type , size , local_cxy );
     280                    __FUNCTION__ , type , size , local_cxy );
    272281                        return NULL;
    273282                }
Note: See TracChangeset for help on using the changeset viewer.