diff options
author | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2003-10-14 17:48:21 +0000 |
---|---|---|
committer | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2003-10-14 17:48:21 +0000 |
commit | 66a8262e506a3436f5c54cf53289a4d7f87dc7db (patch) | |
tree | a9945fd746db5359c2d5c3109b6e967a23d25822 | |
parent | c9b8f195ee70cd1ae90a10cc3c1ae3bc62c5c93e (diff) | |
download | xen-66a8262e506a3436f5c54cf53289a4d7f87dc7db.tar.gz xen-66a8262e506a3436f5c54cf53289a4d7f87dc7db.tar.bz2 xen-66a8262e506a3436f5c54cf53289a4d7f87dc7db.zip |
bitkeeper revision 1.517 (3f8c36e5vjcydzKJknIC6-pAEW9YaA)
memory.c:
Fix deadlock bug introduced in previous changeset.
-rw-r--r-- | xen/common/memory.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/xen/common/memory.c b/xen/common/memory.c index 405bce903f..c9fd39bd31 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -213,22 +213,22 @@ void __init init_frametable(unsigned long nr_pages) } -static void __invalidate_shadow_ldt(void) +static void __invalidate_shadow_ldt(struct task_struct *p) { int i, cpu = smp_processor_id(); unsigned long pfn; struct pfn_info *page; - current->mm.shadow_ldt_mapcnt = 0; + p->mm.shadow_ldt_mapcnt = 0; for ( i = 16; i < 32; i++ ) { - pfn = l1_pgentry_to_pagenr(current->mm.perdomain_pt[i]); + pfn = l1_pgentry_to_pagenr(p->mm.perdomain_pt[i]); if ( pfn == 0 ) continue; - current->mm.perdomain_pt[i] = mk_l1_pgentry(0); + p->mm.perdomain_pt[i] = mk_l1_pgentry(0); page = frame_table + pfn; ASSERT((page->flags & PG_type_mask) == PGT_ldt_page); - ASSERT((page->flags & PG_domain_mask) == current->domain); + ASSERT((page->flags & PG_domain_mask) == p->domain); ASSERT((page->type_count != 0) && (page->tot_count != 0)); put_page_type(page); put_page_tot(page); @@ -242,8 +242,9 @@ static void __invalidate_shadow_ldt(void) static inline void invalidate_shadow_ldt(void) { - if ( current->mm.shadow_ldt_mapcnt != 0 ) - __invalidate_shadow_ldt(); + struct task_struct *p = current; + if ( p->mm.shadow_ldt_mapcnt != 0 ) + __invalidate_shadow_ldt(p); } @@ -252,11 +253,11 @@ int map_ldt_shadow_page(unsigned int off) { struct task_struct *p = current; unsigned long addr = p->mm.ldt_base + (off << PAGE_SHIFT); - unsigned long l1e, *ldt_page; + unsigned long l1e, *ldt_page, flags; struct pfn_info *page; int i, ret = -1; - spin_lock(&p->page_lock); + spin_lock_irqsave(&p->page_lock, flags); __get_user(l1e, (unsigned long *)(linear_pg_table+(addr>>PAGE_SHIFT))); if ( unlikely(!(l1e & _PAGE_PRESENT)) ) @@ -294,7 +295,7 @@ int map_ldt_shadow_page(unsigned int off) ret = 0; out: - spin_unlock(&p->page_lock); + spin_unlock_irqrestore(&p->page_lock, flags); return ret; } |