Re: [PATCH] PPC64 mmu_context_init needs to run earlier

From: Nathan Lynch
Date: Tue Nov 02 2004 - 17:06:06 EST


On Tue, 2004-11-02 at 00:13, Andrew Morton wrote:
> Paul Mackerras <paulus@xxxxxxxxx> wrote:
> >
> > This patch changes mmu_context_init to be called as a core_initcall
> > rather than an arch_initcall, since mmu_context_init needs to run
> > before we try to run any userspace processes, and arch_initcall was
> > found to be too late.
>
> Here we go again...
>
> I don't see why your patch fixes the problem. do_basic_setup() calls
> driver_init() prior to any initcalls being run, and driver_init() can call
> /sbin/hotplug.

My original submission was more of a "works for me, not sure it's
correct" sort of thing. Sorry I wasn't clear.

How about this instead:


Using idr_get_new_above in init_new_context lets us get rid of an
awkward init function which wasn't running early enough in boot
anyway.

Signed-off-by: Nathan Lynch <nathanl@xxxxxxxxxxxxxx>


---


diff -puN arch/ppc64/mm/init.c~ppc64-mmu-context-use-idr_get_new_above arch/ppc64/mm/init.c
--- linux-2.6.10-rc1-bk12/arch/ppc64/mm/init.c~ppc64-mmu-context-use-idr_get_new_above 2004-11-02 14:22:23.000000000 -0600
+++ linux-2.6.10-rc1-bk12-nathanl/arch/ppc64/mm/init.c 2004-11-02 14:29:09.000000000 -0600
@@ -489,7 +489,7 @@ again:
return -ENOMEM;

spin_lock(&mmu_context_lock);
- err = idr_get_new(&mmu_context_idr, NULL, &index);
+ err = idr_get_new_above(&mmu_context_idr, NULL, 0, &index);
spin_unlock(&mmu_context_lock);

if (err == -EAGAIN)
@@ -518,19 +518,6 @@ void destroy_context(struct mm_struct *m
hugetlb_mm_free_pgd(mm);
}

-static int __init mmu_context_init(void)
-{
- int index;
-
- /* Reserve the first (invalid) context*/
- idr_pre_get(&mmu_context_idr, GFP_KERNEL);
- idr_get_new(&mmu_context_idr, NULL, &index);
- BUG_ON(0 != index);
-
- return 0;
-}
-arch_initcall(mmu_context_init);
-
/*
* Do very early mm setup.
*/

_


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/