diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index 72f57180e7..49d9e06b67 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -3486,7 +3486,7 @@ int shadow_track_dirty_vram(struct domain *d, int flush_tlb = 0; unsigned long i; p2m_type_t t; - struct sh_dirty_vram *dirty_vram = d->arch.hvm_domain.dirty_vram; + struct sh_dirty_vram *dirty_vram; struct p2m_domain *p2m = p2m_get_hostp2m(d); if ( end_pfn < begin_pfn || end_pfn > p2m->max_mapped_pfn + 1 ) @@ -3496,6 +3496,8 @@ int shadow_track_dirty_vram(struct domain *d, p2m_lock(p2m_get_hostp2m(d)); paging_lock(d); + dirty_vram = d->arch.hvm_domain.dirty_vram; + if ( dirty_vram && (!nr || ( begin_pfn != dirty_vram->begin_pfn || end_pfn != dirty_vram->end_pfn )) ) diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h index 27b3de50dc..863b097060 100644 --- a/xen/include/asm-x86/hvm/domain.h +++ b/xen/include/asm-x86/hvm/domain.h @@ -73,7 +73,7 @@ struct hvm_domain { /* Memory ranges with pinned cache attributes. */ struct list_head pinned_cacheattr_ranges; - /* VRAM dirty support. */ + /* VRAM dirty support. Protect with the domain paging lock. */ struct sh_dirty_vram *dirty_vram; /* If one of vcpus of this domain is in no_fill_mode or