Changeset 879585a3 in mainline for kernel/arch


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.

Location:
kernel/arch
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia64/src/mm/as.c

    r563c2dd r879585a3  
    3737#include <arch/mm/page.h>
    3838#include <genarch/mm/as_ht.h>
     39#include <genarch/mm/page_ht.h>
    3940#include <genarch/mm/asid_fifo.h>
    4041#include <mm/asid.h>
    41 #include <arch.h>
    4242#include <arch/barrier.h>
    43 #include <synch/spinlock.h>
    4443
    4544/** Architecture dependent address space init. */
     
    5655void as_install_arch(as_t *as)
    5756{
    58         ipl_t ipl;
    5957        region_register rr;
    6058        int i;
    61        
    62         ipl = interrupts_disable();
    63         spinlock_lock(&as->lock);
    6459       
    6560        ASSERT(as->asid != ASID_INVALID);
     
    8176        srlz_d();
    8277        srlz_i();
    83        
    84         spinlock_unlock(&as->lock);
    85         interrupts_restore(ipl);
    8678}
    8779
  • kernel/arch/mips32/src/mm/as.c

    r563c2dd r879585a3  
    3535#include <arch/mm/as.h>
    3636#include <genarch/mm/as_pt.h>
     37#include <genarch/mm/page_pt.h>
    3738#include <genarch/mm/asid_fifo.h>
    3839#include <arch/mm/tlb.h>
     
    4041#include <mm/as.h>
    4142#include <arch/cp0.h>
    42 #include <arch.h>
    4343
    4444/** Architecture dependent address space init. */
     
    5858{
    5959        entry_hi_t hi;
    60         ipl_t ipl;
    6160
    6261        /*
     
    6564        hi.value = cp0_entry_hi_read();
    6665
    67         ipl = interrupts_disable();
    68         spinlock_lock(&as->lock);
    6966        hi.asid = as->asid;
    7067        cp0_entry_hi_write(hi.value);   
    71         spinlock_unlock(&as->lock);
    72         interrupts_restore(ipl);
    7368}
    7469
  • kernel/arch/ppc32/src/mm/as.c

    r563c2dd r879585a3  
    5555{
    5656        asid_t asid;
    57         ipl_t ipl;
    5857        uint32_t sr;
    5958
    60         ipl = interrupts_disable();
    61         spinlock_lock(&as->lock);
    62        
    6359        asid = as->asid;
    6460       
     
    8076                );
    8177        }
    82        
    83         spinlock_unlock(&as->lock);
    84         interrupts_restore(ipl);
    8578}
    8679
  • kernel/arch/ppc64/src/mm/as.c

    r563c2dd r879585a3  
    2727 */
    2828
    29  /** @addtogroup ppc64mm
     29/** @addtogroup ppc64mm
    3030  * @{
    3131 */
     
    4242}
    4343
    44  /** @}
     44/** @}
    4545 */
    4646
  • 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.