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

[Xen-devel] [RFC PATCH V2 8/8] xen: register 3-level event channel



The 3-level event channel is registered in
 a) xen_init_IRQ(), when the guest is fresh started;
 b) xen_vcpu_restore(), when the guest is restored.

If registration fails, the kernel will fall back to 2-level event channel.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 arch/x86/xen/enlighten.c |   12 ++++++++++++
 drivers/xen/events.c     |   11 ++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index bc893e7..25481b1 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -43,6 +43,7 @@
 #include <xen/hvm.h>
 #include <xen/hvc-console.h>
 #include <xen/acpi.h>
+#include <xen/events.h>
 
 #include <asm/paravirt.h>
 #include <asm/apic.h>
@@ -177,6 +178,7 @@ static void xen_vcpu_setup(int cpu)
 void xen_vcpu_restore(void)
 {
        int cpu;
+       int rc;
 
        for_each_possible_cpu(cpu) {
                bool other_cpu = (cpu != smp_processor_id());
@@ -195,6 +197,16 @@ void xen_vcpu_restore(void)
                    HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL))
                        BUG();
        }
+
+       if (!(rc = xen_event_channel_register_nlevel(3))) {
+               printk(KERN_INFO "Register 3-level event channel succeeded.\n");
+               xen_set_event_channel_nlevel(3);
+       } else {
+               printk(KERN_INFO "Register 3-level event channel failed with 
%d.\n"
+                      "Fall back to default 2-level event channel.\n",
+                      rc);
+               xen_set_event_channel_nlevel(2);
+       }
 }
 
 static void __init xen_banner(void)
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 76ff48c..45159d9 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -2291,7 +2291,16 @@ void __init xen_init_IRQ(void)
        int i, rc;
        int cpu;
 
-       /* Setup 2-level event channel */
+       if (!(rc = xen_event_channel_register_3level())) {
+               printk(KERN_INFO "Register 3-level event channel succeeded.\n");
+               xen_set_event_channel_nlevel(3);
+       } else {
+               printk(KERN_INFO "Register 3-level event channel failed with 
%d.\n"
+                      "Fall back to default 2-level event channel.\n",
+                      rc);
+               xen_set_event_channel_nlevel(2);
+       }
+
        evtchn_to_irq = kcalloc(nr_event_channels, sizeof(*evtchn_to_irq),
                                GFP_KERNEL);
        BUG_ON(!evtchn_to_irq);
-- 
1.7.10.4


_______________________________________________
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®.