diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-06-15 09:09:28 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-06-28 08:15:25 -0400 |
commit | ebaac1736245e78109cd47d453a86a18dcfc94b8 (patch) | |
tree | a3c5e049e0ee9345316f538ccc1acc19b0edbfe1 /include/linux/kvm_host.h | |
parent | fb6cec1492d6a693d33224487061e92d0275c6e2 (diff) |
context_tracking: move rcu_virt_note_context_switch out of kvm_host.h
Make kvm_guest_{enter,exit} and __kvm_guest_{enter,exit} trivial wrappers
around the code in context_tracking.h. Name the context_tracking.h functions
consistently with what those for kernel<->user switch.
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r-- | include/linux/kvm_host.h | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 0640ee92b978..ffff40522688 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -878,40 +878,23 @@ static inline void kvm_iommu_unmap_pages(struct kvm *kvm, | |||
878 | /* must be called with irqs disabled */ | 878 | /* must be called with irqs disabled */ |
879 | static inline void __kvm_guest_enter(void) | 879 | static inline void __kvm_guest_enter(void) |
880 | { | 880 | { |
881 | guest_enter(); | 881 | guest_enter_irqoff(); |
882 | /* KVM does not hold any references to rcu protected data when it | ||
883 | * switches CPU into a guest mode. In fact switching to a guest mode | ||
884 | * is very similar to exiting to userspace from rcu point of view. In | ||
885 | * addition CPU may stay in a guest mode for quite a long time (up to | ||
886 | * one time slice). Lets treat guest mode as quiescent state, just like | ||
887 | * we do with user-mode execution. | ||
888 | */ | ||
889 | if (!context_tracking_cpu_is_enabled()) | ||
890 | rcu_virt_note_context_switch(smp_processor_id()); | ||
891 | } | 882 | } |
892 | 883 | ||
893 | /* must be called with irqs disabled */ | 884 | /* must be called with irqs disabled */ |
894 | static inline void __kvm_guest_exit(void) | 885 | static inline void __kvm_guest_exit(void) |
895 | { | 886 | { |
896 | guest_exit(); | 887 | guest_exit_irqoff(); |
897 | } | 888 | } |
898 | 889 | ||
899 | static inline void kvm_guest_enter(void) | 890 | static inline void kvm_guest_enter(void) |
900 | { | 891 | { |
901 | unsigned long flags; | 892 | guest_enter(); |
902 | |||
903 | local_irq_save(flags); | ||
904 | __kvm_guest_enter(); | ||
905 | local_irq_restore(flags); | ||
906 | } | 893 | } |
907 | 894 | ||
908 | static inline void kvm_guest_exit(void) | 895 | static inline void kvm_guest_exit(void) |
909 | { | 896 | { |
910 | unsigned long flags; | 897 | guest_exit(); |
911 | |||
912 | local_irq_save(flags); | ||
913 | __kvm_guest_exit(); | ||
914 | local_irq_restore(flags); | ||
915 | } | 898 | } |
916 | 899 | ||
917 | /* | 900 | /* |