Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1247558 > unrolled thread

[PATCH 0/5] x86/setup/crash: Cleanup some code

Started byBorislav Petkov <bp@alien8.de>
First post2015-10-15 10:30 +0200
Last post2015-10-15 17:40 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/5] x86/setup/crash: Cleanup some code Borislav Petkov <bp@alien8.de> - 2015-10-15 10:30 +0200
    [PATCH 5/5] kexec/crash: Say which char is the unrecognized Borislav Petkov <bp@alien8.de> - 2015-10-15 10:30 +0200
    [PATCH 1/5] x86/setup: Cleanup crashkernel reservation functions Borislav Petkov <bp@alien8.de> - 2015-10-15 10:30 +0200
    Re: [PATCH 0/5] x86/setup/crash: Cleanup some code Dave Young <dyoung@redhat.com> - 2015-10-15 11:20 +0200
    Re: [PATCH 0/5] x86/setup/crash: Cleanup some code Joerg Roedel <jroedel@suse.de> - 2015-10-15 17:40 +0200

#1247558 — [PATCH 0/5] x86/setup/crash: Cleanup some code

FromBorislav Petkov <bp@alien8.de>
Date2015-10-15 10:30 +0200
Subject[PATCH 0/5] x86/setup/crash: Cleanup some code
Message-ID<qjM5c-QH-7@gated-at.bofh.it>
From: Borislav Petkov <bp@suse.de>

Hi all,

this is ontop of Baoquan's fix from yesterday:
https://lkml.kernel.org/r/20151014104338.GA8235@pd.tnic

Looking at the crashkernel reservation code made a couple of style
problems wink at me so this short cleanup should address them. Please
take a look and complain if something's wrong.

Thanks.

Borislav Petkov (5):
  x86/setup: Cleanup crashkernel reservation functions
  x86/setup/crash: Remove alignment variable
  x86/setup/crash: Cleanup some more
  x86/setup/crash: Check memblock_reserve() retval
  kexec/crash: Say which char is the unrecognized

 arch/x86/kernel/setup.c | 81 +++++++++++++++++++++++++------------------------
 kernel/kexec_core.c     |  6 ++--
 2 files changed, 45 insertions(+), 42 deletions(-)

-- 
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1247560 — [PATCH 5/5] kexec/crash: Say which char is the unrecognized

FromBorislav Petkov <bp@alien8.de>
Date2015-10-15 10:30 +0200
Subject[PATCH 5/5] kexec/crash: Say which char is the unrecognized
Message-ID<qjM5d-QH-33@gated-at.bofh.it>
In reply to#1247558
From: Borislav Petkov <bp@suse.de>

It is helpful when the crashkernel cmdline parsing routines actually say
which character is the unrecognized one. Make them do so.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Baoquan He <bhe@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: jerry_hoemann@hp.com
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Juergen Gross <jgross@suse.com>
Cc: Mark Salter <msalter@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: WANG Chao <chaowang@redhat.com>
Cc: x86-ml <x86@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 kernel/kexec_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 201b45327804..bd9f8a03cefa 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1149,7 +1149,7 @@ static int __init parse_crashkernel_simple(char *cmdline,
 	if (*cur == '@')
 		*crash_base = memparse(cur+1, &cur);
 	else if (*cur != ' ' && *cur != '\0') {
-		pr_warn("crashkernel: unrecognized char\n");
+		pr_warn("crashkernel: unrecognized char: %c\n", *cur);
 		return -EINVAL;
 	}
 
@@ -1186,12 +1186,12 @@ static int __init parse_crashkernel_suffix(char *cmdline,
 
 	/* check with suffix */
 	if (strncmp(cur, suffix, strlen(suffix))) {
-		pr_warn("crashkernel: unrecognized char\n");
+		pr_warn("crashkernel: unrecognized char: %c\n", *cur);
 		return -EINVAL;
 	}
 	cur += strlen(suffix);
 	if (*cur != ' ' && *cur != '\0') {
-		pr_warn("crashkernel: unrecognized char\n");
+		pr_warn("crashkernel: unrecognized char: %c\n", *cur);
 		return -EINVAL;
 	}
 
-- 
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1247561 — [PATCH 1/5] x86/setup: Cleanup crashkernel reservation functions

FromBorislav Petkov <bp@alien8.de>
Date2015-10-15 10:30 +0200
Subject[PATCH 1/5] x86/setup: Cleanup crashkernel reservation functions
Message-ID<qjM5e-QH-35@gated-at.bofh.it>
In reply to#1247558
From: Borislav Petkov <bp@suse.de>

* 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

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Young <dyoung@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: jerry_hoemann@hp.com
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Juergen Gross <jgross@suse.com>
Cc: Mark Salter <msalter@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: WANG Chao <chaowang@redhat.com>
Cc: x86-ml <x86@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/setup.c | 43 +++++++++++++++++++++----------------------
 1 file changed, 21 insertions(+), 22 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 1b36839e41eb..fd9e178aa890 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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;
-- 
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1247599

FromDave Young <dyoung@redhat.com>
Date2015-10-15 11:20 +0200
Message-ID<qjMRz-21D-3@gated-at.bofh.it>
In reply to#1247558
On 10/15/15 at 10:20am, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
> 
> Hi all,
> 
> this is ontop of Baoquan's fix from yesterday:
> https://lkml.kernel.org/r/20151014104338.GA8235@pd.tnic
> 
> Looking at the crashkernel reservation code made a couple of style
> problems wink at me so this short cleanup should address them. Please
> take a look and complain if something's wrong.
> 
> Thanks.
> 
> Borislav Petkov (5):
>   x86/setup: Cleanup crashkernel reservation functions
>   x86/setup/crash: Remove alignment variable
>   x86/setup/crash: Cleanup some more
>   x86/setup/crash: Check memblock_reserve() retval
>   kexec/crash: Say which char is the unrecognized
> 
>  arch/x86/kernel/setup.c | 81 +++++++++++++++++++++++++------------------------
>  kernel/kexec_core.c     |  6 ++--
>  2 files changed, 45 insertions(+), 42 deletions(-)
> 
> -- 
> 2.3.5
> 
> 

Reviewed-by: Dave Young <dyoung@redhat.com>

Thanks
Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1247905

FromJoerg Roedel <jroedel@suse.de>
Date2015-10-15 17:40 +0200
Message-ID<qjSNk-2aP-29@gated-at.bofh.it>
In reply to#1247558
On Thu, Oct 15, 2015 at 10:20:26AM +0200, Borislav Petkov wrote:
> this is ontop of Baoquan's fix from yesterday:
> https://lkml.kernel.org/r/20151014104338.GA8235@pd.tnic
> 
> Looking at the crashkernel reservation code made a couple of style
> problems wink at me so this short cleanup should address them. Please
> take a look and complain if something's wrong.
> 
> Thanks.
> 
> Borislav Petkov (5):
>   x86/setup: Cleanup crashkernel reservation functions
>   x86/setup/crash: Remove alignment variable
>   x86/setup/crash: Cleanup some more
>   x86/setup/crash: Check memblock_reserve() retval
>   kexec/crash: Say which char is the unrecognized
> 
>  arch/x86/kernel/setup.c | 81 +++++++++++++++++++++++++------------------------
>  kernel/kexec_core.c     |  6 ++--
>  2 files changed, 45 insertions(+), 42 deletions(-)

Looks good to me.

Reviewed-by: Joerg Roedel <jroedel@suse.de>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web