2008-02-13 13:40:29

by Kumar Gala

[permalink] [raw]
Subject: [PATCH] [POWERPC] Fix initial lmb add region with a non-zero base

If we add to an empty lmb region with a non-zero base we will not coalesce
the number of regions done to one. This causes problems on ppc32 for the
memory region as its assumed to only have one region.

We can fix this be easily specially casing the initial add to just replace
the dummy region.

---

Posting this since Dave's looking a pulling the lmb code out into lib/ and
sharing it between powerpc and sparc.

(this is my git tree git.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git)

- k

arch/powerpc/mm/lmb.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index 4ce23bc..1ea8df0 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -141,6 +141,12 @@ static long __init lmb_add_region(struct lmb_region *rgn, unsigned long base,
unsigned long coalesced = 0;
long adjacent, i;

+ if ((rgn->cnt == 1) && (rgn->region[0].size == 0)) {
+ rgn->region[0].base = base;
+ rgn->region[0].size = size;
+ return 0;
+ }
+
/* First try and coalesce this LMB with another. */
for (i=0; i < rgn->cnt; i++) {
unsigned long rgnbase = rgn->region[i].base;
--
1.5.3.8


2008-02-13 15:00:32

by Jon Loeliger

[permalink] [raw]
Subject: Re: [PATCH] [POWERPC] Fix initial lmb add region with a non-zero base

So, like, the other day Kumar Gala mumbled:
> If we add to an empty lmb region with a non-zero base we will not coalesce
> the number of regions done to one. This causes problems on ppc32 for the

s/done/down

> memory region as its assumed to only have one region.
>
> We can fix this be easily specially casing the initial add to just replace
> the dummy region.
>
> ---
>
> Posting this since Dave's looking a pulling the lmb code out into lib/ and
> sharing it between powerpc and sparc.

Did you want to S-o-b: this patch? Or was this just informational?

Thanks,
jdl

2008-02-13 15:37:53

by Kumar Gala

[permalink] [raw]
Subject: Re: [PATCH] [POWERPC] Fix initial lmb add region with a non-zero base


On Feb 13, 2008, at 8:20 AM, Jon Loeliger wrote:

> So, like, the other day Kumar Gala mumbled:
>> If we add to an empty lmb region with a non-zero base we will not
>> coalesce
>> the number of regions done to one. This causes problems on ppc32
>> for the
>
> s/done/down

will fix.

>> memory region as its assumed to only have one region.
>>
>> We can fix this be easily specially casing the initial add to just
>> replace
>> the dummy region.
>>
>> ---
>>
>> Posting this since Dave's looking a pulling the lmb code out into
>> lib/ and
>> sharing it between powerpc and sparc.
>
> Did you want to S-o-b: this patch? Or was this just informational?

this was info/for review, the git tree has a s-o-b.

- k

2008-02-13 22:33:41

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] [POWERPC] Fix initial lmb add region with a non-zero base

From: Kumar Gala <[email protected]>
Date: Wed, 13 Feb 2008 07:37:27 -0600 (CST)

> If we add to an empty lmb region with a non-zero base we will not coalesce
> the number of regions done to one. This causes problems on ppc32 for the
> memory region as its assumed to only have one region.
>
> We can fix this be easily specially casing the initial add to just replace
> the dummy region.
>
> ---
>
> Posting this since Dave's looking a pulling the lmb code out into lib/ and
> sharing it between powerpc and sparc.
>
> (this is my git tree git.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git)

I noticed this issue when I use lmb on sparc64 and I intended to bring
it up eventually. Thanks for fixing it!