Changeset 879585a3 in mainline for kernel/arch/sparc64


Ignore:
Timestamp:
2007-03-31T22:22:50Z (19 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/arch/sparc64/src/mm/as.c

    r563c2dd r879585a3  
    4343#include <arch/mm/tsb.h>
    4444#include <arch/memstr.h>
    45 #include <synch/mutex.h>
    4645#include <arch/asm.h>
    4746#include <mm/frame.h>
     
    101100{
    102101#ifdef CONFIG_TSB
    103         ipl_t ipl;
    104 
    105         ipl = interrupts_disable();
    106         mutex_lock_active(&as->lock);   /* completely unnecessary, but polite */
    107102        tsb_invalidate(as, 0, (count_t) -1);
    108         mutex_unlock(&as->lock);
    109         interrupts_restore(ipl);
    110103#endif
    111104        return 0;
     
    124117       
    125118        /*
    126          * Note that we don't lock the address space.
    127          * That's correct - we can afford it here
    128          * because we only read members that are
    129          * currently read-only.
     119         * Note that we don't and may not lock the address space. That's ok
     120         * since we only read members that are currently read-only.
     121         *
     122         * Moreover, the as->asid is protected by asidlock, which is being held.
    130123         */
    131124       
    132125        /*
    133          * Write ASID to secondary context register.
    134          * The primary context register has to be set
    135          * from TL>0 so it will be filled from the
    136          * secondary context register from the TL=1
    137          * code just before switch to userspace.
     126         * Write ASID to secondary context register. The primary context
     127         * register has to be set from TL>0 so it will be filled from the
     128         * secondary context register from the TL=1 code just before switch to
     129         * userspace.
    138130         */
    139131        ctx.v = 0;
     
    185177
    186178        /*
    187          * Note that we don't lock the address space.
    188          * That's correct - we can afford it here
    189          * because we only read members that are
    190          * currently read-only.
     179         * Note that we don't and may not lock the address space. That's ok
     180         * since we only read members that are currently read-only.
     181         *
     182         * Moreover, the as->asid is protected by asidlock, which is being held.
    191183         */
    192184
Note: See TracChangeset for help on using the changeset viewer.