linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geoff Levand <geoffrey.levand@am.sony.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>,
	miltonm@bga.com, clameter@sgi.com, apw@shadowen.org,
	linux-kernel@vger.kernel.org, y-goto@jp.fujitsu.com
Subject: Re: PS3: trouble with SPARSEMEM_VMEMMAP and kexec
Date: Wed, 05 Dec 2007 21:44:09 -0800	[thread overview]
Message-ID: <47578C29.9000007@am.sony.com> (raw)
In-Reply-To: <20071205151147.9db4640b.akpm@linux-foundation.org>

Andrew Morton wrote:
> On Wed, 5 Dec 2007 10:52:48 +0100 (CET)
> Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> wrote:
> 
>> --------------------------------------------------------------------------------
>> Subject: sparsemem: sparse_add_one_section() may fail to allocate memory
>> 
>> sparsemem: sparse_add_one_section() may fail to allocate memory, and must check
>> whether the allocation succeeded before proceeding to touch the allocated
>> memory.
>> 
>> From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
>> 
>> Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
>> ---
>> FIXME There are still some possible memory leaks in sparse_add_one_section():
>>   - usemap is never deallocated
>>   - __kfree_section_memmap() is a not yet implemented dummy
> 
> I already had
> 
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc4/2.6.24-rc4-mm1/broken-out/mm-sparsec-improve-the-error-handling-for-sparse_add_one_section.patch


This one has an error in it.  A patch to fix it is below.


> and
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc4/2.6.24-rc4-mm1/broken-out/mm-sparsec-check-the-return-value-of-sparse_index_alloc.patch
> 
> queued.  Do they fix the problem, and should they be merged in 2.6.24?


These two plus my fix below allow the hot plug add_memory() call to fail
gracefully and for the platform code to continue to boot on the
128MB of boot mem.

With ps3_defconfig the condition is only hit by the second stage
kexec'ed (kboot) kernel, which is not generally built by end users,
but there is a chance this condition would be hit by custom kernel
config, so I think they should go in for 2.6.24.

I'll continue to work on a fix for the memory allocation failure.

-Geoff


------------------
Subject: sparsemem: Fix sparse_index_init return check

sparse_index_init() returns -EEXIST to indicate the index
has already been created.  Exclude this from the error check
on the return value.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
 mm/sparse.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -392,7 +392,7 @@ int sparse_add_one_section(struct zone *
 	 * plus, it does a kmalloc
 	 */
 	ret = sparse_index_init(section_nr, pgdat->node_id);
-	if (ret < 0)
+	if (ret < 0 && ret != -EEXIST)
 		return ret;
 	memmap = kmalloc_section_memmap(section_nr, pgdat->node_id, nr_pages);
 	if (!memmap)




  parent reply	other threads:[~2007-12-06  5:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-03  3:59 PS3: trouble with SPARSEMEM_VMEMMAP and kexec Geoff Levand
2007-12-03 15:53 ` Milton Miller
2007-12-04  8:30   ` Geert Uytterhoeven
2007-12-05  4:56     ` Geoff Levand
2007-12-05  4:55   ` Geoff Levand
2007-12-05  9:52   ` Geert Uytterhoeven
2007-12-05 23:11     ` Andrew Morton
2007-12-05 23:45       ` Geoff Levand
2007-12-06  6:09         ` Yasunori Goto
2007-12-06  9:55           ` Geert Uytterhoeven
2007-12-06  9:55             ` Geert Uytterhoeven
2007-12-06 10:48               ` Yasunori Goto
2007-12-08  2:47                 ` Geoff Levand
2007-12-10  1:55                   ` Yasunori Goto
2007-12-08  3:26           ` Geoff Levand
2007-12-08  3:49             ` oops with 2.6.23.1, marvel, software raid, reiserfs and samba jeffunit
2007-12-16 11:05               ` Andrew Morton
2007-12-16 11:56                 ` Herbert Xu
2007-12-16 12:21                   ` Herbert Xu
2007-12-16 14:55                 ` jeffunit
2007-12-16 22:09                   ` Andrew Morton
2007-12-06  7:41         ` PS3: trouble with SPARSEMEM_VMEMMAP and kexec Geert Uytterhoeven
2007-12-07  5:55           ` Geoff Levand
2007-12-06  5:44       ` Geoff Levand [this message]
2007-12-09  4:22 ` sparsemem: Make SPARSEMEM_VMEMMAP selectable Geoff Levand
2007-12-10  5:50   ` Yasunori Goto

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=47578C29.9000007@am.sony.com \
    --to=geoffrey.levand@am.sony.com \
    --cc=Geert.Uytterhoeven@sonycom.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miltonm@bga.com \
    --cc=y-goto@jp.fujitsu.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).