From patchwork Fri Oct 9 14:08:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 52725 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 n99EGmvL017028 for ; Fri, 9 Oct 2009 14:16:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932922AbZJIOKU (ORCPT ); Fri, 9 Oct 2009 10:10:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932230AbZJIOKS (ORCPT ); Fri, 9 Oct 2009 10:10:18 -0400 Received: from va3ehsobe002.messaging.microsoft.com ([216.32.180.12]:21102 "EHLO VA3EHSOBE002.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1760928AbZJIOJd (ORCPT ); Fri, 9 Oct 2009 10:09:33 -0400 Received: from mail162-va3-R.bigfish.com (10.7.14.235) by VA3EHSOBE002.bigfish.com (10.7.40.22) with Microsoft SMTP Server id 8.1.340.0; Fri, 9 Oct 2009 14:08:56 +0000 Received: from mail162-va3 (localhost.localdomain [127.0.0.1]) by mail162-va3-R.bigfish.com (Postfix) with ESMTP id 30AE6A87D3; Fri, 9 Oct 2009 14:08:56 +0000 (UTC) X-SpamScore: 3 X-BigFish: VPS3(zzzz1202hzzz32i6bh2a8h43j63h) X-Spam-TCS-SCL: 2:0 X-FB-SS: 5, Received: by mail162-va3 (MessageSwitch) id 1255097334133472_17329; Fri, 9 Oct 2009 14:08:54 +0000 (UCT) Received: from VA3EHSMHS010.bigfish.com (unknown [10.7.14.240]) by mail162-va3.bigfish.com (Postfix) with ESMTP id CA7831230056; Fri, 9 Oct 2009 14:08:53 +0000 (UTC) Received: from svlb1extmailp01.amd.com (139.95.251.8) by VA3EHSMHS010.bigfish.com (10.7.99.20) with Microsoft SMTP Server (TLS) id 14.0.482.32; Fri, 9 Oct 2009 14:08:52 +0000 Received: from svlb1twp02.amd.com ([139.95.250.35]) by svlb1extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n99E8iUX009203; Fri, 9 Oct 2009 07:08:47 -0700 X-WSS-ID: 0KR93AJ-04-7XA-02 X-M-MSG: Received: from SSVLEXBH2.amd.com (ssvlexbh2.amd.com [139.95.53.183]) by svlb1twp02.amd.com (Tumbleweed MailGate 3.7.0) with ESMTP id 2E4B91B10293; Fri, 9 Oct 2009 07:08:42 -0700 (PDT) Received: from ssvlexmb2.amd.com ([139.95.53.7]) by SSVLEXBH2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 9 Oct 2009 07:08:45 -0700 Received: from SF36EXMB1.amd.com ([172.19.4.24]) by ssvlexmb2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 9 Oct 2009 07:08:46 -0700 Received: from seurexmb1.amd.com ([165.204.9.130]) by SF36EXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 9 Oct 2009 16:08:38 +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 232C6C9FD7; 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 8/9] KVM: SVM: Add tracepoint for skinit instruction Date: Fri, 9 Oct 2009 16:08:32 +0200 Message-ID: <1255097313-23267-9-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.0637 (UTC) FILETIME=[FE693CD0: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 ba18fb7..8b9f6fb 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1987,6 +1987,14 @@ static int invlpga_interception(struct vcpu_svm *svm) return 1; } +static int skinit_interception(struct vcpu_svm *svm) +{ + trace_kvm_skinit(svm->vmcb->save.rip, svm->vcpu.arch.regs[VCPU_REGS_RAX]); + + kvm_queue_exception(&svm->vcpu, UD_VECTOR); + return 1; +} + static int invalid_op_interception(struct vcpu_svm *svm) { kvm_queue_exception(&svm->vcpu, UD_VECTOR); @@ -2350,7 +2358,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm) = { [SVM_EXIT_VMSAVE] = vmsave_interception, [SVM_EXIT_STGI] = stgi_interception, [SVM_EXIT_CLGI] = clgi_interception, - [SVM_EXIT_SKINIT] = invalid_op_interception, + [SVM_EXIT_SKINIT] = skinit_interception, [SVM_EXIT_WBINVD] = emulate_on_interception, [SVM_EXIT_MONITOR] = invalid_op_interception, [SVM_EXIT_MWAIT] = invalid_op_interception, diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index 7e1f08e..816e044 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h @@ -492,6 +492,28 @@ TRACE_EVENT(kvm_invlpga, TP_printk("rip: 0x%016llx asid: %d address: 0x%016llx\n", __entry->rip, __entry->asid, __entry->address) ); + +/* + * Tracepoint for nested #vmexit because of interrupt pending + */ +TRACE_EVENT(kvm_skinit, + TP_PROTO(__u64 rip, __u32 slb), + TP_ARGS(rip, slb), + + TP_STRUCT__entry( + __field( __u64, rip ) + __field( __u32, slb ) + ), + + TP_fast_assign( + __entry->rip = rip; + __entry->slb = slb; + ), + + TP_printk("rip: 0x%016llx slb: 0x%08x\n", + __entry->rip, __entry->slb) +); + #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 1153d92..ed4622c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4985,3 +4985,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_vmexit); EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_vmexit_inject); EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_intr_vmexit); EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_invlpga); +EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_skinit);