diff options
author | Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> | 2012-07-18 09:37:46 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-07-23 06:01:52 -0400 |
commit | 4c088493c8d07e4e27bad53a99dcfdc14cdf45f8 (patch) | |
tree | b90cfa07e207bb938b6997ae62c774c0624b0dd6 /include/linux/kvm_host.h | |
parent | f2a743473194a1ad44a85f8b63aeef9d63e5bf47 (diff) |
KVM: Note down when cpu relax intercepted or pause loop exited
Noting pause loop exited vcpu or cpu relax intercepted helps in
filtering right candidate to yield. Wrong selection of vcpu;
i.e., a vcpu that just did a pl-exit or cpu relax intercepted may
contribute to performance degradation.
Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> # on s390x
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r-- | include/linux/kvm_host.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index db9aa917840a..361b36fe7ecc 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -183,6 +183,18 @@ struct kvm_vcpu { | |||
183 | } async_pf; | 183 | } async_pf; |
184 | #endif | 184 | #endif |
185 | 185 | ||
186 | #ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT | ||
187 | /* | ||
188 | * Cpu relax intercept or pause loop exit optimization | ||
189 | * in_spin_loop: set when a vcpu does a pause loop exit | ||
190 | * or cpu relax intercepted. | ||
191 | * dy_eligible: indicates whether vcpu is eligible for directed yield. | ||
192 | */ | ||
193 | struct { | ||
194 | bool in_spin_loop; | ||
195 | bool dy_eligible; | ||
196 | } spin_loop; | ||
197 | #endif | ||
186 | struct kvm_vcpu_arch arch; | 198 | struct kvm_vcpu_arch arch; |
187 | }; | 199 | }; |
188 | 200 | ||
@@ -898,5 +910,27 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) | |||
898 | } | 910 | } |
899 | } | 911 | } |
900 | 912 | ||
913 | #ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT | ||
914 | |||
915 | static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val) | ||
916 | { | ||
917 | vcpu->spin_loop.in_spin_loop = val; | ||
918 | } | ||
919 | static inline void kvm_vcpu_set_dy_eligible(struct kvm_vcpu *vcpu, bool val) | ||
920 | { | ||
921 | vcpu->spin_loop.dy_eligible = val; | ||
922 | } | ||
923 | |||
924 | #else /* !CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */ | ||
925 | |||
926 | static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val) | ||
927 | { | ||
928 | } | ||
929 | |||
930 | static inline void kvm_vcpu_set_dy_eligible(struct kvm_vcpu *vcpu, bool val) | ||
931 | { | ||
932 | } | ||
933 | |||
934 | #endif /* CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */ | ||
901 | #endif | 935 | #endif |
902 | 936 | ||