Changeset 879585a3 in mainline for kernel/genarch/src/mm/asid.c


Ignore:
Timestamp:
2007-03-31T22:22:50Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
31d8e10
Parents:
563c2dd
Message:

Simplify synchronization in as_switch().
The function was oversynchronized, which
was causing deadlocks on the address
space mutex.

Now, address spaces can only be switched
when the asidlock is held. This also protects
stealing of ASIDs. No other synchronization
is necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/mm/asid.c

    r563c2dd r879585a3  
    6363#include <synch/spinlock.h>
    6464#include <synch/mutex.h>
    65 #include <arch.h>
    6665#include <adt/list.h>
    6766#include <debug.h>
    68 
    69 /**
    70  * asidlock protects the asids_allocated counter.
    71  */
    72 SPINLOCK_INITIALIZE(asidlock);
    7367
    7468static count_t asids_allocated = 0;
     
    9185         */
    9286       
    93         spinlock_lock(&asidlock);
    9487        if (asids_allocated == ASIDS_ALLOCABLE) {
    9588
     
    109102               
    110103                as = list_get_instance(tmp, as_t, inactive_as_with_asid_link);
    111                 mutex_lock_active(&as->lock);
    112104
    113105                /*
     
    131123                as_invalidate_translation_cache(as, 0, (count_t) -1);
    132124               
    133                 mutex_unlock(&as->lock);
    134 
    135125                /*
    136126                 * Get the system rid of the stolen ASID.
     
    157147        }
    158148       
    159         spinlock_unlock(&asidlock);
    160        
    161149        return asid;
    162150}
     
    171159void asid_put(asid_t asid)
    172160{
    173         ipl_t ipl;
    174 
    175         ipl = interrupts_disable();
    176         spinlock_lock(&asidlock);
    177 
    178161        asids_allocated--;
    179162        asid_put_arch(asid);
    180        
    181         spinlock_unlock(&asidlock);
    182         interrupts_restore(ipl);
    183163}
    184164
Note: See TracChangeset for help on using the changeset viewer.