x86/p2m: add PoD accounting to set_typed_p2m_entry() While neither PoD together with pass-through nor PVH are currently supported we still shouldn't leave in place such latent issues. Signed-off-by: Jan Beulich Reviewed-by: Tim Deegan --- To apply cleanly this needs to have http://lists.xenproject.org/archives/html/xen-devel/2015-09/msg02719.html applied first. --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -941,10 +941,18 @@ static int set_typed_p2m_entry(struct do P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn, mfn_x(mfn)); rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access); - gfn_unlock(p2m, gfn, order); if ( rc ) gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n", gfn, order, rc, mfn_x(mfn)); + else if ( p2m_is_pod(ot) ) + { + pod_lock(p2m); + p2m->pod.entry_count -= 1UL << order; + BUG_ON(p2m->pod.entry_count < 0); + pod_unlock(p2m); + } + gfn_unlock(p2m, gfn, order); + return rc; }