Re: [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_idto smp_ops

From: Jeremy Fitzhardinge
Date: Sun Mar 08 2009 - 13:15:27 EST


James Bottomley wrote:
Not having apics, Voyager can't use the default apic implementation of
these, it has to read from a special port in the VIC to get the
processor ID, so abstract these functions in smp_ops to allow voyager
to live simultaneously with the apic code.

These aren't performance-sensitive at all, are they? smp_ops is not subject to patching/inlining optimisations happen to more hotpath pvops.

Is safe_smp_processor_id needed at all? It's only got two callers, and x86-64 just implements it as smp_processor_id().

diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 035582a..0dfb8c0 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -450,6 +450,11 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
+static int xen_hard_smp_processor_id(void)
+{
+ return read_apic_id();
+}
+
static const struct smp_ops xen_smp_ops __initdata = {
.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
.smp_prepare_cpus = xen_smp_prepare_cpus,
@@ -465,6 +470,8 @@ static const struct smp_ops xen_smp_ops __initdata = {
.send_call_func_ipi = xen_smp_send_call_function_ipi,
.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi,
+ .hard_smp_processor_id = xen_hard_smp_processor_id,
+ .safe_smp_processor_id = apic_safe_smp_processor_id,

Hm, there's no meaningful apic-based implementation for these under Xen. DomU has no access to apics, and Dom0's vcpus don't have any fixed relationship to physical cpu apics. They should both just return smp_processor_id(), I guess.

J
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/