validate_guest_pt_write(), by calling sh_validate_guest_entry(), already guarantees the needed update of log-dirty information. Move the operation into the sole code path needing it (when SHOPT_SKIP_VERIFY is enabled), making clear that only one such call is needed.
Signed-off-by: Jan Beulich <jbeul...@suse.com> --- a/xen/arch/x86/mm/shadow/hvm.c +++ b/xen/arch/x86/mm/shadow/hvm.c @@ -656,6 +656,7 @@ static void sh_emulate_unmap_dest(struct { /* Writes with this alignment constraint can't possibly cross pages. */ ASSERT(!mfn_valid(sh_ctxt->mfn[1])); + paging_mark_dirty(v->domain, sh_ctxt->mfn[0]); } else #endif /* SHADOW_OPTIMIZATIONS & SHOPT_SKIP_VERIFY */ @@ -673,12 +674,10 @@ static void sh_emulate_unmap_dest(struct validate_guest_pt_write(v, sh_ctxt->mfn[1], addr + b1, b2); } - paging_mark_dirty(v->domain, sh_ctxt->mfn[0]); put_page(mfn_to_page(sh_ctxt->mfn[0])); if ( unlikely(mfn_valid(sh_ctxt->mfn[1])) ) { - paging_mark_dirty(v->domain, sh_ctxt->mfn[1]); put_page(mfn_to_page(sh_ctxt->mfn[1])); vunmap((void *)((unsigned long)addr & PAGE_MASK)); }