简体   繁体   English

开启KVM-QEMU时,Intel-PT不记录任何数据包

[英]Intel-PT does not record any packets when KVM-QEMU is on

I am trying to use Intel-PT on the host, while I run a general software program in the guest machine. 我尝试在主机上使用Intel-PT,同时在来宾计算机中运行常规软件程序。 So what I expect is the Intel-PT running in the host will record all the relevant packets(like PIP, FUP, TSC etc.) and also all the VM-based packets like VMCS. 因此,我期望主机中运行的Intel-PT将记录所有相关的数据包(如PIP,FUP,TSC等)以及所有基于VM的数据包(如VMCS)。

I use the below command - 我使用以下命令-

./perf kvm --host --guest --guestkallsyms=guest-kallsyms --guestmodules=guest-modules record -e intel_pt//

guest-kallsyms and guest-modules are the kallsyms and module files I copied from the guest onto my host. guest-kallsyms和guest-modules是我从guest虚拟机复制到主机上的kallsyms和模块文件。

I will then start my Virtual Machine. 然后,我将启动我的虚拟机。 I will run a program on the guest machine. 我将在来宾计算机上运行一个程序。 Once the program execution is complete, I will press Ctrl + C (SIGINT) in my host to stop the recording. 程序执行完成后,我将在主机中按Ctrl + C (SIGINT)停止录制。

I see that once I try to use perf report to read the file generated using the below command - 我看到,一旦我尝试使用性能报告来读取使用以下命令生成的文件-

./perf kvm report -i perf.data.kvm

It returns "NO SAMPLES FOUND". 它返回“找不到样本”。 This means that Intel-PT has failed to record any samples. 这意味着Intel-PT无法记录任何样本。

NOTE : I found that the bit 14 for the value in the MSR MSR_IA32_VMX_MISC is 0, for my processor. 注意 :对于我的处理器,我发现MSR MSR_IA32_VMX_MISC的值的位14为0。 As per the Intel documentation, this bit should be 1 for Intel-PT to be used in VMX operation . 根据Intel文档, 对于在VMX操作中使用的Intel-PT该位应为1 Does this in any way affect why Intel-PT does not record any samples ? 这是否以任何方式影响为什么Intel-PT不记录任何样本?

Will INTEL-PT work even when the VM is on ? 虚拟机打开时,INTEL-PT是否也可以工作? Or is my method of recording data wrong ? 还是我记录数据的方法错误?

Edit: I am using Linux Kernel 4.11.3, having Ubuntu 17.04 and a Broadwell CPU, which supports Intel-PT. 编辑:我正在使用Linux Kernel 4.11.3,具有Ubuntu 17.04和支持Intel-PT的Broadwell CPU。

Since I now have a clear idea of why Intel-PT does not work with QEMU-KVM on, I will post an answer. 由于我现在对为什么Intel-PT无法在QEMU-KVM上正常运行有一个清晰的认识,因此,我将发布答案。

As I mentioned in the question, the main reason for this not to work is the fact that the bit 14 for the value in the MSR MSR_IA32_VMX_MISC is 0, for my processor. 正如我在问题中提到的那样,此操作不起作用的MSR_IA32_VMX_MISC是我的处理器的MSR MSR_IA32_VMX_MISC的值的位14为0。 As per the Intel documentation, this bit should be 1 for Intel-PT to be used in VMX root operation(between VMXON and VMXOFF ). 根据英特尔文档,对于在VMX根操作(在VMXONVMXOFF之间)使用的Intel-PT,该位应为1。

The main problem is that when the above bit is 0, a VMXON instruction will set the TraceEn component of IA32_RTIT_CTL MSR to 0. This component controls the tracing operation, if this is reset, no tracing data is written to the buffer. 主要问题是,当上述位为0时,VMXON指令会将IA32_RTIT_CTL MSR的TraceEn组件设置为0。该组件控制跟踪操作,如果将其复位,则不IA32_RTIT_CTL跟踪数据写入缓冲区。 This reset is controlled at the hardware level. 此重置在硬件级别控制。

To perform this activity, it is necessary to have a Skylake processor, at least. 要执行此活动,至少必须有一个Skylake处理器。 I was using a Broadwell system, which, as it looks now, will not work. 我使用的是Broadwell系统,从现在看来,它无法正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM