From patchwork Thu Jun 18 14:47:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 31167 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5IEo17K022741 for ; Thu, 18 Jun 2009 14:50:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758128AbZFROtx (ORCPT ); Thu, 18 Jun 2009 10:49:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757487AbZFROtx (ORCPT ); Thu, 18 Jun 2009 10:49:53 -0400 Received: from mx2.redhat.com ([66.187.237.31]:38373 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754871AbZFROtu (ORCPT ); Thu, 18 Jun 2009 10:49:50 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5IEnqrU031453; Thu, 18 Jun 2009 10:49:52 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5IEnoIj002001; Thu, 18 Jun 2009 10:49:51 -0400 Received: from amt.cnet (vpn-51-44.sfbay.redhat.com [10.14.51.44]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5IEnm7A012841; Thu, 18 Jun 2009 10:49:49 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 2B6E068013E; Thu, 18 Jun 2009 11:49:32 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n5IEnUht005361; Thu, 18 Jun 2009 11:49:30 -0300 Message-Id: <20090618144819.392195778@localhost.localdomain> References: <20090618144726.270388200@localhost.localdomain> User-Agent: quilt/0.46-1 Date: Thu, 18 Jun 2009 11:47:27 -0300 From: Marcelo Tosatti To: avi@redhat.com Cc: kvm@vger.kernel.org, Hollis Blanchard , Marcelo Tosatti Subject: [patch 1/3] KVM: PPC: convert marker probes to event trace Content-Disposition: inline; filename=convert-ppc-to-eventtrace X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org CC: Hollis Blanchard Signed-off-by: Marcelo Tosatti Index: kvm/arch/powerpc/kvm/44x_tlb.c =================================================================== --- kvm.orig/arch/powerpc/kvm/44x_tlb.c +++ kvm/arch/powerpc/kvm/44x_tlb.c @@ -31,6 +31,9 @@ #include "44x_tlb.h" +#define CREATE_TRACE_POINTS +#include "trace-arch.h" + #ifndef PPC44x_TLBE_SIZE #define PPC44x_TLBE_SIZE PPC44x_TLB_4K #endif @@ -263,7 +266,7 @@ static void kvmppc_44x_shadow_release(st /* XXX set tlb_44x_index to stlb_index? */ - KVMTRACE_1D(STLB_INVAL, &vcpu_44x->vcpu, stlb_index, handler); + trace_kvm_stlb_inval(stlb_index); } void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu) @@ -365,8 +368,8 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcp /* Insert shadow mapping into hardware TLB. */ kvmppc_44x_tlbe_set_modified(vcpu_44x, victim); kvmppc_44x_tlbwe(victim, &stlbe); - KVMTRACE_5D(STLB_WRITE, vcpu, victim, stlbe.tid, stlbe.word0, stlbe.word1, - stlbe.word2, handler); + trace_kvm_stlb_write(victim, stlbe.tid, stlbe.word0, stlbe.word1, + stlbe.word2); } /* For a particular guest TLB entry, invalidate the corresponding host TLB @@ -485,8 +488,8 @@ int kvmppc_44x_emul_tlbwe(struct kvm_vcp kvmppc_mmu_map(vcpu, eaddr, gpaddr, gtlb_index); } - KVMTRACE_5D(GTLB_WRITE, vcpu, gtlb_index, tlbe->tid, tlbe->word0, - tlbe->word1, tlbe->word2, handler); + trace_kvm_gtlb_write(gtlb_index, tlbe->tid, tlbe->word0, tlbe->word1, + tlbe->word2); kvmppc_set_exit_type(vcpu, EMULATED_TLBWE_EXITS); return EMULATE_DONE; Index: kvm/arch/powerpc/kvm/trace-arch.h =================================================================== --- /dev/null +++ kvm/arch/powerpc/kvm/trace-arch.h @@ -0,0 +1,84 @@ +#if !defined(_TRACE_KVM_ARCH_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_KVM_ARCH_H + +#include + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM kvm +#define TRACE_INCLUDE_PATH arch/powerpc/kvm +#define TRACE_INCLUDE_FILE trace-arch + +/* + * Tracepoint for kvm guest exit: + */ +TRACE_EVENT(kvm_stlb_inval, + TP_PROTO(unsigned int stlb_index), + TP_ARGS(stlb_index), + + TP_STRUCT__entry( + __field( unsigned int, stlb_index ) + ), + + TP_fast_assign( + __entry->stlb_index = stlb_index; + ), + + TP_printk("stlb_index %u", __entry->stlb_index) +); + +TRACE_EVENT(kvm_stlb_write, + TP_PROTO(unsigned int victim, unsigned int tid, unsigned int word0, + unsigned int word1, unsigned int word2), + TP_ARGS(victim, tid, word0, word1, word2), + + TP_STRUCT__entry( + __field( unsigned int, victim ) + __field( unsigned int, tid ) + __field( unsigned int, word0 ) + __field( unsigned int, word1 ) + __field( unsigned int, word2 ) + ), + + TP_fast_assign( + __entry->victim = victim; + __entry->tid = tid; + __entry->word0 = word0; + __entry->word1 = word1; + __entry->word2 = word2; + ), + + TP_printk("victim %u tid %u w0 %u w1 %u w2 %u", + __entry->victim, __entry->tid, __entry->word0, + __entry->word1, __entry->word2) +); + +TRACE_EVENT(kvm_gtlb_write, + TP_PROTO(unsigned int gtlb_index, unsigned int tid, unsigned int word0, + unsigned int word1, unsigned int word2), + TP_ARGS(gtlb_index, tid, word0, word1, word2), + + TP_STRUCT__entry( + __field( unsigned int, gtlb_index ) + __field( unsigned int, tid ) + __field( unsigned int, word0 ) + __field( unsigned int, word1 ) + __field( unsigned int, word2 ) + ), + + TP_fast_assign( + __entry->gtlb_index = gtlb_index; + __entry->tid = tid; + __entry->word0 = word0; + __entry->word1 = word1; + __entry->word2 = word2; + ), + + TP_printk("gtlb_index %u tid %u w0 %u w1 %u w2 %u", + __entry->gtlb_index, __entry->tid, __entry->word0, + __entry->word1, __entry->word2) +); + +#endif /* _TRACE_KVM_ARCH */ + +/* This part must be outside protection */ +#include Index: kvm/arch/powerpc/kvm/Makefile =================================================================== --- kvm.orig/arch/powerpc/kvm/Makefile +++ kvm/arch/powerpc/kvm/Makefile @@ -8,6 +8,10 @@ common-objs-y = $(addprefix ../../../vir common-objs-$(CONFIG_KVM_TRACE) += $(addprefix ../../../virt/kvm/, kvm_trace.o) +CFLAGS_44x_tlb.o := -I. +CFLAGS_e500_tlb.o := -I. +CFLAGS_emulate.o := -I. + kvm-objs := $(common-objs-y) powerpc.o emulate.o obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o obj-$(CONFIG_KVM) += kvm.o Index: kvm/arch/powerpc/kvm/e500_tlb.c =================================================================== --- kvm.orig/arch/powerpc/kvm/e500_tlb.c +++ kvm/arch/powerpc/kvm/e500_tlb.c @@ -23,6 +23,9 @@ #include "../mm/mmu_decl.h" #include "e500_tlb.h" +#define CREATE_TRACE_POINTS +#include "trace-arch.h" + #define to_htlb1_esel(esel) (tlb1_entry_num - (esel) - 1) static unsigned int tlb1_entry_num; @@ -224,9 +227,8 @@ static void kvmppc_e500_stlbe_invalidate kvmppc_e500_shadow_release(vcpu_e500, tlbsel, esel); stlbe->mas1 = 0; - KVMTRACE_5D(STLB_INVAL, &vcpu_e500->vcpu, index_of(tlbsel, esel), - stlbe->mas1, stlbe->mas2, stlbe->mas3, stlbe->mas7, - handler); + trace_kvm_stlb_inval(index_of(tlbsel, esel), stlbe->mas1, stlbe->mas2, + stlbe->mas3, stlbe->mas7); } static void kvmppc_e500_tlb1_invalidate(struct kvmppc_vcpu_e500 *vcpu_e500, @@ -319,9 +321,8 @@ static inline void kvmppc_e500_shadow_ma vcpu_e500->vcpu.arch.msr & MSR_PR); stlbe->mas7 = (hpaddr >> 32) & MAS7_RPN; - KVMTRACE_5D(STLB_WRITE, &vcpu_e500->vcpu, index_of(tlbsel, esel), - stlbe->mas1, stlbe->mas2, stlbe->mas3, stlbe->mas7, - handler); + trace_kvm_stlb_write(index_of(tlbsel, esel), stlbe->mas1, stlbe->mas2, + stlbe->mas3, stlbe->mas7); } /* XXX only map the one-one case, for now use TLB0 */ @@ -535,9 +536,8 @@ int kvmppc_e500_emul_tlbwe(struct kvm_vc gtlbe->mas3 = vcpu_e500->mas3; gtlbe->mas7 = vcpu_e500->mas7; - KVMTRACE_5D(GTLB_WRITE, vcpu, vcpu_e500->mas0, - gtlbe->mas1, gtlbe->mas2, gtlbe->mas3, gtlbe->mas7, - handler); + trace_kvm_gtlb_write(vcpu_e500->mas0, gtlbe->mas1, gtlbe->mas2, + gtlbe->mas3, gtlbe->mas7); /* Invalidate shadow mappings for the about-to-be-clobbered TLBE. */ if (tlbe_is_host_safe(vcpu, gtlbe)) { Index: kvm/arch/powerpc/kvm/emulate.c =================================================================== --- kvm.orig/arch/powerpc/kvm/emulate.c +++ kvm/arch/powerpc/kvm/emulate.c @@ -30,6 +30,9 @@ #include #include "timing.h" +#define CREATE_TRACE_POINTS +#include "trace.h" + #define OP_TRAP 3 #define OP_31_XOP_LWZX 23 @@ -419,7 +422,7 @@ int kvmppc_emulate_instruction(struct kv } } - KVMTRACE_3D(PPC_INSTR, vcpu, inst, (int)vcpu->arch.pc, emulated, entryexit); + trace_kvm_ppc_instr(inst, vcpu->arch.pc, emulated); if (advance) vcpu->arch.pc += 4; /* Advance past emulated instruction. */ Index: kvm/arch/powerpc/kvm/trace.h =================================================================== --- /dev/null +++ kvm/arch/powerpc/kvm/trace.h @@ -0,0 +1,37 @@ +#if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_KVM_H + +#include + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM kvm +#define TRACE_INCLUDE_PATH arch/powerpc/kvm +#define TRACE_INCLUDE_FILE trace + +/* + * Tracepoint for guest mode entry. + */ +TRACE_EVENT(kvm_ppc_instr + TP_PROTO(unsigned int inst, unsigned long pc, unsigned int emulate), + TP_ARGS(inst, pc, emulate), + + TP_STRUCT__entry( + __field( unsigned int, inst ) + __field( unsigned long, pc ) + __field( unsigned int, emulate ) + ), + + TP_fast_assign( + __entry->inst = inst; + __entry->pc = pc; + __entry->emulate = emulate; + ), + + TP_printk("inst %u pc 0x%lx emulate %u\n", + __entry->inst, __entry->pc, __entry->emulate); +); + +#endif /* _TRACE_KVM_H */ + +/* This part must be outside protection */ +#include