mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
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@intel.com>
This commit is contained in:
1 parent
064a4d414b
commit
bc70813814
2 files changed
+8
No files matched your search
@@ -1450,6 +1450,7 @@ static int resync_all(struct domain *d, u32 stype)
|
||||
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 @@ static int resync_all(struct domain *d, u32 stype)
|
||||
|
||||
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
|
||||
|
||||
@@ -2326,6 +2326,7 @@ static int resync_all(struct domain *d, u32 stype)
|
||||
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 @@ static int resync_all(struct domain *d, u32 stype)
|
||||
|
||||
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)) )
|
||||
|
||||