x86/setup: Cleanup crashkernel reservation functions
* Shorten variable names * Realign code, space out for better readability No code changed: # arch/x86/kernel/setup.o: text data bss dec hex filename 4543 3096 69904 77543 12ee7 setup.o.before 4543 3096 69904 77543 12ee7 setup.o.after md5: 8a1b7c6738a553ca207b56bd84a8f359 setup.o.before.asm 8a1b7c6738a553ca207b56bd84a8f359 setup.o.after.asm Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Dave Young <dyoung@redhat.com> Reviewed-by: Joerg Roedel <jroedel@suse.de> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Juergen Gross <jgross@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mark Salter <msalter@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: WANG Chao <chaowang@redhat.com> Cc: jerry_hoemann@hp.com Link: http://lkml.kernel.org/r/1445246268-26285-4-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Родитель
1a6775c1a2
Коммит
97eac21bab
|
@ -486,11 +486,11 @@ static void __init memblock_x86_reserve_range_setup_data(void)
|
|||
* On 64bit, old kexec-tools need to under 896MiB.
|
||||
*/
|
||||
#ifdef CONFIG_X86_32
|
||||
# define CRASH_KERNEL_ADDR_LOW_MAX (512 << 20)
|
||||
# define CRASH_KERNEL_ADDR_HIGH_MAX (512 << 20)
|
||||
# define CRASH_ADDR_LOW_MAX (512 << 20)
|
||||
# define CRASH_ADDR_HIGH_MAX (512 << 20)
|
||||
#else
|
||||
# define CRASH_KERNEL_ADDR_LOW_MAX (896UL<<20)
|
||||
# define CRASH_KERNEL_ADDR_HIGH_MAX MAXMEM
|
||||
# define CRASH_ADDR_LOW_MAX (896UL << 20)
|
||||
# define CRASH_ADDR_HIGH_MAX MAXMEM
|
||||
#endif
|
||||
|
||||
static int __init reserve_crashkernel_low(void)
|
||||
|
@ -503,10 +503,10 @@ static int __init reserve_crashkernel_low(void)
|
|||
bool auto_set = false;
|
||||
int ret;
|
||||
|
||||
total_low_mem = memblock_mem_size(1UL<<(32-PAGE_SHIFT));
|
||||
total_low_mem = memblock_mem_size(1UL << (32 - PAGE_SHIFT));
|
||||
|
||||
/* crashkernel=Y,low */
|
||||
ret = parse_crashkernel_low(boot_command_line, total_low_mem,
|
||||
&low_size, &base);
|
||||
ret = parse_crashkernel_low(boot_command_line, total_low_mem, &low_size, &base);
|
||||
if (ret != 0) {
|
||||
/*
|
||||
* two parts from lib/swiotlb.c:
|
||||
|
@ -517,7 +517,7 @@ static int __init reserve_crashkernel_low(void)
|
|||
* make sure we allocate enough extra low memory so that we
|
||||
* don't run out of DMA buffers for 32-bit devices.
|
||||
*/
|
||||
low_size = max(swiotlb_size_or_default() + (8UL<<20), 256UL<<20);
|
||||
low_size = max(swiotlb_size_or_default() + (8UL << 20), 256UL << 20);
|
||||
auto_set = true;
|
||||
} else {
|
||||
/* passed with crashkernel=0,low ? */
|
||||
|
@ -525,9 +525,7 @@ static int __init reserve_crashkernel_low(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
low_base = memblock_find_in_range(low_size, (1ULL<<32),
|
||||
low_size, alignment);
|
||||
|
||||
low_base = memblock_find_in_range(low_size, 1ULL << 32, low_size, alignment);
|
||||
if (!low_base) {
|
||||
pr_err("Cannot reserve %ldMB crashkernel low memory, please try smaller size.\n",
|
||||
(unsigned long)(low_size >> 20));
|
||||
|
@ -535,10 +533,12 @@ static int __init reserve_crashkernel_low(void)
|
|||
}
|
||||
|
||||
memblock_reserve(low_base, low_size);
|
||||
|
||||
pr_info("Reserving %ldMB of low memory at %ldMB for crashkernel (System low RAM: %ldMB)\n",
|
||||
(unsigned long)(low_size >> 20),
|
||||
(unsigned long)(low_base >> 20),
|
||||
(unsigned long)(total_low_mem >> 20));
|
||||
(unsigned long)(low_size >> 20),
|
||||
(unsigned long)(low_base >> 20),
|
||||
(unsigned long)(total_low_mem >> 20));
|
||||
|
||||
crashk_low_res.start = low_base;
|
||||
crashk_low_res.end = low_base + low_size - 1;
|
||||
insert_resource(&iomem_resource, &crashk_low_res);
|
||||
|
@ -557,12 +557,11 @@ static void __init reserve_crashkernel(void)
|
|||
total_mem = memblock_phys_mem_size();
|
||||
|
||||
/* crashkernel=XM */
|
||||
ret = parse_crashkernel(boot_command_line, total_mem,
|
||||
&crash_size, &crash_base);
|
||||
ret = parse_crashkernel(boot_command_line, total_mem, &crash_size, &crash_base);
|
||||
if (ret != 0 || crash_size <= 0) {
|
||||
/* crashkernel=X,high */
|
||||
ret = parse_crashkernel_high(boot_command_line, total_mem,
|
||||
&crash_size, &crash_base);
|
||||
&crash_size, &crash_base);
|
||||
if (ret != 0 || crash_size <= 0)
|
||||
return;
|
||||
high = true;
|
||||
|
@ -574,10 +573,9 @@ static void __init reserve_crashkernel(void)
|
|||
* kexec want bzImage is below CRASH_KERNEL_ADDR_MAX
|
||||
*/
|
||||
crash_base = memblock_find_in_range(alignment,
|
||||
high ? CRASH_KERNEL_ADDR_HIGH_MAX :
|
||||
CRASH_KERNEL_ADDR_LOW_MAX,
|
||||
crash_size, alignment);
|
||||
|
||||
high ? CRASH_ADDR_HIGH_MAX
|
||||
: CRASH_ADDR_LOW_MAX,
|
||||
crash_size, alignment);
|
||||
if (!crash_base) {
|
||||
pr_info("crashkernel reservation failed - No suitable area found.\n");
|
||||
return;
|
||||
|
@ -587,7 +585,8 @@ static void __init reserve_crashkernel(void)
|
|||
unsigned long long start;
|
||||
|
||||
start = memblock_find_in_range(crash_base,
|
||||
crash_base + crash_size, crash_size, 1<<20);
|
||||
crash_base + crash_size,
|
||||
crash_size, 1 << 20);
|
||||
if (start != crash_base) {
|
||||
pr_info("crashkernel reservation failed - memory is in use.\n");
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче