VMX: delay p2m insertion of APIC access page
authorJan Beulich <jbeulich@suse.com>
Fri, 26 Feb 2021 09:18:59 +0000 (10:18 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 26 Feb 2021 09:18:59 +0000 (10:18 +0100)
commit68b92ee7fef27f85846ef892e3d2e1763807b72d
treea3aa7903653abd20e000565f6faefae9f3ad3851
parentfc8fb368515391374e5f170a1e07205d914bc14a
VMX: delay p2m insertion of APIC access page

Inserting the mapping at domain creation time leads to a memory leak
when the creation fails later on and the domain uses separate CPU and
IOMMU page tables - the latter requires intermediate page tables to be
allocated, but there's no freeing of them at present in this case. Since
we don't need the p2m insertion to happen this early, avoid the problem
altogether by deferring it until the last possible point. This comes at
the price of not being able to handle an error other than by crashing
the domain.

Reported-by: Julien Grall <julien@xen.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
xen/arch/x86/domain.c
xen/arch/x86/hvm/vmx/vmx.c
xen/include/asm-x86/hvm/hvm.h