Skip to contentSkip to conversation

smp_prepare_boot_cpu

DISCUSSION maheen butt 2 participants 2 messages Dec 10, 2012

lore
Share & tools
lore
#0 lore raw

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:
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?

Thanks

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 6 lines · maheen butt

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.

Quoted 10 lines

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;
}
Quoted 8 lines

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.