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

[Xen-changelog] [xen master] x86/pv: Avoid locked bit manipulation in register_guest_callback()



commit ad43ce53ad2dab6673e750f8793560e6e460ae28
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Mar 14 15:20:05 2018 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Jul 17 10:12:40 2018 +0100

    x86/pv: Avoid locked bit manipulation in register_guest_callback()
    
    Changes to arch.vgc_flags are made to current in syncrhonous context only, 
and
    don't need to be locked.  (The only other changes are via
    arch_set_info_guest(), which operates on descheduled vcpus only).
    
    Replace the {set,clear}_bit() calls with compiler-visible bitwise 
operations.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/pv/callback.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c
index 2550a726d2..394726a197 100644
--- a/xen/arch/x86/pv/callback.c
+++ b/xen/arch/x86/pv/callback.c
@@ -82,21 +82,17 @@ static long register_guest_callback(struct 
callback_register *reg)
     case CALLBACKTYPE_failsafe:
         curr->arch.pv_vcpu.failsafe_callback_eip = reg->address;
         if ( reg->flags & CALLBACKF_mask_events )
-            set_bit(_VGCF_failsafe_disables_events,
-                    &curr->arch.vgc_flags);
+            curr->arch.vgc_flags |= VGCF_failsafe_disables_events;
         else
-            clear_bit(_VGCF_failsafe_disables_events,
-                      &curr->arch.vgc_flags);
+            curr->arch.vgc_flags &= ~VGCF_failsafe_disables_events;
         break;
 
     case CALLBACKTYPE_syscall:
         curr->arch.pv_vcpu.syscall_callback_eip  = reg->address;
         if ( reg->flags & CALLBACKF_mask_events )
-            set_bit(_VGCF_syscall_disables_events,
-                    &curr->arch.vgc_flags);
+            curr->arch.vgc_flags |= VGCF_syscall_disables_events;
         else
-            clear_bit(_VGCF_syscall_disables_events,
-                      &curr->arch.vgc_flags);
+            curr->arch.vgc_flags &= ~VGCF_syscall_disables_events;
         break;
 
     case CALLBACKTYPE_syscall32:
@@ -230,11 +226,9 @@ static long compat_register_guest_callback(struct 
compat_callback_register *reg)
         curr->arch.pv_vcpu.failsafe_callback_cs  = reg->address.cs;
         curr->arch.pv_vcpu.failsafe_callback_eip = reg->address.eip;
         if ( reg->flags & CALLBACKF_mask_events )
-            set_bit(_VGCF_failsafe_disables_events,
-                    &curr->arch.vgc_flags);
+            curr->arch.vgc_flags |= VGCF_failsafe_disables_events;
         else
-            clear_bit(_VGCF_failsafe_disables_events,
-                      &curr->arch.vgc_flags);
+            curr->arch.vgc_flags &= ~VGCF_failsafe_disables_events;
         break;
 
     case CALLBACKTYPE_syscall32:
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
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®.