From: Wei Liu Date: Mon, 14 Aug 2017 15:46:28 +0000 (+0100) Subject: xen: lift hypercall_cancel_continuation to sched.h X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~1684 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5b7c2a25d0e9ebb882e7383fb8d09f3e9b6784e4;p=xen.git xen: lift hypercall_cancel_continuation to sched.h The function is the same on both x86 and arm. Lift it to sched.h to save a function call, make it take a pointer to vcpu to avoid resolving current every time it gets called. Take the chance to change one of its callers to only use one current in code. Signed-off-by: Wei Liu Acked-by: Julien Grall Reviewed-by: Jan Beulich --- diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 2dc8b0ab5a..eeebbdb39a 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -365,11 +365,6 @@ void sync_vcpu_execstate(struct vcpu *v) __arg; \ }) -void hypercall_cancel_continuation(void) -{ - current->hcall_preempted = false; -} - unsigned long hypercall_create_continuation( unsigned int op, const char *format, ...) { diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c index e30181817a..90e88c1d2c 100644 --- a/xen/arch/x86/hypercall.c +++ b/xen/arch/x86/hypercall.c @@ -86,11 +86,6 @@ const hypercall_args_t hypercall_args_table[NR_hypercalls] = __arg; \ }) -void hypercall_cancel_continuation(void) -{ - current->hcall_preempted = false; -} - unsigned long hypercall_create_continuation( unsigned int op, const char *format, ...) { diff --git a/xen/arch/x86/x86_64/compat/mm.c b/xen/arch/x86/x86_64/compat/mm.c index b737af1888..ef0ff86519 100644 --- a/xen/arch/x86/x86_64/compat/mm.c +++ b/xen/arch/x86/x86_64/compat/mm.c @@ -124,7 +124,7 @@ int compat_arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) if ( __copy_to_guest(arg, &cmp, 1) ) { if ( rc == __HYPERVISOR_memory_op ) - hypercall_cancel_continuation(); + hypercall_cancel_continuation(current); rc = -EFAULT; } diff --git a/xen/common/multicall.c b/xen/common/multicall.c index 7cbf857048..c7af4e0156 100644 --- a/xen/common/multicall.c +++ b/xen/common/multicall.c @@ -36,7 +36,8 @@ ret_t do_multicall( XEN_GUEST_HANDLE_PARAM(multicall_entry_t) call_list, uint32_t nr_calls) { - struct mc_state *mcs = ¤t->mc_state; + struct vcpu *curr = current; + struct mc_state *mcs = &curr->mc_state; uint32_t i; int rc = 0; enum mc_disposition disp = mc_continue; @@ -86,7 +87,7 @@ do_multicall( else if ( unlikely(__copy_field_to_guest(call_list, &mcs->call, result)) ) rc = -EFAULT; - else if ( current->hcall_preempted ) + else if ( curr->hcall_preempted ) { /* Translate sub-call continuation to guest layout */ xlat_multicall_entry(mcs); @@ -95,7 +96,7 @@ do_multicall( if ( likely(!__copy_to_guest(call_list, &mcs->call, 1)) ) goto preempted; else - hypercall_cancel_continuation(); + hypercall_cancel_continuation(curr); rc = -EFAULT; } else diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 8690f29ac3..5828a0123c 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -706,7 +706,11 @@ extern void (*dead_idle) (void); */ unsigned long hypercall_create_continuation( unsigned int op, const char *format, ...); -void hypercall_cancel_continuation(void); + +static inline void hypercall_cancel_continuation(struct vcpu *v) +{ + v->hcall_preempted = false; +} /* * For long-running operations that must be in hypercall context, check