All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Bader <stefan.bader@canonical.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Konrad@rly45j.srv.mailcontrol.com, Alex Bligh <alex@alex.org.uk>,
	Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: xen_emul_unplug on xen 4.1, HVM guest 2.6.38
Date: Thu, 27 Oct 2011 10:02:43 +0200	[thread overview]
Message-ID: <4EA91023.5000201@canonical.com> (raw)
In-Reply-To: <1319647412.9436.50.camel@zakaz.uk.xensource.com>

On 26.10.2011 18:43, Ian Campbell wrote:
> On Wed, 2011-10-26 at 17:25 +0100, Alex Bligh wrote:
>> Ian,
>>
>>> No, this will disable PV drivers.
>>
>> I can confirm that our testing illustrates this :-(
>>
>>> The decision to unplug is a kernel side decision and in PVHVM Linux
>>> kernels is not currently possible to have both types of devices by
>>> default due to the risk of dataloss if the guest is not correctly
>>> configured (i.e. the kernel can't tell if it is mounting the same
>>> filesystem via two paths). The xen_emul_unplug option is the current way
>>> you can override this once you have confirmed that your guest
>>> configuration is not dangerous. I'm afraid this necessarily involves
>>> guest config and guest admin interaction.
>>>
>>> In principal we might be able to extend the unplug protocol (which would
>>> involve patches to qemu, the kernel(s) and the toolstack) to allow
>>> devices to be marked as being not necessary to unplug. Someone would
>>> have to send patches though and it would be opening up a way for people
>>> to lose data so we'd need to be careful.
>>>
>>> I'm sure that the unplug protocol is documented somewhere in the source
>>> tree but I can't for the life of me find it :-(
>>
>> So, the issue is this. We have thousands (literally) of disks in use
>> by third parties on xen 3.3. Some are Windows, some are ancient linux,
>> some are modern linux, etc. The hypervisor has no way of whether the
>> images are going to use /dev/sda or /dev/xvda (i.e. PV or emulated)
>> drivers. Indeed the most common linux case is that grub uses the
>> emulated devices to load the kernel, then uses /dev/xvda as a root
>> device, i.e. both are used (but not simultaneously).
>>
>> We need to have the xen pci stuff on, so PV drivers operate (in both
>> new and old kernels). But as modern linux kernels detect the unplug 
>> functionality, they will unplug the emulated devices and then fail to
>> boot because (for instance) under Xen3.3 using /dev/sdaX to access
>> (say) your /boot partition worked perfectly well. What we need is a
>> switch to revert to the old Xen3.3 (pre-unplug) behaviour, so any
>> Linux kernel will see the same set of devices. I cannot believe this
>> is a unique requirement for people attempting to do a Xen3.3 to
>> Xen4.1 migration.
> 
> I'm a bit fuzzy on the details but I'm not sure what this has to do with
> the host, the device naming and behaviour on unplug are kernel side
> things, I'd expect that if /dev/sdaX as /boot worked on 3.3 it'll work
> on 4.1 too. (I believe you that it doesn't work, I'm just wondering
> aloud what I'm missing).
> 
> Can you give us the specifics of a setup which fails, e.g. a complete
> guest cfg file, the kernel version, command line options, /etc/fstab,
> dmesg etc.
> 
>> I think this is in xen_unplug_emulated_devices() in
>> arch/x86/xen/platform-pci-unplug.c
>>
>> This uses check_platform_magic(), which I have appended. In order
>> to avoid unplugging (without relying on the boot line), I need
>> this to return a non-zero value (XEN_PLATFORM_ERR_MAGIC is
>> irrelevant as xen_emul_unplug is 0 by assumption).
>>
>> I can achieve that by either (a) returning a bad magic number,
>> (b) making the host 'blacklist' the product (how does that work?)
>> or (c) using a protocol value of (say) 0. I take it Xen 3.3 simply
>> returns a bad magic number as I don't think XEN_IOPORT_MAGIC existed
>> in 3.3. As far as I can tell, XEN_IOPORT_MAGIC is only use for
>> PCI unplug.
>>
>> So, is the correct approach to disable XEN_IOPORT_MAGIC (or rather
>> make it return a different value) depending on a configuration option?
>> If so, I am happy to submit a patch to do that. Or can I do this
>> without a patch by "blacklisting" everything? (not sure how that is done).
> 
> Hmm, yes I think the special treatment of XEN_IOPORT_MAGIC mismatch on
> the kernel side is what I was missing.
> 
> It might make sense to have a guest level config option which disables
> these magic ports, i.e. makes them return 0xffff like they would have
> done in 3.3 (I think 0xffff is what you'll get from an invalid port in
> general).
> 
>> Out of interest, with a default guest Ubuntu Natty install CD, using the
>> default Xen 4.1 settings, we are seeing the guest (a) unplugging the
>> emulated devices (fine), then (b) failing to find the emulated devices,
>> and (c) the install failing. Is that to be expected?
> 
> Sounds like an Ubuntu bug to me, but I don't follow Ubuntu closely
> enough to know if it is known or not.
> 
At least one part is not Ubuntu specific. And that is that the unplug logic
decides to unplug emulated devices based on having the pci and the blkfront
driver *available* (built-in or module). But later on the blkfront driver
ignores all devices that are not *named* in a way to map to the xvd major.
Which leaves you without any usable devices when you named your disk hda in
the config file and you do not prevent unplugging.

The other part of the problem is that even when you name the disk xvda in the
config file, the installer does not know about blkfront. This is Ubuntu specific
and we either need to have blkfront built-in or put them into a special udeb
which is a special handling just for the installer.

Still I would love to see this unplug handling become a bit more obvious. If
unplug was successful, then blkfront should not ignore the devices. Or maybe
just make the config more what-you-write-is-what-you-get and having hd or sd
there only gives you emulated devices and xvd gives you pv devices.

-Stefan

> Ian.
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

  reply	other threads:[~2011-10-27  8:02 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26 13:17 xen_emul_unplug on xen 4.1, HVM guest 2.6.38 Alex Bligh
2011-10-26 13:49 ` Konrad Rzeszutek Wilk
2011-10-26 14:12   ` Pasi Kärkkäinen
2011-10-26 14:47     ` Alex Bligh
2011-10-26 14:56       ` Ian Campbell
2011-10-26 15:59         ` Pasi Kärkkäinen
2011-10-26 16:22           ` Ian Campbell
2011-10-26 16:25         ` Alex Bligh
2011-10-26 16:43           ` Ian Campbell
2011-10-27  8:02             ` Stefan Bader [this message]
2011-10-27 13:42               ` Stefano Stabellini
2011-10-27 13:45                 ` Stefan Bader
2011-10-27 14:08                   ` Stefano Stabellini
2011-10-27 14:13                     ` Stefan Bader
2011-10-27 14:25                       ` Stefano Stabellini
2011-10-27 14:46                         ` Stefan Bader
2011-10-27 13:48                 ` Stefan Bader
2011-10-27 14:09                   ` Stefano Stabellini
2011-10-26 15:54       ` Pasi Kärkkäinen
  -- strict thread matches above, loose matches on Subject: below --
2011-10-26 17:43 Alex Bligh
2011-10-27  9:27 ` Ian Campbell
2011-10-27 13:13   ` Konrad Rzeszutek Wilk
2011-10-27 13:27     ` Stefano Stabellini
2011-10-27 13:35     ` Ian Campbell
2011-10-27 13:18   ` Alex Bligh
2011-10-27 13:35     ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EA91023.5000201@canonical.com \
    --to=stefan.bader@canonical.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Konrad@rly45j.srv.mailcontrol.com \
    --cc=alex@alex.org.uk \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.