From: Gleb Natapov Date: Wed, 4 May 2011 13:31:04 +0000 (+0300) Subject: KVM: make guest mode entry to be rcu quiescent state X-Git-Tag: v3.0-rc1~350^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8fa2206821953a50a3a02ea33fcfb3ced2fd9997;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git 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 Signed-off-by: Avi Kivity --- diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 0bc3d37..b9c3299 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, static inline void kvm_guest_enter(void) { + BUG_ON(preemptible()); account_system_vtime(current); current->flags |= PF_VCPU; + /* 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. + */ + rcu_virt_note_context_switch(smp_processor_id()); } static inline void kvm_guest_exit(void)