[PATCH] x86/hyperv: Trace hv_set_register()
From: Nischala Yelchuri
Date: Tue Jun 06 2023 - 21:36:32 EST
Add a new trace point trace_hyperv_set_register()
to capture register address and its value in hv_set_register().
Signed-off-by: Nischala Yelchuri <niyelchu@xxxxxxxxxxxxxxxxxxx>
---
arch/x86/include/asm/trace/hyperv.h | 14 ++++++++++++++
arch/x86/kernel/cpu/mshyperv.c | 3 +++
2 files changed, 17 insertions(+)
diff --git a/arch/x86/include/asm/trace/hyperv.h b/arch/x86/include/asm/trace/hyperv.h
index a8e5a7a2b..54b2f69f5 100644
--- a/arch/x86/include/asm/trace/hyperv.h
+++ b/arch/x86/include/asm/trace/hyperv.h
@@ -86,6 +86,20 @@ TRACE_EVENT(hyperv_send_ipi_one,
__entry->cpu, __entry->vector)
);
+TRACE_EVENT(hyperv_set_register,
+ TP_PROTO(unsigned int reg,
+ u64 value),
+ TP_ARGS(reg, value),
+ TP_STRUCT__entry(
+ __field(unsigned int, reg)
+ __field(u64, value)
+ ),
+ TP_fast_assign(__entry->reg = reg;
+ __entry->value = value;
+ ),
+ TP_printk("reg %u value %llu",
+ __entry->reg, __entry->value)
+ );
#endif /* CONFIG_HYPERV */
#undef TRACE_INCLUDE_PATH
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index c7969e806..d4ef63f4e 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -32,6 +32,7 @@
#include <asm/nmi.h>
#include <clocksource/hyperv_timer.h>
#include <asm/numa.h>
+#include <asm/trace/hyperv.h>
/* Is Linux running as the root partition? */
bool hv_root_partition;
@@ -98,6 +99,8 @@ EXPORT_SYMBOL_GPL(hv_get_register);
void hv_set_register(unsigned int reg, u64 value)
{
+ trace_hyperv_set_register(reg, value);
+
if (hv_nested)
reg = hv_get_nested_reg(reg);
--
2.25.1