Skip to contentSkip to conversation

x86/mm: disallow mmu hypercalls for a dying domain

PATCH In review Kouya Shimura 2 participants 4 messages Nov 27, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mm: disallow mmu hypercalls for a dying domain

The race condition should be avoided for efficiency.

xen/arch/x86/mm.c +7 -0
diff -r ba68bb0d229c xen/arch/x86/mm.c
@@ -2537,6 +2537,13 @@ static struct domain *get_pg_owner(domid
             MEM_LOG("Unknown domain '%u'", domid);
             break;
         }
+        if ( unlikely(pg_owner->is_dying) )
+        {
+            MEM_LOG("Domain is dying");
+            rcu_unlock_domain(pg_owner);
+            pg_owner = NULL;
+            break;
+        }
         if ( !IS_PRIV_FOR(curr, pg_owner) )
         {
             MEM_LOG("Cannot set foreign dom");

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Since the check is made with no locks held, I don't think any race can be completely avoided here. I'm not sure the performance argument holds much water either -- this just looks like a pointless extra check.

-- Keir

Quoted 4 lines · Kouya Shimura

The race condition should be avoided for efficiency.

#2 lore raw

I observed that dom0 kept on issuing a mmu_update hypercall while the domain is dying. So I don't feel happy with it.
But I'm ok if the patch is dropped.

Thanks,
Kouya

Quoted 13 lines · Keir Fraser

Since the check is made with no locks held, I don't think any race can be completely avoided here. I'm not sure the performance argument holds much water either -- this just looks like a pointless extra check.

-- Keir

Quoted 4 lines · Kouya Shimura

The race condition should be avoided for efficiency.

#3 lore raw

Probably coming from dom0 userspace somewhere, such as qemu. By the time you get down to the hypercall implementation in Xen, you've already done the expensive traps via dom0 kernel.

-- Keir

Quoted 21 lines · Kouya Shimura

I observed that dom0 kept on issuing a mmu_update hypercall while the domain is dying. So I don't feel happy with it.
But I'm ok if the patch is dropped.

Thanks,
Kouya

Quoted 13 lines · Keir Fraser

Since the check is made with no locks held, I don't think any race can be completely avoided here. I'm not sure the performance argument holds much water either -- this just looks like a pointless extra check.

-- Keir

Quoted 4 lines · Kouya Shimura

The race condition should be avoided for efficiency.