Skip to contentSkip to conversation

is kexec on Xen domU possible?

DISCUSSION Greg KH 8 participants 19 messages Jul 19, 2013 – Jul 24, 2013 virtio core

lore
Share & tools
lore

Greg KH

author
#0 lore raw

Hi all,

I was messing around with kexec and it seems to work just fine on KVM, but for Xen domU images, it doesn't work at all. Daniel, I saw some patches from you back in September 2012 for adding this support for Dom0, but they don't seem to have gone into the kernel (but other patches went into kexec-tools at that time.) You mention that domU support is "easy" after your patches go in, is that because Dom0 needs to support this, or is it something specific to only domU?

Also, what's the status of those patches for the kernel, I don't see them reposted anywhere, did you drop them?

thanks,

greg k-h

#1 lore raw
Quoted 6 lines · Greg KH

Hi all,

I was messing around with kexec and it seems to work just fine on KVM, but for Xen domU images, it doesn't work at all. Daniel, I saw some patches from you back in September 2012 for adding this support for Dom0, but they don't seem to have gone into the kernel (but other

At first I was going use existing in Xen kexec implementation for Dom0. However, after some discussion on Xen-devel and LKML we stated that this implementation is completely broken and should be rewriten. David Vrabel from Citrix wrote new kexec implementation for Xen which does not relay on Linux kernel. I hope that it will be included in Xen 4.4 release.

Quoted 1 line

patches went into kexec-tools at that time.) You mention that domU

These are mostly fixes which were needed for planned Xen kexec support. IIRC, they are also needed for systems using ancient Xen Linux Kernel 2.18. However, most of this implementation will be replaced by new one written by David Vrabel. It will contain support only for new Xen Dom0 kexec implentation.

Quoted 2 lines

support is "easy" after your patches go in, is that because Dom0 needs to support this, or is it something specific to only domU?

In case of domU we should consider following cases:
- PV guests: there is no support for kexec at this time; Once I wrote an implementatation for that type of guests for one company but according to our agreement I could not publish this code; However, I could use it as a base for publicly available kexec implementation; Currently, I do not have any plans to work on this due to some more important stuff to do; However, question about kexec support for PV guests is raised from time to time and maybe this issue will be much more important than others once,
- HVM guests: kexec should work without any issue,
- PVonHVM guests: IIRC, there were some issues with PV drivers but they were fixed some time ago by patches posted by Olaf Hering,
- PVH guests: those type of guests are not available in Xen current releases yet; However, Konrad Wilk done some preliminary work on kexec support but there are still some issues to resolve.

I do not know what are you trying to do but if you would like to get some crash dumps there is also another solution to that. You could use xm/xl dump-core from Dom0 to get dumps of domU memory.

Quoted 2 lines

Also, what's the status of those patches for the kernel, I don't see them reposted anywhere, did you drop them?

They were dropped. Please look above for details.

I hope that helps.

Daniel

#2 lore raw

Hey Daniel,

Thank you for the nice summary.

Quoted 3 lines

- PVonHVM guests: IIRC, there were some issues with PV drivers but they were fixed some time ago by patches posted by Olaf Hering,

Which had to be reverted b/c they caused regressions with 32-bit guests during migration. But Greg if you are just looking to do it on a guest without migration then cherrypicking
9d02b43dee0d7fb18dfb13a00915550b1a3daa9f
("xen PVonHVM: use E820_Reserved area for shared_info") should do it for it.

Olaf, you wouldn't have any time to look at this some more now that Xen 4.3 is out?

#5 lore raw
In reply to Daniel Kiper
Quoted 9 lines · Daniel Kiper

- PV guests: there is no support for kexec at this time; Once I wrote an implementatation for that type of guests for one company but according to our agreement I could not publish this code; However, I could use it as a base for publicly available kexec implementation; Currently, I do not have any plans to work on this due to some more important stuff to do; However, question about kexec support for PV guests is raised from time to time and maybe this issue will be much more important than others once,

To do kexec on PV guests is there a dependency on support from the dom0?

e.g. if we recreated your patches and merged them into 3.12 and booted on a XenServer from a few years ago would it work?

What I want to do is use kexec on existing public cloud providers, that use Xen, like AWS or Rackspace.

Thanks,

Brandon

author
#7 lore raw
In reply to Daniel Kiper
Quoted 21 lines · Daniel Kiper
Quoted 2 lines

support is "easy" after your patches go in, is that because Dom0 needs to support this, or is it something specific to only domU?

In case of domU we should consider following cases:
- PV guests: there is no support for kexec at this time; Once I wrote an implementatation for that type of guests for one company but according to our agreement I could not publish this code; However, I could use it as a base for publicly available kexec implementation; Currently, I do not have any plans to work on this due to some more important stuff to do; However, question about kexec support for PV guests is raised from time to time and maybe this issue will be much more important than others once,
- HVM guests: kexec should work without any issue,
- PVonHVM guests: IIRC, there were some issues with PV drivers but they were fixed some time ago by patches posted by Olaf Hering,
- PVH guests: those type of guests are not available in Xen current releases yet; However, Konrad Wilk done some preliminary work on kexec support but there are still some issues to resolve.

Quoted 3 lines

I do not know what are you trying to do but if you would like to get some crash dumps there is also another solution to that. You could use xm/xl dump-core from Dom0 to get dumps of domU memory.

As Brandon said, we were trying to use kexec in a PV guest in domU to run another kernel. I had assumed this wouldn't need support from dom0. As you have implemented this in the past, did you need to change dom0 in order to achieve this, and if so, why?

The errors that the kexec tools seem to run into is finding the memory to place the new kernel into, is that just an issue that PV guests aren't given enough kernel memory in which to replicate themselves from dom0?

thanks,

greg k-h

#6 lore raw
In reply to Brandon Philips
Quoted 11 lines · Brandon Philips
Quoted 9 lines · Daniel Kiper

- PV guests: there is no support for kexec at this time; Once I wrote an implementatation for that type of guests for one company but according to our agreement I could not publish this code; However, I could use it as a base for publicly available kexec implementation; Currently, I do not have any plans to work on this due to some more important stuff to do; However, question about kexec support for PV guests is raised from time to time and maybe this issue will be much more important than others once,

Quoted 1 line

To do kexec on PV guests is there a dependency on support from the dom0?

No.

Quoted 2 lines

e.g. if we recreated your patches and merged them into 3.12 and booted on a XenServer from a few years ago would it work?

No.

Quoted 2 lines

What I want to do is use kexec on existing public cloud providers, that use Xen, like AWS or Rackspace.

Look for HVM or PVonHVM guests support in this providers. Sadly, there is no support for kexec on PV guests.

Daniel

#8 lore raw
In reply to Greg KH
Quoted 22 lines · Greg KH
Quoted 21 lines · Daniel Kiper
Quoted 2 lines

support is "easy" after your patches go in, is that because Dom0 needs to support this, or is it something specific to only domU?

In case of domU we should consider following cases:
- PV guests: there is no support for kexec at this time; Once I wrote an implementatation for that type of guests for one company but according to our agreement I could not publish this code; However, I could use it as a base for publicly available kexec implementation; Currently, I do not have any plans to work on this due to some more important stuff to do; However, question about kexec support for PV guests is raised from time to time and maybe this issue will be much more important than others once,
- HVM guests: kexec should work without any issue,
- PVonHVM guests: IIRC, there were some issues with PV drivers but they were fixed some time ago by patches posted by Olaf Hering,
- PVH guests: those type of guests are not available in Xen current releases yet; However, Konrad Wilk done some preliminary work on kexec support but there are still some issues to resolve.

Quoted 6 lines
Quoted 3 lines

I do not know what are you trying to do but if you would like to get some crash dumps there is also another solution to that. You could use xm/xl dump-core from Dom0 to get dumps of domU memory.

As Brandon said, we were trying to use kexec in a PV guest in domU to run another kernel. I had assumed this wouldn't need support from dom0.

You are right.

Quoted 2 lines

As you have implemented this in the past, did you need to change dom0 in order to achieve this, and if so, why?

It was strong requirement to not change anything in hypervisor or dom0. I succeeded to do that but it requires changes in kernel and kexec-tools.

Quoted 4 lines

The errors that the kexec tools seem to run into is finding the memory to place the new kernel into, is that just an issue that PV guests aren't given enough kernel memory in which to replicate themselves from dom0?

There are a lot of differences between baremetal machines and PV guests. For example you are not able to do identity mapping per se in PV guests. Arguments to new kernel are passed in completely different way. etc.

Daniel

#3 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 2 lines · Konrad Rzeszutek Wilk

Olaf, you wouldn't have any time to look at this some more now that Xen 4.3 is out?

Currently no time to continue work on kexec for PVonHVM, sorry.

Olaf

#4 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 2 lines · Konrad Rzeszutek Wilk

Olaf, you wouldn't have any time to look at this some more now that Xen 4.3 is out?

Currently no time to continue work on kexec for PVonHVM, sorry.

Olaf

author
#9 lore raw
In reply to Daniel Kiper
Quoted 38 lines · Daniel Kiper
Quoted 22 lines · Greg KH
Quoted 21 lines · Daniel Kiper
Quoted 2 lines

support is "easy" after your patches go in, is that because Dom0 needs to support this, or is it something specific to only domU?

In case of domU we should consider following cases:
- PV guests: there is no support for kexec at this time; Once I wrote an implementatation for that type of guests for one company but according to our agreement I could not publish this code; However, I could use it as a base for publicly available kexec implementation; Currently, I do not have any plans to work on this due to some more important stuff to do; However, question about kexec support for PV guests is raised from time to time and maybe this issue will be much more important than others once,
- HVM guests: kexec should work without any issue,
- PVonHVM guests: IIRC, there were some issues with PV drivers but they were fixed some time ago by patches posted by Olaf Hering,
- PVH guests: those type of guests are not available in Xen current releases yet; However, Konrad Wilk done some preliminary work on kexec support but there are still some issues to resolve.

Quoted 6 lines
Quoted 3 lines

I do not know what are you trying to do but if you would like to get some crash dumps there is also another solution to that. You could use xm/xl dump-core from Dom0 to get dumps of domU memory.

As Brandon said, we were trying to use kexec in a PV guest in domU to run another kernel. I had assumed this wouldn't need support from dom0.

You are right.

Quoted 2 lines

As you have implemented this in the past, did you need to change dom0 in order to achieve this, and if so, why?

It was strong requirement to not change anything in hypervisor or dom0. I succeeded to do that but it requires changes in kernel and kexec-tools.

Quoted 8 lines
Quoted 4 lines

The errors that the kexec tools seem to run into is finding the memory to place the new kernel into, is that just an issue that PV guests aren't given enough kernel memory in which to replicate themselves from dom0?

There are a lot of differences between baremetal machines and PV guests. For example you are not able to do identity mapping per se in PV guests. Arguments to new kernel are passed in completely different way. etc.

Ok, thanks for confirming that it is possible, but doesn't currently work for pv guests.

greg k-h

#10 lore raw
Quoted 6 lines · Greg KH
Quoted 6 lines
Quoted 5 lines

The errors that the kexec tools seem to run into is finding the memory to place the new kernel into, is that just an issue that PV guests aren't given enough kernel memory in which to replicate themselves from dom0?

Quoted 7 lines
Quoted 3 lines

There are a lot of differences between baremetal machines and PV guests. For example you are not able to do identity mapping per se in PV guests. Arguments to new kernel are passed in completely different way. etc.

Ok, thanks for confirming that it is possible, but doesn't currently work for pv guests.

Also, in any virtualized environment the hypervisor can do a better job for things like kdump, simply because it can provide two things that are otherwise hard to do:

1. a known-good system state;
2. a known-clean kdump image.

As such, I do encourage the virtualization people to (also) develop hypervisor-*aware* solutions for these kinds of things.

-hpa

#11 lore raw
Quoted 19 lines · H. Peter Anvin
Quoted 6 lines · Greg KH
Quoted 6 lines
Quoted 5 lines

The errors that the kexec tools seem to run into is finding the memory to place the new kernel into, is that just an issue that PV guests aren't given enough kernel memory in which to replicate themselves from dom0?

Quoted 7 lines
Quoted 3 lines

There are a lot of differences between baremetal machines and PV guests. For example you are not able to do identity mapping per se in PV guests. Arguments to new kernel are passed in completely different way. etc.

Ok, thanks for confirming that it is possible, but doesn't currently work for pv guests.

Also, in any virtualized environment the hypervisor can do a better job for things like kdump, simply because it can provide two things that are otherwise hard to do:

Quoted 5 lines

1. a known-good system state;
2. a known-clean kdump image.

As such, I do encourage the virtualization people to (also) develop hypervisor-*aware* solutions for these kinds of things.

In general I agree but if you could not change hypervisor and/or dom0 (e.g. you are using cloud providers which are stick to old versions of Xen) then you have no choice.

Daniel

#12 lore raw
Quoted 23 lines · Daniel Kiper
Quoted 22 lines · H. Peter Anvin
Quoted 6 lines · Greg KH
Quoted 6 lines
Quoted 5 lines

The errors that the kexec tools seem to run into is finding the memory to place the new kernel into, is that just an issue that PV guests aren't given enough kernel memory in which to replicate themselves from dom0?

Quoted 7 lines
Quoted 3 lines

There are a lot of differences between baremetal machines and PV guests. For example you are not able to do identity mapping per se in PV guests. Arguments to new kernel are passed in completely different way. etc.

Ok, thanks for confirming that it is possible, but doesn't currently work for pv guests.

Also, in any virtualized environment the hypervisor can do a better job for things like kdump, simply because it can provide two things that are otherwise hard to do:

1. a known-good system state;
2. a known-clean kdump image.

Quoted 6 lines
Quoted 2 lines

As such, I do encourage the virtualization people to (also) develop hypervisor-*aware* solutions for these kinds of things.

In general I agree but if you could not change hypervisor and/or dom0 (e.g. you are using cloud providers which are stick to old versions of Xen) then you have no choice.

Which tends to be where kexec on panic comes in most cases. Getting platform vendors to do something sane tends to be a multi-year political effort of dubious worth while just solving the problem locally actually gets the problem solved for those who care.

Eric

#13 lore raw
Quoted 11 lines · Eric W. Biederman
Quoted 11 lines
Quoted 10 lines

Also, in any virtualized environment the hypervisor can do a better job for things like kdump, simply because it can provide two things that are otherwise hard to do:

1. a known-good system state;
2. a known-clean kdump image.

As such, I do encourage the virtualization people to (also) develop hypervisor-*aware* solutions for these kinds of things.

Quoted 9 lines
Quoted 3 lines

In general I agree but if you could not change hypervisor and/or dom0 (e.g. you are using cloud providers which are stick to old versions of Xen) then you have no choice.

Which tends to be where kexec on panic comes in most cases. Getting platform vendors to do something sane tends to be a multi-year political effort of dubious worth while just solving the problem locally actually gets the problem solved for those who care.

It should not be a "one or the other" issue.

-hpa

author
#14 lore raw
Quoted 16 lines · H. Peter Anvin
Quoted 15 lines · Eric W. Biederman
Quoted 14 lines
Quoted 10 lines

Also, in any virtualized environment the hypervisor can do a better job for things like kdump, simply because it can provide two things that are otherwise hard to do:

1. a known-good system state;
2. a known-clean kdump image.

As such, I do encourage the virtualization people to (also) develop hypervisor-*aware* solutions for these kinds of things.

In general I agree but if you could not change hypervisor and/or dom0 (e.g. you are using cloud providers which are stick to old versions of Xen) then you have no choice.

Quoted 7 lines
Quoted 5 lines

Which tends to be where kexec on panic comes in most cases. Getting platform vendors to do something sane tends to be a multi-year political effort of dubious worth while just solving the problem locally actually gets the problem solved for those who care.

It should not be a "one or the other" issue.

I don't care about kdump, I care about kexec on domU for people who are running on cloud providers with old versions of Xen so that they can control what kernel they can boot, when they want to boot it. If kdump works as well, that's just a bonus, but it's down on the list of things for me to be concerned about.

thanks,

greg k-h

#15 lore raw
Quoted 7 lines · Greg KH

I don't care about kdump, I care about kexec on domU for people who are running on cloud providers with old versions of Xen so that they can control what kernel they can boot, when they want to boot it. If kdump works as well, that's just a bonus, but it's down on the list of things for me to be concerned about.

Another valid use case, to be sure.

-hpa

#16 lore raw
In reply to Greg KH
Quoted 23 lines · Greg KH
Quoted 22 lines · H. Peter Anvin
Quoted 20 lines · Eric W. Biederman
Quoted 8 lines
Quoted 8 lines

Also, in any virtualized environment the hypervisor can do a better job for things like kdump, simply because it can provide two things that are otherwise hard to do:

1. a known-good system state;
2. a known-clean kdump image.

Quoted 6 lines
Quoted 2 lines

As such, I do encourage the virtualization people to (also) develop hypervisor-*aware* solutions for these kinds of things.

In general I agree but if you could not change hypervisor and/or dom0 (e.g. you are using cloud providers which are stick to old versions of Xen) then you have no choice.

Which tends to be where kexec on panic comes in most cases. Getting platform vendors to do something sane tends to be a multi-year political effort of dubious worth while just solving the problem locally actually gets the problem solved for those who care.

Quoted 7 lines
Quoted 1 line

It should not be a "one or the other" issue.

I don't care about kdump, I care about kexec on domU for people who are running on cloud providers with old versions of Xen so that they can control what kernel they can boot, when they want to boot it. If kdump works as well, that's just a bonus, but it's down on the list of things for me to be concerned about.

Many Xen-based cloud providers provide a mechanism for users to boot the kernels they want. For example you can use PV-GRUB on EC2 instances to boot a kernel that is stored within an AMI.

For more info:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html

--msw

author
#17 lore raw
Quoted 32 lines · Matt Wilson
Quoted 23 lines · Greg KH
Quoted 22 lines · H. Peter Anvin
Quoted 20 lines · Eric W. Biederman
Quoted 8 lines
Quoted 8 lines

Also, in any virtualized environment the hypervisor can do a better job for things like kdump, simply because it can provide two things that are otherwise hard to do:

1. a known-good system state;
2. a known-clean kdump image.

Quoted 6 lines
Quoted 2 lines

As such, I do encourage the virtualization people to (also) develop hypervisor-*aware* solutions for these kinds of things.

In general I agree but if you could not change hypervisor and/or dom0 (e.g. you are using cloud providers which are stick to old versions of Xen) then you have no choice.

Which tends to be where kexec on panic comes in most cases. Getting platform vendors to do something sane tends to be a multi-year political effort of dubious worth while just solving the problem locally actually gets the problem solved for those who care.

Quoted 7 lines
Quoted 1 line

It should not be a "one or the other" issue.

I don't care about kdump, I care about kexec on domU for people who are running on cloud providers with old versions of Xen so that they can control what kernel they can boot, when they want to boot it. If kdump works as well, that's just a bonus, but it's down on the list of things for me to be concerned about.

Quoted 6 lines

Many Xen-based cloud providers provide a mechanism for users to boot the kernels they want. For example you can use PV-GRUB on EC2 instances to boot a kernel that is stored within an AMI.

For more info:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html

Yes, that's quite true, but some don't, or they make it difficult to do so. Using kexec also allows you to "be the bootloader" and decide on _which_ kernel you want to boot, independant of what cloud provider you use, something that lots of people want in their quest to not dependant on any one company.

thanks,

greg k-h

#18 lore raw
Quoted 9 lines · Greg KH
Quoted 8 lines · Matt Wilson
Quoted 2 lines · Greg KH
Quoted 1 line · H. Peter Anvin

On 07/22/2013 10:20 AM, Eric W. Biederman wrote:

Many Xen-based cloud providers provide a mechanism for users to boot the kernels they want. For example you can use PV-GRUB on EC2 instances to boot a kernel that is stored within an AMI.

Quoted 8 lines
Quoted 2 lines

For more info:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html

Yes, that's quite true, but some don't, or they make it difficult to do so. Using kexec also allows you to "be the bootloader" and decide on _which_ kernel you want to boot, independant of what cloud provider you use, something that lots of people want in their quest to not dependant on any one company.

I would be more than happy to review and help get something merged that sorts out kexec on Xen.

Eric