All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-mm@kvack.org, Russell King <linux@arm.linux.org.uk>
Subject: Re: [RFC] memblock; Properly handle overlaps
Date: Fri, 04 Mar 2011 21:46:12 -0800	[thread overview]
Message-ID: <4D71CE24.1090302@kernel.org> (raw)
In-Reply-To: <1299297946.8833.931.camel@pasglop>

On 03/04/2011 08:05 PM, Benjamin Herrenschmidt wrote:
> Hi folks !
> 
> This is not fully tested yet (I'm toying with a little userspace
> test bench, it seems to work well so far but I haven't yet tested
> the cases with no-coalesce boundaries which at least ARM needs).
> 
> But it's good enough to get comments...
> 
> So currently, things like memblock_reserve() or memblock_free()
> don't deal well -at-all- with overlaps of all kinds. Some specific
> cases are handled but the code is clumsy and things will fall over
> in many cases.
> 
> This is annoying because typically memblock_reserve() is used to
> mark regions passed by the firmware as reserved and we all know
> how much we can trust our firmwares right ?
> 
> I have also a case I need to deal with on powerpc where the flat
> device-tree is fully enclosed within some other FW blob that has
> its own reserve map entry, so when I end up trying to reserve
> both, the current memblock code pukes.

did you try remove and add tricks?

diff --git a/mm/memblock.c b/mm/memblock.c
index 4618fda..ba4ffdc 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -453,6 +453,9 @@ long __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
 
        BUG_ON(0 == size);
 
+       while (__memblock_remove(_rgn, base, size) >= 0)
+               ;
+
        return memblock_add_region(_rgn, base, size);
 }
 

Yinghai

WARNING: multiple messages have this Message-ID (diff)
From: Yinghai Lu <yinghai@kernel.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-mm@kvack.org, Russell King <linux@arm.linux.org.uk>
Subject: Re: [RFC] memblock; Properly handle overlaps
Date: Fri, 04 Mar 2011 21:46:12 -0800	[thread overview]
Message-ID: <4D71CE24.1090302@kernel.org> (raw)
In-Reply-To: <1299297946.8833.931.camel@pasglop>

On 03/04/2011 08:05 PM, Benjamin Herrenschmidt wrote:
> Hi folks !
> 
> This is not fully tested yet (I'm toying with a little userspace
> test bench, it seems to work well so far but I haven't yet tested
> the cases with no-coalesce boundaries which at least ARM needs).
> 
> But it's good enough to get comments...
> 
> So currently, things like memblock_reserve() or memblock_free()
> don't deal well -at-all- with overlaps of all kinds. Some specific
> cases are handled but the code is clumsy and things will fall over
> in many cases.
> 
> This is annoying because typically memblock_reserve() is used to
> mark regions passed by the firmware as reserved and we all know
> how much we can trust our firmwares right ?
> 
> I have also a case I need to deal with on powerpc where the flat
> device-tree is fully enclosed within some other FW blob that has
> its own reserve map entry, so when I end up trying to reserve
> both, the current memblock code pukes.

did you try remove and add tricks?

diff --git a/mm/memblock.c b/mm/memblock.c
index 4618fda..ba4ffdc 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -453,6 +453,9 @@ long __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
 
        BUG_ON(0 == size);
 
+       while (__memblock_remove(_rgn, base, size) >= 0)
+               ;
+
        return memblock_add_region(_rgn, base, size);
 }
 

Yinghai

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-03-05  5:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-05  4:05 [RFC] memblock; Properly handle overlaps Benjamin Herrenschmidt
2011-03-05  4:05 ` Benjamin Herrenschmidt
2011-03-05  5:46 ` Yinghai Lu [this message]
2011-03-05  5:46   ` Yinghai Lu
2011-03-05  7:56   ` Benjamin Herrenschmidt
2011-03-05  7:56     ` Benjamin Herrenschmidt
2011-03-05 19:14     ` Yinghai Lu
2011-03-05 19:14       ` Yinghai Lu
2011-03-05 21:37       ` Benjamin Herrenschmidt
2011-03-05 21:37         ` Benjamin Herrenschmidt
2011-03-05 21:50         ` Benjamin Herrenschmidt
2011-03-05 21:50           ` Benjamin Herrenschmidt
2011-03-05 22:08           ` Benjamin Herrenschmidt
2011-03-05 22:08             ` Benjamin Herrenschmidt
2011-03-05 22:01         ` Yinghai Lu
2011-03-05 22:01           ` Yinghai Lu
2011-03-05 22:19           ` Benjamin Herrenschmidt
2011-03-05 22:19             ` Benjamin Herrenschmidt
2011-03-05 23:20             ` Yinghai Lu
2011-03-05 23:20               ` Yinghai Lu
2011-03-06  0:49               ` Benjamin Herrenschmidt
2011-03-06  0:49                 ` Benjamin Herrenschmidt
2011-03-06  1:20                 ` Yinghai Lu
2011-03-06  1:20                   ` Yinghai Lu

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=4D71CE24.1090302@kernel.org \
    --to=yinghai@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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.