xcp
xcp copied to clipboard
Buggy memory setup for guests when videoram > 16
Initially reported at https://xcp-ng.org/forum/topic/5302/videoram-32-and-almalinux: a VM with more than 16 MiB of videoram, in stdvga mode, with more than 3,78 GiB of RAM, crashes.
The root cause is that xenguest does not setup the guest memory properly in that case, as explained by @idruzhinin at https://xcp-ng.org/forum/post/44837.
The following patches would need to be fixed:
- https://github.com/xcp-ng-rpms/xen/blob/master/SOURCES/xenguest.patch
- https://github.com/xcp-ng-rpms/qemu/blob/master/SOURCES/allocate-vram-reserved.patch
XAPI also needs patching, according to this comment: "Patches to Xenguest/QEMU/Xapi (you will need to pass vram size to xenguest at VM start) are welcome."
The following patch to the xen RPM, by royger from Xen's IRC channel, could also help in debugging, as it will help see where the overlapping of memory regions is happening:
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 425c8ddd97..72fac1354a 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2960,10 +2960,14 @@ void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
const char *mode_str = guest_x86_mode_to_str(hvm_guest_x86_mode(curr));
const struct segment_register *cs =
hvmemul_get_seg_reg(x86_seg_cs, hvmemul_ctxt);
+ uint32_t pfec = PFEC_page_present;
+ unsigned long gfn = paging_gva_to_gfn(curr,
+ cs->base + hvmemul_ctxt->insn_buf_eip,
+ &pfec);
- printk("%s%s emulation failed (%d): %pv %s @ %04x:%08lx -> %*ph\n",
+ printk("%s%s emulation failed (%d): %pv %s @ %04x:%08lx (gfn: %#lx) -> %*ph\n",
loglvl, prefix, rc, curr, mode_str, cs->sel,
- hvmemul_ctxt->insn_buf_eip, hvmemul_ctxt->insn_buf_bytes,
+ hvmemul_ctxt->insn_buf_eip, gfn, hvmemul_ctxt->insn_buf_bytes,
hvmemul_ctxt->insn_buf);
}