xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: xen-devel@lists.xen.org
Cc: david.vrabel@citrix.com, Wei Liu <wei.liu2@citrix.com>,
	ian.campbell@citrix.com, jbeulich@suse.com,
	konrad.wilk@oracle.com
Subject: [RFC PATCH V2 8/8] xen: register 3-level event channel
Date: Mon, 21 Jan 2013 14:58:28 +0000	[thread overview]
Message-ID: <1358780308-30425-9-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1358780308-30425-1-git-send-email-wei.liu2@citrix.com>

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@citrix.com>
---
 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

      parent reply	other threads:[~2013-01-21 14:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-21 14:58 [RFC PATCH V2 0/8] Implement 3-level event channel in Linux Wei Liu
2013-01-21 14:58 ` [RFC PATCH V2 1/8] xen: fix output of xen_debug_interrupt Wei Liu
2013-01-21 14:58 ` [RFC PATCH V2 2/8] xen: sync public headers Wei Liu
2013-01-21 14:58 ` [RFC PATCH V2 3/8] xen: generalized event channel operations Wei Liu
2013-01-22  9:00   ` Jan Beulich
2013-01-21 14:58 ` [RFC PATCH V2 4/8] xen: dynamically allocate cpu_evtchn_mask Wei Liu
2013-01-21 14:58 ` [RFC PATCH V2 5/8] xen: implement 3-level event channel routines Wei Liu
2013-01-22  9:12   ` Jan Beulich
2013-01-21 14:58 ` [RFC PATCH V2 6/8] xen: introduce xen_event_channel_register_3level Wei Liu
2013-01-21 14:58 ` [RFC PATCH V2 7/8] xen: introduce interfaces to register N-level event channel Wei Liu
2013-01-21 14:58 ` Wei Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1358780308-30425-9-git-send-email-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).