ARM: kexec: fix crashkernel= handling
Subsystems (4)
PATCH 1/1 ARM: kexec: fix crashkernel= handling
When the kernel crashkernel parameter is specified with just a size, we are supposed to allocate a region from RAM to store the crashkernel. However, ARM merely reserves physical address zero with no checking that there is even RAM there.
Fix this by lifting similar code from x86, importing it to ARM with the ARM specific parameters added.
Update the kdump documentation to reflect this change.
--- Documentation/kdump/kdump.txt | 13 +++---------- arch/arm/kernel/setup.c | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-)
Documentation/kdump/kdump.txt +3 -10
@@ -263,12 +263,6 @@ been removed from the machine. crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] range=start-[end] -Please note, on arm, the offset is required. - crashkernel=<range1>:<size1>[,<range2>:<size2>,...]@offset - range=start-[end] - - 'start' is inclusive and 'end' is exclusive. - For example: crashkernel=512M-2G:64M,2G-:128M
@@ -307,10 +301,9 @@ Boot into System Kernel on the memory consumption of the kdump system. In general this is not dependent on the memory size of the production system. - On arm, use "crashkernel=Y at X". Note that the start address of the kernel - will be aligned to 128MiB (0x08000000), so if the start address is not then - any space below the alignment point may be overwritten by the dump-capture kernel, - which means it is possible that the vmcore is not that precise as expected. + On arm, the use of "crashkernel=Y at X" is no longer necessary; the + kernel will automatically locate the crash kernel image within the + first 512MB of RAM if X is not given. Load the Dump-capture Kernel
arch/arm/kernel/setup.c +26 -0
@@ -938,6 +938,13 @@ static int __init init_machine_late(void)late_initcall (init_machine_late);#ifdef CONFIG_KEXEC +/* +* The crash region must be aligned to 128MB to avoid +* zImage relocating below the reserved region. +*/ +#define CRASH_ALIGN (128 << 20) +#define CRASH_ADDR_MAX (PHYS_OFFSET + (512 << 20)) +static inline unsigned long long get_total_mem (void ) {unsigned long total;
@@ -965,6 +972,25 @@ static void __init reserve_crashkernel(void)if (ret)return ; +if (crash_base <=0 ) { + crash_base =memblock_find_in_range (CRASH_ALIGN ,CRASH_ADDR_MAX , + crash_size,CRASH_ALIGN ); +if (!crash_base) { +pr_err ("crashkernel reservation failed - No suitable area found.\n" ); +return ; + } + }else { +unsigned long long start; + + start =memblock_find_in_range (crash_base, + crash_base + crash_size, + crash_size,SECTION_SIZE ); +if (start != crash_base) { +pr_err ("crashkernel reservation failed - memory is in use.\n" ); +return ; + } + } + ret =memblock_reserve (crash_base, crash_size);if (ret <0 ) { pr_warn("crashkernel reservation failed - memory is in use (0x%lx)\n",
Signature · 1 line
2.1.0
Hi, Russell
A long standing issue, but nobody tried to do it. Thank you for bringing up.
Quoted 52 lines · Russell King
When the kernel crashkernel parameter is specified with just a size, we are supposed to allocate a region from RAM to store the crashkernel. However, ARM merely reserves physical address zero with no checking that there is even RAM there.
Fix this by lifting similar code from x86, importing it to ARM with the ARM specific parameters added.
Update the kdump documentation to reflect this change.
Signed-off-by Russell King <[email protected]>--- Documentation/kdump/kdump.txt | 13 +++---------- arch/arm/kernel/setup.c | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-)Documentation/kdump/kdump.txt +3
-10@@ -263,12 +263,6 @@ been removed from the machine. crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] range=start-[end] -Please note, on arm, the offset is required. - crashkernel=<range1>:<size1>[,<range2>:<size2>,...]@offset - range=start-[end] - - 'start' is inclusive and 'end' is exclusive. - For example: crashkernel=512M-2G:64M,2G-:128M@@ -307,10 +301,9 @@ Boot into System Kernel on the memory consumption of the kdump system. In general this is not dependent on the memory size of the production system. - On arm, use "crashkernel=Y@X". Note that the start address of the kernel - will be aligned to 128MiB (0x08000000), so if the start address is not then - any space below the alignment point may be overwritten by the dump-capture kernel, - which means it is possible that the vmcore is not that precise as expected. + On arm, the use of "crashkernel=Y@X" is no longer necessary; the + kernel will automatically locate the crash kernel image within the + first 512MB of RAM if X is not given. Load the Dump-capture Kernelarch/arm/kernel/setup.c +0
-0
arch/arm/kernel/setup.c static int __init init_machine_late(void) · line 946
Quoted 9 lines
arch/arm/kernel/setup.c +6
-0@@ -938,6 +938,13 @@ static int __init init_machine_late(void)late_initcall (init_machine_late);#ifdef CONFIG_KEXEC +/* +* The crash region must be aligned to 128MB to avoid +* zImage relocating below the reserved region. +*/ +#define CRASH_ALIGN (128 << 20) +#define CRASH_ADDR_MAX (PHYS_OFFSET + (512 << 20))
Any reason to limit crash mem within the first 512M only? What if one want to reserve memory over 512M?
Thanks
Dave
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 59 lines · Dave Young
Hi, Russell
A long standing issue, but nobody tried to do it. Thank you for bringing up.
Quoted 54 lines · Russell King
When the kernel crashkernel parameter is specified with just a size, we are supposed to allocate a region from RAM to store the crashkernel. However, ARM merely reserves physical address zero with no checking that there is even RAM there.
Fix this by lifting similar code from x86, importing it to ARM with the ARM specific parameters added.
Update the kdump documentation to reflect this change.
Signed-off-by Russell King <[email protected]>--- Documentation/kdump/kdump.txt | 13 +++---------- arch/arm/kernel/setup.c | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-)Documentation/kdump/kdump.txt +3
-10@@ -263,12 +263,6 @@ been removed from the machine. crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] range=start-[end] -Please note, on arm, the offset is required. - crashkernel=<range1>:<size1>[,<range2>:<size2>,...]@offset - range=start-[end] - - 'start' is inclusive and 'end' is exclusive. - For example: crashkernel=512M-2G:64M,2G-:128M@@ -307,10 +301,9 @@ Boot into System Kernel on the memory consumption of the kdump system. In general this is not dependent on the memory size of the production system. - On arm, use "crashkernel=Y@X". Note that the start address of the kernel - will be aligned to 128MiB (0x08000000), so if the start address is not then - any space below the alignment point may be overwritten by the dump-capture kernel, - which means it is possible that the vmcore is not that precise as expected. + On arm, the use of "crashkernel=Y@X" is no longer necessary; the + kernel will automatically locate the crash kernel image within the + first 512MB of RAM if X is not given. Load the Dump-capture Kernelarch/arm/kernel/setup.c +0
-0@@ -938,6 +938,13 @@ static int __init init_machine_late(void)late_initcall (init_machine_late);
Quoted 10 lines
arch/arm/kernel/setup.c static int __init init_machine_late(void) · line 946
Quoted 7 lines
arch/arm/kernel/setup.c +6
-0#ifdef CONFIG_KEXEC +/* +* The crash region must be aligned to 128MB to avoid +* zImage relocating below the reserved region. +*/ +#define CRASH_ALIGN (128 << 20) +#define CRASH_ADDR_MAX (PHYS_OFFSET + (512 << 20))Any reason to limit crash mem within the first 512M only? What if one want to reserve memory over 512M?
When crash base is not give, then may be it can be just checked if memblock region is memory and not reserved, then allow to reserve. That might help to remove 512M restriction.
~Pratyush
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 71 lines · Pratyush Anand
Quoted 59 lines · Dave Young
Hi, Russell
A long standing issue, but nobody tried to do it. Thank you for bringing up.
Quoted 54 lines · Russell King
When the kernel crashkernel parameter is specified with just a size, we are supposed to allocate a region from RAM to store the crashkernel. However, ARM merely reserves physical address zero with no checking that there is even RAM there.
Fix this by lifting similar code from x86, importing it to ARM with the ARM specific parameters added.
Update the kdump documentation to reflect this change.
Signed-off-by Russell King <[email protected]>--- Documentation/kdump/kdump.txt | 13 +++---------- arch/arm/kernel/setup.c | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-)Documentation/kdump/kdump.txt +3
-10@@ -263,12 +263,6 @@ been removed from the machine. crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] range=start-[end] -Please note, on arm, the offset is required. - crashkernel=<range1>:<size1>[,<range2>:<size2>,...]@offset - range=start-[end] - - 'start' is inclusive and 'end' is exclusive. - For example: crashkernel=512M-2G:64M,2G-:128M@@ -307,10 +301,9 @@ Boot into System Kernel on the memory consumption of the kdump system. In general this is not dependent on the memory size of the production system. - On arm, use "crashkernel=Y at X". Note that the start address of the kernel - will be aligned to 128MiB (0x08000000), so if the start address is not then - any space below the alignment point may be overwritten by the dump-capture kernel, - which means it is possible that the vmcore is not that precise as expected. + On arm, the use of "crashkernel=Y at X" is no longer necessary; the + kernel will automatically locate the crash kernel image within the + first 512MB of RAM if X is not given. Load the Dump-capture Kernelarch/arm/kernel/setup.c +0
-0@@ -938,6 +938,13 @@ static int __init init_machine_late(void)late_initcall (init_machine_late);Quoted 10 lines
arch/arm/kernel/setup.c static int __init init_machine_late(void) · line 946
Quoted 7 lines
arch/arm/kernel/setup.c +6
-0#ifdef CONFIG_KEXEC +/* +* The crash region must be aligned to 128MB to avoid +* zImage relocating below the reserved region. +*/ +#define CRASH_ALIGN (128 << 20) +#define CRASH_ADDR_MAX (PHYS_OFFSET + (512 << 20))Any reason to limit crash mem within the first 512M only? What if one want to reserve memory over 512M?
Quoted 3 lines
When crash base is not give, then may be it can be just checked if memblock region is memory and not reserved, then allow to reserve. That might help to remove 512M restriction.
... and then I'll have to update the commit text.
You may notice that I say that this is mostly taken from the x86 implementation. The x86 implementation also has this 512MB allocation limit, to prevent it being placed too high in physical memory.
This limit only applies for the case where the user hasn't specified the base.
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
Quoted 76 lines · Russell King - ARM Linux
Quoted 71 lines · Pratyush Anand
Quoted 59 lines · Dave Young
Hi, Russell
A long standing issue, but nobody tried to do it. Thank you for bringing up.
Quoted 54 lines · Russell King
When the kernel crashkernel parameter is specified with just a size, we are supposed to allocate a region from RAM to store the crashkernel. However, ARM merely reserves physical address zero with no checking that there is even RAM there.
Fix this by lifting similar code from x86, importing it to ARM with the ARM specific parameters added.
Update the kdump documentation to reflect this change.
Signed-off-by Russell King <[email protected]>--- Documentation/kdump/kdump.txt | 13 +++---------- arch/arm/kernel/setup.c | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-)Documentation/kdump/kdump.txt +3
-10@@ -263,12 +263,6 @@ been removed from the machine. crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] range=start-[end] -Please note, on arm, the offset is required. - crashkernel=<range1>:<size1>[,<range2>:<size2>,...]@offset - range=start-[end] - - 'start' is inclusive and 'end' is exclusive. - For example: crashkernel=512M-2G:64M,2G-:128M@@ -307,10 +301,9 @@ Boot into System Kernel on the memory consumption of the kdump system. In general this is not dependent on the memory size of the production system. - On arm, use "crashkernel=Y@X". Note that the start address of the kernel - will be aligned to 128MiB (0x08000000), so if the start address is not then - any space below the alignment point may be overwritten by the dump-capture kernel, - which means it is possible that the vmcore is not that precise as expected. + On arm, the use of "crashkernel=Y@X" is no longer necessary; the + kernel will automatically locate the crash kernel image within the + first 512MB of RAM if X is not given. Load the Dump-capture Kernelarch/arm/kernel/setup.c +0
-0@@ -938,6 +938,13 @@ static int __init init_machine_late(void)late_initcall (init_machine_late);Quoted 10 lines
arch/arm/kernel/setup.c static int __init init_machine_late(void) · line 946
Quoted 7 lines
arch/arm/kernel/setup.c +6
-0#ifdef CONFIG_KEXEC +/* +* The crash region must be aligned to 128MB to avoid +* zImage relocating below the reserved region. +*/ +#define CRASH_ALIGN (128 << 20) +#define CRASH_ADDR_MAX (PHYS_OFFSET + (512 << 20))Any reason to limit crash mem within the first 512M only? What if one want to reserve memory over 512M?
Quoted 3 lines
When crash base is not give, then may be it can be just checked if memblock region is memory and not reserved, then allow to reserve. That might help to remove 512M restriction.
Quoted 6 lines
... and then I'll have to update the commit text.
You may notice that I say that this is mostly taken from the x86 implementation. The x86 implementation also has this 512MB allocation limit, to prevent it being placed too high in physical memory.
IIRC, x86 had this limitation as they could not support any higher. But if ARM can support higher, it would be good to allow that.
Thanks
Vivek
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 79 lines · Vivek Goyal
Quoted 78 lines · Russell King - ARM Linux
Quoted 71 lines · Pratyush Anand
Quoted 59 lines · Dave Young
Hi, Russell
A long standing issue, but nobody tried to do it. Thank you for bringing up.
Quoted 54 lines · Russell King
When the kernel crashkernel parameter is specified with just a size, we are supposed to allocate a region from RAM to store the crashkernel. However, ARM merely reserves physical address zero with no checking that there is even RAM there.
Fix this by lifting similar code from x86, importing it to ARM with the ARM specific parameters added.
Update the kdump documentation to reflect this change.
Signed-off-by Russell King <[email protected]>--- Documentation/kdump/kdump.txt | 13 +++---------- arch/arm/kernel/setup.c | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-)Documentation/kdump/kdump.txt +3
-10@@ -263,12 +263,6 @@ been removed from the machine. crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] range=start-[end] -Please note, on arm, the offset is required. - crashkernel=<range1>:<size1>[,<range2>:<size2>,...]@offset - range=start-[end] - - 'start' is inclusive and 'end' is exclusive. - For example: crashkernel=512M-2G:64M,2G-:128M@@ -307,10 +301,9 @@ Boot into System Kernel on the memory consumption of the kdump system. In general this is not dependent on the memory size of the production system. - On arm, use "crashkernel=Y at X". Note that the start address of the kernel - will be aligned to 128MiB (0x08000000), so if the start address is not then - any space below the alignment point may be overwritten by the dump-capture kernel, - which means it is possible that the vmcore is not that precise as expected. + On arm, the use of "crashkernel=Y at X" is no longer necessary; the + kernel will automatically locate the crash kernel image within the + first 512MB of RAM if X is not given. Load the Dump-capture Kernelarch/arm/kernel/setup.c +0
-0@@ -938,6 +938,13 @@ static int __init init_machine_late(void)late_initcall (init_machine_late);Quoted 10 lines
arch/arm/kernel/setup.c static int __init init_machine_late(void) · line 946
Quoted 7 lines
arch/arm/kernel/setup.c +6
-0#ifdef CONFIG_KEXEC +/* +* The crash region must be aligned to 128MB to avoid +* zImage relocating below the reserved region. +*/ +#define CRASH_ALIGN (128 << 20) +#define CRASH_ADDR_MAX (PHYS_OFFSET + (512 << 20))Any reason to limit crash mem within the first 512M only? What if one want to reserve memory over 512M?
Quoted 3 lines
When crash base is not give, then may be it can be just checked if memblock region is memory and not reserved, then allow to reserve. That might help to remove 512M restriction.
... and then I'll have to update the commit text.
Quoted 7 lines
Quoted 4 lines
You may notice that I say that this is mostly taken from the x86 implementation. The x86 implementation also has this 512MB allocation limit, to prevent it being placed too high in physical memory.
IIRC, x86 had this limitation as they could not support any higher. But if ARM can support higher, it would be good to allow that.
Well, if we want to remove it, we then need to sort out a method of specifying a limit on the address - where platforms physical memory bridges the 4GB CPU-accessible limit, the crashkernel region must be allocated below that so that it is boot-time accessible.
Some patches also have boot-time only aliases of RAM, with the normal alias above 4GB (eg, TI Keystone2) where the running view of RAM is at 0x800000000, but it has a non-coherent boot alias at 0x80000000.
I've patches which resolve some of the issues there, and making that change would make this patch dependent on those changes. So, I recommend that this patch remains as-is for the time being, and this issue is addressed in a later patch after the Keystone2 idmap_to_phys() patches, similar to:
arch/arm/kernel/setup.c +2 -2
@@ -962,7 +962,6 @@ late_initcall(init_machine_late);* zImage relocating below the reserved region. */ #define CRASH_ALIGN (128 << 20) -#define CRASH_ADDR_MAX (PHYS_OFFSET + (512 << 20))static inline unsigned long long get_total_mem (void ) {
@@ -992,7 +991,8 @@ static void __init reserve_crashkernel(void)return ;if (crash_base <=0 ) { - crash_base =memblock_find_in_range (CRASH_ALIGN ,CRASH_ADDR_MAX , +unsigned long long crash_max =idmap_to_phys ((u32 )~0 ); + crash_base =memblock_find_in_range (CRASH_ALIGN , crash_max, crash_size,CRASH_ALIGN );if (!crash_base) {pr_err ("crashkernel reservation failed - No suitable area found.\n" );
Right now, I don't want to tie this facility to TI Keystone2 support as what this patch is doing is something that the ARM kexec support should have been doing since it was first introduced, so folk may want to backport this change to stable trees.
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: [email protected] down 400kbps up according to speedtest.net.
On 04/01/16 at 02:25pm, Russell King - ARM Linux wrote:
[snip]
Quoted 38 lines
Well, if we want to remove it, we then need to sort out a method of specifying a limit on the address - where platforms physical memory bridges the 4GB CPU-accessible limit, the crashkernel region must be allocated below that so that it is boot-time accessible.
Some patches also have boot-time only aliases of RAM, with the normal alias above 4GB (eg, TI Keystone2) where the running view of RAM is at
0x800000000, but it has a non-coherent boot alias at0x80000000.I've patches which resolve some of the issues there, and making that change would make this patch dependent on those changes. So, I recommend that this patch remains as-is for the time being, and this issue is addressed in a later patch after the Keystone2
idmap_to_phys()patches, similar to:arch/arm/kernel/setup.c +2
-2@@ -962,7 +962,6 @@ late_initcall(init_machine_late);* zImage relocating below the reserved region. */ #define CRASH_ALIGN (128 << 20) -#define CRASH_ADDR_MAX (PHYS_OFFSET + (512 << 20))static inline unsigned long long get_total_mem (void ) {@@ -992,7 +991,8 @@ static void __init reserve_crashkernel(void)return ;if (crash_base <=0 ) { - crash_base =memblock_find_in_range (CRASH_ALIGN ,CRASH_ADDR_MAX , +unsigned long long crash_max =idmap_to_phys ((u32 )~0 ); + crash_base =memblock_find_in_range (CRASH_ALIGN , crash_max, crash_size,CRASH_ALIGN );if (!crash_base) {pr_err ("crashkernel reservation failed - No suitable area found.\n" );
Quoted 4 lines
Right now, I don't want to tie this facility to TI Keystone2 support as what this patch is doing is something that the ARM kexec support should have been doing since it was first introduced, so folk may want to backport this change to stable trees.
Is it possible for PHYS_OFFSET + (512 << 20) be larger than 4G assume that phys_addr_t is 32bit, if so it can be trunked to a small value then the max will be wrong?
Otherwise I think use it temprarily is fine.
Thanks
Dave
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH v2 1/1 ARM: kexec: fix crashkernel= handling
In reply to Russell KingWhen the kernel crashkernel parameter is specified with just a size, we are supposed to allocate a region from RAM to store the crashkernel. However, ARM merely reserves physical address zero with no checking that there is even RAM there.
Fix this by lifting similar code from x86, importing it to ARM with the ARM specific parameters added. In the absence of any platform specific information, we allocate the crashkernel region from the first 512MB of physical memory.
Update the kdump documentation to reflect this change.
--- Documentation/kdump/kdump.txt | 13 +++---------- arch/arm/kernel/setup.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 10 deletions(-)
Documentation/kdump/kdump.txt +3 -10
@@ -263,12 +263,6 @@ been removed from the machine. crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] range=start-[end] -Please note, on arm, the offset is required. - crashkernel=<range1>:<size1>[,<range2>:<size2>,...]@offset - range=start-[end] - - 'start' is inclusive and 'end' is exclusive. - For example: crashkernel=512M-2G:64M,2G-:128M
@@ -307,10 +301,9 @@ Boot into System Kernel on the memory consumption of the kdump system. In general this is not dependent on the memory size of the production system. - On arm, use "crashkernel=Y at X". Note that the start address of the kernel - will be aligned to 128MiB (0x08000000), so if the start address is not then - any space below the alignment point may be overwritten by the dump-capture kernel, - which means it is possible that the vmcore is not that precise as expected. + On arm, the use of "crashkernel=Y at X" is no longer necessary; the + kernel will automatically locate the crash kernel image within the + first 512MB of RAM if X is not given. Load the Dump-capture Kernel
arch/arm/kernel/setup.c +29 -0
@@ -938,6 +938,13 @@ static int __init init_machine_late(void)late_initcall (init_machine_late);#ifdef CONFIG_KEXEC +/* +* The crash region must be aligned to 128MB to avoid +* zImage relocating below the reserved region. +*/ +#define CRASH_ALIGN (128 << 20) +#define CRASH_ADDR_MAX (PHYS_OFFSET + (512 << 20)) +static inline unsigned long long get_total_mem (void ) {unsigned long total;
@@ -965,6 +972,28 @@ static void __init reserve_crashkernel(void)if (ret)return ; +if (crash_base <=0 ) { +unsigned long long crash_max =CRASH_ADDR_MAX ; +if (crash_max > (u32 )~0 ) + crash_max = (u32 )~0 ; + crash_base =memblock_find_in_range (CRASH_ALIGN , crash_max, + crash_size,CRASH_ALIGN ); +if (!crash_base) { +pr_err ("crashkernel reservation failed - No suitable area found.\n" ); +return ; + } + }else { +unsigned long long start; + + start =memblock_find_in_range (crash_base, + crash_base + crash_size, + crash_size,SECTION_SIZE ); +if (start != crash_base) { +pr_err ("crashkernel reservation failed - memory is in use.\n" ); +return ; + } + } + ret =memblock_reserve (crash_base, crash_size);if (ret <0 ) { pr_warn("crashkernel reservation failed - memory is in use (0x%lx)\n",
Signature · 1 line
2.1.0
Quoted 86 lines · Russell King
When the kernel crashkernel parameter is specified with just a size, we are supposed to allocate a region from RAM to store the crashkernel. However, ARM merely reserves physical address zero with no checking that there is even RAM there.
Fix this by lifting similar code from x86, importing it to ARM with the ARM specific parameters added. In the absence of any platform specific information, we allocate the crashkernel region from the first 512MB of physical memory.
Update the kdump documentation to reflect this change.
Signed-off-by Russell King <[email protected]>--- Documentation/kdump/kdump.txt | 13 +++---------- arch/arm/kernel/setup.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 10 deletions(-)Documentation/kdump/kdump.txt +3
-10@@ -263,12 +263,6 @@ been removed from the machine. crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] range=start-[end] -Please note, on arm, the offset is required. - crashkernel=<range1>:<size1>[,<range2>:<size2>,...]@offset - range=start-[end] - - 'start' is inclusive and 'end' is exclusive. - For example: crashkernel=512M-2G:64M,2G-:128M@@ -307,10 +301,9 @@ Boot into System Kernel on the memory consumption of the kdump system. In general this is not dependent on the memory size of the production system. - On arm, use "crashkernel=Y@X". Note that the start address of the kernel - will be aligned to 128MiB (0x08000000), so if the start address is not then - any space below the alignment point may be overwritten by the dump-capture kernel, - which means it is possible that the vmcore is not that precise as expected. + On arm, the use of "crashkernel=Y@X" is no longer necessary; the + kernel will automatically locate the crash kernel image within the + first 512MB of RAM if X is not given. Load the Dump-capture Kernelarch/arm/kernel/setup.c +22
-0@@ -938,6 +938,13 @@ static int __init init_machine_late(void)late_initcall (init_machine_late);#ifdef CONFIG_KEXEC +/* +* The crash region must be aligned to 128MB to avoid +* zImage relocating below the reserved region. +*/ +#define CRASH_ALIGN (128 << 20) +#define CRASH_ADDR_MAX (PHYS_OFFSET + (512 << 20)) +static inline unsigned long long get_total_mem (void ) {unsigned long total;@@ -965,6 +972,28 @@ static void __init reserve_crashkernel(void)if (ret)return ; +if (crash_base <=0 ) { +unsigned long long crash_max =CRASH_ADDR_MAX ; +if (crash_max > (u32 )~0 ) + crash_max = (u32 )~0 ; + crash_base =memblock_find_in_range (CRASH_ALIGN , crash_max, + crash_size,CRASH_ALIGN ); +if (!crash_base) { +pr_err ("crashkernel reservation failed - No suitable area found.\n" ); +return ; + } + }else { +unsigned long long start; + + start = memblock_find_in_range(crash_base, + crash_base + crash_size,
arch/arm/kernel/setup.c static void __init reserve_crashkernel(void) · line 999
Quoted 10 lines
arch/arm/kernel/setup.c +7
-0+ crash_size, SECTION_SIZE); +if (start != crash_base) { +pr_err ("crashkernel reservation failed - memory is in use.\n" ); +return ; + } + } + ret =memblock_reserve (crash_base, crash_size);if (ret <0 ) { pr_warn("crashkernel reservation failed - memory is in use (0x%lx)\n",
Thanks
Dave
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec