From patchwork Wed Dec 30 16:25:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 70273 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBUGPuD6003754 for ; Wed, 30 Dec 2009 16:25:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752327AbZL3QZt (ORCPT ); Wed, 30 Dec 2009 11:25:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752295AbZL3QZs (ORCPT ); Wed, 30 Dec 2009 11:25:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19805 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752256AbZL3QZr (ORCPT ); Wed, 30 Dec 2009 11:25:47 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBUGPjH1023016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 30 Dec 2009 11:25:45 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBUGPhZR003909; Wed, 30 Dec 2009 11:25:43 -0500 Received: from localhost.localdomain (file.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 0A59C250050; Wed, 30 Dec 2009 18:25:43 +0200 (IST) From: Avi Kivity To: Marcelo Tosatti , Sheng Yang , Joerg Roedel Cc: kvm@vger.kernel.org Subject: [PATCH 1/5] KVM: VMX: trace clts and lmsw instructions as cr accesses Date: Wed, 30 Dec 2009 18:25:38 +0200 Message-Id: <1262190342-18611-2-git-send-email-avi@redhat.com> In-Reply-To: <1262190342-18611-1-git-send-email-avi@redhat.com> References: <1262190342-18611-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 2cc9b7e..f6d4298 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2987,6 +2987,7 @@ static int handle_cr(struct kvm_vcpu *vcpu) vmx_fpu_deactivate(vcpu); vcpu->arch.cr0 &= ~X86_CR0_TS; vmcs_writel(CR0_READ_SHADOW, vcpu->arch.cr0); + trace_kvm_cr_write(0, vcpu->arch.cr0); vmx_fpu_activate(vcpu); skip_emulated_instruction(vcpu); return 1; @@ -3006,7 +3007,9 @@ static int handle_cr(struct kvm_vcpu *vcpu) } break; case 3: /* lmsw */ - kvm_lmsw(vcpu, (exit_qualification >> LMSW_SOURCE_DATA_SHIFT) & 0x0f); + val = (exit_qualification >> LMSW_SOURCE_DATA_SHIFT) & 0x0f; + trace_kvm_cr_write(0, (vcpu->arch.cr0 & ~0xful) | val); + kvm_lmsw(vcpu, val); skip_emulated_instruction(vcpu); return 1;