From 7c56243225d9ef2298753a8957569483e85c2059 Mon Sep 17 00:00:00 2001 From: Zhipeng Gong Date: Mon, 14 Jan 2019 11:30:36 +0800 Subject: [PATCH] hv: hv_main: adjust vm exit trace position When we use script to analyze the latency between vm_exit and vm_entry, it does not include the duration of vm_exit handler. The patch moves the vm_exit trace before vmexit_handler. v2: move vm_exit trace right after run_vcpu. Tracked-On: #2341 Signed-off-by: Zhipeng Gong Reviewed-by: Yan, Like --- hypervisor/common/hv_main.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hypervisor/common/hv_main.c b/hypervisor/common/hv_main.c index 74243fb4d..49b7d4001 100644 --- a/hypervisor/common/hv_main.c +++ b/hypervisor/common/hv_main.c @@ -58,16 +58,17 @@ void vcpu_thread(struct sched_object *obj) continue; } - TRACE_2L(TRACE_VM_ENTER, 0UL, 0UL); - profiling_vmenter_handler(vcpu); + TRACE_2L(TRACE_VM_ENTER, 0UL, 0UL); ret = run_vcpu(vcpu); if (ret != 0) { pr_fatal("vcpu resume failed"); pause_vcpu(vcpu, VCPU_ZOMBIE); continue; } + basic_exit_reason = vcpu->arch.exit_reason & 0xFFFFU; + TRACE_2L(TRACE_VM_EXIT, basic_exit_reason, vcpu_get_rip(vcpu)); vcpu->arch.nrexits++; @@ -76,7 +77,6 @@ void vcpu_thread(struct sched_object *obj) CPU_IRQ_ENABLE(); /* Dispatch handler */ ret = vmexit_handler(vcpu); - basic_exit_reason = vcpu->arch.exit_reason & 0xFFFFU; if (ret < 0) { pr_fatal("dispatch VM exit handler failed for reason" " %d, ret = %d!", basic_exit_reason, ret); @@ -84,8 +84,6 @@ void vcpu_thread(struct sched_object *obj) continue; } - TRACE_2L(TRACE_VM_EXIT, basic_exit_reason, vcpu_get_rip(vcpu)); - profiling_post_vmexit_handler(vcpu); } while (1); }