linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: clean up the unused argument
@ 2021-03-13  5:10 lihaiwei.kernel
  2021-03-15  4:40 ` Keqian Zhu
  2021-03-26 17:13 ` Paolo Bonzini
  0 siblings, 2 replies; 4+ messages in thread
From: lihaiwei.kernel @ 2021-03-13  5:10 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: pbonzini, seanjc, vkuznets, wanpengli, jmattson, joro, Haiwei Li

From: Haiwei Li <lihaiwei@tencent.com>

kvm_msr_ignored_check function never uses vcpu argument. Clean up the
function and invokers.

Signed-off-by: Haiwei Li <lihaiwei@tencent.com>
---
 arch/x86/kvm/x86.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 012d5df..27e9ee8 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -271,8 +271,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
  * When called, it means the previous get/set msr reached an invalid msr.
  * Return true if we want to ignore/silent this failed msr access.
  */
-static bool kvm_msr_ignored_check(struct kvm_vcpu *vcpu, u32 msr,
-				  u64 data, bool write)
+static bool kvm_msr_ignored_check(u32 msr, u64 data, bool write)
 {
 	const char *op = write ? "wrmsr" : "rdmsr";
 
@@ -1447,7 +1446,7 @@ static int do_get_msr_feature(struct kvm_vcpu *vcpu, unsigned index, u64 *data)
 	if (r == KVM_MSR_RET_INVALID) {
 		/* Unconditionally clear the output for simplicity */
 		*data = 0;
-		if (kvm_msr_ignored_check(vcpu, index, 0, false))
+		if (kvm_msr_ignored_check(index, 0, false))
 			r = 0;
 	}
 
@@ -1613,7 +1612,7 @@ static int kvm_set_msr_ignored_check(struct kvm_vcpu *vcpu,
 	int ret = __kvm_set_msr(vcpu, index, data, host_initiated);
 
 	if (ret == KVM_MSR_RET_INVALID)
-		if (kvm_msr_ignored_check(vcpu, index, data, true))
+		if (kvm_msr_ignored_check(index, data, true))
 			ret = 0;
 
 	return ret;
@@ -1651,7 +1650,7 @@ static int kvm_get_msr_ignored_check(struct kvm_vcpu *vcpu,
 	if (ret == KVM_MSR_RET_INVALID) {
 		/* Unconditionally clear *data for simplicity */
 		*data = 0;
-		if (kvm_msr_ignored_check(vcpu, index, 0, false))
+		if (kvm_msr_ignored_check(index, 0, false))
 			ret = 0;
 	}
 
-- 
1.8.3.1


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

* Re: [PATCH] KVM: clean up the unused argument
  2021-03-13  5:10 [PATCH] KVM: clean up the unused argument lihaiwei.kernel
@ 2021-03-15  4:40 ` Keqian Zhu
  2021-03-25 13:17   ` Haiwei Li
  2021-03-26 17:13 ` Paolo Bonzini
  1 sibling, 1 reply; 4+ messages in thread
From: Keqian Zhu @ 2021-03-15  4:40 UTC (permalink / raw)
  To: lihaiwei.kernel, linux-kernel, kvm
  Cc: pbonzini, seanjc, vkuznets, wanpengli, jmattson, joro, Haiwei Li


This looks OK. The use of vcpu argument is removed in commit d383b3146d80 (KVM: x86: Fix NULL dereference at kvm_msr_ignored_check())

Reviewed-by: Keqian Zhu <zhukeqian1@huawei.com>

On 2021/3/13 13:10, lihaiwei.kernel@gmail.com wrote:
> From: Haiwei Li <lihaiwei@tencent.com>
> 
> kvm_msr_ignored_check function never uses vcpu argument. Clean up the
> function and invokers.
> 
> Signed-off-by: Haiwei Li <lihaiwei@tencent.com>
> ---
>  arch/x86/kvm/x86.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 012d5df..27e9ee8 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -271,8 +271,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
>   * When called, it means the previous get/set msr reached an invalid msr.
>   * Return true if we want to ignore/silent this failed msr access.
>   */
> -static bool kvm_msr_ignored_check(struct kvm_vcpu *vcpu, u32 msr,
> -				  u64 data, bool write)
> +static bool kvm_msr_ignored_check(u32 msr, u64 data, bool write)
>  {
>  	const char *op = write ? "wrmsr" : "rdmsr";
>  
> @@ -1447,7 +1446,7 @@ static int do_get_msr_feature(struct kvm_vcpu *vcpu, unsigned index, u64 *data)
>  	if (r == KVM_MSR_RET_INVALID) {
>  		/* Unconditionally clear the output for simplicity */
>  		*data = 0;
> -		if (kvm_msr_ignored_check(vcpu, index, 0, false))
> +		if (kvm_msr_ignored_check(index, 0, false))
>  			r = 0;
>  	}
>  
> @@ -1613,7 +1612,7 @@ static int kvm_set_msr_ignored_check(struct kvm_vcpu *vcpu,
>  	int ret = __kvm_set_msr(vcpu, index, data, host_initiated);
>  
>  	if (ret == KVM_MSR_RET_INVALID)
> -		if (kvm_msr_ignored_check(vcpu, index, data, true))
> +		if (kvm_msr_ignored_check(index, data, true))
>  			ret = 0;
>  
>  	return ret;
> @@ -1651,7 +1650,7 @@ static int kvm_get_msr_ignored_check(struct kvm_vcpu *vcpu,
>  	if (ret == KVM_MSR_RET_INVALID) {
>  		/* Unconditionally clear *data for simplicity */
>  		*data = 0;
> -		if (kvm_msr_ignored_check(vcpu, index, 0, false))
> +		if (kvm_msr_ignored_check(index, 0, false))
>  			ret = 0;
>  	}
>  
> 

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

* Re: [PATCH] KVM: clean up the unused argument
  2021-03-15  4:40 ` Keqian Zhu
@ 2021-03-25 13:17   ` Haiwei Li
  0 siblings, 0 replies; 4+ messages in thread
From: Haiwei Li @ 2021-03-25 13:17 UTC (permalink / raw)
  To: Keqian Zhu
  Cc: LKML, kvm list, Paolo Bonzini, Sean Christopherson,
	Vitaly Kuznetsov, Wanpeng Li, Jim Mattson, Joerg Roedel,
	Haiwei Li

Kindly ping. :)

On Mon, Mar 15, 2021 at 12:40 PM Keqian Zhu <zhukeqian1@huawei.com> wrote:
>
>
> This looks OK. The use of vcpu argument is removed in commit d383b3146d80 (KVM: x86: Fix NULL dereference at kvm_msr_ignored_check())
>
> Reviewed-by: Keqian Zhu <zhukeqian1@huawei.com>
>
> On 2021/3/13 13:10, lihaiwei.kernel@gmail.com wrote:
> > From: Haiwei Li <lihaiwei@tencent.com>
> >
> > kvm_msr_ignored_check function never uses vcpu argument. Clean up the
> > function and invokers.
> >
> > Signed-off-by: Haiwei Li <lihaiwei@tencent.com>
> > ---
> >  arch/x86/kvm/x86.c | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index 012d5df..27e9ee8 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -271,8 +271,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
> >   * When called, it means the previous get/set msr reached an invalid msr.
> >   * Return true if we want to ignore/silent this failed msr access.
> >   */
> > -static bool kvm_msr_ignored_check(struct kvm_vcpu *vcpu, u32 msr,
> > -                               u64 data, bool write)
> > +static bool kvm_msr_ignored_check(u32 msr, u64 data, bool write)
> >  {
> >       const char *op = write ? "wrmsr" : "rdmsr";
> >
> > @@ -1447,7 +1446,7 @@ static int do_get_msr_feature(struct kvm_vcpu *vcpu, unsigned index, u64 *data)
> >       if (r == KVM_MSR_RET_INVALID) {
> >               /* Unconditionally clear the output for simplicity */
> >               *data = 0;
> > -             if (kvm_msr_ignored_check(vcpu, index, 0, false))
> > +             if (kvm_msr_ignored_check(index, 0, false))
> >                       r = 0;
> >       }
> >
> > @@ -1613,7 +1612,7 @@ static int kvm_set_msr_ignored_check(struct kvm_vcpu *vcpu,
> >       int ret = __kvm_set_msr(vcpu, index, data, host_initiated);
> >
> >       if (ret == KVM_MSR_RET_INVALID)
> > -             if (kvm_msr_ignored_check(vcpu, index, data, true))
> > +             if (kvm_msr_ignored_check(index, data, true))
> >                       ret = 0;
> >
> >       return ret;
> > @@ -1651,7 +1650,7 @@ static int kvm_get_msr_ignored_check(struct kvm_vcpu *vcpu,
> >       if (ret == KVM_MSR_RET_INVALID) {
> >               /* Unconditionally clear *data for simplicity */
> >               *data = 0;
> > -             if (kvm_msr_ignored_check(vcpu, index, 0, false))
> > +             if (kvm_msr_ignored_check(index, 0, false))
> >                       ret = 0;
> >       }
> >
> >

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

* Re: [PATCH] KVM: clean up the unused argument
  2021-03-13  5:10 [PATCH] KVM: clean up the unused argument lihaiwei.kernel
  2021-03-15  4:40 ` Keqian Zhu
@ 2021-03-26 17:13 ` Paolo Bonzini
  1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2021-03-26 17:13 UTC (permalink / raw)
  To: lihaiwei.kernel, linux-kernel, kvm
  Cc: seanjc, vkuznets, wanpengli, jmattson, joro, Haiwei Li

On 13/03/21 06:10, lihaiwei.kernel@gmail.com wrote:
> From: Haiwei Li <lihaiwei@tencent.com>
> 
> kvm_msr_ignored_check function never uses vcpu argument. Clean up the
> function and invokers.
> 
> Signed-off-by: Haiwei Li <lihaiwei@tencent.com>
> ---
>   arch/x86/kvm/x86.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)

Queued, thanks.

Paolo

> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 012d5df..27e9ee8 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -271,8 +271,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
>    * When called, it means the previous get/set msr reached an invalid msr.
>    * Return true if we want to ignore/silent this failed msr access.
>    */
> -static bool kvm_msr_ignored_check(struct kvm_vcpu *vcpu, u32 msr,
> -				  u64 data, bool write)
> +static bool kvm_msr_ignored_check(u32 msr, u64 data, bool write)
>   {
>   	const char *op = write ? "wrmsr" : "rdmsr";
>   
> @@ -1447,7 +1446,7 @@ static int do_get_msr_feature(struct kvm_vcpu *vcpu, unsigned index, u64 *data)
>   	if (r == KVM_MSR_RET_INVALID) {
>   		/* Unconditionally clear the output for simplicity */
>   		*data = 0;
> -		if (kvm_msr_ignored_check(vcpu, index, 0, false))
> +		if (kvm_msr_ignored_check(index, 0, false))
>   			r = 0;
>   	}
>   
> @@ -1613,7 +1612,7 @@ static int kvm_set_msr_ignored_check(struct kvm_vcpu *vcpu,
>   	int ret = __kvm_set_msr(vcpu, index, data, host_initiated);
>   
>   	if (ret == KVM_MSR_RET_INVALID)
> -		if (kvm_msr_ignored_check(vcpu, index, data, true))
> +		if (kvm_msr_ignored_check(index, data, true))
>   			ret = 0;
>   
>   	return ret;
> @@ -1651,7 +1650,7 @@ static int kvm_get_msr_ignored_check(struct kvm_vcpu *vcpu,
>   	if (ret == KVM_MSR_RET_INVALID) {
>   		/* Unconditionally clear *data for simplicity */
>   		*data = 0;
> -		if (kvm_msr_ignored_check(vcpu, index, 0, false))
> +		if (kvm_msr_ignored_check(index, 0, false))
>   			ret = 0;
>   	}
>   
> 


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

end of thread, other threads:[~2021-03-26 17:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-13  5:10 [PATCH] KVM: clean up the unused argument lihaiwei.kernel
2021-03-15  4:40 ` Keqian Zhu
2021-03-25 13:17   ` Haiwei Li
2021-03-26 17:13 ` 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).