[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.2] x86: make hypercall preemption checks consistent
commit 839b603e672c06481e38db2d3bb6c0eb67a23570 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Wed Apr 9 11:30:12 2014 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Apr 9 11:30:12 2014 +0200 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@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Tim Deegan <tim@xxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> master commit: fd7bfce0395ace266159760e35dc49f7af3b90ce master date: 2014-03-13 14:27:51 +0100 --- xen/arch/x86/mm.c | 4 ++-- xen/arch/x86/mm/hap/hap.c | 4 +++- xen/arch/x86/mm/p2m-pod.c | 6 ++++-- xen/arch/x86/mm/shadow/common.c | 4 +++- xen/arch/x86/traps.c | 14 +++++++------- xen/arch/x86/x86_64/compat/traps.c | 14 +++++++------- 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 01f3002..9ec617b 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -3199,7 +3199,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; @@ -3767,7 +3767,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; diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c index 30cc10e..b150fc7 100644 --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -362,7 +362,7 @@ hap_set_allocation(struct domain *d, unsigned int pages, int *preempted) 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 ) { @@ -391,6 +391,8 @@ hap_set_allocation(struct domain *d, unsigned int pages, int *preempted) 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() ) diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index cdbd8d2..3d3e989 100644 --- 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_domain *p2m, unsigned long pod_target, int p 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_domain *p2m, unsigned long pod_target, int p put_page(page+i); - if ( hypercall_preempt_check() && preemptible ) + if ( preemptible && pod_target != p2m->pod.count && + hypercall_preempt_check() ) { ret = -EAGAIN; goto out; diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index ef06a03..1805018 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -1735,7 +1735,7 @@ static unsigned int sh_set_allocation(struct domain *d, 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 ) { @@ -1770,6 +1770,8 @@ static unsigned int sh_set_allocation(struct domain *d, 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() ) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index fd8bd8c..3d395a6 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -3756,13 +3756,6 @@ long do_set_trap_table(XEN_GUEST_HANDLE(const_trap_info_t) traps) 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; @@ -3783,6 +3776,13 @@ long do_set_trap_table(XEN_GUEST_HANDLE(const_trap_info_t) traps) 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; diff --git a/xen/arch/x86/x86_64/compat/traps.c b/xen/arch/x86/x86_64/compat/traps.c index 6e0ff11..25f4d70 100644 --- a/xen/arch/x86/x86_64/compat/traps.c +++ b/xen/arch/x86/x86_64/compat/traps.c @@ -324,13 +324,6 @@ int compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) traps) 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; @@ -348,6 +341,13 @@ int compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) traps) 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; -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.2 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |