WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 14/15] xen/multicall: special-case singleton hypercal

To: Xen Devel <Xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 14/15] xen/multicall: special-case singleton hypercalls
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Mon, 20 Jun 2011 15:15:10 -0700
Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Steven Rostedt <rostedt@xxxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Mon, 20 Jun 2011 15:47:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <cover.1308607697.git.jeremy.fitzhardinge@xxxxxxxxxx>
In-reply-to: <cover.1308607697.git.jeremy.fitzhardinge@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <cover.1308607697.git.jeremy.fitzhardinge@xxxxxxxxxx>
References: <cover.1308607697.git.jeremy.fitzhardinge@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
From: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>

Singleton calls seem to end up being pretty common, so just
directly call the hypercall rather than going via multicall.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
---
 arch/x86/xen/multicalls.c |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/arch/x86/xen/multicalls.c b/arch/x86/xen/multicalls.c
index b9b9811..eb022fd 100644
--- a/arch/x86/xen/multicalls.c
+++ b/arch/x86/xen/multicalls.c
@@ -55,6 +55,7 @@ DEFINE_PER_CPU(unsigned long, xen_mc_irq_flags);
 void xen_mc_flush(void)
 {
        struct mc_buffer *b = &__get_cpu_var(mc_buffer);
+       struct multicall_entry *mc;
        int ret = 0;
        unsigned long flags;
        int i;
@@ -67,7 +68,24 @@ void xen_mc_flush(void)
 
        trace_xen_mc_flush(b->mcidx, b->argidx, b->cbidx);
 
-       if (b->mcidx) {
+       switch (b->mcidx) {
+       case 0:
+               /* no-op */
+               BUG_ON(b->argidx != 0);
+               break;
+
+       case 1:
+               /* Singleton multicall - bypass multicall machinery
+                  and just do the call directly. */
+               mc = &b->entries[0];
+
+               mc->result = privcmd_call(mc->op,
+                                         mc->args[0], mc->args[1], 
mc->args[2], 
+                                         mc->args[3], mc->args[4]);
+               ret = mc->result < 0;
+               break;
+
+       default:
 #if MC_DEBUG
                memcpy(b->debug, b->entries,
                       b->mcidx * sizeof(struct multicall_entry));
@@ -94,11 +112,10 @@ void xen_mc_flush(void)
                        }
                }
 #endif
+       }
 
-               b->mcidx = 0;
-               b->argidx = 0;
-       } else
-               BUG_ON(b->argidx != 0);
+       b->mcidx = 0;
+       b->argidx = 0;
 
        for (i = 0; i < b->cbidx; i++) {
                struct callback *cb = &b->callbacks[i];
-- 
1.7.5.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel