All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 2/2] MIPS: KEXEC: Fixes Random crashes while loading crashkernel
@ 2013-09-04 17:56 Prem Mallappa
  2013-09-05 18:12 ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Prem Mallappa @ 2013-09-04 17:56 UTC (permalink / raw)
  To: linux-mips; +Cc: Prem Mallappa

Fixed compilation errors in case of non-KEXEC kernel
Rearranging code so that crashk_res gets updated.
- crashk_res is updated after mips_parse_crashkernel(),
   after resource_init(), which is after arch_mem_init().
- The reserved memory is actually treated as Usable memory,
   Unless we load the crash kernel, everything works.

Signed-off-by: Prem Mallappa <pmallappa@caviumnetworks.com>
---
 arch/mips/kernel/setup.c | 99 +++++++++++++++++++++++-------------------------
 1 file changed, 48 insertions(+), 51 deletions(-)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index c7f9051..c538d6e 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -552,6 +552,52 @@ static void __init arch_mem_addpart(phys_t mem, phys_t end, int type)
 	add_memory_region(mem, size, type);
 }
 
+#ifdef CONFIG_KEXEC
+static inline unsigned long long get_total_mem(void)
+{
+	unsigned long long total;
+
+	total = max_pfn - min_low_pfn;
+	return total << PAGE_SHIFT;
+}
+
+static void __init mips_parse_crashkernel(void)
+{
+	unsigned long long total_mem;
+	unsigned long long crash_size, crash_base;
+	int ret;
+
+	total_mem = get_total_mem();
+	ret = parse_crashkernel(boot_command_line, total_mem,
+				&crash_size, &crash_base);
+	if (ret != 0 || crash_size <= 0)
+		return;
+
+	crashk_res.start = crash_base;
+	crashk_res.end	 = crash_base + crash_size - 1;
+}
+
+static void __init request_crashkernel(struct resource *res)
+{
+	int ret;
+
+	ret = request_resource(res, &crashk_res);
+	if (!ret)
+		pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n",
+			(unsigned long)((crashk_res.end -
+					 crashk_res.start + 1) >> 20),
+			(unsigned long)(crashk_res.start  >> 20));
+}
+#else /* !defined(CONFIG_KEXEC)		*/
+static void __init mips_parse_crashkernel(void)
+{
+}
+
+static void __init request_crashkernel(struct resource *res)
+{
+}
+#endif /* !defined(CONFIG_KEXEC)  */
+
 static void __init arch_mem_init(char **cmdline_p)
 {
 	extern void plat_mem_setup(void);
@@ -608,6 +654,8 @@ static void __init arch_mem_init(char **cmdline_p)
 				BOOTMEM_DEFAULT);
 	}
 #endif
+
+	mips_parse_crashkernel();
 #ifdef CONFIG_KEXEC
 	if (crashk_res.start != crashk_res.end)
 		reserve_bootmem(crashk_res.start,
@@ -620,52 +668,6 @@ static void __init arch_mem_init(char **cmdline_p)
 	paging_init();
 }
 
-#ifdef CONFIG_KEXEC
-static inline unsigned long long get_total_mem(void)
-{
-	unsigned long long total;
-
-	total = max_pfn - min_low_pfn;
-	return total << PAGE_SHIFT;
-}
-
-static void __init mips_parse_crashkernel(void)
-{
-	unsigned long long total_mem;
-	unsigned long long crash_size, crash_base;
-	int ret;
-
-	total_mem = get_total_mem();
-	ret = parse_crashkernel(boot_command_line, total_mem,
-				&crash_size, &crash_base);
-	if (ret != 0 || crash_size <= 0)
-		return;
-
-	crashk_res.start = crash_base;
-	crashk_res.end	 = crash_base + crash_size - 1;
-}
-
-static void __init request_crashkernel(struct resource *res)
-{
-	int ret;
-
-	ret = request_resource(res, &crashk_res);
-	if (!ret)
-		pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n",
-			(unsigned long)((crashk_res.end -
-				crashk_res.start + 1) >> 20),
-			(unsigned long)(crashk_res.start  >> 20));
-}
-#else /* !defined(CONFIG_KEXEC)	 */
-static void __init mips_parse_crashkernel(void)
-{
-}
-
-static void __init request_crashkernel(struct resource *res)
-{
-}
-#endif /* !defined(CONFIG_KEXEC)  */
-
 static void __init resource_init(void)
 {
 	int i;
@@ -678,11 +680,6 @@ static void __init resource_init(void)
 	data_resource.start = __pa_symbol(&_etext);
 	data_resource.end = __pa_symbol(&_edata) - 1;
 
-	/*
-	 * Request address space for all standard RAM.
-	 */
-	mips_parse_crashkernel();
-
 	for (i = 0; i < boot_mem_map.nr_map; i++) {
 		struct resource *res;
 		unsigned long start, end;
-- 
1.8.4

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

* Re: [PATCH v2 2/2] MIPS: KEXEC: Fixes Random crashes while loading crashkernel
  2013-09-04 17:56 [PATCH v2 2/2] MIPS: KEXEC: Fixes Random crashes while loading crashkernel Prem Mallappa
@ 2013-09-05 18:12 ` Ralf Baechle
  2013-09-05 18:31   ` David Daney
  0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2013-09-05 18:12 UTC (permalink / raw)
  To: Prem Mallappa; +Cc: linux-mips, Prem Mallappa

On Wed, Sep 04, 2013 at 11:26:24PM +0530, Prem Mallappa wrote:
> Date:   Wed,  4 Sep 2013 23:26:24 +0530
> From: Prem Mallappa <prem.mallappa@gmail.com>
> To: linux-mips <linux-mips@linux-mips.org>
> Cc: Prem Mallappa <pmallappa@caviumnetworks.com>
> Subject: [PATCH v2 2/2] MIPS: KEXEC: Fixes Random crashes while loading

Prem,

I only see patch 2/2.  I wonder, has 1/2 been lost in transit or is there
only the 2/2 patch?

Thanks,

  Ralf

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

* Re: [PATCH v2 2/2] MIPS: KEXEC: Fixes Random crashes while loading crashkernel
  2013-09-05 18:12 ` Ralf Baechle
@ 2013-09-05 18:31   ` David Daney
  2013-09-06  8:00     ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: David Daney @ 2013-09-05 18:31 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Prem Mallappa, linux-mips, Prem Mallappa

On 09/05/2013 11:12 AM, Ralf Baechle wrote:
> On Wed, Sep 04, 2013 at 11:26:24PM +0530, Prem Mallappa wrote:
>> Date:   Wed,  4 Sep 2013 23:26:24 +0530
>> From: Prem Mallappa <prem.mallappa@gmail.com>
>> To: linux-mips <linux-mips@linux-mips.org>
>> Cc: Prem Mallappa <pmallappa@caviumnetworks.com>
>> Subject: [PATCH v2 2/2] MIPS: KEXEC: Fixes Random crashes while loading
>
> Prem,
>
> I only see patch 2/2.  I wonder, has 1/2 been lost in transit or is there
> only the 2/2 patch?
>

V1 of 1/2 didn't need revision, so it can be applied as is:

http://patchwork.linux-mips.org/patch/5786/

David.

> Thanks,
>
>    Ralf
>
>
>

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

* Re: [PATCH v2 2/2] MIPS: KEXEC: Fixes Random crashes while loading crashkernel
  2013-09-05 18:31   ` David Daney
@ 2013-09-06  8:00     ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2013-09-06  8:00 UTC (permalink / raw)
  To: David Daney; +Cc: Prem Mallappa, linux-mips, Prem Mallappa

On Thu, Sep 05, 2013 at 11:31:11AM -0700, David Daney wrote:

> >Prem,
> >
> >I only see patch 2/2.  I wonder, has 1/2 been lost in transit or is there
> >only the 2/2 patch?
> >
> 
> V1 of 1/2 didn't need revision, so it can be applied as is:
> 
> http://patchwork.linux-mips.org/patch/5786/

I've done some cosmetic changes.  Formatting with tabs, as per CodingStyle
use

	/*
	 *
	 */

style comments, not

	/*
	*
	*/

And finally use beqz rather than beq $reg, zero.  Anyway, Prem, thanks
for debugging this & patch applied!

  Ralf

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-04 17:56 [PATCH v2 2/2] MIPS: KEXEC: Fixes Random crashes while loading crashkernel Prem Mallappa
2013-09-05 18:12 ` Ralf Baechle
2013-09-05 18:31   ` David Daney
2013-09-06  8:00     ` Ralf Baechle

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.