提交 fab413f6 编写于 作者: Z Zengruan Ye 提交者: Zheng Zengkai

KVM: arm64: Add tracepoints for PV qspinlock

virt inclusion
category: feature
bugzilla: 47624
CVE: NA

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

Add tracepoints for PV qspinlock
Signed-off-by: NZengruan Ye <yezengruan@huawei.com>
Reviewed-by: NZhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 72fa593a
......@@ -25,6 +25,9 @@
#include <asm/qspinlock_paravirt.h>
#include <asm/smp_plat.h>
#define CREATE_TRACE_POINTS
#include "trace-paravirt.h"
struct static_key paravirt_steal_enabled;
struct static_key paravirt_steal_rq_enabled;
......@@ -261,6 +264,8 @@ static void kvm_kick_cpu(int cpu)
struct arm_smccc_res res;
arm_smccc_1_1_invoke(ARM_SMCCC_HV_PV_SCHED_KICK_CPU, cpu, &res);
trace_kvm_kick_cpu("kvm kick cpu", smp_processor_id(), cpu);
}
static void kvm_wait(u8 *ptr, u8 val)
......@@ -277,6 +282,7 @@ static void kvm_wait(u8 *ptr, u8 val)
dsb(sy);
wfi();
trace_kvm_wait("kvm wait wfi", smp_processor_id());
out:
local_irq_restore(flags);
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright(c) 2019 Huawei Technologies Co., Ltd
* Author: Zengruan Ye <yezengruan@huawei.com>
*/
#undef TRACE_SYSTEM
#define TRACE_SYSTEM paravirt
#if !defined(_TRACE_PARAVIRT_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_PARAVIRT_H
#include <linux/tracepoint.h>
TRACE_EVENT(kvm_kick_cpu,
TP_PROTO(const char *name, int cpu, int target),
TP_ARGS(name, cpu, target),
TP_STRUCT__entry(
__string(name, name)
__field(int, cpu)
__field(int, target)
),
TP_fast_assign(
__assign_str(name, name);
__entry->cpu = cpu;
__entry->target = target;
),
TP_printk("PV qspinlock: %s, cpu %d kick target cpu %d",
__get_str(name),
__entry->cpu,
__entry->target
)
);
TRACE_EVENT(kvm_wait,
TP_PROTO(const char *name, int cpu),
TP_ARGS(name, cpu),
TP_STRUCT__entry(
__string(name, name)
__field(int, cpu)
),
TP_fast_assign(
__assign_str(name, name);
__entry->cpu = cpu;
),
TP_printk("PV qspinlock: %s, cpu %d wait kvm access wfi",
__get_str(name),
__entry->cpu
)
);
#endif /* _TRACE_PARAVIRT_H */
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_PATH ../../../arch/arm64/kernel/
#define TRACE_INCLUDE_FILE trace-paravirt
#include <trace/define_trace.h>
......@@ -11,6 +11,8 @@
#include <kvm/arm_hypercalls.h>
#include "trace.h"
void kvm_update_pvsched_preempted(struct kvm_vcpu *vcpu, u32 preempted)
{
struct kvm *kvm = vcpu->kvm;
......@@ -53,6 +55,7 @@ long kvm_pvsched_kick_vcpu(struct kvm_vcpu *vcpu)
kvm_vcpu_yield_to(target);
val = SMCCC_RET_SUCCESS;
trace_kvm_pvsched_kick_vcpu(vcpu->vcpu_id, target->vcpu_id);
out:
return val;
......
......@@ -367,6 +367,24 @@ TRACE_EVENT(kvm_timer_emulate,
__entry->timer_idx, __entry->should_fire)
);
TRACE_EVENT(kvm_pvsched_kick_vcpu,
TP_PROTO(int vcpu_id, int target_vcpu_id),
TP_ARGS(vcpu_id, target_vcpu_id),
TP_STRUCT__entry(
__field(int, vcpu_id)
__field(int, target_vcpu_id)
),
TP_fast_assign(
__entry->vcpu_id = vcpu_id;
__entry->target_vcpu_id = target_vcpu_id;
),
TP_printk("PV qspinlock: vcpu %d kick target vcpu %d",
__entry->vcpu_id, __entry->target_vcpu_id)
);
#endif /* _TRACE_ARM_ARM64_KVM_H */
#undef TRACE_INCLUDE_PATH
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册