linux/include/xen
Olaf Hering 00e37bdb01 xen PVonHVM: move shared_info to MMIO before kexec
Currently kexec in a PVonHVM guest fails with a triple fault because the
new kernel overwrites the shared info page. The exact failure depends on
the size of the kernel image. This patch moves the pfn from RAM into
MMIO space before the kexec boot.

The pfn containing the shared_info is located somewhere in RAM. This
will cause trouble if the current kernel is doing a kexec boot into a
new kernel. The new kernel (and its startup code) can not know where the
pfn is, so it can not reserve the page. The hypervisor will continue to
update the pfn, and as a result memory corruption occours in the new
kernel.

One way to work around this issue is to allocate a page in the
xen-platform pci device's BAR memory range. But pci init is done very
late and the shared_info page is already in use very early to read the
pvclock. So moving the pfn from RAM to MMIO is racy because some code
paths on other vcpus could access the pfn during the small   window when
the old pfn is moved to the new pfn. There is even a  small window were
the old pfn is not backed by a mfn, and during that time all reads
return -1.

Because it is not known upfront where the MMIO region is located it can
not be used right from the start in xen_hvm_init_shared_info.

To minimise trouble the move of the pfn is done shortly before kexec.
This does not eliminate the race because all vcpus are still online when
the syscore_ops will be called. But hopefully there is no work pending
at this point in time. Also the syscore_op is run last which reduces the
risk further.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
2012-07-19 15:52:05 -04:00
..
interface xen/pv-on-hvm kexec: shutdown watches from old kernel 2012-07-19 15:52:02 -04:00
acpi.h xen/acpi/sleep: Enable ACPI sleep via the __acpi_os_prepare_sleep 2012-05-07 15:33:18 -04:00
balloon.h xen-balloon: convert sysdev_class to a regular subsystem 2011-12-14 15:32:50 -08:00
events.h xen PVonHVM: move shared_info to MMIO before kexec 2012-07-19 15:52:05 -04:00
evtchn.h
features.h
gntalloc.h
gntdev.h
grant_table.h xenbus: Add support for xenbus backend in stub domain 2012-05-21 09:53:18 -04:00
hvc-console.h
hvm.h
Kbuild
page.h
platform_pci.h xen: Remove hanging references to CONFIG_XEN_PLATFORM_PCI 2011-11-16 12:13:42 -05:00
privcmd.h
swiotlb-xen.h X86 & IA64: adapt for dma_map_ops changes 2012-03-28 16:36:31 +02:00
tmem.h xen/tmem: cleanup 2012-03-20 15:34:18 -04:00
xen-ops.h Disintegrate asm/system.h for IA64 2012-03-28 18:30:02 +01:00
xen.h
xenbus_dev.h xenbus: Add support for xenbus backend in stub domain 2012-05-21 09:53:18 -04:00
xenbus.h include/ and checkpatch: prefer __scanf to __attribute__((format(scanf,...) 2012-03-23 16:58:36 -07:00
xencomm.h