[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100721161654.GR26154@erda.amd.com>
Date: Wed, 21 Jul 2010 18:16:54 +0200
From: Robert Richter <robert.richter@....com>
To: Cyrill Gorcunov <gorcunov@...il.com>
CC: "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
Suresh Siddha <suresh.b.siddha@...el.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 00/10] x86, xsave: some code cleanups and reworks
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.
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists