]> xenbits.xensource.com Git - xen.git/commit
xen/x86: remove foreign mappings from the p2m on teardown
authorRoger Pau Monné <roger.pau@citrix.com>
Wed, 29 May 2024 14:11:19 +0000 (16:11 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 29 May 2024 14:11:19 +0000 (16:11 +0200)
commit845a60b63be11acfe435e2bd83ceebb0acc76d62
treef2ceca70f5201694b737df158954c4dc87d8af51
parent0291089f6ea81690f37035a124d54c51fa7ba097
xen/x86: remove foreign mappings from the p2m on teardown

Iterate over the p2m up to the maximum recorded gfn and remove any foreign
mappings, in order to drop the underlying page references and thus don't keep
extra page references if a domain is destroyed while still having foreign
mappings on it's p2m.

The logic is similar to the one used on Arm.

Note that foreign mappings cannot be created by guests that have altp2m or
nested HVM enabled, as p2ms different than the host one are not currently
scrubbed when destroyed in order to drop references to any foreign maps.

It's unclear whether the right solution is to take an extra reference when
foreign maps are added to p2ms different than the host one, or just rely on the
host p2m already having a reference.  The mapping being removed from the host
p2m should cause it to be dropped on all domain p2ms.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
CHANGELOG.md
xen/arch/x86/domain.c
xen/arch/x86/include/asm/p2m.h
xen/arch/x86/mm/p2m-basic.c
xen/arch/x86/mm/p2m.c