KVM: Use __print_symbolic() for vmexit tracepoints
The vmexit tracepoints format the exit_reason to make it human-readable. Since the exit_reason depends on the instruction set (vmx or svm), formatting is handled with ftrace_print_symbols_seq() by referring to the appropriate exit reason table. However, the ftrace_print_symbols_seq() function is not meant to be used directly in tracepoints since it does not export the formatting table which userspace tools like trace-cmd and perf use to format traces. In practice perf dies when formatting vmexit-related events and trace-cmd falls back to printing the numeric value (with extra formatting code in the kvm plugin to paper over this limitation). Other userspace consumers of vmexit-related tracepoints would be in similar trouble. To avoid significant changes to the kvm_exit tracepoint, this patch moves the vmx and svm exit reason tables into arch/x86/kvm/trace.h and selects the right table with __print_symbolic() depending on the instruction set. Note that __print_symbolic() is designed for exporting the formatting table to userspace and allows trace-cmd and perf to work. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
此提交包含在:
@@ -6241,49 +6241,6 @@ static u64 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define _ER(x) { EXIT_REASON_##x, #x }
|
||||
|
||||
static const struct trace_print_flags vmx_exit_reasons_str[] = {
|
||||
_ER(EXCEPTION_NMI),
|
||||
_ER(EXTERNAL_INTERRUPT),
|
||||
_ER(TRIPLE_FAULT),
|
||||
_ER(PENDING_INTERRUPT),
|
||||
_ER(NMI_WINDOW),
|
||||
_ER(TASK_SWITCH),
|
||||
_ER(CPUID),
|
||||
_ER(HLT),
|
||||
_ER(INVLPG),
|
||||
_ER(RDPMC),
|
||||
_ER(RDTSC),
|
||||
_ER(VMCALL),
|
||||
_ER(VMCLEAR),
|
||||
_ER(VMLAUNCH),
|
||||
_ER(VMPTRLD),
|
||||
_ER(VMPTRST),
|
||||
_ER(VMREAD),
|
||||
_ER(VMRESUME),
|
||||
_ER(VMWRITE),
|
||||
_ER(VMOFF),
|
||||
_ER(VMON),
|
||||
_ER(CR_ACCESS),
|
||||
_ER(DR_ACCESS),
|
||||
_ER(IO_INSTRUCTION),
|
||||
_ER(MSR_READ),
|
||||
_ER(MSR_WRITE),
|
||||
_ER(MWAIT_INSTRUCTION),
|
||||
_ER(MONITOR_INSTRUCTION),
|
||||
_ER(PAUSE_INSTRUCTION),
|
||||
_ER(MCE_DURING_VMENTRY),
|
||||
_ER(TPR_BELOW_THRESHOLD),
|
||||
_ER(APIC_ACCESS),
|
||||
_ER(EPT_VIOLATION),
|
||||
_ER(EPT_MISCONFIG),
|
||||
_ER(WBINVD),
|
||||
{ -1, NULL }
|
||||
};
|
||||
|
||||
#undef _ER
|
||||
|
||||
static int vmx_get_lpage_level(void)
|
||||
{
|
||||
if (enable_ept && !cpu_has_vmx_ept_1g_page())
|
||||
@@ -7039,7 +6996,6 @@ static struct kvm_x86_ops vmx_x86_ops = {
|
||||
.get_mt_mask = vmx_get_mt_mask,
|
||||
|
||||
.get_exit_info = vmx_get_exit_info,
|
||||
.exit_reasons_str = vmx_exit_reasons_str,
|
||||
|
||||
.get_lpage_level = vmx_get_lpage_level,
|
||||
|
||||
|
新增問題並參考
封鎖使用者