From: David Daney <ddaney@caviumnetworks.com>
To: Alexander Sverdlin <alexander.sverdlin.ext@nsn.com>
Cc: <linux-mips@linux-mips.org>, <david.daney@cavium.com>,
Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH V2] Octeon: fix broken plat_mem_setup()
Date: Fri, 12 Apr 2013 10:10:42 -0700 [thread overview]
Message-ID: <51684012.2020602@caviumnetworks.com> (raw)
In-Reply-To: <51683BCB.8060209@nsn.com>
On 04/12/2013 09:52 AM, Alexander Sverdlin wrote:
> Octeon: fix broken plat_mem_setup()
>
> Upstream patch abe77f90dc9c65a7c9a4d61c2cbb8db4d5566e4f (MIPS: Octeon:
> Add kexec
> and kdump support) seems to be untested and broken Linux 3.8 on Octeon
> -- in
> comparison with 3.7 Linux crashes with
>
[...]
> [ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task!
>
> There are at least couple of issues in the patch:
>
> 1. reason for add_memory_region(memory, mem_alloc_size, BOOT_MEM_RAM)
> instead of
> add_memory_region(memory, size, BOOT_MEM_RAM) is unclear, especially
> because it
> will discard corrections performed by two preceding calls to
> memory_exclude_page().
> This is fixed using size again instead of mem_alloc_size, moreover,
> block sizes
> calculation could be simplified.
>
> 2. add_memory_region(kernel_start, kernel_size, BOOT_MEM_RAM) marks
> kernel body
> as RAM available for allocation, that's why the kernel later crashes
> overwritting
> itself. Marking it as BOOT_MEM_INIT_RAM solves the crash and still
> allows to load
> the same kernel with kexec (tested also).
>
I have a different patch I am testing that gets rid of all this crap.
The strategy we are using is to use cvmx_bootmem named blocks for all
memory in a KEXEC environment.
David Daney
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin.ext@nsn.com>
> Cc: David Daney <david.daney@cavium.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> ---
>
> Changes in V2:
> * corrected "end" calculation, simplified "size" calculation
> * Mapped the kernel correctly as INIT RAM, instead of throwing this code
> out
>
> As a result, kernel not only boots succefully, but also able to load itself
> with "kexec -l <image>".
>
> --- linux.orig/arch/mips/cavium-octeon/setup.c
> +++ linux/arch/mips/cavium-octeon/setup.c
> @@ -936,14 +936,14 @@ void __init plat_mem_setup(void)
> CVMX_PCIE_BAR1_PHYS_SIZE,
> &memory, &size);
> #ifdef CONFIG_KEXEC
> - end = memory + mem_alloc_size;
> + end = memory + size;
>
> /*
> * This function automatically merges address regions
> * next to each other if they are received in
> * incrementing order
> */
> - if (memory < crashk_base && end > crashk_end) {
> + if (memory < crashk_base && end > crashk_end) {
> /* region is fully in */
> add_memory_region(memory,
> crashk_base - memory,
> @@ -969,20 +969,20 @@ void __init plat_mem_setup(void)
> * Overlap with the beginning of the region,
> * reserve the beginning.
> */
> - mem_alloc_size -= crashk_end - memory;
> + size = end - crashk_end;
> memory = crashk_end;
> } else if (memory < crashk_base && end > crashk_base &&
> - end < crashk_end)
> + end < crashk_end) {
> /*
> * Overlap with the beginning of the region,
> * chop of end.
> */
> - mem_alloc_size -= end - crashk_base;
> + size = crashk_base - memory;
> + }
> #endif
> - add_memory_region(memory, mem_alloc_size, BOOT_MEM_RAM);
> + if (size)
> + add_memory_region(memory, size, BOOT_MEM_RAM);
> total += mem_alloc_size;
> - /* Recovering mem_alloc_size */
> - mem_alloc_size = 4 << 20;
> } else {
> break;
> }
> @@ -994,7 +994,7 @@ void __init plat_mem_setup(void)
>
> /* Adjust for physical offset. */
> kernel_start &= ~0xffffffff80000000ULL;
> - add_memory_region(kernel_start, kernel_size, BOOT_MEM_RAM);
> + add_memory_region(kernel_start, kernel_size, BOOT_MEM_INIT_RAM);
> #endif /* CONFIG_CRASH_DUMP */
>
> #ifdef CONFIG_CAVIUM_RESERVE32
>
>
WARNING: multiple messages have this Message-ID (diff)
From: David Daney <ddaney@caviumnetworks.com>
To: Alexander Sverdlin <alexander.sverdlin.ext@nsn.com>
Cc: linux-mips@linux-mips.org, david.daney@cavium.com,
Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH V2] Octeon: fix broken plat_mem_setup()
Date: Fri, 12 Apr 2013 10:10:42 -0700 [thread overview]
Message-ID: <51684012.2020602@caviumnetworks.com> (raw)
Message-ID: <20130412171042.V-eOwqWSngHgDo2f2-4uRba7GiUF3Gsw6P7aw90xo7I@z> (raw)
In-Reply-To: <51683BCB.8060209@nsn.com>
On 04/12/2013 09:52 AM, Alexander Sverdlin wrote:
> Octeon: fix broken plat_mem_setup()
>
> Upstream patch abe77f90dc9c65a7c9a4d61c2cbb8db4d5566e4f (MIPS: Octeon:
> Add kexec
> and kdump support) seems to be untested and broken Linux 3.8 on Octeon
> -- in
> comparison with 3.7 Linux crashes with
>
[...]
> [ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task!
>
> There are at least couple of issues in the patch:
>
> 1. reason for add_memory_region(memory, mem_alloc_size, BOOT_MEM_RAM)
> instead of
> add_memory_region(memory, size, BOOT_MEM_RAM) is unclear, especially
> because it
> will discard corrections performed by two preceding calls to
> memory_exclude_page().
> This is fixed using size again instead of mem_alloc_size, moreover,
> block sizes
> calculation could be simplified.
>
> 2. add_memory_region(kernel_start, kernel_size, BOOT_MEM_RAM) marks
> kernel body
> as RAM available for allocation, that's why the kernel later crashes
> overwritting
> itself. Marking it as BOOT_MEM_INIT_RAM solves the crash and still
> allows to load
> the same kernel with kexec (tested also).
>
I have a different patch I am testing that gets rid of all this crap.
The strategy we are using is to use cvmx_bootmem named blocks for all
memory in a KEXEC environment.
David Daney
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin.ext@nsn.com>
> Cc: David Daney <david.daney@cavium.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> ---
>
> Changes in V2:
> * corrected "end" calculation, simplified "size" calculation
> * Mapped the kernel correctly as INIT RAM, instead of throwing this code
> out
>
> As a result, kernel not only boots succefully, but also able to load itself
> with "kexec -l <image>".
>
> --- linux.orig/arch/mips/cavium-octeon/setup.c
> +++ linux/arch/mips/cavium-octeon/setup.c
> @@ -936,14 +936,14 @@ void __init plat_mem_setup(void)
> CVMX_PCIE_BAR1_PHYS_SIZE,
> &memory, &size);
> #ifdef CONFIG_KEXEC
> - end = memory + mem_alloc_size;
> + end = memory + size;
>
> /*
> * This function automatically merges address regions
> * next to each other if they are received in
> * incrementing order
> */
> - if (memory < crashk_base && end > crashk_end) {
> + if (memory < crashk_base && end > crashk_end) {
> /* region is fully in */
> add_memory_region(memory,
> crashk_base - memory,
> @@ -969,20 +969,20 @@ void __init plat_mem_setup(void)
> * Overlap with the beginning of the region,
> * reserve the beginning.
> */
> - mem_alloc_size -= crashk_end - memory;
> + size = end - crashk_end;
> memory = crashk_end;
> } else if (memory < crashk_base && end > crashk_base &&
> - end < crashk_end)
> + end < crashk_end) {
> /*
> * Overlap with the beginning of the region,
> * chop of end.
> */
> - mem_alloc_size -= end - crashk_base;
> + size = crashk_base - memory;
> + }
> #endif
> - add_memory_region(memory, mem_alloc_size, BOOT_MEM_RAM);
> + if (size)
> + add_memory_region(memory, size, BOOT_MEM_RAM);
> total += mem_alloc_size;
> - /* Recovering mem_alloc_size */
> - mem_alloc_size = 4 << 20;
> } else {
> break;
> }
> @@ -994,7 +994,7 @@ void __init plat_mem_setup(void)
>
> /* Adjust for physical offset. */
> kernel_start &= ~0xffffffff80000000ULL;
> - add_memory_region(kernel_start, kernel_size, BOOT_MEM_RAM);
> + add_memory_region(kernel_start, kernel_size, BOOT_MEM_INIT_RAM);
> #endif /* CONFIG_CRASH_DUMP */
>
> #ifdef CONFIG_CAVIUM_RESERVE32
>
>
next prev parent reply other threads:[~2013-04-12 17:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-12 16:52 [PATCH V2] Octeon: fix broken plat_mem_setup() Alexander Sverdlin
2013-04-12 17:10 ` David Daney [this message]
2013-04-12 17:10 ` David Daney
2013-04-15 7:06 ` Alexander Sverdlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51684012.2020602@caviumnetworks.com \
--to=ddaney@caviumnetworks.com \
--cc=alexander.sverdlin.ext@nsn.com \
--cc=david.daney@cavium.com \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.