[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-4.0-testing] x86_32: [un]map_domain_page() is now IRQ safe.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1285010201 -3600
# Node ID 59917443fc5090cd4833a2381e96c96001007b21
# Parent  09e971d829482ec045f309949e14ed1de938e845
x86_32: [un]map_domain_page() is now IRQ safe.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset:   22177:7405e0ddb912
xen-unstable date:        Sat Sep 18 08:57:15 2010 +0100
---
 xen/arch/x86/x86_32/domain_page.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff -r 09e971d82948 -r 59917443fc50 xen/arch/x86/x86_32/domain_page.c
--- a/xen/arch/x86/x86_32/domain_page.c Mon Sep 20 20:16:22 2010 +0100
+++ b/xen/arch/x86/x86_32/domain_page.c Mon Sep 20 20:16:41 2010 +0100
@@ -42,21 +42,21 @@ static inline struct vcpu *mapcache_curr
 
 void *map_domain_page(unsigned long mfn)
 {
-    unsigned long va;
-    unsigned int idx, i, flags;
+    unsigned long va, flags;
+    unsigned int idx, i;
     struct vcpu *v;
     struct mapcache_domain *dcache;
     struct mapcache_vcpu *vcache;
     struct vcpu_maphash_entry *hashent;
 
-    ASSERT(!in_irq());
-
     perfc_incr(map_domain_page_count);
 
     v = mapcache_current_vcpu();
 
     dcache = &v->domain->arch.mapcache;
     vcache = &v->arch.mapcache;
+
+    local_irq_save(flags);
 
     hashent = &vcache->hash[MAPHASH_HASHFN(mfn)];
     if ( hashent->mfn == mfn )
@@ -69,7 +69,7 @@ void *map_domain_page(unsigned long mfn)
         goto out;
     }
 
-    spin_lock_irqsave(&dcache->lock, flags);
+    spin_lock(&dcache->lock);
 
     /* Has some other CPU caused a wrap? We must flush if so. */
     if ( unlikely(dcache->epoch != vcache->shadow_epoch) )
@@ -105,11 +105,12 @@ void *map_domain_page(unsigned long mfn)
     set_bit(idx, dcache->inuse);
     dcache->cursor = idx + 1;
 
-    spin_unlock_irqrestore(&dcache->lock, flags);
+    spin_unlock(&dcache->lock);
 
     l1e_write(&dcache->l1tab[idx], l1e_from_pfn(mfn, __PAGE_HYPERVISOR));
 
  out:
+    local_irq_restore(flags);
     va = MAPCACHE_VIRT_START + (idx << PAGE_SHIFT);
     return (void *)va;
 }
@@ -119,10 +120,8 @@ void unmap_domain_page(const void *va)
     unsigned int idx;
     struct vcpu *v;
     struct mapcache_domain *dcache;
-    unsigned long mfn;
-    struct vcpu_maphash_entry *hashent;
-
-    ASSERT(!in_irq());
+    unsigned long mfn, flags;
+    struct vcpu_maphash_entry *hashent;
 
     ASSERT((void *)MAPCACHE_VIRT_START <= va);
     ASSERT(va < (void *)MAPCACHE_VIRT_END);
@@ -134,6 +133,8 @@ void unmap_domain_page(const void *va)
     idx = ((unsigned long)va - MAPCACHE_VIRT_START) >> PAGE_SHIFT;
     mfn = l1e_get_pfn(dcache->l1tab[idx]);
     hashent = &v->arch.mapcache.hash[MAPHASH_HASHFN(mfn)];
+
+    local_irq_save(flags);
 
     if ( hashent->idx == idx )
     {
@@ -163,6 +164,8 @@ void unmap_domain_page(const void *va)
         /* /Second/, mark as garbage. */
         set_bit(idx, dcache->garbage);
     }
+
+    local_irq_restore(flags);
 }
 
 void mapcache_domain_init(struct domain *d)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.