]> xenbits.xensource.com Git - xen.git/commit
x86: perform mem_sharing teardown before paging teardown
authorTamas K Lengyel <tamas@tklengyel.com>
Thu, 23 Feb 2023 11:35:48 +0000 (12:35 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 23 Feb 2023 11:35:48 +0000 (12:35 +0100)
commit2869349f0cb3a89dcbf1f1b30371f58df6309312
treeffcbb81bdd026a625bf7dd50f2aebaa66c8fcb5b
parentc15e2d4c1c93d3d1744501b7f938db4ca23ee5e1
x86: perform mem_sharing teardown before paging teardown

An assert failure has been observed in p2m_teardown when performing vm
forking and then destroying the forked VM (p2m-basic.c:173). The assert
checks whether the domain's shared pages counter is 0. According to the
patch that originally added the assert (7bedbbb5c31) the p2m_teardown
should only happen after mem_sharing already relinquished all shared pages.

In this patch we flip the order in which relinquish ops are called to avoid
tripping the assert. Conceptually sharing being torn down makes sense to
happen before paging is torn down.

Fixes: e7aa55c0aab3 ("x86/p2m: free the paging memory pool preemptively")
Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/domain.c