diff mbox series

KVM: PPC: Book3S HV: Fix vcore_blocked tracepoint

Message ID 20220328215831.320409-1-farosas@linux.ibm.com
State New
Headers show
Series KVM: PPC: Book3S HV: Fix vcore_blocked tracepoint | expand

Commit Message

Fabiano Rosas March 28, 2022, 9:58 p.m. UTC
We removed most of the vcore logic from the P9 path but there's still
a tracepoint that tried to dereference vc->runner.

Fixes: ecb6a7207f92 ("KVM: PPC: Book3S HV P9: Remove most of the vcore logic")
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
---
 arch/powerpc/kvm/book3s_hv.c | 8 ++++----
 arch/powerpc/kvm/trace_hv.h  | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

Comments

Nicholas Piggin March 29, 2022, 8:19 a.m. UTC | #1
Excerpts from Fabiano Rosas's message of March 29, 2022 7:58 am:
> We removed most of the vcore logic from the P9 path but there's still
> a tracepoint that tried to dereference vc->runner.

Thanks for the fix.

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>

> 
> Fixes: ecb6a7207f92 ("KVM: PPC: Book3S HV P9: Remove most of the vcore logic")
> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
> ---
>  arch/powerpc/kvm/book3s_hv.c | 8 ++++----
>  arch/powerpc/kvm/trace_hv.h  | 8 ++++----
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index c886557638a1..5f5b2d0dee8c 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -4218,13 +4218,13 @@ static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc)
>  	start_wait = ktime_get();
>  
>  	vc->vcore_state = VCORE_SLEEPING;
> -	trace_kvmppc_vcore_blocked(vc, 0);
> +	trace_kvmppc_vcore_blocked(vc->runner, 0);
>  	spin_unlock(&vc->lock);
>  	schedule();
>  	finish_rcuwait(&vc->wait);
>  	spin_lock(&vc->lock);
>  	vc->vcore_state = VCORE_INACTIVE;
> -	trace_kvmppc_vcore_blocked(vc, 1);
> +	trace_kvmppc_vcore_blocked(vc->runner, 1);
>  	++vc->runner->stat.halt_successful_wait;
>  
>  	cur = ktime_get();
> @@ -4596,9 +4596,9 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
>  			if (kvmppc_vcpu_check_block(vcpu))
>  				break;
>  
> -			trace_kvmppc_vcore_blocked(vc, 0);
> +			trace_kvmppc_vcore_blocked(vcpu, 0);
>  			schedule();
> -			trace_kvmppc_vcore_blocked(vc, 1);
> +			trace_kvmppc_vcore_blocked(vcpu, 1);
>  		}
>  		finish_rcuwait(wait);
>  	}
> diff --git a/arch/powerpc/kvm/trace_hv.h b/arch/powerpc/kvm/trace_hv.h
> index 38cd0ed0a617..32e2cb5811cc 100644
> --- a/arch/powerpc/kvm/trace_hv.h
> +++ b/arch/powerpc/kvm/trace_hv.h
> @@ -409,9 +409,9 @@ TRACE_EVENT(kvmppc_run_core,
>  );
>  
>  TRACE_EVENT(kvmppc_vcore_blocked,
> -	TP_PROTO(struct kvmppc_vcore *vc, int where),
> +	TP_PROTO(struct kvm_vcpu *vcpu, int where),
>  
> -	TP_ARGS(vc, where),
> +	TP_ARGS(vcpu, where),
>  
>  	TP_STRUCT__entry(
>  		__field(int,	n_runnable)
> @@ -421,8 +421,8 @@ TRACE_EVENT(kvmppc_vcore_blocked,
>  	),
>  
>  	TP_fast_assign(
> -		__entry->runner_vcpu = vc->runner->vcpu_id;
> -		__entry->n_runnable  = vc->n_runnable;
> +		__entry->runner_vcpu = vcpu->vcpu_id;
> +		__entry->n_runnable  = vcpu->arch.vcore->n_runnable;
>  		__entry->where       = where;
>  		__entry->tgid	     = current->tgid;
>  	),
> -- 
> 2.35.1
> 
>
Michael Ellerman May 24, 2022, 10:51 a.m. UTC | #2
On Mon, 28 Mar 2022 18:58:31 -0300, Fabiano Rosas wrote:
> We removed most of the vcore logic from the P9 path but there's still
> a tracepoint that tried to dereference vc->runner.
> 
> 

Applied to powerpc/topic/ppc-kvm.

[1/1] KVM: PPC: Book3S HV: Fix vcore_blocked tracepoint
      https://git.kernel.org/powerpc/c/ad55bae7dc364417434b69dd6c30104f20d0f84d

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index c886557638a1..5f5b2d0dee8c 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -4218,13 +4218,13 @@  static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc)
 	start_wait = ktime_get();
 
 	vc->vcore_state = VCORE_SLEEPING;
-	trace_kvmppc_vcore_blocked(vc, 0);
+	trace_kvmppc_vcore_blocked(vc->runner, 0);
 	spin_unlock(&vc->lock);
 	schedule();
 	finish_rcuwait(&vc->wait);
 	spin_lock(&vc->lock);
 	vc->vcore_state = VCORE_INACTIVE;
-	trace_kvmppc_vcore_blocked(vc, 1);
+	trace_kvmppc_vcore_blocked(vc->runner, 1);
 	++vc->runner->stat.halt_successful_wait;
 
 	cur = ktime_get();
@@ -4596,9 +4596,9 @@  int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
 			if (kvmppc_vcpu_check_block(vcpu))
 				break;
 
-			trace_kvmppc_vcore_blocked(vc, 0);
+			trace_kvmppc_vcore_blocked(vcpu, 0);
 			schedule();
-			trace_kvmppc_vcore_blocked(vc, 1);
+			trace_kvmppc_vcore_blocked(vcpu, 1);
 		}
 		finish_rcuwait(wait);
 	}
diff --git a/arch/powerpc/kvm/trace_hv.h b/arch/powerpc/kvm/trace_hv.h
index 38cd0ed0a617..32e2cb5811cc 100644
--- a/arch/powerpc/kvm/trace_hv.h
+++ b/arch/powerpc/kvm/trace_hv.h
@@ -409,9 +409,9 @@  TRACE_EVENT(kvmppc_run_core,
 );
 
 TRACE_EVENT(kvmppc_vcore_blocked,
-	TP_PROTO(struct kvmppc_vcore *vc, int where),
+	TP_PROTO(struct kvm_vcpu *vcpu, int where),
 
-	TP_ARGS(vc, where),
+	TP_ARGS(vcpu, where),
 
 	TP_STRUCT__entry(
 		__field(int,	n_runnable)
@@ -421,8 +421,8 @@  TRACE_EVENT(kvmppc_vcore_blocked,
 	),
 
 	TP_fast_assign(
-		__entry->runner_vcpu = vc->runner->vcpu_id;
-		__entry->n_runnable  = vc->n_runnable;
+		__entry->runner_vcpu = vcpu->vcpu_id;
+		__entry->n_runnable  = vcpu->arch.vcore->n_runnable;
 		__entry->where       = where;
 		__entry->tgid	     = current->tgid;
 	),