All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] kexec-tools: Remove saved_max_mem
@ 2013-05-26  3:38 Zhang Yanfei
  2013-05-26  3:40 ` [PATCH 1/4] kexec-tools: mips: " Zhang Yanfei
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Zhang Yanfei @ 2013-05-26  3:38 UTC (permalink / raw)
  To: Simon Horman; +Cc: kexec, Eric W. Biederman

When loading the dump-capture kernel, in some architectures(mips/ppc/ppc64),
we should add the parameter "savemaxmem=" in the dump-capture kernel
commandline to tell the new kernel the amount of memory that the previous
kernel used.

Then in the dump-capture kernel, we parse this parameter and assign the
value to saved_max_pfn. In these architectures, the only user of
saved_max_pfn is the read interface read_oldmem for /dev/oldmem.

But, no one actually uses the /dev/oldmem interface. And we have decided
to remove the /dev/oldmem interface. A kernel side patch to remove this
interface have been sent. See https://lkml.org/lkml/2013/5/24/451.

So in kexec-tools, we don't need to pass this parameter anymore. This
patchset aims to remove the related variables and funtions in kexec-tools.

Zhang Yanfei (4):
  kexec-tools: mips: Remove saved_max_mem
  kexec-tools: ppc: Remove saved_max_mem
  kexec-tools: ppc64: Remove saved_max_mem
  kexec-tools: sh: Remove saved_max_mem

 kexec/arch/mips/crashdump-mips.c   |   34 ----------------------------------
 kexec/arch/ppc/crashdump-powerpc.c |   19 -------------------
 kexec/arch/ppc64/crashdump-ppc64.c |   19 -------------------
 kexec/arch/sh/crashdump-sh.c       |    6 ------
 4 files changed, 0 insertions(+), 78 deletions(-)

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] kexec-tools: mips: Remove saved_max_mem
  2013-05-26  3:38 [PATCH 0/4] kexec-tools: Remove saved_max_mem Zhang Yanfei
@ 2013-05-26  3:40 ` Zhang Yanfei
  2013-05-26  3:40 ` [PATCH 2/4] kexec-tools: ppc: " Zhang Yanfei
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Zhang Yanfei @ 2013-05-26  3:40 UTC (permalink / raw)
  To: Simon Horman; +Cc: kexec, Eric W. Biederman

From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>

saved_max_mem is used to calculate the amount of memory that the previous
kernel used. And passed to the dump-capture kernel by kernel commandline
parameter "savemaxmem=". But in the dump-capture kernel, we never use
this parameter now, so remove saved_max_mem and don't add "savemaxmem="
to new kernel commandline.

Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
 kexec/arch/mips/crashdump-mips.c |   34 ----------------------------------
 1 files changed, 0 insertions(+), 34 deletions(-)

diff --git a/kexec/arch/mips/crashdump-mips.c b/kexec/arch/mips/crashdump-mips.c
index 8e7b1c3..e7840e0 100644
--- a/kexec/arch/mips/crashdump-mips.c
+++ b/kexec/arch/mips/crashdump-mips.c
@@ -41,14 +41,6 @@ static struct memory_range crash_memory_range[CRASH_MAX_MEMORY_RANGES];
 /* Memory region reserved for storing panic kernel and other data. */
 static struct memory_range crash_reserved_mem;
 
-/*
- * To store the memory size of the first kernel and this value will be
- * passed to the second kernel as command line (savemaxmem=xM).
- * The second kernel will be calculated saved_max_pfn based on this
- * variable.
- */
-unsigned long long saved_max_mem;
-
 /* Read kernel physical load addr from the file returned by proc_iomem()
  * (Kernel Code) and store in kexec_info */
 static int get_kernel_paddr(struct crash_elf_info *elf_info)
@@ -220,10 +212,6 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges)
 	if (exclude_crash_reserve_region(&memory_ranges) < 0)
 		return -1;
 
-	for (i = 0; i < memory_ranges; i++)
-		if (saved_max_mem < crash_memory_range[i].end)
-			saved_max_mem = crash_memory_range[i].end + 1;
-
 	*range = crash_memory_range;
 	*ranges = memory_ranges;
 	return 0;
@@ -299,27 +287,6 @@ static int cmdline_add_elfcorehdr(char *cmdline, unsigned long addr)
 	return 0;
 }
 
-/* Adds the savemaxmem= command line parameter to command line. */
-static int cmdline_add_savemaxmem(char *cmdline, unsigned long long addr)
-{
-	int cmdlen, len, align = 1024;
-	char str[30], *ptr;
-
-	/* Passing in savemaxmem=xxxM format. Saves space required in cmdline.*/
-	addr = addr/(align*align);
-	ptr = str;
-	strcpy(str, " savemaxmem=");
-	ptr += strlen(str);
-	ultoa(addr, ptr);
-	strcat(str, "M");
-	len = strlen(str);
-	cmdlen = strlen(cmdline) + len;
-	if (cmdlen > (COMMAND_LINE_SIZE - 1))
-		die("Command line overflow\n");
-	strcat(cmdline, str);
-	return 0;
-}
-
 #ifdef __mips64
 static struct crash_elf_info elf_info64 = {
 	class: ELFCLASS64,
@@ -394,7 +361,6 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 	cmdline_add_mem(mod_cmdline, crash_reserved_mem.start,
 		elfcorehdr - crash_reserved_mem.start);
 	cmdline_add_elfcorehdr(mod_cmdline, elfcorehdr);
-	cmdline_add_savemaxmem(mod_cmdline, saved_max_mem);
 
 	dbgprintf("CRASH MEMORY RANGES:\n");
 	dbgprintf("%016Lx-%016Lx\n", crash_reserved_mem.start,
-- 
1.7.1

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] kexec-tools: ppc: Remove saved_max_mem
  2013-05-26  3:38 [PATCH 0/4] kexec-tools: Remove saved_max_mem Zhang Yanfei
  2013-05-26  3:40 ` [PATCH 1/4] kexec-tools: mips: " Zhang Yanfei
@ 2013-05-26  3:40 ` Zhang Yanfei
  2013-05-26  3:41 ` [PATCH 3/4] kexec-tools: ppc64: " Zhang Yanfei
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Zhang Yanfei @ 2013-05-26  3:40 UTC (permalink / raw)
  To: Simon Horman; +Cc: kexec, Eric W. Biederman

From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>

saved_max_mem is used to calculate the amount of memory that the previous
kernel used. And passed to the dump-capture kernel by kernel commandline
parameter "savemaxmem=". But in the dump-capture kernel, we never use
this parameter now, so remove saved_max_mem and don't add "savemaxmem="
to new kernel commandline.

Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
 kexec/arch/ppc/crashdump-powerpc.c |   19 -------------------
 1 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/kexec/arch/ppc/crashdump-powerpc.c b/kexec/arch/ppc/crashdump-powerpc.c
index eee5b37..c06d310 100644
--- a/kexec/arch/ppc/crashdump-powerpc.c
+++ b/kexec/arch/ppc/crashdump-powerpc.c
@@ -51,17 +51,6 @@ static int crash_max_memory_ranges;
  */
 mem_rgns_t usablemem_rgns = {0, NULL};
 
-/*
- * To store the memory size of the first kernel and this value will be
- * passed to the second kernel as command line (savemaxmem=xM).
- * The second kernel will be calculated saved_max_pfn based on this
- * variable.
- * Since we are creating/using usable-memory property, there is no way
- * we can determine the RAM size unless parsing the device-tree/memoy@/reg
- * property in the kernel.
- */
-unsigned long long saved_max_mem;
-
 /* Reads the appropriate file and retrieves the SYSTEM RAM regions for whom to
  * create Elf headers. Keeping it separate from get_memory_ranges() as
  * requirements are different in the case of normal kexec and crashdumps.
@@ -224,13 +213,6 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges)
 		crash_memory_range[memory_ranges].start = cstart;
 		crash_memory_range[memory_ranges++].end = cend;
 	}
-	/*
-	 * Can not trust the memory regions order that we read from
-	 * device-tree. Hence, get the MAX end value.
-	 */
-	for (i = 0; i < memory_ranges; i++)
-		if (saved_max_mem < crash_memory_range[i].end)
-			saved_max_mem = crash_memory_range[i].end;
 
 	*range = crash_memory_range;
 	*ranges = memory_ranges;
@@ -378,7 +360,6 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 	 * read by flatten_device_tree and modified if required
 	 */
 	add_cmdline_param(mod_cmdline, elfcorehdr, " elfcorehdr=", "K");
-	add_cmdline_param(mod_cmdline, saved_max_mem, " savemaxmem=", "M");
 	add_cmdline(mod_cmdline, " maxcpus=1");
 	return 0;
 }
-- 
1.7.1

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] kexec-tools: ppc64: Remove saved_max_mem
  2013-05-26  3:38 [PATCH 0/4] kexec-tools: Remove saved_max_mem Zhang Yanfei
  2013-05-26  3:40 ` [PATCH 1/4] kexec-tools: mips: " Zhang Yanfei
  2013-05-26  3:40 ` [PATCH 2/4] kexec-tools: ppc: " Zhang Yanfei
@ 2013-05-26  3:41 ` Zhang Yanfei
  2013-05-26  3:41 ` [PATCH 4/4] kexec-tools: sh: " Zhang Yanfei
  2013-05-28 22:35 ` [PATCH 0/4] kexec-tools: " Eric W. Biederman
  4 siblings, 0 replies; 7+ messages in thread
From: Zhang Yanfei @ 2013-05-26  3:41 UTC (permalink / raw)
  To: Simon Horman; +Cc: kexec, Eric W. Biederman

From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>

saved_max_mem is used to calculate the amount of memory that the previous
kernel used. And passed to the dump-capture kernel by kernel commandline
parameter "savemaxmem=". But in the dump-capture kernel, we never use
this parameter now, so remove saved_max_mem and don't add "savemaxmem="
to new kernel commandline.

Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
 kexec/arch/ppc64/crashdump-ppc64.c |   19 -------------------
 1 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/kexec/arch/ppc64/crashdump-ppc64.c b/kexec/arch/ppc64/crashdump-ppc64.c
index 49cab12..e31dd6d 100644
--- a/kexec/arch/ppc64/crashdump-ppc64.c
+++ b/kexec/arch/ppc64/crashdump-ppc64.c
@@ -69,17 +69,6 @@ static int crash_max_memory_ranges;
  */
 mem_rgns_t usablemem_rgns = {0, NULL};
 
-/*
- * To store the memory size of the first kernel and this value will be
- * passed to the second kernel as command line (savemaxmem=xM).
- * The second kernel will be calculated saved_max_pfn based on this
- * variable.
- * Since we are creating/using usable-memory property, there is no way
- * we can determine the RAM size unless parsing the device-tree/memoy@/reg
- * property in the kernel.
- */
-uint64_t saved_max_mem = 0;
-
 static unsigned long long cstart, cend;
 static int memory_ranges;
 
@@ -303,13 +292,6 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges)
 		crash_memory_range[memory_ranges].start = cstart;
 		crash_memory_range[memory_ranges++].end = cend;
 	}
-	/*
-	 * Can not trust the memory regions order that we read from
-	 * device-tree. Hence, get the MAX end value.
-	 */
-	for (i = 0; i < memory_ranges; i++)
-		if (saved_max_mem < crash_memory_range[i].end)
-			saved_max_mem = crash_memory_range[i].end;
 
 	*range = crash_memory_range;
 	*ranges = memory_ranges;
@@ -446,7 +428,6 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 	 * read by flatten_device_tree and modified if required
 	 */
 	add_cmdline_param(mod_cmdline, elfcorehdr, " elfcorehdr=", "K");
-	add_cmdline_param(mod_cmdline, saved_max_mem, " savemaxmem=", "M");
 	return 0;
 }
 
-- 
1.7.1

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] kexec-tools: sh: Remove saved_max_mem
  2013-05-26  3:38 [PATCH 0/4] kexec-tools: Remove saved_max_mem Zhang Yanfei
                   ` (2 preceding siblings ...)
  2013-05-26  3:41 ` [PATCH 3/4] kexec-tools: ppc64: " Zhang Yanfei
@ 2013-05-26  3:41 ` Zhang Yanfei
  2013-05-28 22:35 ` [PATCH 0/4] kexec-tools: " Eric W. Biederman
  4 siblings, 0 replies; 7+ messages in thread
From: Zhang Yanfei @ 2013-05-26  3:41 UTC (permalink / raw)
  To: Simon Horman; +Cc: kexec, Eric W. Biederman

From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>

saved_max_mem is used to calculate the amount of memory that the previous
kernel used. It seems in sh, we just calculate this variable, but we
never use it. So remove it.

Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
 kexec/arch/sh/crashdump-sh.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/kexec/arch/sh/crashdump-sh.c b/kexec/arch/sh/crashdump-sh.c
index 68ca756..fe11b17 100644
--- a/kexec/arch/sh/crashdump-sh.c
+++ b/kexec/arch/sh/crashdump-sh.c
@@ -31,8 +31,6 @@
 #define CRASH_MAX_MEMORY_RANGES 64
 static struct memory_range crash_memory_range[CRASH_MAX_MEMORY_RANGES];
 
-uint64_t saved_max_mem;
-
 static int crash_sh_range_nr;
 static int crash_sh_memory_range_callback(void *UNUSED(data), int UNUSED(nr),
 					  char *str,
@@ -54,9 +52,6 @@ static int crash_sh_memory_range_callback(void *UNUSED(data), int UNUSED(nr),
 		range->end = base + length - 1;
 		range->type = RANGE_RAM;
 		crash_sh_range_nr++;
-
-		if (saved_max_mem < range->end)
-			saved_max_mem = range->end;
 	}
 
 	if (strncmp(str, "Crash kernel\n", 13) == 0) {
@@ -80,7 +75,6 @@ static int crash_sh_memory_range_callback(void *UNUSED(data), int UNUSED(nr),
 static int crash_get_memory_ranges(struct memory_range **range, int *ranges)
 {
 	crash_sh_range_nr = 0;
-	saved_max_mem = 0;
 
 	kexec_iomem_for_each_line(NULL, crash_sh_memory_range_callback, NULL);
 	*range = crash_memory_range;
-- 
1.7.1

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] kexec-tools: Remove saved_max_mem
  2013-05-26  3:38 [PATCH 0/4] kexec-tools: Remove saved_max_mem Zhang Yanfei
                   ` (3 preceding siblings ...)
  2013-05-26  3:41 ` [PATCH 4/4] kexec-tools: sh: " Zhang Yanfei
@ 2013-05-28 22:35 ` Eric W. Biederman
  2013-06-10  8:35   ` Simon Horman
  4 siblings, 1 reply; 7+ messages in thread
From: Eric W. Biederman @ 2013-05-28 22:35 UTC (permalink / raw)
  To: Zhang Yanfei; +Cc: Simon Horman, kexec

Zhang Yanfei <zhangyanfei.yes@gmail.com> writes:

> When loading the dump-capture kernel, in some architectures(mips/ppc/ppc64),
> we should add the parameter "savemaxmem=" in the dump-capture kernel
> commandline to tell the new kernel the amount of memory that the previous
> kernel used.
>
> Then in the dump-capture kernel, we parse this parameter and assign the
> value to saved_max_pfn. In these architectures, the only user of
> saved_max_pfn is the read interface read_oldmem for /dev/oldmem.
>
> But, no one actually uses the /dev/oldmem interface. And we have decided
> to remove the /dev/oldmem interface. A kernel side patch to remove this
> interface have been sent. See https://lkml.org/lkml/2013/5/24/451.
>
> So in kexec-tools, we don't need to pass this parameter anymore. This
> patchset aims to remove the related variables and funtions in
> kexec-tools.

To this series.

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>

No one cares unless they are actually using /dev/oldmem, and so far
it appears no one actually uses /dev/oldmem so this change looks very
safe.

> Zhang Yanfei (4):
>   kexec-tools: mips: Remove saved_max_mem
>   kexec-tools: ppc: Remove saved_max_mem
>   kexec-tools: ppc64: Remove saved_max_mem
>   kexec-tools: sh: Remove saved_max_mem
>
>  kexec/arch/mips/crashdump-mips.c   |   34 ----------------------------------
>  kexec/arch/ppc/crashdump-powerpc.c |   19 -------------------
>  kexec/arch/ppc64/crashdump-ppc64.c |   19 -------------------
>  kexec/arch/sh/crashdump-sh.c       |    6 ------
>  4 files changed, 0 insertions(+), 78 deletions(-)

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] kexec-tools: Remove saved_max_mem
  2013-05-28 22:35 ` [PATCH 0/4] kexec-tools: " Eric W. Biederman
@ 2013-06-10  8:35   ` Simon Horman
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2013-06-10  8:35 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: kexec, Zhang Yanfei

On Tue, May 28, 2013 at 03:35:23PM -0700, Eric W. Biederman wrote:
> Zhang Yanfei <zhangyanfei.yes@gmail.com> writes:
> 
> > When loading the dump-capture kernel, in some architectures(mips/ppc/ppc64),
> > we should add the parameter "savemaxmem=" in the dump-capture kernel
> > commandline to tell the new kernel the amount of memory that the previous
> > kernel used.
> >
> > Then in the dump-capture kernel, we parse this parameter and assign the
> > value to saved_max_pfn. In these architectures, the only user of
> > saved_max_pfn is the read interface read_oldmem for /dev/oldmem.
> >
> > But, no one actually uses the /dev/oldmem interface. And we have decided
> > to remove the /dev/oldmem interface. A kernel side patch to remove this
> > interface have been sent. See https://lkml.org/lkml/2013/5/24/451.
> >
> > So in kexec-tools, we don't need to pass this parameter anymore. This
> > patchset aims to remove the related variables and funtions in
> > kexec-tools.
> 
> To this series.
> 
> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> No one cares unless they are actually using /dev/oldmem, and so far
> it appears no one actually uses /dev/oldmem so this change looks very
> safe.

Thanks, all four patches applied.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-10  8:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-26  3:38 [PATCH 0/4] kexec-tools: Remove saved_max_mem Zhang Yanfei
2013-05-26  3:40 ` [PATCH 1/4] kexec-tools: mips: " Zhang Yanfei
2013-05-26  3:40 ` [PATCH 2/4] kexec-tools: ppc: " Zhang Yanfei
2013-05-26  3:41 ` [PATCH 3/4] kexec-tools: ppc64: " Zhang Yanfei
2013-05-26  3:41 ` [PATCH 4/4] kexec-tools: sh: " Zhang Yanfei
2013-05-28 22:35 ` [PATCH 0/4] kexec-tools: " Eric W. Biederman
2013-06-10  8:35   ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.