lkml.org 
[lkml]   [2010]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 00/10] x86, xsave: some code cleanups and reworks
On Wed, Jul 21, 2010 at 06:16:54PM +0200, Robert Richter wrote:
> On 20.07.10 16:17:40, Cyrill Gorcunov wrote:
>
> > note the snippet
> >
> > if (cpu == boot_cpu_id)
> > switch_to_new_gdt(cpu);
> >
> > but cycle of assignment is done over all possible cpus so
> > smp_processor_id will be = 0 for BP but definitely it's
> > confusing and better to check for BP via explicit cpu == boot_cpu_id
> > I think. Though I might be missing something.
>
> This in smpboot.c makes it clear:
>
> void __cpuinit smp_store_cpu_info(int id)
> {
> struct cpuinfo_x86 *c = &cpu_data(id);
>
> copy_cpuinfo_x86(c, &boot_cpu_data);
> c->cpu_index = id;
> if (id != 0)
> identify_secondary_cpu(c);
> }
>
> So boot cpu id is always 0.

yeah, thanks!

>
> Also note, as Hans Peter already pointed out, this for CONFIG_SMP:
>
> &cpu_data(0) != &boot_cpu_data
>
> The data in boot_cpu_data is (partly) already available after
> early_cpu_init(). It is later copied to the &cpu_data() structures. So
> boot_cpu_data should be used for init code.
>
> Also, to make the test obviously, instead of testing (cpu ==
> boot_cpu_id) I rather tend to use an is_boot_cpu() macro as you
> suggested in your earlier mail.
>
> -Robert
>
> --
> Advanced Micro Devices, Inc.
> Operating System Research Center
>

ok, thanks Robert!

-- Cyrill


\
 
 \ /
  Last update: 2010-07-21 18:33    [W:0.077 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site