Changeset 6b6626d3 in mainline


Ignore:
Timestamp:
2010-04-28T19:45:46Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6e121b8
Parents:
a3900cc
Message:

Replace sysinfo_lock spinlock with a mutex.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/sysinfo/sysinfo.c

    ra3900cc r6b6626d3  
    3737#include <print.h>
    3838#include <syscall/copy.h>
    39 #include <synch/spinlock.h>
     39#include <synch/mutex.h>
    4040#include <arch/asm.h>
    4141#include <errno.h>
     
    5252static slab_cache_t *sysinfo_item_slab;
    5353
    54 /** Sysinfo spinlock */
    55 SPINLOCK_STATIC_INITIALIZE_NAME(sysinfo_lock, "sysinfo_lock");
     54/** Sysinfo lock */
     55static mutex_t sysinfo_lock;
    5656
    5757/** Sysinfo item constructor
     
    9898            sizeof(sysinfo_item_t), 0, sysinfo_item_constructor,
    9999            sysinfo_item_destructor, SLAB_CACHE_MAGDEFERRED);
     100
     101        mutex_initialize(&sysinfo_lock, MUTEX_ACTIVE);
    100102}
    101103
     
    300302        /* Protect sysinfo tree consistency */
    301303        ipl_t ipl = interrupts_disable();
    302         spinlock_lock(&sysinfo_lock);
     304        mutex_lock(&sysinfo_lock);
    303305       
    304306        if (root == NULL)
     
    311313        }
    312314       
    313         spinlock_unlock(&sysinfo_lock);
     315        mutex_unlock(&sysinfo_lock);
    314316        interrupts_restore(ipl);
    315317}
     
    333335        /* Protect sysinfo tree consistency */
    334336        ipl_t ipl = interrupts_disable();
    335         spinlock_lock(&sysinfo_lock);
     337        mutex_lock(&sysinfo_lock);
    336338       
    337339        if (root == NULL)
     
    345347        }
    346348       
    347         spinlock_unlock(&sysinfo_lock);
     349        mutex_unlock(&sysinfo_lock);
    348350        interrupts_restore(ipl);
    349351}
     
    362364        /* Protect sysinfo tree consistency */
    363365        ipl_t ipl = interrupts_disable();
    364         spinlock_lock(&sysinfo_lock);
     366        mutex_lock(&sysinfo_lock);
    365367       
    366368        if (root == NULL)
     
    373375        }
    374376       
    375         spinlock_unlock(&sysinfo_lock);
     377        mutex_unlock(&sysinfo_lock);
    376378        interrupts_restore(ipl);
    377379}
     
    395397        /* Protect sysinfo tree consistency */
    396398        ipl_t ipl = interrupts_disable();
    397         spinlock_lock(&sysinfo_lock);
     399        mutex_lock(&sysinfo_lock);
    398400       
    399401        if (root == NULL)
     
    406408        }
    407409       
    408         spinlock_unlock(&sysinfo_lock);
     410        mutex_unlock(&sysinfo_lock);
    409411        interrupts_restore(ipl);
    410412}
     
    421423        /* Protect sysinfo tree consistency */
    422424        ipl_t ipl = interrupts_disable();
    423         spinlock_lock(&sysinfo_lock);
     425        mutex_lock(&sysinfo_lock);
    424426       
    425427        if (root == NULL)
     
    430432                item->val_type = SYSINFO_VAL_UNDEFINED;
    431433       
    432         spinlock_unlock(&sysinfo_lock);
     434        mutex_unlock(&sysinfo_lock);
    433435        interrupts_restore(ipl);
    434436}
     
    447449        /* Protect sysinfo tree consistency */
    448450        ipl_t ipl = interrupts_disable();
    449         spinlock_lock(&sysinfo_lock);
     451        mutex_lock(&sysinfo_lock);
    450452       
    451453        if (root == NULL)
     
    461463        }
    462464       
    463         spinlock_unlock(&sysinfo_lock);
     465        mutex_unlock(&sysinfo_lock);
    464466        interrupts_restore(ipl);
    465467}
     
    480482 *
    481483 * Should be called with interrupts disabled
    482  * and sysinfo_lock held. Because this routine
    483  * might take a reasonable long time to proceed,
    484  * having the spinlock held is not optimal, but
    485  * there is no better simple solution.
     484 * and sysinfo_lock held.
    486485 *
    487486 * @param root  Root item of the current (sub)tree.
     
    560559           while we are dumping it */
    561560        ipl_t ipl = interrupts_disable();
    562         spinlock_lock(&sysinfo_lock);
     561        mutex_lock(&sysinfo_lock);
    563562       
    564563        if (root == NULL)
     
    567566                sysinfo_dump_internal(root, 0);
    568567       
    569         spinlock_unlock(&sysinfo_lock);
     568        mutex_unlock(&sysinfo_lock);
    570569        interrupts_restore(ipl);
    571570}
     
    660659                 */
    661660                ipl_t ipl = interrupts_disable();
    662                 spinlock_lock(&sysinfo_lock);
     661                mutex_lock(&sysinfo_lock);
    663662                ret = sysinfo_get_item(path, NULL, dry_run);
    664                 spinlock_unlock(&sysinfo_lock);
     663                mutex_unlock(&sysinfo_lock);
    665664                interrupts_restore(ipl);
    666665        }
Note: See TracChangeset for help on using the changeset viewer.