From patchwork Fri Oct 9 14:08:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 52764 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 n99H84NW005307 for ; Fri, 9 Oct 2009 17:08:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933891AbZJIRGb (ORCPT ); Fri, 9 Oct 2009 13:06:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933808AbZJIRGb (ORCPT ); Fri, 9 Oct 2009 13:06:31 -0400 Received: from tx2ehsobe004.messaging.microsoft.com ([65.55.88.14]:15449 "EHLO TX2EHSOBE007.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933802AbZJIRGa (ORCPT ); Fri, 9 Oct 2009 13:06:30 -0400 Received: from mail183-tx2-R.bigfish.com (10.9.14.238) by TX2EHSOBE007.bigfish.com (10.9.40.27) with Microsoft SMTP Server id 8.1.340.0; Fri, 9 Oct 2009 17:05:51 +0000 Received: from mail183-tx2 (localhost.localdomain [127.0.0.1]) by mail183-tx2-R.bigfish.com (Postfix) with ESMTP id E575F1A682E2; Fri, 9 Oct 2009 17:05:50 +0000 (UTC) X-SpamScore: 3 X-BigFish: VPS3(zzzz1202hzzz32i2a8h6bh43j64h) X-Spam-TCS-SCL: 3:0 X-FB-SS: 5, Received: by mail183-tx2 (MessageSwitch) id 1255107948299383_27338; Fri, 9 Oct 2009 17:05:48 +0000 (UCT) Received: from TX2EHSMHS014.bigfish.com (unknown [10.9.14.238]) by mail183-tx2.bigfish.com (Postfix) with ESMTP id 13A9D1088063; Fri, 9 Oct 2009 17:05:48 +0000 (UTC) Received: from ausb3extmailp01.amd.com (163.181.251.8) by TX2EHSMHS014.bigfish.com (10.9.99.114) with Microsoft SMTP Server (TLS) id 14.0.482.32; Fri, 9 Oct 2009 17:05:46 +0000 Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n99H5eWW000476; Fri, 9 Oct 2009 12:05:44 -0500 X-WSS-ID: 0KR9BHF-02-069-02 X-M-MSG: Received: from sausexbh1.amd.com (sausexbh1.amd.com [163.181.22.101]) by ausb3twp02.amd.com (Tumbleweed MailGate 3.7.0) with ESMTP id 22656C84FD; Fri, 9 Oct 2009 12:05:38 -0500 (CDT) Received: from sausexmb5.amd.com ([163.181.49.129]) by sausexbh1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 9 Oct 2009 09:08:41 -0500 Received: from SDRSEXMB1.amd.com ([172.20.3.116]) by sausexmb5.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 9 Oct 2009 09:08:40 -0500 Received: from seurexmb1.amd.com ([165.204.9.130]) by SDRSEXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 9 Oct 2009 16:08:37 +0200 Received: from lemmy.amd.com ([165.204.15.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 9 Oct 2009 16:08:36 +0200 Received: by lemmy.amd.com (Postfix, from userid 41430) id 0A082C9FC0; Fri, 9 Oct 2009 16:08:36 +0200 (CEST) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: Alexander Graf , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH 3/9] KVM: SVM: Add tracepoint for nested vmrun Date: Fri, 9 Oct 2009 16:08:27 +0200 Message-ID: <1255097313-23267-4-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.6.4.3 In-Reply-To: <1255097313-23267-1-git-send-email-joerg.roedel@amd.com> References: <1255097313-23267-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 09 Oct 2009 14:08:36.0325 (UTC) FILETIME=[FE39A150:01CA48E9] MIME-Version: 1.0 X-Reverse-DNS: unknown Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 884bffc..907af3f 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1726,6 +1726,12 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm) /* nested_vmcb is our indicator if nested SVM is activated */ svm->nested.vmcb = svm->vmcb->save.rax; + trace_kvm_nested_vmrun(svm->vmcb->save.rip - 3, svm->nested.vmcb, + nested_vmcb->save.rip, + nested_vmcb->control.int_ctl, + nested_vmcb->control.event_inj, + nested_vmcb->control.nested_ctl); + /* Clear internal status */ kvm_clear_exception_queue(&svm->vcpu); kvm_clear_interrupt_queue(&svm->vcpu); diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index 0d480e7..b5798e1 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h @@ -349,6 +349,39 @@ TRACE_EVENT(kvm_apic_accept_irq, __entry->coalesced ? " (coalesced)" : "") ); +/* + * Tracepoint for nested VMRUN + */ +TRACE_EVENT(kvm_nested_vmrun, + TP_PROTO(__u64 rip, __u64 vmcb, __u64 nested_rip, __u32 int_ctl, + __u32 event_inj, bool npt), + TP_ARGS(rip, vmcb, nested_rip, int_ctl, event_inj, npt), + + TP_STRUCT__entry( + __field( __u64, rip ) + __field( __u64, vmcb ) + __field( __u64, nested_rip ) + __field( __u32, int_ctl ) + __field( __u32, event_inj ) + __field( bool, npt ) + ), + + TP_fast_assign( + __entry->rip = rip; + __entry->vmcb = vmcb; + __entry->nested_rip = nested_rip; + __entry->int_ctl = int_ctl; + __entry->event_inj = event_inj; + __entry->npt = npt; + ), + + TP_printk("rip: 0x%016llx vmcb: 0x%016llx nrip: 0x%016llx int_ctl: 0x%08x " + "event_inj: 0x%08x npt: %s\n", + __entry->rip, __entry->vmcb, __entry->nested_rip, + __entry->int_ctl, __entry->event_inj, + __entry->npt ? "on" : "off") +); + #endif /* _TRACE_KVM_H */ /* This part must be outside protection */ diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 11a6f2f..f1e44e9 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4980,3 +4980,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_inj_virq); EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_page_fault); EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_msr); EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_cr); +EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_vmrun);