* [PATCH -mm 1/4] x86_64 boot: Add free_early to early reservation machanism
@ 2008-03-27 7:09 Huang, Ying
2008-03-27 11:34 ` Paul Jackson
2008-03-27 11:40 ` Paul Jackson
0 siblings, 2 replies; 5+ messages in thread
From: Huang, Ying @ 2008-03-27 7:09 UTC (permalink / raw)
To: H. Peter Anvin, andi, mingo, tglx, Paul Jackson; +Cc: linux-kernel
Add free_early to early reservation mechanism.
Signed-off-by: Huang Ying <ying.huang@intel.com>
---
arch/x86/kernel/e820_64.c | 17 +++++++++++++++++
include/asm-x86/e820_64.h | 1 +
2 files changed, 18 insertions(+)
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -84,6 +84,23 @@ void __init reserve_early(unsigned long
strncpy(r->name, name, sizeof(r->name) - 1);
}
+void __init free_early(unsigned long start, unsigned long end)
+{
+ int i, j;
+ struct early_res *r;
+ for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
+ r = &early_res[i];
+ if (start == r->start && end == r->end)
+ break;
+ }
+ if (i >= MAX_EARLY_RES || !early_res[i].end)
+ panic("free_early on not reserved area: %lx-%lx!", start, end);
+ for (j = i+1; j < MAX_EARLY_RES && early_res[j].end; j++) ;
+ memcpy(&early_res[i], &early_res[i+1],
+ (j-1-i) * sizeof(struct early_res));
+ early_res[j-1].end = 0;
+}
+
void __init early_res_to_bootmem(void)
{
int i;
--- a/include/asm-x86/e820_64.h
+++ b/include/asm-x86/e820_64.h
@@ -41,6 +41,7 @@ extern struct e820map e820;
extern void update_e820(void);
extern void reserve_early(unsigned long start, unsigned long end, char *name);
+extern void free_early(unsigned long start, unsigned long end);
extern void early_res_to_bootmem(void);
#endif/*!__ASSEMBLY__*/
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH -mm 1/4] x86_64 boot: Add free_early to early reservation machanism
2008-03-27 7:09 [PATCH -mm 1/4] x86_64 boot: Add free_early to early reservation machanism Huang, Ying
@ 2008-03-27 11:34 ` Paul Jackson
2008-03-27 11:58 ` Ingo Molnar
2008-03-27 11:40 ` Paul Jackson
1 sibling, 1 reply; 5+ messages in thread
From: Paul Jackson @ 2008-03-27 11:34 UTC (permalink / raw)
To: Huang, Ying; +Cc: hpa, andi, mingo, tglx, linux-kernel
Huang wrote:
> + panic("free_early on not reserved area: %lx-%lx!", start, end);
Should that be 'early_panic', not 'panic' ?
(I see a couple more panics in that file, which I wonder
if should be early_panic as well ?)
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.940.382.4214
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH -mm 1/4] x86_64 boot: Add free_early to early reservation machanism
2008-03-27 11:34 ` Paul Jackson
@ 2008-03-27 11:58 ` Ingo Molnar
2008-03-27 12:08 ` Andi Kleen
0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2008-03-27 11:58 UTC (permalink / raw)
To: Paul Jackson; +Cc: Huang, Ying, hpa, andi, mingo, tglx, linux-kernel
* Paul Jackson <pj@sgi.com> wrote:
> Huang wrote:
> > + panic("free_early on not reserved area: %lx-%lx!", start, end);
>
> Should that be 'early_panic', not 'panic' ?
>
> (I see a couple more panics in that file, which I wonder
> if should be early_panic as well ?)
this should be fixed properly btw: panic() should self-select whether it
does an early_panic() or a real panic().
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH -mm 1/4] x86_64 boot: Add free_early to early reservation machanism
2008-03-27 11:58 ` Ingo Molnar
@ 2008-03-27 12:08 ` Andi Kleen
0 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2008-03-27 12:08 UTC (permalink / raw)
To: Ingo Molnar
Cc: Paul Jackson, Huang, Ying, hpa, andi, mingo, tglx, linux-kernel
On Thu, Mar 27, 2008 at 12:58:51PM +0100, Ingo Molnar wrote:
>
> * Paul Jackson <pj@sgi.com> wrote:
>
> > Huang wrote:
> > > + panic("free_early on not reserved area: %lx-%lx!", start, end);
> >
> > Should that be 'early_panic', not 'panic' ?
> >
> > (I see a couple more panics in that file, which I wonder
> > if should be early_panic as well ?)
>
> this should be fixed properly btw: panic() should self-select whether it
> does an early_panic() or a real panic().
There's also need of a EARLY_BUG, but self selection would be a little
tricky here.
I still have an old patch for this, but I haven't gotten around to submit it
because it turned out the first user of it wasn't a good idea.
-Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -mm 1/4] x86_64 boot: Add free_early to early reservation machanism
2008-03-27 7:09 [PATCH -mm 1/4] x86_64 boot: Add free_early to early reservation machanism Huang, Ying
2008-03-27 11:34 ` Paul Jackson
@ 2008-03-27 11:40 ` Paul Jackson
1 sibling, 0 replies; 5+ messages in thread
From: Paul Jackson @ 2008-03-27 11:40 UTC (permalink / raw)
To: Huang, Ying; +Cc: hpa, andi, mingo, tglx, linux-kernel
Huang wrote:
> + for (j = i+1; j < MAX_EARLY_RES && early_res[j].end; j++) ;
Could we space this code out a little, as in:
for (j = i + 1; j < MAX_EARLY_RES && early_res[j].end; j++)
;
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.940.382.4214
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-03-27 12:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-27 7:09 [PATCH -mm 1/4] x86_64 boot: Add free_early to early reservation machanism Huang, Ying
2008-03-27 11:34 ` Paul Jackson
2008-03-27 11:58 ` Ingo Molnar
2008-03-27 12:08 ` Andi Kleen
2008-03-27 11:40 ` Paul Jackson
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.