* [PATCH] [LMB]: Fix lmb_add_region if region should be added at the head
@ 2008-02-20 4:27 Kumar Gala
2008-02-20 4:45 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Kumar Gala @ 2008-02-20 4:27 UTC (permalink / raw)
To: davem; +Cc: sparclinux, linuxppc-dev, linux-kernel
We introduced a bug in fixing lmb_add_region to handle an initial
region being non-zero. Before that fix it was impossible to insert
a region at the head of the list since the first region always started
at zero.
Now that its possible for the first region to be non-zero we need to
check to see if the new region should be added at the head and if so
actually add it.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
lib/lmb.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/lmb.c b/lib/lmb.c
index e3c8dcb..3c43b95 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -184,6 +184,11 @@ static long __init lmb_add_region(struct lmb_region *rgn, u64 base, u64 size)
break;
}
}
+
+ if (base < rgn->region[0].base) {
+ rgn->region[0].base = base;
+ rgn->region[0].size = size;
+ }
rgn->cnt++;
return 0;
--
1.5.3.8
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] [LMB]: Fix lmb_add_region if region should be added at the head
2008-02-20 4:27 [PATCH] [LMB]: Fix lmb_add_region if region should be added at the head Kumar Gala
@ 2008-02-20 4:45 ` David Miller
2008-02-20 5:16 ` Kumar Gala
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2008-02-20 4:45 UTC (permalink / raw)
To: galak; +Cc: sparclinux, linuxppc-dev, linux-kernel
From: Kumar Gala <galak@kernel.crashing.org>
Date: Tue, 19 Feb 2008 22:27:48 -0600 (CST)
> We introduced a bug in fixing lmb_add_region to handle an initial
> region being non-zero. Before that fix it was impossible to insert
> a region at the head of the list since the first region always started
> at zero.
>
> Now that its possible for the first region to be non-zero we need to
> check to see if the new region should be added at the head and if so
> actually add it.
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
...
> @@ -184,6 +184,11 @@ static long __init lmb_add_region(struct lmb_region *rgn, u64 base, u64 size)
> break;
> }
> }
> +
> + if (base < rgn->region[0].base) {
> + rgn->region[0].base = base;
> + rgn->region[0].size = size;
> + }
> rgn->cnt++;
>
> return 0;
Are you sure this is sufficient?
It seems to me, to handle this properly, you'll need to handle
the case where the lower addressed entry you are inserting is
not contiguous with the existing entry 0.
Therefore, you need to move all existing entries up a slot,
then you can set the 0 entry to 'base' and 'size'.
What do you think?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] [LMB]: Fix lmb_add_region if region should be added at the head
2008-02-20 4:45 ` David Miller
@ 2008-02-20 5:16 ` Kumar Gala
2008-02-20 5:26 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Kumar Gala @ 2008-02-20 5:16 UTC (permalink / raw)
To: David Miller; +Cc: sparclinux, linuxppc-dev, linux-kernel
On Feb 19, 2008, at 10:45 PM, David Miller wrote:
> From: Kumar Gala <galak@kernel.crashing.org>
> Date: Tue, 19 Feb 2008 22:27:48 -0600 (CST)
>
>> We introduced a bug in fixing lmb_add_region to handle an initial
>> region being non-zero. Before that fix it was impossible to insert
>> a region at the head of the list since the first region always
>> started
>> at zero.
>>
>> Now that its possible for the first region to be non-zero we need to
>> check to see if the new region should be added at the head and if so
>> actually add it.
>>
>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ...
>> @@ -184,6 +184,11 @@ static long __init lmb_add_region(struct
>> lmb_region *rgn, u64 base, u64 size)
>> break;
>> }
>> }
>> +
>> + if (base < rgn->region[0].base) {
>> + rgn->region[0].base = base;
>> + rgn->region[0].size = size;
>> + }
>> rgn->cnt++;
>>
>> return 0;
>
> Are you sure this is sufficient?
>
> It seems to me, to handle this properly, you'll need to handle
> the case where the lower addressed entry you are inserting is
> not contiguous with the existing entry 0.
>
> Therefore, you need to move all existing entries up a slot,
> then you can set the 0 entry to 'base' and 'size'.
The for loop above the code I added will move all the existing slots
up one. Its just the tail cleanup we are missing.
- k
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] [LMB]: Fix lmb_add_region if region should be added at the head
2008-02-20 5:16 ` Kumar Gala
@ 2008-02-20 5:26 ` David Miller
2008-02-20 5:29 ` Kumar Gala
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2008-02-20 5:26 UTC (permalink / raw)
To: galak; +Cc: sparclinux, linuxppc-dev, linux-kernel
From: Kumar Gala <galak@kernel.crashing.org>
Date: Tue, 19 Feb 2008 23:16:18 -0600
> The for loop above the code I added will move all the existing slots
> up one. Its just the tail cleanup we are missing.
Aha, I see how this works now, thanks!
I'll add this to my LMB tree.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] [LMB]: Fix lmb_add_region if region should be added at the head
2008-02-20 5:26 ` David Miller
@ 2008-02-20 5:29 ` Kumar Gala
0 siblings, 0 replies; 5+ messages in thread
From: Kumar Gala @ 2008-02-20 5:29 UTC (permalink / raw)
To: David Miller; +Cc: sparclinux, linuxppc-dev, linux-kernel
On Feb 19, 2008, at 11:26 PM, David Miller wrote:
> From: Kumar Gala <galak@kernel.crashing.org>
> Date: Tue, 19 Feb 2008 23:16:18 -0600
>
>> The for loop above the code I added will move all the existing slots
>> up one. Its just the tail cleanup we are missing.
>
> Aha, I see how this works now, thanks!
>
> I'll add this to my LMB tree.
Sounds good. Now just convince Paul or Linus to pull this in for
2.6.25 :)
- k
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-02-20 5:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-20 4:27 [PATCH] [LMB]: Fix lmb_add_region if region should be added at the head Kumar Gala
2008-02-20 4:45 ` David Miller
2008-02-20 5:16 ` Kumar Gala
2008-02-20 5:26 ` David Miller
2008-02-20 5:29 ` Kumar Gala
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox