[opensuse-factory] Xen domU startup fails on 2.6.20 (patch attached)
Xen domains cannot be started on the 2.6.20.2-2 SuSE kernel - they crash immediately after xm create. This happens no matter what Xen hypervisor version is in use, but it's new to 2.6.20. I've attached a patch to privcmd.c to fix this problem. When the Xen tools try to copy the kernel image and page tables to a new domU, the IOCTL_PRIVCMD_MMAP is used to mmap the domain's pages into xend. Unfortunately, some changes to the page flags in 2.6.20 cause the kernel to configure the mapping of the foreign domain's pages as a copy-on-write private mapping (despite MAP_SHARED being used). This means the domain builder never actually modifies the physical pages, even though it thinks everything is fine. The patch is simple: add VM_INSERTPAGE to the page flags in privcmd_mmap(). This forces vma_wants_writenotify() to leave the page alone, rather than marking it read only to trigger a copy-on-write. I don't think this has any side effects other than telling the kernel not to mess with the PTE bits after we set them. --- linux-2.6.20-mtyrel/drivers/xen/privcmd/privcmd.c.orig 2007-03-17 02:37:32.929101000 -0400 +++ linux-2.6.20-mtyrel/drivers/xen/privcmd/privcmd.c 2007-03-17 02:42:26.890256006 -0400 @@ -234,8 +234,15 @@ if (xen_feature(XENFEAT_auto_translated_physmap)) return -ENOSYS; - /* DONTCOPY is essential for Xen as copy_page_range is broken. */ - vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY; + /* + * DONTCOPY is essential for Xen as copy_page_range is broken. + * + * INSERTPAGE is needed to prevent vma_wants_writenotify from + * marking the page read-only so as to trap initial write attempts. + * The kernel gets very confused with foreign domain pages and + * erroneously tries to make a copy-on-write duplicate. + */ + vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY | VM_INSERTPAGE; vma->vm_ops = &privcmd_vm_ops; vma->vm_private_data = NULL; - Matt ------------------------------------------------------- Matt T. Yourst yourst@cs.binghamton.edu Binghamton University, Department of Computer Science -------------------------------------------------------
"Matt T. Yourst"
Xen domains cannot be started on the 2.6.20.2-2 SuSE kernel - they crash immediately after xm create. This happens no matter what Xen hypervisor version is in use, but it's new to 2.6.20.
I've attached a patch to privcmd.c to fix this problem.
Thanks. I suggest to file a bugreport in bugzilla against Xen as well so that this one does not get lost, Andreas -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj/ SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) Maxfeldstr. 5, 90409 Nürnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
participants (2)
-
Andreas Jaeger
-
Matt T. Yourst