mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Andrew Morton <akpm@osdl.org>
Cc: stsp@aknet.ru, linux-kernel@vger.kernel.org
Subject: Re: the creation of boot_cpu_init() is wrong and accessing uninitialised data
Date: Tue, 27 Jun 2006 22:45:34 -0400	[thread overview]
Message-ID: <1151462735.5793.2.camel@mulgrave.il.steeleye.com> (raw)
In-Reply-To: <20060627170446.30392b00.akpm@osdl.org>

On Tue, 2006-06-27 at 17:04 -0700, Andrew Morton wrote:
> +static void __init __attribute__((weak)) smp_setup_processor_id(void)

If you're really sure this works .. then it looks OK.  However, I
thought weak was a linker attribute, not a compiler one.  How does the
compiler know if the static inline needs to be incorporated or if a
strong symbol is going to override it when the whole thing is linked
together at the time it just compiles main.c?

> +{
> +}
> +
>  asmlinkage void __init start_kernel(void)
>  {
>  	char * command_line;
>  	extern struct kernel_param __start___param[], __stop___param[];
> +
> +	smp_setup_processor_id();
> +
>  /*
>   * Interrupts are still disabled. Do necessary setups, then
>   * enable them
> diff -puN arch/i386/mach-voyager/voyager_smp.c~add-smp_setup_processor_id arch/i386/mach-voyager/voyager_smp.c
> --- a/arch/i386/mach-voyager/voyager_smp.c~add-smp_setup_processor_id
> +++ a/arch/i386/mach-voyager/voyager_smp.c
> @@ -1938,3 +1938,9 @@ smp_cpus_done(unsigned int max_cpus)
>  {
>  	zap_low_mappings();
>  }
> +
> +void __init
> +smp_setup_processor_id(void)
> +{
> +	current_thread_info()->cpu = hard_smp_processor_id();
> +}
> diff -puN include/linux/smp.h~add-smp_setup_processor_id include/linux/smp.h
> --- a/include/linux/smp.h~add-smp_setup_processor_id
> +++ a/include/linux/smp.h
> @@ -125,4 +125,6 @@ static inline void smp_send_reschedule(i
>  #define put_cpu()		preempt_enable()
>  #define put_cpu_no_resched()	preempt_enable_no_resched()
>  
> +void smp_setup_processor_id(void);
> +
>  #endif /* __LINUX_SMP_H */
> _
> 
> 
> Note that I moved the call to smp_setup_processor_id() to be super-early. 
> Before the lock_kernel(), before everything.  It seems better that way. 
> And there's lockdep init stuff in -mm which is called immediately on entry
> to start_kernel() which might want to use smp_processor_id().
> 
> Is that all OK?

I'll give it a whirl tomorrow when I get access to one of the voyager
systems in Columbia.

James



  reply	other threads:[~2006-06-28  2:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-27  2:45 James Bottomley
2006-06-27  3:04 ` Andrew Morton
2006-06-27  3:36   ` James Bottomley
2006-06-27  5:03     ` Andrew Morton
2006-06-27 13:00       ` Keith Owens
2006-06-27 14:01         ` James Bottomley
2006-06-27 14:49       ` James Bottomley
2006-06-28  0:04         ` Andrew Morton
2006-06-28  2:45           ` James Bottomley [this message]
2006-06-28  2:57             ` Andrew Morton
2006-06-28 23:10               ` James Bottomley
2006-06-29 16:58                 ` James Bottomley
2006-07-02 14:52                   ` Eric W. Biederman
2006-07-02 15:06                     ` James Bottomley
2006-07-02 15:37                       ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1151462735.5793.2.camel@mulgrave.il.steeleye.com \
    --to=james.bottomley@steeleye.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stsp@aknet.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®