ia64/xen-unstable

changeset 835:6dfc4a422bbd

bitkeeper revision 1.517 (3f8c36e5vjcydzKJknIC6-pAEW9YaA)

memory.c:
Fix deadlock bug introduced in previous changeset.
author kaf24@scramble.cl.cam.ac.uk
date Tue Oct 14 17:48:21 2003 +0000 (2003-10-14)
parents d44118178696
children 4d5ff0cbdbfb
files xen/common/memory.c
line diff
     1.1 --- a/xen/common/memory.c	Tue Oct 14 15:27:17 2003 +0000
     1.2 +++ b/xen/common/memory.c	Tue Oct 14 17:48:21 2003 +0000
     1.3 @@ -213,22 +213,22 @@ void __init init_frametable(unsigned lon
     1.4  }
     1.5  
     1.6  
     1.7 -static void __invalidate_shadow_ldt(void)
     1.8 +static void __invalidate_shadow_ldt(struct task_struct *p)
     1.9  {
    1.10      int i, cpu = smp_processor_id();
    1.11      unsigned long pfn;
    1.12      struct pfn_info *page;
    1.13      
    1.14 -    current->mm.shadow_ldt_mapcnt = 0;
    1.15 +    p->mm.shadow_ldt_mapcnt = 0;
    1.16  
    1.17      for ( i = 16; i < 32; i++ )
    1.18      {
    1.19 -        pfn = l1_pgentry_to_pagenr(current->mm.perdomain_pt[i]);
    1.20 +        pfn = l1_pgentry_to_pagenr(p->mm.perdomain_pt[i]);
    1.21          if ( pfn == 0 ) continue;
    1.22 -        current->mm.perdomain_pt[i] = mk_l1_pgentry(0);
    1.23 +        p->mm.perdomain_pt[i] = mk_l1_pgentry(0);
    1.24          page = frame_table + pfn;
    1.25          ASSERT((page->flags & PG_type_mask) == PGT_ldt_page);
    1.26 -        ASSERT((page->flags & PG_domain_mask) == current->domain);
    1.27 +        ASSERT((page->flags & PG_domain_mask) == p->domain);
    1.28          ASSERT((page->type_count != 0) && (page->tot_count != 0));
    1.29          put_page_type(page);
    1.30          put_page_tot(page);                
    1.31 @@ -242,8 +242,9 @@ static void __invalidate_shadow_ldt(void
    1.32  
    1.33  static inline void invalidate_shadow_ldt(void)
    1.34  {
    1.35 -    if ( current->mm.shadow_ldt_mapcnt != 0 )
    1.36 -        __invalidate_shadow_ldt();
    1.37 +    struct task_struct *p = current;
    1.38 +    if ( p->mm.shadow_ldt_mapcnt != 0 )
    1.39 +        __invalidate_shadow_ldt(p);
    1.40  }
    1.41  
    1.42  
    1.43 @@ -252,11 +253,11 @@ int map_ldt_shadow_page(unsigned int off
    1.44  {
    1.45      struct task_struct *p = current;
    1.46      unsigned long addr = p->mm.ldt_base + (off << PAGE_SHIFT);
    1.47 -    unsigned long l1e, *ldt_page;
    1.48 +    unsigned long l1e, *ldt_page, flags;
    1.49      struct pfn_info *page;
    1.50      int i, ret = -1;
    1.51  
    1.52 -    spin_lock(&p->page_lock);
    1.53 +    spin_lock_irqsave(&p->page_lock, flags);
    1.54  
    1.55      __get_user(l1e, (unsigned long *)(linear_pg_table+(addr>>PAGE_SHIFT)));
    1.56      if ( unlikely(!(l1e & _PAGE_PRESENT)) )
    1.57 @@ -294,7 +295,7 @@ int map_ldt_shadow_page(unsigned int off
    1.58      ret = 0;
    1.59  
    1.60   out:
    1.61 -    spin_unlock(&p->page_lock);
    1.62 +    spin_unlock_irqrestore(&p->page_lock, flags);
    1.63      return ret;
    1.64  }
    1.65