Commit f9d0c531 authored by chenjiajun's avatar chenjiajun Committed by liangtian
Browse files

kvm: debugfs: add EXIT_REASON_PREEMPTION_TIMER to vcpu_stat

virt inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I919BF


CVE: NA

-----------------------------------------

Export EXIT_REASON_PREEMPTION_TIMER kvm exits to vcpu_stat debugfs.
Add a new column to vcpu_stat, and provide preemption_timer status to
virtualization detection tools.

Signed-off-by: default avatarchenjiajun <chenjiajun8@huawei.com>
Signed-off-by: default avatarliangtian <liangtian13@huawei.com>
parent 84d4616c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1531,6 +1531,7 @@ struct kvm_vcpu_stat {
	u64 utime;
	u64 stime;
	u64 gtime;
	u64 preemption_timer_exits;
	u64 nested_run;
	u64 directed_yield_attempted;
	u64 directed_yield_successful;
+2 −0
Original line number Diff line number Diff line
@@ -6012,6 +6012,7 @@ static fastpath_t handle_fastpath_preemption_timer(struct kvm_vcpu *vcpu)

static int handle_preemption_timer(struct kvm_vcpu *vcpu)
{
	++vcpu->stat.preemption_timer_exits;
	handle_fastpath_preemption_timer(vcpu);
	return 1;
}
@@ -7219,6 +7220,7 @@ static fastpath_t vmx_exit_handlers_fastpath(struct kvm_vcpu *vcpu)
		++vcpu->stat.msr_wr_exits;
		return handle_fastpath_set_msr_irqoff(vcpu);
	case EXIT_REASON_PREEMPTION_TIMER:
		++vcpu->stat.preemption_timer_exits;
		return handle_fastpath_preemption_timer(vcpu);
	default:
		return EXIT_FASTPATH_NONE;
+1 −0
Original line number Diff line number Diff line
@@ -280,6 +280,7 @@ struct dfx_kvm_stats_debugfs_item dfx_debugfs_entries[] = {
	DFX_STAT("utime", utime),
	DFX_STAT("stime", stime),
	DFX_STAT("gtime", gtime),
	DFX_STAT("preemption_timer_exits", preemption_timer_exits),
	{ NULL }
};
#endif