Simon Horman
2008-Feb-27 07:10 UTC
[Xen-devel] [patch 0/4] linux-xen: Extend xen kexec hypercall to return additional regions
this series makes use of the extra regions that can be retrieved using the kexec hypercall, as per patches posted in a separate series. This allows all regions that kexec needs to avoid to be retrieved from the hypervisor. The patch set also places all of these regions into /proc/iomem_machine - previously some where in /proc/iomem_machine and some where in /proc/iomem. There are generic and ia64 specific patches in this series. I wanted to post them together as they don''t make much sense without each other. As well as the related xen patches, there are also related kexec-tools patches which I have posted to the kexec mailing list and intend to merge. http://lists.infradead.org/pipermail/kexec/2008-February/001348.html The end-game here is to make sure that all the reserved regions show up in /proc/iomem_machine on ia64. This currently does not happen. And manifests as kexec only being able to be performed once as the boot parameter ends up being overwritten in relocate_kernel before purgatory is reached. Xen--kexec-->Xen--kexec [hang in purgatory!] The EFI-RID patches for ia64 xen kexec are also needed for kexec to function on ia64. However they touch different code paths and can be merged separately. -- Horms _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Simon Horman
2008-Feb-27 07:10 UTC
[Xen-devel] [patch 1/4] kexec: add parent to per-cpu regions at setup time.
This is slightly more efficient as xen_machine_kexec_setup_resorces() is called once (before xen_machine_kexec_register_resources()). While xen_machine_kexec_register_resources() is called once for each EFI memory region seen by a domain. More cosmetic than anything else, but it seems more logical to me. Signed-off-by: Simon Horman <horms@verge.net.au> --- drivers/xen/core/machine_kexec.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) Index: linux-2.6.18-xen.hg/drivers/xen/core/machine_kexec.c ==================================================================--- linux-2.6.18-xen.hg.orig/drivers/xen/core/machine_kexec.c 2008-02-26 18:37:15.000000000 +0900 +++ linux-2.6.18-xen.hg/drivers/xen/core/machine_kexec.c 2008-02-26 18:37:17.000000000 +0900 @@ -79,6 +79,10 @@ void __init xen_machine_kexec_setup_reso xen_hypervisor_res.end = range.start + range.size - 1; xen_hypervisor_res.flags = IORESOURCE_BUSY | IORESOURCE_MEM; + /* The per-cpu crash note resources belong to the hypervisor resource */ + for (k = 0; k < xen_max_nr_phys_cpus; k++) + request_resource(&xen_hypervisor_res, xen_phys_cpus + k); + /* fill in crashk_res if range is reserved by hypervisor */ memset(&range, 0, sizeof(range)); @@ -106,13 +110,7 @@ void __init xen_machine_kexec_setup_reso void __init xen_machine_kexec_register_resources(struct resource *res) { - int k; - request_resource(res, &xen_hypervisor_res); - - for (k = 0; k < xen_max_nr_phys_cpus; k++) - request_resource(&xen_hypervisor_res, xen_phys_cpus + k); - } static void setup_load_arg(xen_kexec_image_t *xki, struct kimage *image) -- -- Horms _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Simon Horman
2008-Feb-27 07:10 UTC
[Xen-devel] [patch 2/4] kexec: add xen_machine_kexec_register_resources() and machine_kexec_register_resources()
Add xen_machine_kexec_register_resources() and machine_kexec_register_resources() to allow architecture specific handling of iomem resources. At this time xen_machine_kexec_register_resources() does the same parenting of per-cpu resources on all architectures. And machine_kexec_register_resources does nothing on all architectures. A subsequent patch will alter the behaviour on ia64. Signed-off-by: Simon Horman <horms@verge.net.au> --- arch/i386/kernel/machine_kexec.c | 15 +++++++++++++++ arch/ia64/kernel/machine_kexec.c | 15 +++++++++++++++ arch/x86_64/kernel/machine_kexec.c | 15 +++++++++++++++ drivers/xen/core/machine_kexec.c | 13 +++++++++---- 4 files changed, 54 insertions(+), 4 deletions(-) Index: linux-2.6.18-xen.hg/arch/i386/kernel/machine_kexec.c ==================================================================--- linux-2.6.18-xen.hg.orig/arch/i386/kernel/machine_kexec.c 2008-02-25 14:18:14.000000000 +0900 +++ linux-2.6.18-xen.hg/arch/i386/kernel/machine_kexec.c 2008-02-25 14:19:19.000000000 +0900 @@ -64,6 +64,21 @@ void machine_kexec_setup_load_arg(xen_ke } +int __init machine_kexec_setup_resources(struct resource *hypervisor, + struct resource *phys_cpus, + int nr_phys_cpus) +{ + int k; + + /* The per-cpu crash note resources belong to the hypervisor resource */ + for (k = 0; k < nr_phys_cpus; k++) + request_resource(hypervisor, phys_cpus + k); + + return 0; +} + +void machine_kexec_register_resources(struct resource *res) { ; } + #endif /* CONFIG_XEN */ /* Index: linux-2.6.18-xen.hg/arch/ia64/kernel/machine_kexec.c ==================================================================--- linux-2.6.18-xen.hg.orig/arch/ia64/kernel/machine_kexec.c 2008-02-25 14:18:14.000000000 +0900 +++ linux-2.6.18-xen.hg/arch/ia64/kernel/machine_kexec.c 2008-02-25 14:33:05.000000000 +0900 @@ -142,4 +142,19 @@ void machine_kexec_setup_load_arg(xen_ke xki->reboot_code_buffer kexec_page_to_pfn(image->control_code_page) << PAGE_SHIFT; } + +int __init machine_kexec_setup_resources(struct resource *hypervisor, + struct resource *phys_cpus, + int nr_phys_cpus) +{ + int k; + + /* The per-cpu crash note resources belong to the hypervisor resource */ + for (k = 0; k < nr_phys_cpus; k++) + request_resource(hypervisor, phys_cpus + k); + + return 0; +} + +void machine_kexec_register_resources(struct resource *res) { ; } #endif /* CONFIG_XEN */ Index: linux-2.6.18-xen.hg/arch/x86_64/kernel/machine_kexec.c ==================================================================--- linux-2.6.18-xen.hg.orig/arch/x86_64/kernel/machine_kexec.c 2008-02-25 14:18:14.000000000 +0900 +++ linux-2.6.18-xen.hg/arch/x86_64/kernel/machine_kexec.c 2008-02-25 14:19:19.000000000 +0900 @@ -104,6 +104,21 @@ void machine_kexec_setup_load_arg(xen_ke xki->page_list[PA_PTE_1] = __ma(kexec_pte1); } +int __init machine_kexec_setup_resources(struct resource *hypervisor, + struct resource *phys_cpus, + int nr_phys_cpus) +{ + int k; + + /* The per-cpu crash note resources belong to the hypervisor resource */ + for (k = 0; k < nr_phys_cpus; k++) + request_resource(hypervisor, phys_cpus + k); + + return 0; +} + +void machine_kexec_register_resources(struct resource *res) { ; } + #else /* CONFIG_XEN */ #define x__pmd(x) __pmd(x) Index: linux-2.6.18-xen.hg/drivers/xen/core/machine_kexec.c ==================================================================--- linux-2.6.18-xen.hg.orig/drivers/xen/core/machine_kexec.c 2008-02-25 14:19:06.000000000 +0900 +++ linux-2.6.18-xen.hg/drivers/xen/core/machine_kexec.c 2008-02-25 14:19:19.000000000 +0900 @@ -10,6 +10,10 @@ extern void machine_kexec_setup_load_arg(xen_kexec_image_t *xki, struct kimage *image); +extern int machine_kexec_setup_resources(struct resource *hypervisor, + struct resource *phys_cpus, + int nr_phys_cpus); +extern void machine_kexec_register_resources(struct resource *res); static int __initdata xen_max_nr_phys_cpus; static struct resource xen_hypervisor_res; @@ -79,10 +83,6 @@ void __init xen_machine_kexec_setup_reso xen_hypervisor_res.end = range.start + range.size - 1; xen_hypervisor_res.flags = IORESOURCE_BUSY | IORESOURCE_MEM; - /* The per-cpu crash note resources belong to the hypervisor resource */ - for (k = 0; k < xen_max_nr_phys_cpus; k++) - request_resource(&xen_hypervisor_res, xen_phys_cpus + k); - /* fill in crashk_res if range is reserved by hypervisor */ memset(&range, 0, sizeof(range)); @@ -96,6 +96,10 @@ void __init xen_machine_kexec_setup_reso crashk_res.end = range.start + range.size - 1; } + if (machine_kexec_setup_resources(&xen_hypervisor_res, xen_phys_cpus, + xen_max_nr_phys_cpus)) + goto err; + return; err: @@ -111,6 +115,7 @@ void __init xen_machine_kexec_setup_reso void __init xen_machine_kexec_register_resources(struct resource *res) { request_resource(res, &xen_hypervisor_res); + machine_kexec_register_resources(res); } static void setup_load_arg(xen_kexec_image_t *xki, struct kimage *image) -- -- Horms _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Simon Horman
2008-Feb-27 07:10 UTC
[Xen-devel] [patch 3/4] kexec: read more iomem regions from hypevisor
This sets the location of the efi memmap and boot parameter regions using information provided by the hypervisor, overriding values derived by dom0 from the virtualised efi memory regions. It also creates a xen heap region and uses this as the parent of per-cpu regions - they belong in hypervisor memory not dom0 kernel memory. The xen heap region is inserted into /proc/iomem_machine * There is also a hypervisor portion of this patch. * In order for the regions to show up after kexec patches to kexec-tools are required. I have posted them to the kexec mailing list and intend to merge them. http://lists.infradead.org/pipermail/kexec/2008-February/001348.html Signed-off-by: Simon Horman <horms@verge.net.au> --- arch/ia64/kernel/machine_kexec.c | 50 +++++++++++++++++++++++++++++++++++--- include/xen/interface/kexec.h | 15 +++++++++-- 2 files changed, 59 insertions(+), 6 deletions(-) Index: linux-2.6.18-xen.hg/include/xen/interface/kexec.h ==================================================================--- linux-2.6.18-xen.hg.orig/include/xen/interface/kexec.h 2008-02-26 13:51:03.000000000 +0900 +++ linux-2.6.18-xen.hg/include/xen/interface/kexec.h 2008-02-26 13:51:26.000000000 +0900 @@ -108,9 +108,18 @@ typedef struct xen_kexec_load { xen_kexec_image_t image; } xen_kexec_load_t; -#define KEXEC_RANGE_MA_CRASH 0 /* machine address and size of crash area */ -#define KEXEC_RANGE_MA_XEN 1 /* machine address and size of Xen itself */ -#define KEXEC_RANGE_MA_CPU 2 /* machine address and size of a CPU note */ +#define KEXEC_RANGE_MA_CRASH 0 /* machine address and size of crash area */ +#define KEXEC_RANGE_MA_XEN 1 /* machine address and size of Xen itself */ +#define KEXEC_RANGE_MA_CPU 2 /* machine address and size of a CPU note */ +#define KEXEC_RANGE_MA_XENHEAP 3 /* machine address and size of xenheap + * Note that although this is adjacent + * to Xen it exists in a separate EFI + * region on ia64, and thus needs to be + * inserted into iomem_machine separately */ +#define KEXEC_RANGE_MA_BOOT_PARAM 4 /* machine address and size of + * the ia64_boot_param */ +#define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of + * of the EFI Memory Map */ /* * Find the address and size of certain memory areas Index: linux-2.6.18-xen.hg/arch/ia64/kernel/machine_kexec.c ==================================================================--- linux-2.6.18-xen.hg.orig/arch/ia64/kernel/machine_kexec.c 2008-02-26 13:51:26.000000000 +0900 +++ linux-2.6.18-xen.hg/arch/ia64/kernel/machine_kexec.c 2008-02-26 13:51:26.000000000 +0900 @@ -143,18 +143,62 @@ void machine_kexec_setup_load_arg(xen_ke kexec_page_to_pfn(image->control_code_page) << PAGE_SHIFT; } +static struct resource xen_hypervisor_heap_res; + int __init machine_kexec_setup_resources(struct resource *hypervisor, struct resource *phys_cpus, int nr_phys_cpus) { + xen_kexec_range_t range; int k; - /* The per-cpu crash note resources belong to the hypervisor resource */ + /* fill in xen_hypervisor_heap_res with hypervisor heap + * machine address range + */ + + memset(&range, 0, sizeof(range)); + range.range = KEXEC_RANGE_MA_XENHEAP; + + if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range)) + return -1; + + xen_hypervisor_heap_res.name = "Hypervisor heap"; + xen_hypervisor_heap_res.start = range.start; + xen_hypervisor_heap_res.end = range.start + range.size - 1; + xen_hypervisor_heap_res.flags = IORESOURCE_BUSY | IORESOURCE_MEM; + + /* The per-cpu crash note resources belong inside the + * hypervisor heap resource */ for (k = 0; k < nr_phys_cpus; k++) - request_resource(hypervisor, phys_cpus + k); + request_resource(&xen_hypervisor_heap_res, phys_cpus + k); + + /* fill in efi_memmap_res with EFI memmap machine address range */ + + memset(&range, 0, sizeof(range)); + range.range = KEXEC_RANGE_MA_EFI_MEMMAP; + + if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range)) + return -1; + + efi_memmap_res.start = range.start; + efi_memmap_res.end = range.start + range.size - 1; + + /* fill in boot_param_res with boot parameter machine address range */ + + memset(&range, 0, sizeof(range)); + range.range = KEXEC_RANGE_MA_BOOT_PARAM; + + if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range)) + return -1; + + boot_param_res.start = range.start; + boot_param_res.end = range.start + range.size - 1; return 0; } -void machine_kexec_register_resources(struct resource *res) { ; } +void machine_kexec_register_resources(struct resource *res) +{ + request_resource(res, &xen_hypervisor_heap_res); +} #endif /* CONFIG_XEN */ -- -- Horms _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Simon Horman
2008-Feb-27 07:10 UTC
[Xen-devel] [patch 4/4] kexec: dont initialise regions in reserve_memory()
There is no need to initialise efi_memmap_res and boot_param_res in reserve_memory() for the initial xen domain as it is done in machine_kexec_setup_resources() using values from the kexec hypercall. Signed-off-by: Simon Horman <horms@verge.net.au> --- arch/ia64/kernel/setup.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) Index: linux-2.6.18-xen.hg/arch/ia64/kernel/setup.c ==================================================================--- linux-2.6.18-xen.hg.orig/arch/ia64/kernel/setup.c 2008-02-26 18:26:48.000000000 +0900 +++ linux-2.6.18-xen.hg/arch/ia64/kernel/setup.c 2008-02-26 18:33:54.000000000 +0900 @@ -336,15 +336,15 @@ reserve_memory (void) } } } -#ifdef CONFIG_XEN - } -#endif efi_memmap_res.start = ia64_boot_param->efi_memmap; efi_memmap_res.end = efi_memmap_res.start + ia64_boot_param->efi_memmap_size; boot_param_res.start = kexec_virt_to_phys(ia64_boot_param); boot_param_res.end = boot_param_res.start + sizeof(*ia64_boot_param); +#ifdef CONFIG_XEN + } +#endif } #endif /* end of memory marker */ -- -- Horms _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Alex Williamson
2008-Feb-27 19:58 UTC
[Xen-devel] Re: [patch 0/4] linux-xen: Extend xen kexec hypercall to return additional regions
Hi Simon, These look ok to me. Ack. Thanks, Alex On Wed, 2008-02-27 at 16:10 +0900, Simon Horman wrote:> this series makes use of the extra regions that can be > retrieved using the kexec hypercall, as per patches posted > in a separate series. > > This allows all regions that kexec needs to avoid to be retrieved > from the hypervisor. The patch set also places all of these > regions into /proc/iomem_machine - previously some where in > /proc/iomem_machine and some where in /proc/iomem. > > There are generic and ia64 specific patches in this series. > I wanted to post them together as they don''t make much sense > without each other. > > As well as the related xen patches, there are also related kexec-tools > patches which I have posted to the kexec mailing list and intend to merge. > http://lists.infradead.org/pipermail/kexec/2008-February/001348.html > > > The end-game here is to make sure that all the reserved regions > show up in /proc/iomem_machine on ia64. This currently does not happen. > And manifests as kexec only being able to be performed once as > the boot parameter ends up being overwritten in relocate_kernel before > purgatory is reached. > > Xen--kexec-->Xen--kexec [hang in purgatory!] > > > The EFI-RID patches for ia64 xen kexec are also needed for kexec to > function on ia64. However they touch different code paths and can be merged > separately. >-- Alex Williamson HP Open Source & Linux Org. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2008-Feb-28 08:59 UTC
Re: [Xen-devel] Re: [patch 0/4] linux-xen: Extend xen kexec hypercall to return additional regions
Thanks, I will apply all parts of these kexec patches into xen-unstable directly, including the ia64 portions. -- Keir On 27/2/08 19:58, "Alex Williamson" <alex.williamson@hp.com> wrote:> Hi Simon, > > These look ok to me. Ack. Thanks, > > Alex > > On Wed, 2008-02-27 at 16:10 +0900, Simon Horman wrote: >> this series makes use of the extra regions that can be >> retrieved using the kexec hypercall, as per patches posted >> in a separate series. >> >> This allows all regions that kexec needs to avoid to be retrieved >> from the hypervisor. The patch set also places all of these >> regions into /proc/iomem_machine - previously some where in >> /proc/iomem_machine and some where in /proc/iomem. >> >> There are generic and ia64 specific patches in this series. >> I wanted to post them together as they don''t make much sense >> without each other. >> >> As well as the related xen patches, there are also related kexec-tools >> patches which I have posted to the kexec mailing list and intend to merge. >> http://lists.infradead.org/pipermail/kexec/2008-February/001348.html >> >> >> The end-game here is to make sure that all the reserved regions >> show up in /proc/iomem_machine on ia64. This currently does not happen. >> And manifests as kexec only being able to be performed once as >> the boot parameter ends up being overwritten in relocate_kernel before >> purgatory is reached. >> >> Xen--kexec-->Xen--kexec [hang in purgatory!] >> >> >> The EFI-RID patches for ia64 xen kexec are also needed for kexec to >> function on ia64. However they touch different code paths and can be merged >> separately. >>_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Simon Horman
2008-Feb-29 00:55 UTC
Re: [Xen-devel] Re: [patch 0/4] linux-xen: Extend xen kexec hypercall to return additional regions
On Thu, Feb 28, 2008 at 08:59:41AM +0000, Keir Fraser wrote:> Thanks, > > I will apply all parts of these kexec patches into xen-unstable directly, > including the ia64 portions.Thanks Keir. -- Horms _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel