Skip to contentSkip to conversation

2.6.37 PV on HVM issues

DISCUSSION Alex Bligh 6 participants 26 messages Dec 2, 2010 – Jan 10, 2011

lore
Share & tools
lore

Alex Bligh

author
#0 lore raw

I'm running Ubuntu's current kernel from Natty which I believe to be 2.6.37-rc1, and hoping to get PV drivers on HVM working. I think I must be missing something as despite a helpful dmesg I can't actually see any PV devices (or think I can't).

I see this:

# uname -a ; dmesg | egrep -i '(pv|xen|hvm)'
Linux 109-231-66-11 2.6.37-7-virtual #19-Ubuntu SMP Wed Dec 1 02:15:20 UTC 2010 x86_64 GNU/Linux
[    0.000000] DMI: /HVM domU, BIOS 3.3.1 02/02/2009
[    0.000000] Hypervisor detected: Xen HVM       <-----********************
[    0.000000] Xen version 3.3.
[    0.000000] Xen Platform PCI: unrecognised magic value  <--- ++++++++++++
[    0.000000] HVMOP_pagetable_dying not supported
[    0.000000] ACPI: RSDP 00000000000ea010 00024 (v02    Xen)
[    0.000000] ACPI: XSDT 000000001fff8b70 00034 (v01    Xen      HVM 00000000 HVML 00000000)
[    0.000000] ACPI: FACP 000000001fff8a00 000F4 (v04    Xen      HVM 00000000 HVML 00000000)
[    0.000000] ACPI: DSDT 000000001fff7840 01132 (v02    Xen      HVM 00000000 INTL 20060707)
[    0.000000] ACPI: APIC 000000001fff8b00 00068 (v02    Xen      HVM 00000000 HVML 00000000)
[    0.000000] Booting paravirtualized kernel on Xen <---*******************
[    0.800582] Initialising Xen virtual ethernet driver.
[   13.980075] eth0: no IPv6 routers present

The lines marked with asterisks are confusing to me as they appear to be in contradiction.

Should I be worried about the line marked +++++?

Moreover, despite the line re "initialising Xen virtual ethernet driver" I see one ethernet device (eth0), and one block device (sda). I was expecting to see eth1 and either vbda or xvdba.

$ ls -lad /sys/block/sda
lrwxrwxrwx 1 root root 0 2010-12-02 14:18 /sys/block/sda -> ../devices/pci0000:00/0000:00:01.1/host0/target0:0:0/0:0:0:0/block/sda
$ ls -lad /sys/class/net/eth0
lrwxrwxrwx 1 root root 0 2010-12-02 14:03 /sys/class/net/eth0 -> ../../devices/pci0000:00/0000:00:04.0/net/eth0

This suggests they are not paravirtualised.

# egrep _XEN_ /boot/config-2.6.37-7-virtual
CONFIG_XEN_DOM0=y
CONFIG_XEN_PRIVILEGED_GUEST=y
CONFIG_XEN_PVHVM=y
CONFIG_XEN_MAX_DOMAIN_MEMORY=128
CONFIG_XEN_SAVE_RESTORE=y
# CONFIG_XEN_DEBUG_FS is not set
CONFIG_XEN_PCIDEV_FRONTEND=m
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
CONFIG_XEN_KBDDEV_FRONTEND=m
CONFIG_XEN_FBDEV_FRONTEND=m
CONFIG_XEN_BALLOON=y
CONFIG_XEN_SCRUB_PAGES=y
CONFIG_XEN_DEV_EVTCHN=m
CONFIG_XEN_COMPAT_XENFS=y
CONFIG_XEN_SYS_HYPERVISOR=y
CONFIG_XEN_PLATFORM_PCI=m

That would seem to be right to me.

Signature · 1 line
Alex Bligh
author
#1 lore raw
Quoted 4 lines · --On 2 December 2010 15:23:16 +0000 Alex Bligh <[email protected]> wrote:

I'm running Ubuntu's current kernel from Natty which I believe to be 2.6.37-rc1, and hoping to get PV drivers on HVM working. I think I must be missing something as despite a helpful dmesg I can't actually see any PV devices (or think I can't).

I should have added that PV drivers on HVM using either XenSource 2.6.18 or the patches on my blog, or any other patches I have tried work just fine.

Signature · 1 line
Alex Bligh
#2 lore raw
In reply to Alex Bligh
Quoted 28 lines · Alex Bligh

I'm running Ubuntu's current kernel from Natty which I believe to be 2.6.37-rc1, and hoping to get PV drivers on HVM working. I think I must be missing something as despite a helpful dmesg I can't actually see any PV devices (or think I can't).

I see this:

# uname -a ; dmesg | egrep -i '(pv|xen|hvm)'
Linux 109-231-66-11 2.6.37-7-virtual #19-Ubuntu SMP Wed Dec 1 02:15:20 UTC 
2010 x86_64 GNU/Linux
[    0.000000] DMI: /HVM domU, BIOS 3.3.1 02/02/2009
[    0.000000] Hypervisor detected: Xen HVM       <-----********************
[    0.000000] Xen version 3.3.
[    0.000000] Xen Platform PCI: unrecognised magic value  <--- ++++++++++++
[    0.000000] HVMOP_pagetable_dying not supported
[    0.000000] ACPI: RSDP 00000000000ea010 00024 (v02    Xen)
[    0.000000] ACPI: XSDT 000000001fff8b70 00034 (v01    Xen      HVM 
00000000 HVML 00000000)
[    0.000000] ACPI: FACP 000000001fff8a00 000F4 (v04    Xen      HVM 
00000000 HVML 00000000)
[    0.000000] ACPI: DSDT 000000001fff7840 01132 (v02    Xen      HVM 
00000000 INTL 20060707)
[    0.000000] ACPI: APIC 000000001fff8b00 00068 (v02    Xen      HVM 
00000000 HVML 00000000)
[    0.000000] Booting paravirtualized kernel on Xen <---*******************
[    0.800582] Initialising Xen virtual ethernet driver.
[   13.980075] eth0: no IPv6 routers present
Quoted 3 lines

The lines marked with asterisks are confusing to me as they appear to be in contradiction.

They mean that Linux recognized that it is running on Xen but the platform pci device is too old to support the device unplug protocol, therefore pv drivers have been disabled.
You can try to enable them anyway at your own risk passing xen_emul_unplug=unnecessary to the kernel command line options. Be careful with enabling both the pv disk and the IDE disk interfaces at the same time because it might cause disk data corruptions.

author
#3 lore raw

Stefano,

Quoted 7 lines · --On 2 December 2010 15:41:08 +0000 Stefano Stabellini…
Quoted 7 lines
[    0.000000] Hypervisor detected: Xen HVM
[    0.000000] Xen Platform PCI: unrecognised magic value
[    0.000000] Booting paravirtualized kernel on Xen
[    0.800582] Initialising Xen virtual ethernet
driver.
[   13.980075] eth0: no IPv6 routers present
Quoted 7 lines
Quoted 3 lines

The lines marked with asterisks are confusing to me as they appear to be in contradiction.

They mean that Linux recognized that it is running on Xen but the platform pci device is too old to support the device unplug protocol, therefore pv drivers have been disabled.

OK. How modern a version of Xen am I meant to need to run 2.6.37? This version of Xen supports non-inline pvdrivers fine.

Quoted 2 lines

You can try to enable them anyway at your own risk passing xen_emul_unplug=unnecessary to the kernel command line options.

OK, so I get the following, which looks superficially nasty, but in fact suggests I need to unplug the disks. But the same happens with "xen_emul_unplug=unnecessary,all".

[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 2.6.37-7-virtual (buildd@yellow) (gcc version 4.5.2 (Ubuntu/Linaro 4.5.1-10ubuntu3) ) #19-Ubuntu SMP Wed Dec 1 02:15:20 UTC 2010 (Ubuntu 2.6.37-7.19-virtual 2.6.37-rc3)
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-2.6.37-7-virtual root=UUID=f7f04f87-04f3-488b-a6ae-014ce5d63850 ro xen_emul_unplug=unnecessary console=ttyS0
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
--
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] DMI 2.4 present.
[    0.000000] DMI: /HVM domU, BIOS 3.3.1 02/02/2009
[    0.000000] Hypervisor detected: Xen HVM
[    0.000000] Xen version 3.3.
[    0.000000] Xen Platform PCI: unrecognised magic value
[    0.000000] HVMOP_pagetable_dying not supported
[    0.000000] e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
[    0.000000] e820 remove range: 00000000000a0000 - 0000000000100000 (usable)
--
[    0.000000] kernel direct mapping tables up to 1fff7000 @ 1fff4000-1fff7000
[    0.000000] RAMDISK: 1f348000 - 1f799000
[    0.000000] ACPI: RSDP 00000000000ea010 00024 (v02    Xen)
[    0.000000] ACPI: XSDT 000000001fff8b70 00034 (v01    Xen      HVM 00000000 HVML 00000000)
[    0.000000] ACPI: FACP 000000001fff8a00 000F4 (v04    Xen      HVM 00000000 HVML 00000000)
[    0.000000] ACPI: DSDT 000000001fff7840 01132 (v02    Xen      HVM 00000000 INTL 20060707)
[    0.000000] ACPI: FACS 000000001fff7800 00040
[    0.000000] ACPI: APIC 000000001fff8b00 00068 (v02    Xen      HVM 00000000 HVML 00000000)
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] No NUMA configuration found
--
[    0.000000] PM: Registered nosave memory: 00000000000e0000 - 0000000000100000
[    0.000000] Allocating PCI resources starting at 20000000 (gap: 20000000:e0000000)
[    0.000000] Booting paravirtualized kernel on Xen
[    0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:1 nr_node_ids:1
[    0.000000] PERCPU: Embedded 28 pages/cpu @ffff88001fc00000 s83712 r8192 d22784 u2097152
--
[    0.000000] Built 1 zonelists in Node order, mobility grouping on. Total pages: 129152
[    0.000000] Policy zone: DMA32
[    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-2.6.37-7-virtual root=UUID=f7f04f87-04f3-488b-a6ae-014ce5d63850 ro xen_emul_unplug=unnecessary console=ttyS0
[    0.000000] PID hash table entries: 2048 (order: 2, 16384 bytes)
[    0.000000] Checking aperture...
--
[    0.821839] Fixed MDIO Bus: probed
[    0.823360] PPP generic driver version 2.4.2
[    0.825496] Initialising Xen virtual ethernet driver.
[    0.827998] tun: Universal TUN/TAP device driver, 1.6
[    0.830247] tun: (C) 1999-2004 Max Krasnyansky <[email protected]>
--
[    2.791086] xen-platform-pci 0000:00:03.0: PCI INT A -> GSI 28 (level, low) -> IRQ 28
[    2.798695] Grant table initialized
[    2.889459] blkfront device/vbd/51712 num-ring-pages 1 nr_ents 32.
[    2.897163] blkfront: sda: barriers disabled
[    2.900483] ------------[ cut here ]------------
[    2.900608] WARNING: at /build/buildd/linux-2.6.37/fs/sysfs/dir.c:451 sysfs_add_one+0xd8/0x150()
[    2.900616] Hardware name: HVM domU
[    2.900618] sysfs: cannot create duplicate filename '/class/block/sda'
[    2.900619] Modules linked in: platform_pci acpiphp floppy 8139too 8139cp
[    2.900656] Pid: 10, comm: xenwatch Not tainted 2.6.37-7-virtual #19-Ubuntu
[    2.900659] Call Trace:
[    2.900668]  [<ffffffff8106623f>] warn_slowpath_common+0x7f/0xc0
[    2.900671]  [<ffffffff81066336>] warn_slowpath_fmt+0x46/0x50
[    2.900674]  [<ffffffff811d4608>] sysfs_add_one+0xd8/0x150
[    2.900677]  [<ffffffff811d4fbb>] sysfs_do_create_link+0x12b/0x210
[    2.900680]  [<ffffffff811d50b3>] sysfs_create_link+0x13/0x20
[    2.900717]  [<ffffffff813ab923>] device_add_class_symlinks+0xb3/0xd0
[    2.900721]  [<ffffffff813acd98>] device_add+0x248/0x410
[    2.900725]  [<ffffffff811cb2b1>] register_disk+0x41/0x170
[    2.900748]  [<ffffffff812cbf26>] add_disk+0xa6/0x160
[    2.900753]  [<ffffffff813c9a60>] blkfront_connect+0x120/0x1e0
[    2.900756]  [<ffffffff813c9b60>] blkback_changed+0x40/0x50
[    2.900761]  [<ffffffff8136d420>] otherend_changed+0xb0/0xc0
[    2.900763]  [<ffffffff8136b9b6>] xenwatch_thread+0xb6/0x170
[    2.900768]  [<ffffffff81087da0>] ? autoremove_wake_function+0x0/0x40
[    2.900771]  [<ffffffff8136b900>] ? xenwatch_thread+0x0/0x170
[    2.900773]  [<ffffffff81087676>] kthread+0x96/0xa0
[    2.900777]  [<ffffffff8100cee4>] kernel_thread_helper+0x4/0x10
[    2.900780]  [<ffffffff810875e0>] ? kthread+0x0/0xa0
[    2.900783]  [<ffffffff8100cee0>] ? kernel_thread_helper+0x0/0x10
[    2.900785] ---[ end trace d4f9aa3628762311 ]---
[    2.900811] ------------[ cut here ]------------
[    2.902999] kernel BUG at /build/buildd/linux-2.6.37/fs/sysfs/group.c:65!
[    2.906099] invalid opcode: 0000 [#1] SMP
[    2.908061] last sysfs file: /sys/devices/pci0000:00/0000:00:03.0/uevent
[    2.910028] CPU 0
[    2.910028] Modules linked in: platform_pci acpiphp floppy 8139too 8139cp
[    2.910028]
[    2.910028] Pid: 10, comm: xenwatch Tainted: G        W 2.6.37-7-virtual #19-Ubuntu /HVM domU
[    2.910028] RIP: 0010:[<ffffffff811d64b7>]  [<ffffffff811d64b7>] internal_create_group+0x187/0x1a0
[    2.910028] RSP: 0018:ffff88001f9b3ce0  EFLAGS: 00010246
[    2.910028] RAX: 00000000ffffffef RBX: ffff88001c4f3800 RCX: ffff88001cf70900
[    2.910028] RDX: ffffffff81a1faa0 RSI: 0000000000000000 RDI: ffff88001c4f3870
[    2.910028] RBP: ffff88001f9b3d30 R08: 000000000000000d R09: 000000000000000b
[    2.910028] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88001c6368e0
[    2.910028] R13: ffff88001c4f3860 R14: ffffffff81a1faa0 R15: 0000000000000000
[    2.910028] FS:  00007f1c2c9e4700(0000) GS:ffff88001fc00000(0000) knlGS:0000000000000000
[    2.910028] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[    2.910028] CR2: 00007fe87eb2c1d8 CR3: 000000001cd33000 CR4: 00000000000006f0
[    2.910028] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    2.910028] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[    2.910028] Process xenwatch (pid: 10, threadinfo ffff88001f9b2000, task ffff88001f9a5b00)
[    2.910028] Stack:
[    2.910028]  ffff88001f9b3d40 ffff88001c4f3870 000000303a323032 ffff88001f9b3d50
[    2.910028]  ffff88001f9b3d10 ffff88001c4f3800 ffff88001c6368e0 ffff88001c4f3860
[    2.910028]  ffff88001dfc1de0 ffff88001c4f3800 ffff88001f9b3d40 ffffffff811d6503
[    2.910028] Call Trace:
[    2.910028]  [<ffffffff811d6503>] sysfs_create_group+0x13/0x20
[    2.910028]  [<ffffffff810f7174>] blk_trace_init_sysfs+0x14/0x20
[    2.910028]  [<ffffffff812c5fa0>] blk_register_queue+0x40/0x110
[    2.910028]  [<ffffffff812cbf2e>] add_disk+0xae/0x160
[    2.910028]  [<ffffffff813c9a60>] blkfront_connect+0x120/0x1e0
[    2.910028]  [<ffffffff813c9b60>] blkback_changed+0x40/0x50
[    2.910028]  [<ffffffff8136d420>] otherend_changed+0xb0/0xc0
[    2.910028]  [<ffffffff8136b9b6>] xenwatch_thread+0xb6/0x170
[    2.910028]  [<ffffffff81087da0>] ? autoremove_wake_function+0x0/0x40
[    2.910028]  [<ffffffff8136b900>] ? xenwatch_thread+0x0/0x170
[    2.910028]  [<ffffffff81087676>] kthread+0x96/0xa0
[    2.910028]  [<ffffffff8100cee4>] kernel_thread_helper+0x4/0x10
[    2.910028]  [<ffffffff810875e0>] ? kthread+0x0/0xa0
[    2.910028]  [<ffffffff8100cee0>] ? kernel_thread_helper+0x0/0x10
[    2.910028] Code: 8b 45 b0 74 15 48 8b 7d c8 89 45 b0 e8 93 e3 ff ff 4c 8b 6d c8 8b 45 b0 eb 90 4c 8b 6d c8 eb 8a 48 83 7f 30 00 0f 85 be fe ff ff <0f> 0b be b7 00 00 00 48 c7 c7 58 79 7d 81 e8 b6 fd e8 ff e9 dc
[    2.910028] RIP  [<ffffffff811d64b7>] internal_create_group+0x187/0x1a0
[    2.910028]  RSP <ffff88001f9b3ce0>
[    2.928247] ---[ end trace d4f9aa3628762312 ]---
[    3.836521] eth0: link up, 100Mbps, full-duplex, lpa 0x05E1
[    4.142405] parport_pc 00:0a: reported by Plug and Play ACPI
Signature · 1 line
Alex Bligh
#4 lore raw
Quoted 15 lines · Alex Bligh

Stefano,

--On 2 December 2010 15:41:08 +0000 Stefano Stabellini

Quoted 11 lines · <[email protected]> wrote:
Quoted 10 lines
[    0.000000] Hypervisor detected: Xen HVM
[    0.000000] Xen Platform PCI: unrecognised magic value
[    0.000000] Booting paravirtualized kernel on Xen
[    0.800582] Initialising Xen virtual ethernet
driver.
[   13.980075] eth0: no IPv6 routers present

The lines marked with asterisks are confusing to me as they appear to be in contradiction.

Quoted 5 lines
Quoted 3 lines

They mean that Linux recognized that it is running on Xen but the platform pci device is too old to support the device unplug protocol, therefore pv drivers have been disabled.

OK. How modern a version of Xen am I meant to need to run 2.6.37?

You need xen 3.4 or later.

Quoted 2 lines

This
version of Xen supports non-inline pvdrivers fine.

They use hacks to disable the emulated interfaces that couldn't possibly be upstreamed.

Quoted 8 lines
Quoted 3 lines

You can try to enable them anyway at your own risk passing xen_emul_unplug=unnecessary to the kernel command line options.

OK, so I get the following, which looks superficially nasty, but in fact suggests I need to unplug the disks. But the same happens with "xen_emul_unplug=unnecessary,all".

You could try specifying "xvda" instead of hda in the VM config file, and make sure the root= command line option points to /dev/xvda1 so that there is no confusion with possible emulated paths.
Or you could always disable the IDE driver or blkfront in the kernel.

author
#5 lore raw

Stefano,

Quoted 3 lines
Quoted 1 line

OK. How modern a version of Xen am I meant to need to run 2.6.37?

You need xen 3.4 or later.

Thanks, that's useful.

Quoted 5 lines
Quoted 2 lines

This
version of Xen supports non-inline pvdrivers fine.

They use hacks to disable the emulated interfaces that couldn't possibly be upstreamed.

I don't need the emulated interfaces to be disabled. Both the emulated interfaces and the PV-Ops ones appear and we use only one of them. So, for instance, we see /dev/xvda and /dev/sda. We mount by UUID or label and have technology that causes the emulated ones to be preferred (if present).

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

You can try to enable them anyway at your own risk passing xen_emul_unplug=unnecessary to the kernel command line options.

OK, so I get the following, which looks superficially nasty, but in fact suggests I need to unplug the disks. But the same happens with "xen_emul_unplug=unnecessary,all".

You could try specifying "xvda" instead of hda in the VM config file,

We're in HVM mode on 3.3.1. I'm not quite sure what you mean here. The name "xvda" comes from blkfront.c (or at least it used to last time I was playing around with modified_drivers and produced a standalone patch into the new kernel). Looking at the current source, it seems to still think it's called /dev/xvda. However, something in the xen_watch thread is causing it to try and register as /dev/sda (even though that exists). Where exactly is it picking this up from? IE how is that name being passed through? Is there some new technology that causes the device name in the guest to be called something in the config file? We're using the same config file (well, system) as with the unmodified_drivers based machines, and they come up fine with /dev/xvdX.

Quoted 2 lines

and make sure the root= command line option points to /dev/xvda1 so that there is no confusion with possible emulated paths.

That should make any difference as it just controls which root option is mounted. We pass a label or UUID.

Quoted 1 line

Or you could always disable the IDE driver or blkfront in the kernel.

That would sort of defeat the object. I already have kernels that run just fine (and support /dev/xvda and /dev/sda). What I am trying to do is to get a stock kernel to run (specifically a stock Ubuntu kernel).

Signature · 1 line
Alex Bligh
#6 lore raw
Quoted 12 lines · Alex Bligh
Quoted 5 lines
Quoted 2 lines

This
version of Xen supports non-inline pvdrivers fine.

They use hacks to disable the emulated interfaces that couldn't possibly be upstreamed.

I don't need the emulated interfaces to be disabled. Both the emulated interfaces and the PV-Ops ones appear and we use only one of them. So, for instance, we see /dev/xvda and /dev/sda. We mount by UUID or label and have technology that causes the emulated ones to be preferred (if present).

I guess you mean the paravirtualized ones to be preferred.

Quoted 9 lines
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

You can try to enable them anyway at your own risk passing xen_emul_unplug=unnecessary to the kernel command line options.

OK, so I get the following, which looks superficially nasty, but in fact suggests I need to unplug the disks. But the same happens with "xen_emul_unplug=unnecessary,all".

You could try specifying "xvda" instead of hda in the VM config file,

Quoted 13 lines

We're in HVM mode on 3.3.1. I'm not quite sure what you mean here. The name "xvda" comes from blkfront.c (or at least it used to last time I was playing around with modified_drivers and produced a standalone patch into the new kernel). Looking at the current source, it seems to still think it's called /dev/xvda. However, something in the xen_watch thread is causing it to try and register as /dev/sda (even though that exists). Where exactly is it picking this up from? IE how is that name being passed through? Is there some new technology that causes the device name in the guest to be called something in the config file? We're using the same config file (well, system) as with the unmodified_drivers based machines, and they come up fine with /dev/xvdX.

I was referring to the device name in the disk config file option, usually is "hda" in HVM config files. Some blkfront development versions don't always create an xvd device, so if you manually specify xvda in the disk config file you would rule that problem out (even though it also depends on the behaviour toolstack and I don't remember what xend 3.3 would do).

But in any case upstream blkfront should always create xvd devices so I am not sure how you could end up with a /dev/sda there.

Quoted 6 lines
Quoted 2 lines

and make sure the root= command line option points to /dev/xvda1 so that there is no confusion with possible emulated paths.

That should make any difference as it just controls which root option is mounted. We pass a label or UUID.

If you pass a label or a UUID you cannot be sure if you end up using the emulated or the paravitualized interface, unless xen supports the unplug protocol.
Maybe the technology you mentioned before solves also this problem for you.

Quoted 7 lines
Quoted 1 line

Or you could always disable the IDE driver or blkfront in the kernel.

That would sort of defeat the object. I already have kernels that run just fine (and support /dev/xvda and /dev/sda). What I am trying to do is to get a stock kernel to run (specifically a stock Ubuntu kernel).

If you'd like a stock kernel, the best thing to do is upgrade xen, then you don't need any changes in the guest.
Keep in mind that xen 3.4 was released almost 2 years ago. If you know what you are doing you can manually remove the check for the unplug protocol in the kernel, just hack arch/x86/xen/platform-pci-unplug.c:check_platform_magic.

#7 lore raw
Quoted 4 lines · Stefano Stabellini

If you know what you are doing you can manually remove the check for the unplug protocol in the kernel, just hack arch/x86/xen/platform-pci-unplug.c:check_platform_magic.

This is exactly equivalent to adding "xen_emul_unplug=unnecessary" to the kernel command line, isn't it?

Conversely if you want to always force emulated devices (i.e. disable any attempt to unplug) then "xen_emul_unplug=never" will do what you want.

Ian.

#8 lore raw
Quoted 9 lines · Ian Campbell
Quoted 4 lines · Stefano Stabellini

If you know what you are doing you can manually remove the check for the unplug protocol in the kernel, just hack arch/x86/xen/platform-pci-unplug.c:check_platform_magic.

This is exactly equivalent to adding "xen_emul_unplug=unnecessary" to the kernel command line, isn't it?

yeah, easier your way :)

author
#9 lore raw
In reply to Ian Campbell
Quoted 6 lines · --On 3 December 2010 11:24:43 +0000 Ian Campbell <[email protected]>…
Quoted 4 lines · Stefano Stabellini

If you know what you are doing you can manually remove the check for the unplug protocol in the kernel, just hack arch/x86/xen/platform-pci-unplug.c:check_platform_magic.

Quoted 6 lines

This is exactly equivalent to adding "xen_emul_unplug=unnecessary" to the kernel command line, isn't it?

Conversely if you want to always force emulated devices (i.e. disable any attempt to unplug) then "xen_emul_unplug=never" will do what you want.

OK, I am confused. What I want do is is bring the PV devices up as /dev/xvda not /dev/sda. I don't much care whether or not it attempts to unplug the emulated devices, as I can cope with or without the additional presence of the emulated devices.

IE I want it to work just like it used to work with unmodified_drivers.

Is there a command line option for that? Or if not, I am happy to try and work on a patch.

Signature · 1 line
Alex Bligh
#10 lore raw
Quoted 17 lines · Alex Bligh

--On 3 December 2010 11:24:43 +0000 Ian Campbell <[email protected]>

Quoted 6 lines · wrote:
Quoted 4 lines · Stefano Stabellini

If you know what you are doing you can manually remove the check for the unplug protocol in the kernel, just hack arch/x86/xen/platform-pci-unplug.c:check_platform_magic.

Quoted 6 lines

This is exactly equivalent to adding "xen_emul_unplug=unnecessary" to the kernel command line, isn't it?

Conversely if you want to always force emulated devices (i.e. disable any attempt to unplug) then "xen_emul_unplug=never" will do what you want.

Quoted 8 lines

OK, I am confused. What I want do is is bring the PV devices up as /dev/xvda not /dev/sda. I don't much care whether or not it attempts to unplug the emulated devices, as I can cope with or without the additional presence of the emulated devices.

IE I want it to work just like it used to work with unmodified_drivers.

Is there a command line option for that?

Yes, it is "xen_emul_unplug=unnecessary" which tells the driver that you know what you are doing and that it is not necessary to unplug the emulated devices before enabling the pv path because you as the admin have ensured that the pv path is safe to use.

Without this option present the default is to err on the side of caution and not enable the pv path unless the emulated path can be unplugged.

Ian.

Quoted 2 lines

Or if not, I am happy
to try and work on a patch.

author
#11 lore raw

Ian,

Quoted 4 lines · --On 3 December 2010 16:44:42 +0000 Ian Campbell <[email protected]>…

Yes, it is "xen_emul_unplug=unnecessary" which tells the driver that you know what you are doing and that it is not necessary to unplug the emulated devices before enabling the pv path because you as the admin have ensured that the pv path is safe to use.

Yes, that's what I thought.

However, that is what produces 'kernel bug' I posted earlier.

See:
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-2.6.37-7-virtual
root=UUID=f7f04f87-04f3-488b-a6ae-014ce5d63850 ro xen_emul_unplug=unnecessary console=ttyS0

For some reason, there is a call path through xenwatch_thread, then blkfront that causes it to try and register something (I presume the PV driver) as /dev/sda (not /dev/xvda).

Signature · 126 lines
Alex Bligh



[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 2.6.37-7-virtual (buildd@yellow) (gcc version 4.5.2 (Ubuntu/Linaro 4.5.1-10ubuntu3) ) #19-Ubuntu SMP Wed Dec 1 02:15:20 UTC 2010 (Ubuntu 2.6.37-7.19-virtual 2.6.37-rc3)
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-2.6.37-7-virtual root=UUID=f7f04f87-04f3-488b-a6ae-014ce5d63850 ro xen_emul_unplug=unnecessary console=ttyS0
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
--
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] DMI 2.4 present.
[    0.000000] DMI: /HVM domU, BIOS 3.3.1 02/02/2009
[    0.000000] Hypervisor detected: Xen HVM
[    0.000000] Xen version 3.3.
[    0.000000] Xen Platform PCI: unrecognised magic value
[    0.000000] HVMOP_pagetable_dying not supported
[    0.000000] e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
[    0.000000] e820 remove range: 00000000000a0000 - 0000000000100000 (usable)
--
[    0.000000] kernel direct mapping tables up to 1fff7000 @ 1fff4000-1fff7000
[    0.000000] RAMDISK: 1f348000 - 1f799000
[    0.000000] ACPI: RSDP 00000000000ea010 00024 (v02    Xen)
[    0.000000] ACPI: XSDT 000000001fff8b70 00034 (v01    Xen      HVM 00000000 HVML 00000000)
[    0.000000] ACPI: FACP 000000001fff8a00 000F4 (v04    Xen      HVM 00000000 HVML 00000000)
[    0.000000] ACPI: DSDT 000000001fff7840 01132 (v02    Xen      HVM 00000000 INTL 20060707)
[    0.000000] ACPI: FACS 000000001fff7800 00040
[    0.000000] ACPI: APIC 000000001fff8b00 00068 (v02    Xen      HVM 00000000 HVML 00000000)
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] No NUMA configuration found
--
[    0.000000] PM: Registered nosave memory: 00000000000e0000 - 0000000000100000
[    0.000000] Allocating PCI resources starting at 20000000 (gap: 20000000:e0000000)
[    0.000000] Booting paravirtualized kernel on Xen
[    0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:1 nr_node_ids:1
[    0.000000] PERCPU: Embedded 28 pages/cpu @ffff88001fc00000 s83712 r8192 d22784 u2097152
--
[    0.000000] Built 1 zonelists in Node order, mobility grouping on. Total pages: 129152
[    0.000000] Policy zone: DMA32
[    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-2.6.37-7-virtual root=UUID=f7f04f87-04f3-488b-a6ae-014ce5d63850 ro xen_emul_unplug=unnecessary console=ttyS0
[    0.000000] PID hash table entries: 2048 (order: 2, 16384 bytes)
[    0.000000] Checking aperture...
--
[    0.821839] Fixed MDIO Bus: probed
[    0.823360] PPP generic driver version 2.4.2
[    0.825496] Initialising Xen virtual ethernet driver.
[    0.827998] tun: Universal TUN/TAP device driver, 1.6
[    0.830247] tun: (C) 1999-2004 Max Krasnyansky <[email protected]>
--
[    2.791086] xen-platform-pci 0000:00:03.0: PCI INT A -> GSI 28 (level, low) -> IRQ 28
[    2.798695] Grant table initialized
[    2.889459] blkfront device/vbd/51712 num-ring-pages 1 nr_ents 32.
[    2.897163] blkfront: sda: barriers disabled
[    2.900483] ------------[ cut here ]------------
[    2.900608] WARNING: at /build/buildd/linux-2.6.37/fs/sysfs/dir.c:451 sysfs_add_one+0xd8/0x150()
[    2.900616] Hardware name: HVM domU
[    2.900618] sysfs: cannot create duplicate filename '/class/block/sda'
[    2.900619] Modules linked in: platform_pci acpiphp floppy 8139too 8139cp
[    2.900656] Pid: 10, comm: xenwatch Not tainted 2.6.37-7-virtual #19-Ubuntu
[    2.900659] Call Trace:
[    2.900668]  [<ffffffff8106623f>] warn_slowpath_common+0x7f/0xc0
[    2.900671]  [<ffffffff81066336>] warn_slowpath_fmt+0x46/0x50
[    2.900674]  [<ffffffff811d4608>] sysfs_add_one+0xd8/0x150
[    2.900677]  [<ffffffff811d4fbb>] sysfs_do_create_link+0x12b/0x210
[    2.900680]  [<ffffffff811d50b3>] sysfs_create_link+0x13/0x20
[    2.900717]  [<ffffffff813ab923>] device_add_class_symlinks+0xb3/0xd0
[    2.900721]  [<ffffffff813acd98>] device_add+0x248/0x410
[    2.900725]  [<ffffffff811cb2b1>] register_disk+0x41/0x170
[    2.900748]  [<ffffffff812cbf26>] add_disk+0xa6/0x160
[    2.900753]  [<ffffffff813c9a60>] blkfront_connect+0x120/0x1e0
[    2.900756]  [<ffffffff813c9b60>] blkback_changed+0x40/0x50
[    2.900761]  [<ffffffff8136d420>] otherend_changed+0xb0/0xc0
[    2.900763]  [<ffffffff8136b9b6>] xenwatch_thread+0xb6/0x170
[    2.900768]  [<ffffffff81087da0>] ? autoremove_wake_function+0x0/0x40
[    2.900771]  [<ffffffff8136b900>] ? xenwatch_thread+0x0/0x170
[    2.900773]  [<ffffffff81087676>] kthread+0x96/0xa0
[    2.900777]  [<ffffffff8100cee4>] kernel_thread_helper+0x4/0x10
[    2.900780]  [<ffffffff810875e0>] ? kthread+0x0/0xa0
[    2.900783]  [<ffffffff8100cee0>] ? kernel_thread_helper+0x0/0x10
[    2.900785] ---[ end trace d4f9aa3628762311 ]---
[    2.900811] ------------[ cut here ]------------
[    2.902999] kernel BUG at /build/buildd/linux-2.6.37/fs/sysfs/group.c:65!
[    2.906099] invalid opcode: 0000 [#1] SMP
[    2.908061] last sysfs file: /sys/devices/pci0000:00/0000:00:03.0/uevent
[    2.910028] CPU 0
[    2.910028] Modules linked in: platform_pci acpiphp floppy 8139too 8139cp
[    2.910028]
[    2.910028] Pid: 10, comm: xenwatch Tainted: G        W 2.6.37-7-virtual #19-Ubuntu /HVM domU
[    2.910028] RIP: 0010:[<ffffffff811d64b7>]  [<ffffffff811d64b7>] internal_create_group+0x187/0x1a0
[    2.910028] RSP: 0018:ffff88001f9b3ce0  EFLAGS: 00010246
[    2.910028] RAX: 00000000ffffffef RBX: ffff88001c4f3800 RCX: ffff88001cf70900
[    2.910028] RDX: ffffffff81a1faa0 RSI: 0000000000000000 RDI: ffff88001c4f3870
[    2.910028] RBP: ffff88001f9b3d30 R08: 000000000000000d R09: 000000000000000b
[    2.910028] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88001c6368e0
[    2.910028] R13: ffff88001c4f3860 R14: ffffffff81a1faa0 R15: 0000000000000000
[    2.910028] FS:  00007f1c2c9e4700(0000) GS:ffff88001fc00000(0000) knlGS:0000000000000000
[    2.910028] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[    2.910028] CR2: 00007fe87eb2c1d8 CR3: 000000001cd33000 CR4: 00000000000006f0
[    2.910028] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    2.910028] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[    2.910028] Process xenwatch (pid: 10, threadinfo ffff88001f9b2000, task ffff88001f9a5b00)
[    2.910028] Stack:
[    2.910028]  ffff88001f9b3d40 ffff88001c4f3870 000000303a323032 ffff88001f9b3d50
[    2.910028]  ffff88001f9b3d10 ffff88001c4f3800 ffff88001c6368e0 ffff88001c4f3860
[    2.910028]  ffff88001dfc1de0 ffff88001c4f3800 ffff88001f9b3d40 ffffffff811d6503
[    2.910028] Call Trace:
[    2.910028]  [<ffffffff811d6503>] sysfs_create_group+0x13/0x20
[    2.910028]  [<ffffffff810f7174>] blk_trace_init_sysfs+0x14/0x20
[    2.910028]  [<ffffffff812c5fa0>] blk_register_queue+0x40/0x110
[    2.910028]  [<ffffffff812cbf2e>] add_disk+0xae/0x160
[    2.910028]  [<ffffffff813c9a60>] blkfront_connect+0x120/0x1e0
[    2.910028]  [<ffffffff813c9b60>] blkback_changed+0x40/0x50
[    2.910028]  [<ffffffff8136d420>] otherend_changed+0xb0/0xc0
[    2.910028]  [<ffffffff8136b9b6>] xenwatch_thread+0xb6/0x170
[    2.910028]  [<ffffffff81087da0>] ? autoremove_wake_function+0x0/0x40
[    2.910028]  [<ffffffff8136b900>] ? xenwatch_thread+0x0/0x170
[    2.910028]  [<ffffffff81087676>] kthread+0x96/0xa0
[    2.910028]  [<ffffffff8100cee4>] kernel_thread_helper+0x4/0x10
[    2.910028]  [<ffffffff810875e0>] ? kthread+0x0/0xa0
[    2.910028]  [<ffffffff8100cee0>] ? kernel_thread_helper+0x0/0x10
[    2.910028] Code: 8b 45 b0 74 15 48 8b 7d c8 89 45 b0 e8 93 e3 ff ff 4c 8b 6d c8 8b 45 b0 eb 90 4c 8b 6d c8 eb 8a 48 83 7f 30 00 0f 85 be fe ff ff <0f> 0b be b7 00 00 00 48 c7 c7 58 79 7d 81 e8 b6 fd e8 ff e9 dc
[    2.910028] RIP  [<ffffffff811d64b7>] internal_create_group+0x187/0x1a0
[    2.910028]  RSP <ffff88001f9b3ce0>
[    2.928247] ---[ end trace d4f9aa3628762312 ]---
[    3.836521] eth0: link up, 100Mbps, full-duplex, lpa 0x05E1
[    4.142405] parport_pc 00:0a: reported by Plug and Play ACPI
#12 lore raw
In reply to Alex Bligh
Quoted 12 lines · Alex Bligh

--On 3 December 2010 11:24:43 +0000 Ian Campbell <[email protected]>

Quoted 9 lines · wrote:
Quoted 4 lines · Stefano Stabellini

If you know what you are doing you can manually remove the check for the unplug protocol in the kernel, just hack arch/x86/xen/platform-pci-unplug.c:check_platform_magic.

This is exactly equivalent to adding "xen_emul_unplug=unnecessary" to the kernel command line, isn't it?

Quoted 9 lines
Quoted 3 lines

Conversely if you want to always force emulated devices (i.e. disable any attempt to unplug) then "xen_emul_unplug=never" will do what you want.

OK, I am confused. What I want do is is bring the PV devices up as /dev/xvda not /dev/sda. I don't much care whether or not it attempts to unplug the emulated devices, as I can cope with or without the additional presence of the emulated devices.

This is what it should happen on a vanilla upstream kernel if you pass xen_emul_unplug=unnecessary to the kernel command line options. Blkfront should never create devices other than xvd.

author
#13 lore raw
Quoted 3 lines · --On 3 December 2010 17:21:13 +0000 Stefano Stabellini…

This is what it should happen on a vanilla upstream kernel if you pass xen_emul_unplug=unnecessary to the kernel command line options. Blkfront should never create devices other than xvd.

That appears to not be what's happening. See the call trace. It's complaining it can't create another device called "sda". No, I have no explanation either.

If you want access to a VM or three, I can of course get you one.

Signature · 1 line
Alex Bligh
author
#14 lore raw
Quoted 3 lines · --On 3 December 2010 17:32:10 +0000 Alex Bligh <[email protected]> wrote:

That appears to not be what's happening. See the call trace. It's complaining it can't create another device called "sda". No, I have no explanation either.

Ah, I am guessing the problem is this patch:

http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-natty.git;a=commitdiff;h=38096c28f13d0c2dd08584ff834da6d81306c7b3

I'll go moan at the Ubuntu people.

Signature · 1 line
Alex Bligh
#15 lore raw
Quoted 8 lines · Alex Bligh
Quoted 3 lines · --On 3 December 2010 17:32:10 +0000 Alex Bligh <[email protected]> wrote:

That appears to not be what's happening. See the call trace. It's complaining it can't create another device called "sda". No, I have no explanation either.

Quoted 5 lines

Ah, I am guessing the problem is this patch:

http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-natty.git;a=commitdiff;h=38096c28f13d0c2dd08584ff834da6d81306c7b3

I'll go moan at the Ubuntu people.

well spotted!!

#17 lore raw
Quoted 4 lines · Alex Bligh

Bug filed:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/684875

The bug has been marked as fixed and I can confirm that it now (using 2.6.37-12-server) tries to create an xvd device (instead of sd) but I'm still unable to boot Natty PV-on-HVM (as HVM domain with just xvd and non-ioemu devices). According to dmesg everything is fine:

DMI: /HVM domU, BIOS 4.0.1 09/28/2010
Hypervisor detected: Xen HVM
Xen version 4.0.
Xen Platform PCI: I/O protocol version 1
Netfront and the Xen platform PCI driver have been compiled for this kernel: unplug emulated NICs. Blkfront and the Xen platform PCI driver have been compiled for this kernel: unplug emulated disks. Booting paravirtualized kernel on Xen
Xen HVM callback vector for event delivery is enabled

But I cannot load xen-blkfront (manually creating the 202 device nodes does not help either):

register_blkdev: cannot get major 202 for xvd
xen_blk: can't get major 202 with name xvd
FATAL: Error inserting xen_blkfront (/lib/modules/2.6.37-12-server/kernel/drivers/block/xen-blkfront.ko): No such device

Does anyone have a running Natty domU with PV-on-HVM?

Best regards,
Christian

#18 lore raw
Quoted 27 lines · Christian Tramnitz
Quoted 4 lines · Alex Bligh

Bug filed:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/684875

The bug has been marked as fixed and I can confirm that it now (using 2.6.37-12-server) tries to create an xvd device (instead of sd) but I'm still unable to boot Natty PV-on-HVM (as HVM domain with just xvd and non-ioemu devices).
According to dmesg everything is fine:

DMI: /HVM domU, BIOS 4.0.1 09/28/2010
Hypervisor detected: Xen HVM
Xen version 4.0.
Xen Platform PCI: I/O protocol version 1
Netfront and the Xen platform PCI driver have been compiled for this
kernel: unplug emulated NICs.
Blkfront and the Xen platform PCI driver have been compiled for this
kernel: unplug emulated disks.
Booting paravirtualized kernel on Xen
Xen HVM callback vector for event delivery is enabled

But I cannot load xen-blkfront (manually creating the 202 device nodes does not help either):

Quoted 8 lines

register_blkdev: cannot get major 202 for xvd
xen_blk: can't get major 202 with name xvd
FATAL: Error inserting xen_blkfront (/lib/modules/2.6.37-12-server/kernel/drivers/block/xen-blkfront.ko): No such device

Does anyone have a running Natty domU with PV-on-HVM?

It looks like another block driver has already registered the same major number 202 but unfortunately the error message in register_blkdev doesn't tell you who is it.

#19 lore raw
Quoted 3 lines · Stefano Stabellini

It looks like another block driver has already registered the same major number 202 but unfortunately the error message in register_blkdev doesn't tell you who is it.

If you can get to a command prompt somehow (even the rescue shell in the initrd) then /proc/devices will tell you who has registered it.

Ian.

Quoted 5 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#20 lore raw
Quoted 7 lines · Ian Campbell
Quoted 3 lines · Stefano Stabellini

It looks like another block driver has already registered the same major number 202 but unfortunately the error message in register_blkdev doesn't tell you who is it.

If you can get to a command prompt somehow (even the rescue shell in the initrd) then /proc/devices will tell you who has registered it.

I looked into this issue and it turns out that the problem is completely different from what I originally guessed.
I think Ubuntu builds platform-pci as a module by default and mkinitramfs doesn't include it in the initrd but it is required by blkfront and netfront.

Could you please rebuild your initramfs making sure that platform-pci is included (add platform-pci to /etc/initramfs-tools/modules) and try again?

#21 lore raw
Quoted 15 lines · Stefano Stabellini
Quoted 7 lines · Ian Campbell
Quoted 3 lines · Stefano Stabellini

It looks like another block driver has already registered the same major number 202 but unfortunately the error message in register_blkdev doesn't tell you who is it.

If you can get to a command prompt somehow (even the rescue shell in the initrd) then /proc/devices will tell you who has registered it.

I looked into this issue and it turns out that the problem is completely different from what I originally guessed.
I think Ubuntu builds platform-pci as a module by default and mkinitramfs doesn't include it in the initrd but it is required by blkfront and netfront.

Quoted 4 lines

Could you please rebuild your initramfs making sure that platform-pci is included (add platform-pci to /etc/initramfs-tools/modules) and try again?

I finally got a Natty VM setup and running: it really seems that adding platform_pci to /etc/initramfs-tools/modules and rebuilding the initramfs is enough to solve the problem.

Could somebody be kind enough to fill the bug on launchpad?

author
#22 lore raw
In reply to Stefano Stabellini

Stefano,

Quoted 1 line

I guess you mean the paravirtualized ones to be preferred.

Ooops, yes :-)

Quoted 6 lines

I was referring to the device name in the disk config file option, usually is "hda" in HVM config files. Some blkfront development versions don't always create an xvd device, so if you manually specify xvda in the disk config file you would rule that problem out (even though it also depends on the behaviour toolstack and I don't remember what xend 3.3 would do).

Would this not break booting a non-PV driver equipped kernel? In the general case, we don't know what guests will be booted (up to the customer).

Quoted 2 lines

But in any case upstream blkfront should always create xvd devices so I am not sure how you could end up with a /dev/sda there.

The /dev/sda that is there is the emulated devices. xen_watch (judging by the call trace) is trying to create another /dev/sda, presumably for the paravirtualised device (given the call path through blkfront).

Quoted 5 lines

If you pass a label or a UUID you cannot be sure if you end up using the emulated or the paravitualized interface, unless xen supports the unplug protocol.
Maybe the technology you mentioned before solves also this problem for you.

The technology is simply ensuring the modules in the kernel initialise in the right order. This makes UUID and label mounting prefer PV drivers.

It's described here:
http://blog.alex.org.uk/2010/05/09/linux-pv-drivers-for-xen-hvm-building-nor
mally-within-an-arbitrary-kernel-tree/
with patches.

I think our current method is to use a modular sd_mod and a builtin blkfront etc., but it's possible to do it without that.

Quoted 6 lines

If you'd like a stock kernel, the best thing to do is upgrade xen, then you don't need any changes in the guest.
Keep in mind that xen 3.4 was released almost 2 years ago. If you know what you are doing you can manually remove the check for the unplug protocol in the kernel, just hack arch/x86/xen/platform-pci-unplug.c:check_platform_magic.

That's easier said than done on a running platform with large numbers of nodes, a huge variety of operating systems etc.; we have Xen 4 working in the lab, but the code change our end is very substantial,

My first priority is to ensure 2.6.37 doesn't break anything (that's fine, because it comes up without PV drivers which is no worse than 2.6.36). My second priority is to try and allow end users to get 2.6.37+ working with PV drivers easily (so adding grub command line options is doable).

Signature · 1 line
Alex Bligh
#23 lore raw
Quoted 30 lines · Alex Bligh

Stefano,

Quoted 1 line

I guess you mean the paravirtualized ones to be preferred.

Ooops, yes :-)

Quoted 6 lines

I was referring to the device name in the disk config file option, usually is "hda" in HVM config files. Some blkfront development versions don't always create an xvd device, so if you manually specify xvda in the disk config file you would rule that problem out (even though it also depends on the behaviour toolstack and I don't remember what xend 3.3 would do).

Would this not break booting a non-PV driver equipped kernel? In the general case, we don't know what guests will be booted (up to the customer).

Quoted 2 lines

But in any case upstream blkfront should always create xvd devices so I am not sure how you could end up with a /dev/sda there.

The /dev/sda that is there is the emulated devices. xen_watch (judging by the call trace) is trying to create another /dev/sda, presumably for the paravirtualised device (given the call path through blkfront).

Quoted 5 lines

If you pass a label or a UUID you cannot be sure if you end up using the emulated or the paravitualized interface, unless xen supports the unplug protocol.
Maybe the technology you mentioned before solves also this problem for you.

Quoted 8 lines

The technology is simply ensuring the modules in the kernel initialise in the right order. This makes UUID and label mounting prefer PV drivers.

It's described here:
http://blog.alex.org.uk/2010/05/09/linux-pv-drivers-for-xen-hvm-building-nor
mally-within-an-arbitrary-kernel-tree/
with patches.

Btw I added a link to your blog to http://wiki.xen.org/xenwiki/XenLinuxPVonHVMdrivers

-- Pasi

#24 lore raw
In reply to Alex Bligh
Quoted 10 lines · Alex Bligh
Quoted 6 lines

I was referring to the device name in the disk config file option, usually is "hda" in HVM config files. Some blkfront development versions don't always create an xvd device, so if you manually specify xvda in the disk config file you would rule that problem out (even though it also depends on the behaviour toolstack and I don't remember what xend 3.3 would do).

Would this not break booting a non-PV driver equipped kernel? In the general case, we don't know what guests will be booted (up to the customer).

It wouldn't break anything because qemu emulates the IDE disks anyway, but I am not recommending this in production, just for debugging this particular issue.

Quoted 7 lines
Quoted 2 lines

But in any case upstream blkfront should always create xvd devices so I am not sure how you could end up with a /dev/sda there.

The /dev/sda that is there is the emulated devices. xen_watch (judging by the call trace) is trying to create another /dev/sda, presumably for the paravirtualised device (given the call path through blkfront).

This shouldn't happen. What kernel are you using? Can I see the sources?

Quoted 11 lines
Quoted 6 lines

If you'd like a stock kernel, the best thing to do is upgrade xen, then you don't need any changes in the guest.
Keep in mind that xen 3.4 was released almost 2 years ago. If you know what you are doing you can manually remove the check for the unplug protocol in the kernel, just hack arch/x86/xen/platform-pci-unplug.c:check_platform_magic.

That's easier said than done on a running platform with large numbers of nodes, a huge variety of operating systems etc.; we have Xen 4 working in the lab, but the code change our end is very substantial,

Quoted 6 lines

My first priority is to ensure 2.6.37 doesn't break anything (that's fine, because it comes up without PV drivers which is no worse than 2.6.36). My second priority is to try and allow end users to get 2.6.37+ working with PV drivers easily (so adding grub command line options is doable).

Another option would be to backport the appended patch that implements the unplug protocol in qemu to your qemu-xen tree:

commit e7911109f4321e9ba0cc56a253b653600aa46bea

Author: Ian Jackson <[email protected]>
Date:   Wed Dec 31 16:00:20 2008 +0000

disable qemu PCI devices in HVM domains

Magic ioport (0x10) protocol for negotating with guest PV drivers during startup, and allowing PV drivers to disable hardware emulations thus preventing guest from seeing the same device through two paths.

Protocol and implementation from the Citrix Xenserver product line. Documentation (protocol spec) will follow in a moment.

block-raw-posix.c +5 -0
index 044d1f4..f705c51 100644
@@ -51,6 +51,7 @@
 #include <sys/ioctl.h>
 #include <linux/cdrom.h>
 #include <linux/fd.h>
+#include <sys/mount.h>
 #endif
 #ifdef __FreeBSD__
 #include <signal.h>
@@ -792,6 +793,10 @@ static void raw_close(BlockDriverState *bs)
 {
     BDRVRawState *s = bs->opaque;
     if (s->fd >= 0) {
+#ifndef CONFIG_STUBDOM
+        /* Invalidate buffer cache for this device. */
+        ioctl(s->fd, BLKFLSBUF, 0);
+#endif
         close(s->fd);
         s->fd = -1;
         if (s->aligned_buf != NULL)
hw/ide.c +48 -0

72 lines not on this page · raw message

hw/pc.h +2 -0
index 02b7018..455306d 100644
@@ -150,6 +150,8 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
                         qemu_irq *pic);
 void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
                         qemu_irq *pic);
+void ide_unplug_harddisks(void);
+void ide_unplug_aux_harddisks(void);
 
 /* ne2000.c */
 
hw/pci.c +43 -0

55 lines not on this page · raw message

hw/xen_platform.c +219 -0

260 lines not on this page · raw message

i386-dm/exec-dm.c +12 -1
index 6dbd460..20ac93c 100644
@@ -272,7 +272,7 @@ void cpu_abort(CPUState *env, const char *fmt, ...)
 
 /* XXX: Simple implementation. Fix later */
 #define MAX_MMIO 32
-struct mmio_space {
+static struct mmio_space {
         target_phys_addr_t start;
         unsigned long size;
         unsigned long io_index;
@@ -418,6 +418,17 @@ int iomem_index(target_phys_addr_t addr)
         return 0;
 }
 
+void unregister_iomem(target_phys_addr_t start)
+{
+    int index = iomem_index(start);
+    if (index) {
+        fprintf(logfile, "squash iomem [%lx, %lx).\n", mmio[index].start,
+                mmio[index].start + mmio[index].size);
+        mmio[index].start = mmio[index].size = 0;
+    }
+}
+
+
 #if defined(__i386__) || defined(__x86_64__)
 #define phys_ram_addr(x) (qemu_map_cache(x))
 #elif defined(__ia64__)
qemu-xen.h +6 -1
index 8375b79..44467a3 100644
@@ -26,8 +26,11 @@ void xen_vga_populate_vram(uint64_t vram_addr);
 void xen_vga_vram_map(uint64_t vram_addr, int copy);
 #endif
 
-
+void ide_unplug_harddisks(void);
+void net_tap_shutdown_all(void);
+void pci_unplug_netifs(void);
 void destroy_hvm_domain(void);
+void unregister_iomem(target_phys_addr_t start);
 
 #ifdef __ia64__
 static inline void xc_domain_shutdown_hook(int xc_handle, uint32_t domid)
@@ -88,6 +91,8 @@ char *xenstore_vm_read(int domid, const char *key, unsigned int *len);
 char *xenstore_device_model_read(int domid, char *key, unsigned int *len);
 char *xenstore_read_battery_data(int battery_status);
 int xenstore_refresh_battery_status(void);
+int xenstore_pv_driver_build_blacklisted(uint16_t product_number,
+                                         uint32_t build_nr);
 
 /* xenfbfront.c */
 int xenfb_pv_display_init(DisplayState *ds);
vl.c +45 -14

89 lines not on this page · raw message

xenstore.c +28 -0
index 86e8b63..e57fd66 100644
@@ -778,6 +778,34 @@ void xenstore_record_dm(char *subpath, char *state)
     free(path);
 }
 
+int
+xenstore_pv_driver_build_blacklisted(uint16_t product_nr,
+                                     uint32_t build_nr)
+{
+    char *buf = NULL;
+    char *tmp;
+    const char *product;
+
+    switch (product_nr) {
+    case 1:
+        product = "xensource-windows";
+        break;
+    default:
+        /* Don't know what product this is -> we can't blacklist
+         * it. */
+        return 0;
+    }
+    if (asprintf(&buf, "/mh/driver-blacklist/%s/%d", product, build_nr) < 0)
+        return 0;
+    tmp = xs_read(xsh, XBT_NULL, buf, NULL);
+    free(tmp);
+    free(buf);
+    if (tmp == NULL)
+        return 0;
+    else
+        return 1;
+}
+
 void xenstore_record_dm_state(char *state)
 {
     xenstore_record_dm("state", state);
author
#25 lore raw

Stefano,

Quoted 1 line

This shouldn't happen. What kernel are you using? Can I see the sources?

ubuntu natty 2.6.37-7.19-virtual kernel as of yesterday.

Git repo at:
http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-natty.git;a=commit;h=1645c7e0f14120357fbeba339abbe2540cd4e083

Quoted 2 lines

Another option would be to backport the appended patch that implements the unplug protocol in qemu to your qemu-xen tree:

Oooh, thanks. That looks really doable. I'd quite like to find out what the sda bizarreness is.

Signature · 1 line
Alex Bligh