[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xen: lift hypercall_cancel_continuation to sched.h



commit 5b7c2a25d0e9ebb882e7383fb8d09f3e9b6784e4
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Mon Aug 14 16:46:28 2017 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Aug 15 15:49:26 2017 +0100

    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 <wei.liu2@xxxxxxxxxx>
    Acked-by: Julien Grall <julien.grall@xxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/arm/domain.c           | 5 -----
 xen/arch/x86/hypercall.c        | 5 -----
 xen/arch/x86/x86_64/compat/mm.c | 2 +-
 xen/common/multicall.c          | 7 ++++---
 xen/include/xen/sched.h         | 6 +++++-
 5 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 2dc8b0a..eeebbdb 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 e301818..90e88c1 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 b737af1..ef0ff86 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 7cbf857..c7af4e0 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 = &current->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 8690f29..5828a01 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
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.