revert "tools/libs/guest: fix max_pfn setting in map_p2m()"
authorJuergen Gross <jgross@suse.com>
Mon, 14 Jun 2021 12:39:52 +0000 (14:39 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 14 Jun 2021 12:39:52 +0000 (14:39 +0200)
The reasoning for commit 7bd8989ab77b6a ("tools/libs/guest: fix max_pfn
setting in map_p2m()") was wrong.

The max_pfn field in shared_info is misnamed, it has the semantics of
num_pfns, which is hidden at least partially in Linux, as the kernel is
(wrongly) treating it like the highest used pfn in some places.

So revert above commit.

Fixes: 7bd8989ab77b6a ("tools/libs/guest: fix max_pfn setting in map_p2m()")
Signed-off-by: Juergen Gross <jgross@suse.com>
tools/libs/guest/xg_sr_save_x86_pv.c

index dae7f2817f725361f36264be3c78a863f29c264a..4964f1f7b8e1ef903191ada130df6b6fd35fa5c1 100644 (file)
@@ -468,7 +468,7 @@ static int map_p2m(struct xc_sr_context *ctx)
 
     ctx->x86.pv.p2m_generation = ~0ULL;
     ctx->x86.pv.max_pfn = GET_FIELD(ctx->x86.pv.shinfo, arch.max_pfn,
-                                    ctx->x86.pv.width);
+                                    ctx->x86.pv.width) - 1;
     p2m_cr3 = GET_FIELD(ctx->x86.pv.shinfo, arch.p2m_cr3, ctx->x86.pv.width);
 
     return p2m_cr3 ? map_p2m_list(ctx, p2m_cr3) : map_p2m_tree(ctx);