linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: selftests: fix bit test in is_steal_time_supported()
@ 2022-07-19  9:54 Dan Carpenter
  2022-07-19 12:59 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-07-19  9:54 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson
  Cc: Shuah Khan, kvm, linux-kselftest, kernel-janitors

The KVM_FEATURE_STEAL_TIME (5) define is the BIT() value so we need to
do shift for this to work correctly.

Fixes: 998016048221 ("KVM: selftests: Convert steal_time away from VCPU_ID")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 tools/testing/selftests/kvm/steal_time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c
index d122f1e05cdd..b89f0cfa2dc3 100644
--- a/tools/testing/selftests/kvm/steal_time.c
+++ b/tools/testing/selftests/kvm/steal_time.c
@@ -62,7 +62,7 @@ static bool is_steal_time_supported(struct kvm_vcpu *vcpu)
 {
 	struct kvm_cpuid_entry2 *cpuid = kvm_get_supported_cpuid_entry(KVM_CPUID_FEATURES);
 
-	return cpuid && (cpuid->eax & KVM_FEATURE_STEAL_TIME);
+	return cpuid && (cpuid->eax & (1 << KVM_FEATURE_STEAL_TIME));
 }
 
 static void steal_time_init(struct kvm_vcpu *vcpu, uint32_t i)
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: selftests: fix bit test in is_steal_time_supported()
  2022-07-19  9:54 [PATCH] KVM: selftests: fix bit test in is_steal_time_supported() Dan Carpenter
@ 2022-07-19 12:59 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2022-07-19 12:59 UTC (permalink / raw)
  To: Dan Carpenter, Sean Christopherson
  Cc: Shuah Khan, kvm, linux-kselftest, kernel-janitors

On 7/19/22 11:54, Dan Carpenter wrote:
> The KVM_FEATURE_STEAL_TIME (5) define is the BIT() value so we need to
> do shift for this to work correctly.
> 
> Fixes: 998016048221 ("KVM: selftests: Convert steal_time away from VCPU_ID")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   tools/testing/selftests/kvm/steal_time.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c
> index d122f1e05cdd..b89f0cfa2dc3 100644
> --- a/tools/testing/selftests/kvm/steal_time.c
> +++ b/tools/testing/selftests/kvm/steal_time.c
> @@ -62,7 +62,7 @@ static bool is_steal_time_supported(struct kvm_vcpu *vcpu)
>   {
>   	struct kvm_cpuid_entry2 *cpuid = kvm_get_supported_cpuid_entry(KVM_CPUID_FEATURES);
>   
> -	return cpuid && (cpuid->eax & KVM_FEATURE_STEAL_TIME);
> +	return cpuid && (cpuid->eax & (1 << KVM_FEATURE_STEAL_TIME));
>   }
>   
>   static void steal_time_init(struct kvm_vcpu *vcpu, uint32_t i)

This is already fixed in kvm/queue, but also actually the Fixes tag 
would have to date back to commit 94c4b76b88d4 ("KVM: selftests: 
Introduce steal-time test", 2020-03-16).

Paolo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-19 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19  9:54 [PATCH] KVM: selftests: fix bit test in is_steal_time_supported() Dan Carpenter
2022-07-19 12:59 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).