# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 5f7398785e02a753d50c022b6dbe5a6983166f89
# Parent 29055c5ad51dabf44d855cdce41f192d2fe724aa
Don't unshadow when the shadow l2 is the current used shadow table.
Otherwise, when destroying the domain, if the current sl2 is unpinned
then the shadow page will be freed without accquire the shadow_lock.
This may also improve the performance due to avoiding uncessary
unshadow.
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@xxxxxxxxx>
diff -r 29055c5ad51d -r 5f7398785e02 xen/arch/x86/shadow.c
--- a/xen/arch/x86/shadow.c Thu Dec 8 14:18:13 2005
+++ b/xen/arch/x86/shadow.c Thu Dec 8 14:21:36 2005
@@ -1450,6 +1450,7 @@
int changed;
u32 min_max_shadow, min_max_snapshot;
int min_shadow, max_shadow, min_snapshot, max_snapshot;
+ struct vcpu *v;
ASSERT(shadow_lock_is_acquired(d));
@@ -1739,6 +1740,9 @@
if ( unlikely(unshadow) )
{
+ for_each_vcpu(d, v)
+ if(smfn == pagetable_get_pfn(v->arch.shadow_table))
+ return need_flush;
perfc_incrc(unshadow_l2_count);
shadow_unpin(smfn);
#if CONFIG_PAGING_LEVELS == 2
diff -r 29055c5ad51d -r 5f7398785e02 xen/arch/x86/shadow32.c
--- a/xen/arch/x86/shadow32.c Thu Dec 8 14:18:13 2005
+++ b/xen/arch/x86/shadow32.c Thu Dec 8 14:21:36 2005
@@ -2326,6 +2326,7 @@
int changed;
u32 min_max_shadow, min_max_snapshot;
int min_shadow, max_shadow, min_snapshot, max_snapshot;
+ struct vcpu *v;
ASSERT(shadow_lock_is_acquired(d));
@@ -2527,6 +2528,9 @@
if ( unlikely(unshadow) )
{
+ for_each_vcpu(d, v)
+ if(smfn == pagetable_get_pfn(v->arch.shadow_table))
+ return need_flush;
perfc_incrc(unshadow_l2_count);
shadow_unpin(smfn);
if ( unlikely(shadow_mode_external(d)) )
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|