Difference between revisions of "Linux PVH"

From Xen
m
Line 2: Line 2:
  
 
The only things needed to make this work as PVH are:
 
The only things needed to make this work as PVH are:
* Get the latest version of Xen and compile/install it. See [http://wiki.xen.org/wiki/Compiling_Xen_From_Source]for details or [http://wiki.xen.org/wiki/Xen_4.4_RC3_test_instructions]
+
* Get the latest version of Xen (4.10 at least) and compile/install it. See [http://wiki.xen.org/wiki/Compiling_Xen_From_Source]for details
  
* Get the latest version of Linux, see [http://wiki.xenproject.org/wiki/Mainline_Linux_Kernel_Configs#Configuring_the_Kernel] for details. The steps are:
+
* Get the latest version of Linux (or a reasonable recent one, at least 4.11 is required), see [http://wiki.xenproject.org/wiki/Mainline_Linux_Kernel_Configs#Configuring_the_Kernel] for details. The steps are:
  
 
  cd $HOME
 
  cd $HOME
Line 16: Line 16:
 
   make menuconfig
 
   make menuconfig
  
Where one will select <code>Processor type and features ---> Linux guest support --->Support for running as a PVH guest (NEW)</code>
+
Where one will select <code>Processor type and features ---> Linux guest support --->Support for running as a PVH guest</code>
 +
 
 +
This entry requires <code>Processor type and features ---> Linux guest support --->Xen PVHVM guest support</code> to be set.
 
** Or from scratch:
 
** Or from scratch:
 
  make localmodconfig
 
  make localmodconfig
 
You should see:
 
You should see:
''"Support for running as a PVH guest (XEN_PVH) [N/y] (NEW)"''
+
''"Support for running as a PVH guest (XEN_PVH) [N/y]"''
 
In case you missed it:
 
In case you missed it:
 
  make menuconfig
 
  make menuconfig
 
<code>Processor type and features ---> Linux guest support --->
 
<code>Processor type and features ---> Linux guest support --->
 
Xen guest support </code> (selecting that will now show you):
 
Xen guest support </code> (selecting that will now show you):
<code>Support for running as a PVH guest (NEW)</code>
+
<code>Support for running as a PVH guest</code>
 
** If you prefer to edit .config, these should be enabled:
 
** If you prefer to edit .config, these should be enabled:
 
  CONFIG_HYPERVISOR_GUEST=y
 
  CONFIG_HYPERVISOR_GUEST=y
Line 32: Line 34:
 
  CONFIG_PARAVIRT_SPINLOCKS=y
 
  CONFIG_PARAVIRT_SPINLOCKS=y
 
  CONFIG_XEN=y
 
  CONFIG_XEN=y
 +
CONFIG_XEN_PVHVM=y
 
  CONFIG_XEN_PVH=y
 
  CONFIG_XEN_PVH=y
 
You will also have to enable the block, network drivers, console, etc which are in different submenus.
 
You will also have to enable the block, network drivers, console, etc which are in different submenus.
Line 37: Line 40:
 
  make modules_install &amp;&amp; install
 
  make modules_install &amp;&amp; install
 
is suffice. It should generate the initramfs.cpio.gz and the kernel and stash them in /boot directory.
 
is suffice. It should generate the initramfs.cpio.gz and the kernel and stash them in /boot directory.
* Launch it with '''pvh=1''' in your guest config (for example):
+
* Launch it with '''type="pvh"''' in your guest config (for example):
  extra="console=hvc0 debug kgdboc=hvc0 nokgdbroundup initcall_debug debug"
+
  extra="console=hvc0 earlyprintk=xen initcall_debug debug"
  kernel="/boot/vmlinuz-3.13+"
+
  kernel="/boot/vmlinuz-4.14+"
  ramdisk="/boot/initramfs-3.13+.cpio.gz"
+
  ramdisk="/boot/initramfs-4.14+.cpio.gz"
 
  memory=1024
 
  memory=1024
 
  vcpus=4
 
  vcpus=4
Line 47: Line 50:
 
  vfb = [ 'vnc=1, vnclisten=0.0.0.0,vncunused=1']
 
  vfb = [ 'vnc=1, vnclisten=0.0.0.0,vncunused=1']
 
  disk=['phy:/dev/sdb1,xvda,w']
 
  disk=['phy:/dev/sdb1,xvda,w']
  pvh=1
+
  type="pvh"
 
  on_reboot="preserve"
 
  on_reboot="preserve"
 
  on_crash="preserve"
 
  on_crash="preserve"
Line 53: Line 56:
  
 
using 'xl'. Xend 'xm' does not have PVH support.
 
using 'xl'. Xend 'xm' does not have PVH support.
 
It will bootup as a normal PV guest, but 'xen-detect' will report it as an HVM guest.
 
  
 
= Items that have not been tested extensively or at all: =
 
= Items that have not been tested extensively or at all: =
  
 
* Migration (xl save &amp;&amp; xl restore for example).
 
* Migration (xl save &amp;&amp; xl restore for example).
* 32-bit guests (won't even present you with a CONFIG_XEN_PVH option)
 
 
* PCI passthrough
 
* PCI passthrough
* Running it in dom0 mode (as the patches for that are not yet in Xen upstream). If you want to try that, you can merge/pull Mukesh's branch:
+
* Running it in dom0 mode (as the patches for that are not yet in Xen upstream).
 
 
cd $HOME/xen
 
git pull git://oss.oracle.com/git/mrathor/xen.git dom0pvh-v7
 
 
 
And use on the Xen command line the '''dom0pvh=1''' bootup parameter. Remember to recompile and install the new version of Xen. The patches in Linux do not contain the necessary code to setup guests.
 
 
* Memory ballooning
 
* Memory ballooning
* Multiple VBDs, NICs, etc.
 
  
 
== Things that are broken: ==
 
== Things that are broken: ==
 
* CPUID filtering. There are no filtering done at all which means that certain cpuid flags are exposed to the guest. The x2apic will cause a crash if the NMI handler is invoked. The APERF will cause inferior scheduling decisions.
 
* Does not work with AMD hardware.
 
* Does not work with 32-bit guests.
 
  
 
If you encounter errors, please email with the following (please note that the guest config has ''on_reboot="preserve"'', ''on_crash="preserve"'' - which you should have in your guest config to contain the memory of the guest):
 
If you encounter errors, please email with the following (please note that the guest config has ''on_reboot="preserve"'', ''on_crash="preserve"'' - which you should have in your guest config to contain the memory of the guest):

Revision as of 06:19, 12 December 2017

PVH and Linux

The only things needed to make this work as PVH are:

  • Get the latest version of Xen (4.10 at least) and compile/install it. See [1]for details
  • Get the latest version of Linux (or a reasonable recent one, at least 4.11 is required), see [2] for details. The steps are:
cd $HOME
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux
  • Compile with CONFIG_XEN_PVH=y:
    • Based on your current distro.
 cp /boot/config-`uname -r `$HOME/linux/.config
 make menuconfig

Where one will select Processor type and features ---> Linux guest support --->Support for running as a PVH guest

This entry requires Processor type and features ---> Linux guest support --->Xen PVHVM guest support to be set.

    • Or from scratch:
make localmodconfig

You should see: "Support for running as a PVH guest (XEN_PVH) [N/y]" In case you missed it:

make menuconfig

Processor type and features ---> Linux guest support ---> Xen guest support (selecting that will now show you): Support for running as a PVH guest

    • If you prefer to edit .config, these should be enabled:
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_PARAVIRT_GUEST=y
CONFIG_PARAVIRT_SPINLOCKS=y
CONFIG_XEN=y
CONFIG_XEN_PVHVM=y
CONFIG_XEN_PVH=y

You will also have to enable the block, network drivers, console, etc which are in different submenus.

  • Install it. Usually doing:
make modules_install && install

is suffice. It should generate the initramfs.cpio.gz and the kernel and stash them in /boot directory.

  • Launch it with type="pvh" in your guest config (for example):
extra="console=hvc0 earlyprintk=xen initcall_debug debug"
kernel="/boot/vmlinuz-4.14+"
ramdisk="/boot/initramfs-4.14+.cpio.gz"
memory=1024
vcpus=4
name="pvh"
vif = [ 'mac=00:0F:4B:00:00:68' ]
vfb = [ 'vnc=1, vnclisten=0.0.0.0,vncunused=1']
disk=['phy:/dev/sdb1,xvda,w']
type="pvh"
on_reboot="preserve"
on_crash="preserve"
on_poweroff="preserve

using 'xl'. Xend 'xm' does not have PVH support.

Items that have not been tested extensively or at all:

  • Migration (xl save && xl restore for example).
  • PCI passthrough
  • Running it in dom0 mode (as the patches for that are not yet in Xen upstream).
  • Memory ballooning

Things that are broken:

If you encounter errors, please email with the following (please note that the guest config has on_reboot="preserve", on_crash="preserve" - which you should have in your guest config to contain the memory of the guest):

  • xl dmesg
  • xl list
  • xenctx -s $HOME/linux/System.map -f -a -C <domain id>

(xenctx is sometimes found in /usr/lib/xen/bin/xenctx)

  • The console output from the guest
  • Anything else you can think off.

to xen-devel@lists.xenproject.org

Stash away your vmlinux file (it is too big to send via email) - as we might need it later on.

That is it!

Thank you!