Fixing update-grub to work with paravirt ops (2.6.22+) Xen kernels

Ian Campbell ijc at hellion.org.uk
Wed May 7 20:42:24 UTC 2008


On Wed, 2008-05-07 at 17:23 +0200, Robert Millan wrote:
> On Wed, May 07, 2008 at 03:54:53PM +0100, Ian Campbell wrote:
> > 
> > Just to clarify that there are two sets of patches/issues at hand here:
> > 
> > The patch I sent to grub-devel is about having grub/grub2 understand the
> > xvd device types. That is #456776 against grub and #456777 against
> > grub-2. I'll respond to the comments on grub-devel when I get home
> > tonight and have a moment to check my facts etc. I'm completely happy to
> > work on getting this included in grub-2 first as you request.
> 
> Thanks.

I've posted an update version.

> > The second issue is the behaviour of update-grub in grub legacy wrt to
> > kernels with CONFIG_XEN(_PRIV..._GUEST) vs CONFIG_PARAVIRT
> > +CONFIG_XEN. The issue is that grub legacy's update-grub does not
> > handle the CONFIG_PARAVIRT+CONFIG_XEN case. As far as I can tell grub-2
> > currently has no special handling of Xen enabled kernels
> > (i.e. /etc/grub.d/10_linux doesn't have any Xen specific checks) and so
> > there is no problem with grub-2[0].
> > 
> > My preferred patch for this issue is
> > update-grub-no-xen-special-case.patch which makes the grub and grub-2
> > behaviour WRT Xen enabled kernels the same by removing the Xen special
> > cases from grub-legacy. I think this is the correct thing to do since
> > the special casing in grub legacy, while a nice idea, is mostly just
> > confusing and gets in the way of the admin (e.g. it doesn't work if you
> > create your guest filesystem in a chroot or if you wish to switch
> > between HVM and PV mode, e.g. #479478). In this case there is no
> > equivalent patch required for grub-2 and so no regression is created by
> > patching grub-legacy.
> > 
> > If you prefer the special casing I could look at creating a patch for
> > grub-2 which implements the same scheme as
> > update-grub-better-xen-support.patch does for grub-legacy.
> 
> Where can I find update-grub-no-xen-special-case.patch?  I'll have a look.

It was attached to a previous mail -- I was at work and didn't have the
file handy or I would have reattached it when referring to it again.
I've attached both patches now.

> Although, it's probably better to discuss with upstream whether we should
> special-case in GRUB 2 or not.  If we decide that special-casing is a bad
> idea, I'd probably be fine with removing it in GRUB Legacy for consistency,
> but we'd have to evaluate the reasons why it was added in first place (can
> you provide some pointers to that?).

Looks like it was done by a previous Debian grub package maintainer
based on patches provided by others, I found at least:
        #343076 fixed 0.97-13 Mon, 24 Jul 2006 SVN r259,r263
        #397775 fixed 0.97-19 Thu,  9 Nov 2006 SVN r380
        #404536 fixed 0.97-22 Wed, 31 Jan 2007 SVN r412

The logic was sound enough at the time. The problem is that newer
CONFIG_PARAVIRT=y kernels can be booted both natively and under Xen.
Additionally there is no distinction in this case between a kernel which
is good for dom0 and one which is good for domU (i.e.
CONFIG_XEN_PRIVILEGED_GUEST does not exist).

The current scheme causes some pain even independent of the new
CONFIG_PARAVIRT kernels, for example at work when we build a chroot for
use in a domU we have to do
	mkdir -p /chroot/proc/xen
	touch /chroot/proc/xen/capabilities
	chroot /chroot update-grub
	rm -rf /chroot/proc/xen
(or similar, you get the idea).

I'll wait and see what you think of the patches and prepare to take the
discussion to grub-devel.

> > [0] As a separate issue grub-2 doesn't yet know about creating stanzas
> > for domain0 use, i.e. hypervisor+dom0 kernel but that is unrelated to
> > the above. I was planning to have a tinker with
> > making /etc/grub.d/nn_xen at some point, not sure if that is a patch for
> > you or the xen maintainers though.
> 
> I'm not sure either... I suppose it depends a lot on how much dependant on
> our interfaces will the resulting code be.  It's probably also a good idea
> to discuss it in grub-devel.

I probably won't get on to this one right now, but I'll bring it to
grub-devel when I get round to it.

Ian.
-- 
Ian Campbell

If you don't care where you are, then you ain't lost.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: update-grub-better-xen-support.patch
Type: text/x-patch
Size: 3704 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20080507/a863042b/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: update-grub-no-xen-special-case.patch
Type: text/x-patch
Size: 3055 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20080507/a863042b/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20080507/a863042b/attachment.pgp 


More information about the Pkg-grub-devel mailing list