[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH v1 1/2] xen/apic: Use vAPIC for IPI if the hardware supports it.



Instead of using the event channels.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 arch/x86/xen/smp.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 3f4ebf0..d4f4560 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -793,15 +793,33 @@ static int xen_hvm_cpu_up(unsigned int cpu, struct 
task_struct *tidle)
        return rc;
 }
 
+static bool __init xen_use_vapic(void)
+{
+       uint32_t eax = cpuid_eax(xen_cpuid_base() + 4);
+
+       if (((eax & XEN_HVM_CPUID_X2APIC_VIRT) && x2apic_mode) ||
+           ((eax & XEN_HVM_CPUID_APIC_ACCESS_VIRT) && cpu_has_apic))
+               return true;
+
+       return false;
+}
 void __init xen_hvm_smp_init(void)
 {
+       bool vapic;
+
        if (!xen_have_vector_callback)
                return;
+
+       vapic = xen_use_vapic();
        smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
-       smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
        smp_ops.cpu_up = xen_hvm_cpu_up;
        smp_ops.cpu_die = xen_cpu_die;
+       smp_ops.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu;
+
+       printk("Using %s IPI mode\n", vapic ? "vAPIC" : "event channel");
+       if (vapic)
+               return;
+       smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
        smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi;
        smp_ops.send_call_func_single_ipi = 
xen_smp_send_call_function_single_ipi;
-       smp_ops.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu;
 }
-- 
2.4.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.