diff mbox

MIPS: KVM: Combine entry trace events into class

Message ID 1466183980-11264-1-git-send-email-james.hogan@imgtec.com (mailing list archive)
State New, archived
Headers show

Commit Message

James Hogan June 17, 2016, 5:19 p.m. UTC
Combine the kvm_enter, kvm_reenter and kvm_out trace events into a
single kvm_transition event class to reduce duplication and bloat.

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Fixes: 93258604ab6d ("MIPS: KVM: Add guest mode switch trace events")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
---
 arch/mips/kvm/trace.h | 62 ++++++++++++++++++---------------------------------
 1 file changed, 22 insertions(+), 40 deletions(-)

Comments

Paolo Bonzini June 23, 2016, 5:15 p.m. UTC | #1
On 17/06/2016 19:19, James Hogan wrote:
> Combine the kvm_enter, kvm_reenter and kvm_out trace events into a
> single kvm_transition event class to reduce duplication and bloat.
> 
> Suggested-by: Steven Rostedt <rostedt@goodmis.org>
> Fixes: 93258604ab6d ("MIPS: KVM: Add guest mode switch trace events")
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: linux-mips@linux-mips.org
> Cc: kvm@vger.kernel.org
> ---
>  arch/mips/kvm/trace.h | 62 ++++++++++++++++++---------------------------------
>  1 file changed, 22 insertions(+), 40 deletions(-)
> 
> diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h
> index 75f1fda08f70..e7d140fc574e 100644
> --- a/arch/mips/kvm/trace.h
> +++ b/arch/mips/kvm/trace.h
> @@ -20,50 +20,32 @@
>  /*
>   * Tracepoints for VM enters
>   */
> -TRACE_EVENT(kvm_enter,
> -	    TP_PROTO(struct kvm_vcpu *vcpu),
> -	    TP_ARGS(vcpu),
> -	    TP_STRUCT__entry(
> -			__field(unsigned long, pc)
> -	    ),
> -
> -	    TP_fast_assign(
> -			__entry->pc = vcpu->arch.pc;
> -	    ),
> -
> -	    TP_printk("PC: 0x%08lx",
> -		      __entry->pc)
> +DECLARE_EVENT_CLASS(kvm_transition,
> +	TP_PROTO(struct kvm_vcpu *vcpu),
> +	TP_ARGS(vcpu),
> +	TP_STRUCT__entry(
> +		__field(unsigned long, pc)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->pc = vcpu->arch.pc;
> +	),
> +
> +	TP_printk("PC: 0x%08lx",
> +		  __entry->pc)
>  );
>  
> -TRACE_EVENT(kvm_reenter,
> -	    TP_PROTO(struct kvm_vcpu *vcpu),
> -	    TP_ARGS(vcpu),
> -	    TP_STRUCT__entry(
> -			__field(unsigned long, pc)
> -	    ),
> +DEFINE_EVENT(kvm_transition, kvm_enter,
> +	     TP_PROTO(struct kvm_vcpu *vcpu),
> +	     TP_ARGS(vcpu));
>  
> -	    TP_fast_assign(
> -			__entry->pc = vcpu->arch.pc;
> -	    ),
> -
> -	    TP_printk("PC: 0x%08lx",
> -		      __entry->pc)
> -);
> +DEFINE_EVENT(kvm_transition, kvm_reenter,
> +	     TP_PROTO(struct kvm_vcpu *vcpu),
> +	     TP_ARGS(vcpu));
>  
> -TRACE_EVENT(kvm_out,
> -	    TP_PROTO(struct kvm_vcpu *vcpu),
> -	    TP_ARGS(vcpu),
> -	    TP_STRUCT__entry(
> -			__field(unsigned long, pc)
> -	    ),
> -
> -	    TP_fast_assign(
> -			__entry->pc = vcpu->arch.pc;
> -	    ),
> -
> -	    TP_printk("PC: 0x%08lx",
> -		      __entry->pc)
> -);
> +DEFINE_EVENT(kvm_transition, kvm_out,
> +	     TP_PROTO(struct kvm_vcpu *vcpu),
> +	     TP_ARGS(vcpu));
>  
>  /* The first 32 exit reasons correspond to Cause.ExcCode */
>  #define KVM_TRACE_EXIT_INT		 0
> 

Queued, thanks.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h
index 75f1fda08f70..e7d140fc574e 100644
--- a/arch/mips/kvm/trace.h
+++ b/arch/mips/kvm/trace.h
@@ -20,50 +20,32 @@ 
 /*
  * Tracepoints for VM enters
  */
-TRACE_EVENT(kvm_enter,
-	    TP_PROTO(struct kvm_vcpu *vcpu),
-	    TP_ARGS(vcpu),
-	    TP_STRUCT__entry(
-			__field(unsigned long, pc)
-	    ),
-
-	    TP_fast_assign(
-			__entry->pc = vcpu->arch.pc;
-	    ),
-
-	    TP_printk("PC: 0x%08lx",
-		      __entry->pc)
+DECLARE_EVENT_CLASS(kvm_transition,
+	TP_PROTO(struct kvm_vcpu *vcpu),
+	TP_ARGS(vcpu),
+	TP_STRUCT__entry(
+		__field(unsigned long, pc)
+	),
+
+	TP_fast_assign(
+		__entry->pc = vcpu->arch.pc;
+	),
+
+	TP_printk("PC: 0x%08lx",
+		  __entry->pc)
 );
 
-TRACE_EVENT(kvm_reenter,
-	    TP_PROTO(struct kvm_vcpu *vcpu),
-	    TP_ARGS(vcpu),
-	    TP_STRUCT__entry(
-			__field(unsigned long, pc)
-	    ),
+DEFINE_EVENT(kvm_transition, kvm_enter,
+	     TP_PROTO(struct kvm_vcpu *vcpu),
+	     TP_ARGS(vcpu));
 
-	    TP_fast_assign(
-			__entry->pc = vcpu->arch.pc;
-	    ),
-
-	    TP_printk("PC: 0x%08lx",
-		      __entry->pc)
-);
+DEFINE_EVENT(kvm_transition, kvm_reenter,
+	     TP_PROTO(struct kvm_vcpu *vcpu),
+	     TP_ARGS(vcpu));
 
-TRACE_EVENT(kvm_out,
-	    TP_PROTO(struct kvm_vcpu *vcpu),
-	    TP_ARGS(vcpu),
-	    TP_STRUCT__entry(
-			__field(unsigned long, pc)
-	    ),
-
-	    TP_fast_assign(
-			__entry->pc = vcpu->arch.pc;
-	    ),
-
-	    TP_printk("PC: 0x%08lx",
-		      __entry->pc)
-);
+DEFINE_EVENT(kvm_transition, kvm_out,
+	     TP_PROTO(struct kvm_vcpu *vcpu),
+	     TP_ARGS(vcpu));
 
 /* The first 32 exit reasons correspond to Cause.ExcCode */
 #define KVM_TRACE_EXIT_INT		 0