From: Jan Beulich Date: Wed, 23 Sep 2015 09:14:05 +0000 (+0200) Subject: x86/p2m: add PoD accounting to set_typed_p2m_entry() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~2511 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=11d49fffb2cad84403d807200be3085d653c854c;p=xen.git 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 Reviewed-by: Andrew Cooper Acked-by: George Dunlap --- diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index e1d930a0af..87b6a16026 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -926,11 +926,19 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn, mfn_x(mfn)); rc = p2m_set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, gfn_p2mt, access); - gfn_unlock(p2m, gfn, 0); if ( rc ) gdprintk(XENLOG_ERR, "p2m_set_entry failed! mfn=%08lx rc:%d\n", mfn_x(get_gfn_query_unlocked(p2m->domain, gfn, &ot)), rc); + else if ( p2m_is_pod(ot) ) + { + pod_lock(p2m); + p2m->pod.entry_count--; + BUG_ON(p2m->pod.entry_count < 0); + pod_unlock(p2m); + } + gfn_unlock(p2m, gfn, 0); + return rc; }