linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/hyperv: Trace hv_set_register()
@ 2023-06-07  1:35 Nischala Yelchuri
  2023-06-07 11:27 ` Dave Hansen
  0 siblings, 1 reply; 2+ messages in thread
From: Nischala Yelchuri @ 2023-06-07  1:35 UTC (permalink / raw)
  To: linux-hyperv, linux-kernel
  Cc: Tyler Hicks, boqun.feng, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
	Dexuan Cui, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Nischala Yelchuri,
	Nischala Yelchuri

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@linux.microsoft.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/hyperv: Trace hv_set_register()
  2023-06-07  1:35 [PATCH] x86/hyperv: Trace hv_set_register() Nischala Yelchuri
@ 2023-06-07 11:27 ` Dave Hansen
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Hansen @ 2023-06-07 11:27 UTC (permalink / raw)
  To: Nischala Yelchuri, linux-hyperv, linux-kernel
  Cc: Tyler Hicks, boqun.feng, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
	Dexuan Cui, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Nischala Yelchuri

On 6/6/23 18:35, Nischala Yelchuri wrote:
>  void hv_set_register(unsigned int reg, u64 value)
>  {
> +	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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-07 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-07  1:35 [PATCH] x86/hyperv: Trace hv_set_register() Nischala Yelchuri
2023-06-07 11:27 ` Dave Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).