Some hypercalls can be batched: lazy_hcall is the wrapper which
determines this, so it's pretty harmless to use lazy_hcall() instead of
hcall().

Before:
Time for one context switch via pipe: 6745 (6521 - 13966)

After:
Time for one context switch via pipe: 5406 (5170 - 7467)

Signed-off-by: Rusty Russell <[EMAIL PROTECTED]>
---
 drivers/lguest/lguest.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

===================================================================
--- a/drivers/lguest/lguest.c
+++ b/drivers/lguest/lguest.c
@@ -225,7 +225,7 @@ static unsigned long current_cr0, curren
 static unsigned long current_cr0, current_cr3;
 static void lguest_write_cr0(unsigned long val)
 {
-       hcall(LHCALL_TS, val & 8, 0, 0);
+       lazy_hcall(LHCALL_TS, val & 8, 0, 0);
        current_cr0 = val;
 }
 
@@ -247,7 +247,7 @@ static unsigned long lguest_read_cr2(voi
 
 static void lguest_write_cr3(unsigned long cr3)
 {
-       hcall(LHCALL_NEW_PGTABLE, cr3, 0, 0);
+       lazy_hcall(LHCALL_NEW_PGTABLE, cr3, 0, 0);
        current_cr3 = cr3;
 }
 
@@ -287,7 +287,7 @@ static void lguest_set_pte(pte_t *ptep, 
        *ptep = pteval;
        /* Don't bother with hypercall before initial setup. */
        if (current_cr3)
-               hcall(LHCALL_FLUSH_TLB, 1, 0, 0);
+               lazy_hcall(LHCALL_FLUSH_TLB, 1, 0, 0);
 }
 
 static void lguest_flush_tlb_single(unsigned long addr)


_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/virtualization

Reply via email to