diff options
| author | Gleb Natapov <gleb@redhat.com> | 2011-05-04 09:31:04 -0400 |
|---|---|---|
| committer | Avi Kivity <avi@redhat.com> | 2011-05-22 08:48:09 -0400 |
| commit | 8fa2206821953a50a3a02ea33fcfb3ced2fd9997 (patch) | |
| tree | f4f773a0501f0fd8d3bfe30dd4851c9f0095911d /include | |
| parent | e3aa52d665ec1a962d1cf025a2e5ee84b3b33406 (diff) | |
KVM: make guest mode entry to be rcu quiescent state
KVM does not hold any references to rcu protected data when it switches
CPU into a guest mode. In fact switching to a guest mode is very similar
to exiting to userspase from rcu point of view. In addition CPU may stay
in a guest mode for quite a long time (up to one time slice). Lets treat
guest mode as quiescent state, just like we do with user-mode execution.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/kvm_host.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 0bc3d372e3cb..b9c3299c6a55 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
| @@ -591,8 +591,17 @@ static inline int kvm_deassign_device(struct kvm *kvm, | |||
| 591 | 591 | ||
| 592 | static inline void kvm_guest_enter(void) | 592 | static inline void kvm_guest_enter(void) |
| 593 | { | 593 | { |
| 594 | BUG_ON(preemptible()); | ||
| 594 | account_system_vtime(current); | 595 | account_system_vtime(current); |
| 595 | current->flags |= PF_VCPU; | 596 | current->flags |= PF_VCPU; |
| 597 | /* KVM does not hold any references to rcu protected data when it | ||
| 598 | * switches CPU into a guest mode. In fact switching to a guest mode | ||
| 599 | * is very similar to exiting to userspase from rcu point of view. In | ||
| 600 | * addition CPU may stay in a guest mode for quite a long time (up to | ||
| 601 | * one time slice). Lets treat guest mode as quiescent state, just like | ||
| 602 | * we do with user-mode execution. | ||
| 603 | */ | ||
| 604 | rcu_virt_note_context_switch(smp_processor_id()); | ||
| 596 | } | 605 | } |
| 597 | 606 | ||
| 598 | static inline void kvm_guest_exit(void) | 607 | static inline void kvm_guest_exit(void) |
