mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [start_kernel] Suggest to move parse_args() before trap_init()
@ 2004-03-01  9:36 Zhu, Yi
  2004-03-01 10:56 ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Zhu, Yi @ 2004-03-01  9:36 UTC (permalink / raw)
  To: Linux Kernel Mailing List


Hi,

I'm not sure it is _correct_ to move parse_args() before trap_init() in
start_kernel(). Is there any potencial dependencies? I did this on my P4 UP
box, it boots OK.

My issue is if the parse_args() runs after trap_init(), the kernel
parameter "lapic" and "nolapic" takes no effect. Because lapic_enable()
is called after init_apic_mappings().


--- init/main.c.orig    2004-03-01 16:54:23.000000000 +0800
+++ init/main.c 2004-03-01 16:54:45.000000000 +0800
@@ -416,11 +416,11 @@

        build_all_zonelists();
        page_alloc_init();
-       trap_init();
        printk("Kernel command line: %s\n", saved_command_line);
        parse_args("Booting kernel", command_line, __start___param,
                   __stop___param - __start___param,
                   &unknown_bootoption);
+       trap_init();
        sort_main_extable();
        rcu_init();
        init_IRQ();


Thanks,
-- 
-----------------------------------------------------------------
Opinions expressed are those of the author and do not represent
Intel Corp.

Zhu Yi (Chuyee)

GnuPG v1.0.6 (GNU/Linux)
http://cn.geocities.com/chewie_chuyee/gpg.txt or
$ gpg --keyserver wwwkeys.pgp.net --recv-keys 71C34820
1024D/71C34820 C939 2B0B FBCE 1D51 109A  55E5 8650 DB90 71C3 4820


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [start_kernel] Suggest to move parse_args() before trap_init()
  2004-03-01  9:36 [start_kernel] Suggest to move parse_args() before trap_init() Zhu, Yi
@ 2004-03-01 10:56 ` Andrew Morton
       [not found]   ` <20040301025637.338f41cf.akpm@osdl.org.suse.lists.linux.kernel>
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2004-03-01 10:56 UTC (permalink / raw)
  To: Zhu, Yi; +Cc: linux-kernel

"Zhu, Yi" <yi.zhu@intel.com> wrote:
>
> I'm not sure it is _correct_ to move parse_args() before trap_init() in
>  start_kernel(). Is there any potencial dependencies? I did this on my P4 UP
>  box, it boots OK.
> 
>  My issue is if the parse_args() runs after trap_init(), the kernel
>  parameter "lapic" and "nolapic" takes no effect. Because lapic_enable()
>  is called after init_apic_mappings().
> 
> 
>  --- init/main.c.orig    2004-03-01 16:54:23.000000000 +0800
>  +++ init/main.c 2004-03-01 16:54:45.000000000 +0800
>  @@ -416,11 +416,11 @@
> 
>          build_all_zonelists();
>          page_alloc_init();
>  -       trap_init();
>          printk("Kernel command line: %s\n", saved_command_line);
>          parse_args("Booting kernel", command_line, __start___param,
>                     __stop___param - __start___param,
>                     &unknown_bootoption);
>  +       trap_init();
>          sort_main_extable();
>          rcu_init();
>          init_IRQ();

I think the only problem with this is if we get a fault during
parse_args(), the kernel flies off into outer space.  So you lose some
debuggability when using an early console.

But 2.4 does trap_init() after parse_args() and nobody has complained, as
did 2.6 until recently.  So the change is probably OK.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [start_kernel] Suggest to move parse_args() before trap_init()
       [not found]   ` <20040301025637.338f41cf.akpm@osdl.org.suse.lists.linux.kernel>
@ 2004-03-01 20:46     ` Andi Kleen
  2004-03-01 20:54       ` Dave Jones
  2004-03-01 21:15       ` Dave Hansen
  0 siblings, 2 replies; 7+ messages in thread
From: Andi Kleen @ 2004-03-01 20:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: yi.zhu, linux-kernel

Andrew Morton <akpm@osdl.org> writes:

> I think the only problem with this is if we get a fault during
> parse_args(), the kernel flies off into outer space.  So you lose some
> debuggability when using an early console.
> 
> But 2.4 does trap_init() after parse_args() and nobody has complained, as
> did 2.6 until recently.  So the change is probably OK.

The standard way to fix this is to add an explicit check for lapic
to the early argument parsing in setup.c (but keep the __setup so that
no unknown argument is reported).

I think that's better than moving it and getting possible bugs that cannot
even be catched with early printk.

Another way that i've considered on x86-64 for 2.7 at least is a special
__early_setup() for this

-Andi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [start_kernel] Suggest to move parse_args() before trap_init()
  2004-03-01 20:46     ` Andi Kleen
@ 2004-03-01 20:54       ` Dave Jones
  2004-03-01 21:14         ` Andi Kleen
  2004-03-01 21:15       ` Dave Hansen
  1 sibling, 1 reply; 7+ messages in thread
From: Dave Jones @ 2004-03-01 20:54 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, yi.zhu, linux-kernel

On Mon, Mar 01, 2004 at 09:46:38PM +0100, Andi Kleen wrote:

 > > I think the only problem with this is if we get a fault during
 > > parse_args(), the kernel flies off into outer space.  So you lose some
 > > debuggability when using an early console.
 > > 
 > > But 2.4 does trap_init() after parse_args() and nobody has complained, as
 > > did 2.6 until recently.  So the change is probably OK.
 > 
 > The standard way to fix this is to add an explicit check for lapic
 > to the early argument parsing in setup.c (but keep the __setup so that
 > no unknown argument is reported).

This just got me thinking of a sort-of related problem.
Some laptops hang when local apic is enabled, and we couldn't
blacklist them in 2.4 due to us not doing the dmi scan early enough.

Did that get fixed in 2.6 ?

		Dave

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [start_kernel] Suggest to move parse_args() before trap_init()
  2004-03-01 20:54       ` Dave Jones
@ 2004-03-01 21:14         ` Andi Kleen
  0 siblings, 0 replies; 7+ messages in thread
From: Andi Kleen @ 2004-03-01 21:14 UTC (permalink / raw)
  To: Dave Jones; +Cc: akpm, yi.zhu, linux-kernel

On Mon, 1 Mar 2004 20:54:26 +0000
Dave Jones <davej@redhat.com> wrote:


> Did that get fixed in 2.6 ?

It's called directly after paging_init now. That should be early enough.

-Andi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [start_kernel] Suggest to move parse_args() before trap_init()
  2004-03-01 20:46     ` Andi Kleen
  2004-03-01 20:54       ` Dave Jones
@ 2004-03-01 21:15       ` Dave Hansen
  1 sibling, 0 replies; 7+ messages in thread
From: Dave Hansen @ 2004-03-01 21:15 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, yi.zhu, Linux Kernel Mailing List

On Mon, 2004-03-01 at 12:46, Andi Kleen wrote:
> Andrew Morton <akpm@osdl.org> writes:
> 
> > I think the only problem with this is if we get a fault during
> > parse_args(), the kernel flies off into outer space.  So you lose some
> > debuggability when using an early console.
> > 
> > But 2.4 does trap_init() after parse_args() and nobody has complained, as
> > did 2.6 until recently.  So the change is probably OK.
>...
> Another way that i've considered on x86-64 for 2.7 at least is a special
> __early_setup() for this

It might be nice to have the same thing as the initcalls:
#define core_initcall(fn)               __define_initcall("1",fn)
...
#define late_initcall(fn)               __define_initcall("7",fn)

If we had something like this, we could also use it for stuff like
early_printk(), in addition to things like mem= in setup_arch().  You
can actually do serial early printk in about 3 lines of code if you can
parse arguments really, really early.  

-- dave


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [start_kernel] Suggest to move parse_args() before trap_init()
@ 2004-03-02  1:49 Mikael Pettersson
  0 siblings, 0 replies; 7+ messages in thread
From: Mikael Pettersson @ 2004-03-02  1:49 UTC (permalink / raw)
  To: ak, davej; +Cc: akpm, linux-kernel, yi.zhu

On Mon, 1 Mar 2004 20:54:26 +0000, Dave Jones wrote:
>On Mon, Mar 01, 2004 at 09:46:38PM +0100, Andi Kleen wrote:
>
> > > I think the only problem with this is if we get a fault during
> > > parse_args(), the kernel flies off into outer space.  So you lose some
> > > debuggability when using an early console.
> > > 
> > > But 2.4 does trap_init() after parse_args() and nobody has complained, as
> > > did 2.6 until recently.  So the change is probably OK.
> > 
> > The standard way to fix this is to add an explicit check for lapic
> > to the early argument parsing in setup.c (but keep the __setup so that
> > no unknown argument is reported).
>
>This just got me thinking of a sort-of related problem.
>Some laptops hang when local apic is enabled, and we couldn't
>blacklist them in 2.4 due to us not doing the dmi scan early enough.
>
>Did that get fixed in 2.6 ?

My patch for early DMI scan and local APIC blacklisting
was included in 2.5.6 and 2.4.19. This was done mainly
to handle all those broken Dell laptops.

/Mikael

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-03-02  1:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-01  9:36 [start_kernel] Suggest to move parse_args() before trap_init() Zhu, Yi
2004-03-01 10:56 ` Andrew Morton
     [not found]   ` <20040301025637.338f41cf.akpm@osdl.org.suse.lists.linux.kernel>
2004-03-01 20:46     ` Andi Kleen
2004-03-01 20:54       ` Dave Jones
2004-03-01 21:14         ` Andi Kleen
2004-03-01 21:15       ` Dave Hansen
2004-03-02  1:49 Mikael Pettersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®