314583a822
5321b20b-common-make-hypercall-preemption-checks-consistent.patch 5321b257-x86-make-hypercall-preemption-checks-consistent.patch 53271880-VT-d-fix-RMRR-handling.patch 5327190a-x86-Intel-work-around-Xeon-7400-series-erratum-AAI65.patch - Dropped the following as now part of 5321b257 5310bac3-mm-ensure-useful-progress-in-decrease_reservation.patch - bnc#867910 - VUL-0: EMBARGOED: xen: XSA-89: HVMOP_set_mem_access is not preemptible xsa89.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=306
157 lines
4.8 KiB
Diff
157 lines
4.8 KiB
Diff
# Commit fd7bfce0395ace266159760e35dc49f7af3b90ce
|
|
# Date 2014-03-13 14:27:51 +0100
|
|
# Author Jan Beulich <jbeulich@suse.com>
|
|
# Committer Jan Beulich <jbeulich@suse.com>
|
|
x86: make hypercall preemption checks consistent
|
|
|
|
- never preempt on the first iteration (ensure forward progress)
|
|
- never preempt on the last iteration (pointless/wasteful)
|
|
|
|
Signed-off-by: Jan Beulich <jbeulich@suse.com>
|
|
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
|
|
Reviewed-by: Tim Deegan <tim@xen.org>
|
|
Acked-by: Keir Fraser <keir@xen.org>
|
|
|
|
--- a/xen/arch/x86/mm.c
|
|
+++ b/xen/arch/x86/mm.c
|
|
@@ -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;
|
|
--- a/xen/arch/x86/mm/hap/hap.c
|
|
+++ b/xen/arch/x86/mm/hap/hap.c
|
|
@@ -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() )
|
|
--- a/xen/arch/x86/mm/p2m-pod.c
|
|
+++ b/xen/arch/x86/mm/p2m-pod.c
|
|
@@ -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;
|
|
--- a/xen/arch/x86/mm/shadow/common.c
|
|
+++ b/xen/arch/x86/mm/shadow/common.c
|
|
@@ -1674,7 +1674,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 )
|
|
{
|
|
@@ -1709,6 +1709,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() )
|
|
--- a/xen/arch/x86/traps.c
|
|
+++ b/xen/arch/x86/traps.c
|
|
@@ -3595,13 +3595,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;
|
|
@@ -3622,6 +3615,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;
|
|
--- a/xen/arch/x86/x86_64/compat/traps.c
|
|
+++ b/xen/arch/x86/x86_64/compat/traps.c
|
|
@@ -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;
|