mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	MIPS: KVM: Add guest mode switch trace events
Add a few trace events for entering and coming out of guest mode, as well as re-entering it from a guest exit exception. 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: kvm@vger.kernel.org Cc: linux-mips@linux-mips.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							parent
							
								
									9887d1c75b
								
							
						
					
					
						commit
						93258604ab
					
				
					 2 changed files with 52 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -410,7 +410,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
 | 
			
		|||
	/* Disable hardware page table walking while in guest */
 | 
			
		||||
	htw_stop();
 | 
			
		||||
 | 
			
		||||
	trace_kvm_enter(vcpu);
 | 
			
		||||
	r = vcpu->arch.vcpu_run(run, vcpu);
 | 
			
		||||
	trace_kvm_out(vcpu);
 | 
			
		||||
 | 
			
		||||
	/* Re-enable HTW before enabling interrupts */
 | 
			
		||||
	htw_start();
 | 
			
		||||
| 
						 | 
				
			
			@ -1389,6 +1391,8 @@ int kvm_mips_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	if (ret == RESUME_GUEST) {
 | 
			
		||||
		trace_kvm_reenter(vcpu);
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * If FPU / MSA are enabled (i.e. the guest's FPU / MSA context
 | 
			
		||||
		 * is live), restore FCR31 / MSACSR.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,6 +17,54 @@
 | 
			
		|||
#define TRACE_INCLUDE_PATH .
 | 
			
		||||
#define TRACE_INCLUDE_FILE trace
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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)
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
TRACE_EVENT(kvm_reenter,
 | 
			
		||||
	    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_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)
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
/* The first 32 exit reasons correspond to Cause.ExcCode */
 | 
			
		||||
#define KVM_TRACE_EXIT_INT		 0
 | 
			
		||||
#define KVM_TRACE_EXIT_TLBMOD		 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue