Received: by 10.223.164.221 with SMTP id h29csp3777452wrb; Tue, 31 Oct 2017 04:50:00 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Td0m9b9aiXT1L13SIpH/bFMMcWZYIW2xWRyDAgOK0NqMqmcYoD/mUbHoaA6IBeOfcfIJab X-Received: by 10.98.141.209 with SMTP id p78mr1744610pfk.263.1509450599905; Tue, 31 Oct 2017 04:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509450599; cv=none; d=google.com; s=arc-20160816; b=MoTSJHjR031bwAyCMVaFbUUpLAsJvyMLJkT0c5izEaYhFhsBiLr69V0r1zlJEWBffD YT0RgbCDWlzXSGabw8HJaDPOWb1TDGvXlgoBnDzCkcLps98Qup3dEV8OCGZznVX4Z75t jevolomKUg3ct9GeiHUNJ9d5BTxxyOlsV/6LyUHVSPLBzdFcrC/BMFi3QzPJWZlMjsrG TTzQyqnrurc4Z89Gs7zzBi8JXNjGHJUzDfbCuajFCi/37UyBZDcpPxAIWCR/9BbqLSvS wedAPXZO0bM1hnK9XYC1ra09ChRIT5yh76rW4stEhT5gVJmICGMJtXVHDM7JiRKvjTDw 5RAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:arc-authentication-results; bh=LnZitkkvVAF4vZdXv31A3fUGyKD5cISG9eJBYtVurd0=; b=mAX+CMC9WJeXej6bXV6qksWsuxAQl/vi06kMpjic3WcRXBVb3XCsRO9Yr2XVrwPhml p+tHKo6eOmQkDx67Hjsiv+j6s0Gqsq02Nw868gApo+yMLqYDjr8SxBzWU8rXM3EyAtQe qj+ZIp7duWQvP7Rhpl8BnWioIvx9xx1DFHUHb0vCEYppAu00N6L+iyUkkGD51VKGLdiR rvS5ljsjgsKtvBOKRy2qE6g6uWZH6NoBxlE+ULFMlBiTAYGrcWgcrzdtJLbuA3Sd8gD8 MKNvOODJazzMBp2y1F5pWzU3ZeZdYD5jtmrozqumDbFrGjTZaV4XM5WrUfmeQFxKWBuT SHZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si1291622plt.574.2017.10.31.04.49.46; Tue, 31 Oct 2017 04:49:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753286AbdJaLsv (ORCPT + 99 others); Tue, 31 Oct 2017 07:48:51 -0400 Received: from mga09.intel.com ([134.134.136.24]:48332 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752833AbdJaLst (ORCPT ); Tue, 31 Oct 2017 07:48:49 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Oct 2017 04:48:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,323,1505804400"; d="scan'208";a="915804212" Received: from vmm.bj.intel.com ([10.238.135.172]) by FMSMGA003.fm.intel.com with ESMTP; 31 Oct 2017 04:48:46 -0700 From: Luwei Kang To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Chao Peng Subject: [patch v2 0/8] Intel Processor Trace virtulization enabling Date: Tue, 31 Oct 2017 06:05:09 +0800 Message-Id: <1509401117-15521-1-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Peng Hi All, Here is a patch-series which adding Processor Trace enabling in KVM guest. You can get It's software developer manuals from: https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf In Chapter 5 INTEL PROCESSOR TRACE: VMX IMPROVEMENTS. Introduction: Intel Processor Trace (Intel PT) is an extension of Intel Architecture that captures information about software execution using dedicated hardware facilities that cause only minimal performance perturbation to the software being traced. Details on the Intel PT infrastructure and trace capabilities can be found in the Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 3C. The suite of architecture changes serve to simplify the process of virtualizing Intel PT for use by a guest software. There are two primary elements to this new architecture support for VMX support improvements made for Intel PT. 1. Addition of a new guest IA32_RTIT_CTL value field to the VMCS. — This serves to speed and simplify the process of disabling trace on VM exit, and restoring it on VM entry. 2. Enabling use of EPT to redirect PT output. — This enables the VMM to elect to virtualize the PT output buffer using EPT. In this mode, the CPU will treat PT output addresses as Guest Physical Addresses (GPAs) and translate them using EPT. This means that Intel PT output reads (of the ToPA table) and writes (of trace output) can cause EPT violations, and other output events. Processor Trace virtualization can be work in one of 3 possible modes by set new option "pt_mode". Default value is host guest mode. a. system-wide: trace both host/guest and output to host buffer; b. host-only: only trace host and output to host buffer; c. host-guest: trace host/guest simultaneous and output to their respective buffer. >From v1: - remove guest-only mode because guest-only mode can be covered by host-guest mode; - always set "use GPA for processor tracing" in secondary execution control if it can be; - trap RTIT_CTL read/write. Forbid write this msr when VMXON in L1 hypervisor. Chao Peng (8): perf/x86/intel/pt: Move Intel-PT MSR bit definitions to a public header perf/x86/intel/pt: change pt_cap_get() to a public function KVM: x86: add Intel processor trace virtualization mode KVM: x86: add Intel processor trace cpuid emulataion KVM: x86: add Intel processor trace context for each vcpu KVM: x86: Implement Intel processor trace context switch KVM: x86: add Intel PT msr RTIT_CTL read/write KVM: x86: Disable intercept for Intel processor trace MSRs arch/x86/events/intel/pt.c | 3 +- arch/x86/events/intel/pt.h | 55 ----------- arch/x86/include/asm/intel_pt.h | 26 ++++++ arch/x86/include/asm/kvm_host.h | 1 + arch/x86/include/asm/msr-index.h | 35 +++++++ arch/x86/include/asm/vmx.h | 8 ++ arch/x86/kvm/cpuid.c | 23 ++++- arch/x86/kvm/svm.c | 6 ++ arch/x86/kvm/vmx.c | 195 ++++++++++++++++++++++++++++++++++++++- 9 files changed, 290 insertions(+), 62 deletions(-) -- 1.8.3.1 From 1582972854326968500@xxx Thu Nov 02 16:35:54 +0000 2017 X-GM-THRID: 1582972854326968500 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread