Skip to contentSkip to conversation

make hypercall preemption checks consistent

PATCH In review Jan Beulich 6 participants 15 messages Mar 4, 2014 – Mar 13, 2014

lore
Share & tools
lore
#0 lore raw

cover make hypercall preemption checks consistent

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)
- do cheap checks first

1: common: make hypercall preemption checks consistent 2: x86: make hypercall preemption checks consistent

#1 lore raw

PATCH 1/2 common: make hypercall preemption checks consistent

- never preempt on the first iteration (ensure forward progress)
- do cheap checks first

xen/common/memory.c +5 -4
@@ -63,7 +63,7 @@ static void increase_reservation(struct 
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
     {
-        if ( hypercall_preempt_check() )
+        if ( i != a->nr_done && hypercall_preempt_check() )
         {
             a->preempted = 1;
             goto out;
@@ -109,7 +109,7 @@ static void populate_physmap(struct memo
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
     {
-        if ( hypercall_preempt_check() )
+        if ( i != a->nr_done && hypercall_preempt_check() )
         {
             a->preempted = 1;
             goto out;
@@ -268,7 +268,7 @@ static void decrease_reservation(struct 
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
     {
-        if ( hypercall_preempt_check() && i != a->nr_done )
+        if ( i != a->nr_done && hypercall_preempt_check() )
         {
             a->preempted = 1;
             goto out;
@@ -398,7 +398,8 @@ static long memory_exchange(XEN_GUEST_HA
           i < (exch.in.nr_extents >> in_chunk_order);
           i++ )
     {
-        if ( hypercall_preempt_check() )
+        if ( i != (exch.nr_exchanged >> in_chunk_order) &&
+             hypercall_preempt_check() )
         {
             exch.nr_exchanged = i << in_chunk_order;
             rcu_unlock_domain(d);
xen/common/multicall.c +1 -1
@@ -52,7 +52,7 @@ do_multicall(
 
     for ( i = 0; !rc && i < nr_calls; i++ )
     {
-        if ( hypercall_preempt_check() )
+        if ( i && hypercall_preempt_check() )
             goto preempted;
 
         if ( unlikely(__copy_from_guest(&mcs->call, call_list, 1)) )
xen/drivers/char/console.c +2 -2
@@ -375,12 +375,12 @@ static DECLARE_SOFTIRQ_TASKLET(notify_do
 static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer, int count)
 {
     char kbuf[128];
-    int kcount;
+    int kcount = 0;
     struct domain *cd = current->domain;
 
     while ( count > 0 )
     {
-        if ( hypercall_preempt_check() )
+        if ( kcount && hypercall_preempt_check() )
             return hypercall_create_continuation(
                 __HYPERVISOR_console_io, "iih",
                 CONSOLEIO_write, count, buffer);

common: make hypercall preemption checks consistent

- never preempt on the first iteration (ensure forward progress)
- do cheap checks first

xen/common/memory.c +5 -4
@@ -63,7 +63,7 @@ static void increase_reservation(struct 
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
     {
-        if ( hypercall_preempt_check() )
+        if ( i != a->nr_done && hypercall_preempt_check() )
         {
             a->preempted = 1;
             goto out;
@@ -109,7 +109,7 @@ static void populate_physmap(struct memo
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
     {
-        if ( hypercall_preempt_check() )
+        if ( i != a->nr_done && hypercall_preempt_check() )
         {
             a->preempted = 1;
             goto out;
@@ -268,7 +268,7 @@ static void decrease_reservation(struct 
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
     {
-        if ( hypercall_preempt_check() && i != a->nr_done )
+        if ( i != a->nr_done && hypercall_preempt_check() )
         {
             a->preempted = 1;
             goto out;
@@ -398,7 +398,8 @@ static long memory_exchange(XEN_GUEST_HA
           i < (exch.in.nr_extents >> in_chunk_order);
           i++ )
     {
-        if ( hypercall_preempt_check() )
+        if ( i != (exch.nr_exchanged >> in_chunk_order) &&
+             hypercall_preempt_check() )
         {
             exch.nr_exchanged = i << in_chunk_order;
             rcu_unlock_domain(d);
xen/common/multicall.c +1 -1
@@ -52,7 +52,7 @@ do_multicall(
 
     for ( i = 0; !rc && i < nr_calls; i++ )
     {
-        if ( hypercall_preempt_check() )
+        if ( i && hypercall_preempt_check() )
             goto preempted;
 
         if ( unlikely(__copy_from_guest(&mcs->call, call_list, 1)) )
xen/drivers/char/console.c +2 -2
@@ -375,12 +375,12 @@ static DECLARE_SOFTIRQ_TASKLET(notify_do
 static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer, int count)
 {
     char kbuf[128];
-    int kcount;
+    int kcount = 0;
     struct domain *cd = current->domain;
 
     while ( count > 0 )
     {
-        if ( hypercall_preempt_check() )
+        if ( kcount && hypercall_preempt_check() )
             return hypercall_create_continuation(
                 __HYPERVISOR_console_io, "iih",
                 CONSOLEIO_write, count, buffer);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] common: make hypercall preemption checks consistent

Quoted 4 lines · Jan Beulich

- never preempt on the first iteration (ensure forward progress)
- do cheap checks first

Quoted 73 lines
xen/common/memory.c +5 -4
@@ -63,7 +63,7 @@ static void increase_reservation(struct 
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
     {
-        if ( hypercall_preempt_check() )
+        if ( i != a->nr_done && hypercall_preempt_check() )
         {
             a->preempted = 1;
             goto out;
@@ -109,7 +109,7 @@ static void populate_physmap(struct memo
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
     {
-        if ( hypercall_preempt_check() )
+        if ( i != a->nr_done && hypercall_preempt_check() )
         {
             a->preempted = 1;
             goto out;
@@ -268,7 +268,7 @@ static void decrease_reservation(struct 
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
     {
-        if ( hypercall_preempt_check() && i != a->nr_done )
+        if ( i != a->nr_done && hypercall_preempt_check() )
         {
             a->preempted = 1;
             goto out;
@@ -398,7 +398,8 @@ static long memory_exchange(XEN_GUEST_HA
           i < (exch.in.nr_extents >> in_chunk_order);
           i++ )
     {
-        if ( hypercall_preempt_check() )
+        if ( i != (exch.nr_exchanged >> in_chunk_order) &&
+             hypercall_preempt_check() )
         {
             exch.nr_exchanged = i << in_chunk_order;
             rcu_unlock_domain(d);
xen/common/multicall.c +1 -1
@@ -52,7 +52,7 @@ do_multicall(
 
     for ( i = 0; !rc && i < nr_calls; i++ )
     {
-        if ( hypercall_preempt_check() )
+        if ( i && hypercall_preempt_check() )
             goto preempted;
 
         if ( unlikely(__copy_from_guest(&mcs->call, call_list, 1)) )
xen/drivers/char/console.c +2 -2
@@ -375,12 +375,12 @@ static DECLARE_SOFTIRQ_TASKLET(notify_do
 static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer, int count)
 {
     char kbuf[128];
-    int kcount;
+    int kcount = 0;
     struct domain *cd = current->domain;
 
     while ( count > 0 )
     {
-        if ( hypercall_preempt_check() )
+        if ( kcount && hypercall_preempt_check() )
             return hypercall_create_continuation(
                 __HYPERVISOR_console_io, "iih",
                 CONSOLEIO_write, count, buffer);
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw

PATCH 2/2 x86: make hypercall preemption checks consistent

In reply to Jan Beulich

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)

xen/arch/x86/mm.c +2 -2
@@ -2934,7 +2934,7 @@ long do_mmuext_op(
 
     for ( i = 0; i < count; i++ )
     {
-        if ( curr->arch.old_guest_table || hypercall_preempt_check() )
+        if ( curr->arch.old_guest_table || (i && hypercall_preempt_check()) )
         {
             rc = -EAGAIN;
             break;
@@ -3481,7 +3481,7 @@ long do_mmu_update(
 
     for ( i = 0; i < count; i++ )
     {
-        if ( curr->arch.old_guest_table || hypercall_preempt_check() )
+        if ( curr->arch.old_guest_table || (i && hypercall_preempt_check()) )
         {
             rc = -EAGAIN;
             break;
xen/arch/x86/mm/hap/hap.c +3 -1
@@ -326,7 +326,7 @@ hap_set_allocation(struct domain *d, uns
     else
         pages -= d->arch.paging.hap.p2m_pages;
 
-    while ( d->arch.paging.hap.total_pages != pages )
+    for ( ; ; )
     {
         if ( d->arch.paging.hap.total_pages < pages )
         {
@@ -355,6 +355,8 @@ hap_set_allocation(struct domain *d, uns
             d->arch.paging.hap.total_pages--;
             free_domheap_page(pg);
         }
+        else
+            break;
 
         /* Check to see if we need to yield and try again */
         if ( preempted && hypercall_preempt_check() )
xen/arch/x86/mm/p2m-pod.c +4 -2
@@ -242,7 +242,8 @@ p2m_pod_set_cache_target(struct p2m_doma
 
         p2m_pod_cache_add(p2m, page, order);
 
-        if ( hypercall_preempt_check() && preemptible )
+        if ( preemptible && pod_target != p2m->pod.count &&
+             hypercall_preempt_check() )
         {
             ret = -EAGAIN;
             goto out;
@@ -286,7 +287,8 @@ p2m_pod_set_cache_target(struct p2m_doma
 
             put_page(page+i);
 
-            if ( hypercall_preempt_check() && preemptible )
+            if ( preemptible && pod_target != p2m->pod.count &&
+                 hypercall_preempt_check() )
             {
                 ret = -EAGAIN;
                 goto out;
xen/arch/x86/mm/shadow/common.c +3 -1
@@ -1672,7 +1672,7 @@ static unsigned int sh_set_allocation(st
     SHADOW_PRINTK("current %i target %i\n", 
                    d->arch.paging.shadow.total_pages, pages);
 
-    while ( d->arch.paging.shadow.total_pages != pages ) 
+    for ( ; ; )
     {
         if ( d->arch.paging.shadow.total_pages < pages ) 
         {
@@ -1707,6 +1707,8 @@ static unsigned int sh_set_allocation(st
             d->arch.paging.shadow.total_pages--;
             free_domheap_page(sp);
         }
+        else
+            break;
 
         /* Check to see if we need to yield and try again */
         if ( preempted && hypercall_preempt_check() )
xen/arch/x86/traps.c +7 -7
@@ -3596,13 +3596,6 @@ long do_set_trap_table(XEN_GUEST_HANDLE_
 
     for ( ; ; )
     {
-        if ( hypercall_preempt_check() )
-        {
-            rc = hypercall_create_continuation(
-                __HYPERVISOR_set_trap_table, "h", traps);
-            break;
-        }
-
         if ( copy_from_guest(&cur, traps, 1) )
         {
             rc = -EFAULT;
@@ -3623,6 +3616,13 @@ long do_set_trap_table(XEN_GUEST_HANDLE_
             init_int80_direct_trap(curr);
 
         guest_handle_add_offset(traps, 1);
+
+        if ( hypercall_preempt_check() )
+        {
+            rc = hypercall_create_continuation(
+                __HYPERVISOR_set_trap_table, "h", traps);
+            break;
+        }
     }
 
     return rc;
xen/arch/x86/x86_64/compat/traps.c +7 -7
@@ -329,13 +329,6 @@ int compat_set_trap_table(XEN_GUEST_HAND
 
     for ( ; ; )
     {
-        if ( hypercall_preempt_check() )
-        {
-            rc = hypercall_create_continuation(
-                __HYPERVISOR_set_trap_table, "h", traps);
-            break;
-        }
-
         if ( copy_from_guest(&cur, traps, 1) )
         {
             rc = -EFAULT;
@@ -353,6 +346,13 @@ int compat_set_trap_table(XEN_GUEST_HAND
             init_int80_direct_trap(current);
 
         guest_handle_add_offset(traps, 1);
+
+        if ( hypercall_preempt_check() )
+        {
+            rc = hypercall_create_continuation(
+                __HYPERVISOR_set_trap_table, "h", traps);
+            break;
+        }
     }
 
     return rc;

x86: make hypercall preemption checks consistent

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)

xen/arch/x86/mm.c +2 -2
@@ -2934,7 +2934,7 @@ long do_mmuext_op(
 
     for ( i = 0; i < count; i++ )
     {
-        if ( curr->arch.old_guest_table || hypercall_preempt_check() )
+        if ( curr->arch.old_guest_table || (i && hypercall_preempt_check()) )
         {
             rc = -EAGAIN;
             break;
@@ -3481,7 +3481,7 @@ long do_mmu_update(
 
     for ( i = 0; i < count; i++ )
     {
-        if ( curr->arch.old_guest_table || hypercall_preempt_check() )
+        if ( curr->arch.old_guest_table || (i && hypercall_preempt_check()) )
         {
             rc = -EAGAIN;
             break;
xen/arch/x86/mm/hap/hap.c +3 -1
@@ -326,7 +326,7 @@ hap_set_allocation(struct domain *d, uns
     else
         pages -= d->arch.paging.hap.p2m_pages;
 
-    while ( d->arch.paging.hap.total_pages != pages )
+    for ( ; ; )
     {
         if ( d->arch.paging.hap.total_pages < pages )
         {
@@ -355,6 +355,8 @@ hap_set_allocation(struct domain *d, uns
             d->arch.paging.hap.total_pages--;
             free_domheap_page(pg);
         }
+        else
+            break;
 
         /* Check to see if we need to yield and try again */
         if ( preempted && hypercall_preempt_check() )
xen/arch/x86/mm/p2m-pod.c +4 -2
@@ -242,7 +242,8 @@ p2m_pod_set_cache_target(struct p2m_doma
 
         p2m_pod_cache_add(p2m, page, order);
 
-        if ( hypercall_preempt_check() && preemptible )
+        if ( preemptible && pod_target != p2m->pod.count &&
+             hypercall_preempt_check() )
         {
             ret = -EAGAIN;
             goto out;
@@ -286,7 +287,8 @@ p2m_pod_set_cache_target(struct p2m_doma
 
             put_page(page+i);
 
-            if ( hypercall_preempt_check() && preemptible )
+            if ( preemptible && pod_target != p2m->pod.count &&
+                 hypercall_preempt_check() )
             {
                 ret = -EAGAIN;
                 goto out;
xen/arch/x86/mm/shadow/common.c +3 -1
@@ -1672,7 +1672,7 @@ static unsigned int sh_set_allocation(st
     SHADOW_PRINTK("current %i target %i\n", 
                    d->arch.paging.shadow.total_pages, pages);
 
-    while ( d->arch.paging.shadow.total_pages != pages ) 
+    for ( ; ; )
     {
         if ( d->arch.paging.shadow.total_pages < pages ) 
         {
@@ -1707,6 +1707,8 @@ static unsigned int sh_set_allocation(st
             d->arch.paging.shadow.total_pages--;
             free_domheap_page(sp);
         }
+        else
+            break;
 
         /* Check to see if we need to yield and try again */
         if ( preempted && hypercall_preempt_check() )
xen/arch/x86/traps.c +7 -7
@@ -3596,13 +3596,6 @@ long do_set_trap_table(XEN_GUEST_HANDLE_
 
     for ( ; ; )
     {
-        if ( hypercall_preempt_check() )
-        {
-            rc = hypercall_create_continuation(
-                __HYPERVISOR_set_trap_table, "h", traps);
-            break;
-        }
-
         if ( copy_from_guest(&cur, traps, 1) )
         {
             rc = -EFAULT;
@@ -3623,6 +3616,13 @@ long do_set_trap_table(XEN_GUEST_HANDLE_
             init_int80_direct_trap(curr);
 
         guest_handle_add_offset(traps, 1);
+
+        if ( hypercall_preempt_check() )
+        {
+            rc = hypercall_create_continuation(
+                __HYPERVISOR_set_trap_table, "h", traps);
+            break;
+        }
     }
 
     return rc;
xen/arch/x86/x86_64/compat/traps.c +7 -7
@@ -329,13 +329,6 @@ int compat_set_trap_table(XEN_GUEST_HAND
 
     for ( ; ; )
     {
-        if ( hypercall_preempt_check() )
-        {
-            rc = hypercall_create_continuation(
-                __HYPERVISOR_set_trap_table, "h", traps);
-            break;
-        }
-
         if ( copy_from_guest(&cur, traps, 1) )
         {
             rc = -EFAULT;
@@ -353,6 +346,13 @@ int compat_set_trap_table(XEN_GUEST_HAND
             init_int80_direct_trap(current);
 
         guest_handle_add_offset(traps, 1);
+
+        if ( hypercall_preempt_check() )
+        {
+            rc = hypercall_create_continuation(
+                __HYPERVISOR_set_trap_table, "h", traps);
+            break;
+        }
     }
 
     return rc;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] x86: make hypercall preemption checks consistent

Quoted 4 lines · Jan Beulich

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)

Quoted 147 lines
xen/arch/x86/mm.c +2 -2
@@ -2934,7 +2934,7 @@ long do_mmuext_op(
 
     for ( i = 0; i < count; i++ )
     {
-        if ( curr->arch.old_guest_table || hypercall_preempt_check() )
+        if ( curr->arch.old_guest_table || (i && hypercall_preempt_check()) )
         {
             rc = -EAGAIN;
             break;
@@ -3481,7 +3481,7 @@ long do_mmu_update(
 
     for ( i = 0; i < count; i++ )
     {
-        if ( curr->arch.old_guest_table || hypercall_preempt_check() )
+        if ( curr->arch.old_guest_table || (i && hypercall_preempt_check()) )
         {
             rc = -EAGAIN;
             break;
xen/arch/x86/mm/hap/hap.c +3 -1
@@ -326,7 +326,7 @@ hap_set_allocation(struct domain *d, uns
     else
         pages -= d->arch.paging.hap.p2m_pages;
 
-    while ( d->arch.paging.hap.total_pages != pages )
+    for ( ; ; )
     {
         if ( d->arch.paging.hap.total_pages < pages )
         {
@@ -355,6 +355,8 @@ hap_set_allocation(struct domain *d, uns
             d->arch.paging.hap.total_pages--;
             free_domheap_page(pg);
         }
+        else
+            break;
 
         /* Check to see if we need to yield and try again */
         if ( preempted && hypercall_preempt_check() )
xen/arch/x86/mm/p2m-pod.c +4 -2
@@ -242,7 +242,8 @@ p2m_pod_set_cache_target(struct p2m_doma
 
         p2m_pod_cache_add(p2m, page, order);
 
-        if ( hypercall_preempt_check() && preemptible )
+        if ( preemptible && pod_target != p2m->pod.count &&
+             hypercall_preempt_check() )
         {
             ret = -EAGAIN;
             goto out;
@@ -286,7 +287,8 @@ p2m_pod_set_cache_target(struct p2m_doma
 
             put_page(page+i);
 
-            if ( hypercall_preempt_check() && preemptible )
+            if ( preemptible && pod_target != p2m->pod.count &&
+                 hypercall_preempt_check() )
             {
                 ret = -EAGAIN;
                 goto out;
xen/arch/x86/mm/shadow/common.c +3 -1
@@ -1672,7 +1672,7 @@ static unsigned int sh_set_allocation(st
     SHADOW_PRINTK("current %i target %i\n", 
                    d->arch.paging.shadow.total_pages, pages);
 
-    while ( d->arch.paging.shadow.total_pages != pages ) 
+    for ( ; ; )
     {
         if ( d->arch.paging.shadow.total_pages < pages ) 
         {
@@ -1707,6 +1707,8 @@ static unsigned int sh_set_allocation(st
             d->arch.paging.shadow.total_pages--;
             free_domheap_page(sp);
         }
+        else
+            break;
 
         /* Check to see if we need to yield and try again */
         if ( preempted && hypercall_preempt_check() )
xen/arch/x86/traps.c +7 -7
@@ -3596,13 +3596,6 @@ long do_set_trap_table(XEN_GUEST_HANDLE_
 
     for ( ; ; )
     {
-        if ( hypercall_preempt_check() )
-        {
-            rc = hypercall_create_continuation(
-                __HYPERVISOR_set_trap_table, "h", traps);
-            break;
-        }
-
         if ( copy_from_guest(&cur, traps, 1) )
         {
             rc = -EFAULT;
@@ -3623,6 +3616,13 @@ long do_set_trap_table(XEN_GUEST_HANDLE_
             init_int80_direct_trap(curr);
 
         guest_handle_add_offset(traps, 1);
+
+        if ( hypercall_preempt_check() )
+        {
+            rc = hypercall_create_continuation(
+                __HYPERVISOR_set_trap_table, "h", traps);
+            break;
+        }
     }
 
     return rc;
xen/arch/x86/x86_64/compat/traps.c +7 -7
@@ -329,13 +329,6 @@ int compat_set_trap_table(XEN_GUEST_HAND
 
     for ( ; ; )
     {
-        if ( hypercall_preempt_check() )
-        {
-            rc = hypercall_create_continuation(
-                __HYPERVISOR_set_trap_table, "h", traps);
-            break;
-        }
-
         if ( copy_from_guest(&cur, traps, 1) )
         {
             rc = -EFAULT;
@@ -353,6 +346,13 @@ int compat_set_trap_table(XEN_GUEST_HAND
             init_int80_direct_trap(current);
 
         guest_handle_add_offset(traps, 1);
+
+        if ( hypercall_preempt_check() )
+        {
+            rc = hypercall_create_continuation(
+                __HYPERVISOR_set_trap_table, "h", traps);
+            break;
+        }
     }
 
     return rc;
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw
In reply to Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Jan Beulich

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)
- do cheap checks first

1: common: make hypercall preemption checks consistent 2: x86: make hypercall preemption checks consistent

And just to clarify - this time I did check ARM, and the two uses of hypercall_preempt_check() it currently has look okay.

Jan

#6 lore raw
Quoted 10 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Jan Beulich

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)
- do cheap checks first

1: common: make hypercall preemption checks consistent 2: x86: make hypercall preemption checks consistent

And just to clarify - this time I did check ARM, and the two uses of hypercall_preempt_check() it currently has look okay.

Thanks!

Ian.

#8 lore raw
In reply to Jan Beulich
Quoted 8 lines · Jan Beulich

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)
- do cheap checks first

1: common: make hypercall preemption checks consistent 2: x86: make hypercall preemption checks consistent

All in all, this is a good improvement over what is currently present.

However, given the overhead of creating continuations (particularly for 32bit HVM guests, which have been seen to unconditionally fail the preemption check by the time the compat layer has run), some of these operations would probably be better having more than a single guaranteed operation.

~Andrew

#9 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
Quoted 8 lines · Jan Beulich

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)
- do cheap checks first

1: common: make hypercall preemption checks consistent 2: x86: make hypercall preemption checks consistent

Quoted 7 lines

All in all, this is a good improvement over what is currently present.

However, given the overhead of creating continuations (particularly for 32bit HVM guests, which have been seen to unconditionally fail the preemption check by the time the compat layer has run), some of these operations would probably be better having more than a single guaranteed operation.

I agree, but I wanted to do one step at a time. Judging how much work we want to permit done between preemption points will be either heavy guess work, or require quite a bit of performance measurement...

Jan

#10 lore raw
Quoted 19 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
Quoted 8 lines · Jan Beulich

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)
- do cheap checks first

1: common: make hypercall preemption checks consistent 2: x86: make hypercall preemption checks consistent

Quoted 7 lines

All in all, this is a good improvement over what is currently present.

However, given the overhead of creating continuations (particularly for 32bit HVM guests, which have been seen to unconditionally fail the preemption check by the time the compat layer has run), some of these operations would probably be better having more than a single guaranteed operation.

Quoted 4 lines

I agree, but I wanted to do one step at a time. Judging how much work we want to permit done between preemption points will be either heavy guess work, or require quite a bit of performance measurement...

Perhaps something time-based? Record the time at start and make hypercall_preempt_check() return true if more than T time has elapsed?

David

#11 lore raw
Quoted 21 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 19 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
Quoted 8 lines · Jan Beulich

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)
- do cheap checks first

1: common: make hypercall preemption checks consistent 2: x86: make hypercall preemption checks consistent

All in all, this is a good improvement over what is currently present.

However, given the overhead of creating continuations (particularly for 32bit HVM guests, which have been seen to unconditionally fail the preemption check by the time the compat layer has run), some of these operations would probably be better having more than a single guaranteed operation.

Quoted 7 lines
Quoted 4 lines

I agree, but I wanted to do one step at a time. Judging how much work we want to permit done between preemption points will be either heavy guess work, or require quite a bit of performance measurement...

Perhaps something time-based? Record the time at start and make hypercall_preempt_check() return true if more than T time has elapsed?

That's certainly an interesting idea. But it doesn't remove the need to determine the actual value of the parameter to use (T in this case).

Jan

#12 lore raw
Quoted 26 lines · Jan Beulich
Quoted 26 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 23 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
Quoted 8 lines · Jan Beulich

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)
- do cheap checks first

1: common: make hypercall preemption checks consistent 2: x86: make hypercall preemption checks consistent

Quoted 7 lines

All in all, this is a good improvement over what is currently present.

However, given the overhead of creating continuations (particularly for 32bit HVM guests, which have been seen to unconditionally fail the preemption check by the time the compat layer has run), some of these operations would probably be better having more than a single guaranteed operation.

I agree, but I wanted to do one step at a time. Judging how much work we want to permit done between preemption points will be either heavy guess work, or require quite a bit of performance measurement...

Quoted 5 lines
Quoted 2 lines

Perhaps something time-based? Record the time at start and make hypercall_preempt_check() return true if more than T time has elapsed?

That's certainly an interesting idea. But it doesn't remove the need to determine the actual value of the parameter to use (T in this case).

Sure, but it should be just one parameter for all hypercalls instead of having to consider each one separately.

David

#13 lore raw

Ping: [PATCH 0/2] make hypercall preemption checks consistent

In reply to Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · Jan Beulich

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)
- do cheap checks first

1: common: make hypercall preemption checks consistent 2: x86: make hypercall preemption checks consistent

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on the v1 series
#14 lore raw
In reply to Jan Beulich
Quoted 7 lines

Jan Beulich <mailto:[email protected]>
4 March 2014 11:21
- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)
- do cheap checks first

Quoted 5 lines

1: common: make hypercall preemption checks consistent 2: x86: make hypercall preemption checks consistent

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel