开启KVM-QEMU时,Intel-PT不记录任何数据包 [英] Intel-PT does not record any packets when KVM-QEMU is on

查看:136
本文介绍了开启KVM-QEMU时,Intel-PT不记录任何数据包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在主机上使用Intel-PT,而我在来宾计算机上运行常规软件程序.因此,我期望主机中运行的Intel-PT将记录所有相关的数据包(例如PIP,FUP,TSC等)以及所有基于VM的数据包(例如VMCS).

I am trying to use Intel-PT on the host, while I run a general software program in the guest machine. 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.

我使用以下命令-

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

guest-kallsyms和guest-modules是我从guest虚拟机复制到主机上的kallsyms和模块文件.

guest-kallsyms and guest-modules are the kallsyms and module files I copied from the guest onto my host.

然后我将启动我的虚拟机.我将在来宾计算机上运行一个程序.程序执行完成后,我将按主机中的 Ctrl + C (SIGINT)停止录制.

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.

我发现,一旦我尝试使用性能报告来读取使用以下命令生成的文件-

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

它返回找不到样品".这意味着Intel-PT无法记录任何样本.

It returns "NO SAMPLES FOUND". This means that Intel-PT has failed to record any samples.

注意:对于我的处理器,我发现MSR MSR_IA32_VMX_MISC中的值的位14为0.根据Intel文档,对于在VMX操作中使用的Intel-PT,此位应​​为1 .这是否以任何方式影响了Intel-PT为什么不记录任何样本的原因?

NOTE: I found that the bit 14 for the value in the MSR MSR_IA32_VMX_MISC is 0, for my processor. As per the Intel documentation, this bit should be 1 for Intel-PT to be used in VMX operation. Does this in any way affect why Intel-PT does not record any samples ?

即使VM处于打开状态,INTEL-PT也能正常工作吗?还是我记录数据的方法不对?

Will INTEL-PT work even when the VM is on ? Or is my method of recording data wrong ?

我使用的是 Linux Kernel 4.11.3,具有Ubuntu 17.04 和支持Intel-PT的Broadwell CPU.

I am using Linux Kernel 4.11.3, having Ubuntu 17.04 and a Broadwell CPU, which supports Intel-PT.

推荐答案

由于我现在清楚地知道为什么Intel-PT无法与QEMU-KVM一起使用,因此我将发布一个答案.

Since I now have a clear idea of why Intel-PT does not work with QEMU-KVM on, I will post an answer.

正如我在问题中提到的那样,不起作用的主要原因是我的处理器的MSR MSR_IA32_VMX_MISC中的值的位14为0.根据Intel文档, VMX根操作(在 VMXON VMXOFF 之间)使用的Intel-PT该位应为1.

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. As per the Intel documentation, this bit should be 1 for Intel-PT to be used in VMX root operation(between VMXON and VMXOFF).

主要问题是,当上述位为0时,VMXON指令会将IA32_RTIT_CTL MSR的 TraceEn 组件设置为0.该组件控制跟踪操作(如果重置),没有跟踪数据写入缓冲区.此重置是在硬件级别控制的.

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. This reset is controlled at the hardware level.

要执行此活动,至少必须有一个 Skylake 处理器.我使用的是 Broadwell 系统,从现在看来,它无法正常工作.

To perform this activity, it is necessary to have a Skylake processor, at least. I was using a Broadwell system, which, as it looks now, will not work.

这篇关于开启KVM-QEMU时,Intel-PT不记录任何数据包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆