Skip to contentSkip to conversation

x86/hyperv: Trace hv_set_register()

PATCH In review Nischala Yelchuri 2 participants 2 messages Jun 7, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hyperv: Trace hv_set_register()

Add a new trace point trace_hyperv_set_register()
to capture register address and its value in hv_set_register().

---
 arch/x86/include/asm/trace/hyperv.h | 14 ++++++++++++++
 arch/x86/kernel/cpu/mshyperv.c      |  3 +++
 2 files changed, 17 insertions(+)
arch/x86/include/asm/trace/hyperv.h +14 -0
index a8e5a7a2b..54b2f69f5 100644
@@ -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
arch/x86/kernel/cpu/mshyperv.c +3 -0
index c7969e806..d4ef63f4e 100644
@@ -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);
 
Signature · 1 line
2.25.1
#1 lore raw

arch/x86/kernel/cpu/mshyperv.c EXPORT_SYMBOL_GPL(hv_get_register); · line 105

Quoted 6 lines · Nischala Yelchuri

void hv_set_register(unsigned int reg, u64 value) {

arch/x86/kernel/cpu/mshyperv.c +2 -0
+	trace_hyperv_set_register(reg, value);
+
 	if (hv_nested)
 		reg = hv_get_nested_reg(reg);

I can't help but wonder if this is just a patch for people that don't know how to set kprobes.