From: Ian Campbell Subject: Re: smp_prepare_boot_cpu Date: Mon, 10 Dec 2012 10:34:02 +0000 Message-ID: <1355135642.21160.0.camel@zakaz.uk.xensource.com> References: <1355120859.46777.YahooMailNeo@web120003.mail.ne1.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1355120859.46777.YahooMailNeo@web120003.mail.ne1.yahoo.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: maheen butt Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Mon, 2012-12-10 at 06:27 +0000, maheen butt wrote: > Hi, > > > In start_xen():xen/arch/x86/setup.c > has function smp_prepare_boot_cpu() which also exist in vanilla kernel > the kernel version is given that: I'm not sure that you can infer that because these functions are similarly named in Linux and Xen that they should have the same behaviour / semantics. > void __init native_smp_prepare_boot_cpu(void) > { > int me = smp_processor_id(); > switch_to_new_gdt(me); > /* already set me in cpu_online_mask in boot_cpu_init() */ > cpumask_set_cpu(me, cpu_callout_mask); > per_cpu(cpu_state, me) = CPU_ONLINE; > } > > > Whera in case of Xen we have: > void __init smp_prepare_boot_cpu(void) > { > cpumask_set_cpu(smp_processor_id(), &cpu_online_map); > cpumask_set_cpu(smp_processor_id(), &cpu_present_map); > } > My question is that why there is no need to change gdt pointer to > current cpu segment as it is done in case of kernel code? Perhaps it is done somewhere else? IIRC the gdtr contains a virtual address and Xen uses a fixed virtual address for the GDT with per-PCPU mappings, so perhaps loading the gdtr here is simply not necessary. Ian.