The trace event was checking for HV_INTERCEPT_ACCESS_READ twice in the
ternary operator chain instead of checking for EXECUTE, which would
cause execute accesses to be incorrectly displayed as '?' in traces.

Move the access type conversion to the TP_fast_assign section where
the raw value is available, rather than performing the conversion
during formatting. This eliminates the redundant checks and ensures
all access types are correctly identified and displayed.

Fixes: 03f7d01f699010 ("mshv: Add tracepoint for GPA intercept handling")
Signed-off-by: Stanislav Kinsburskii <[email protected]>
---
 drivers/hv/mshv_trace.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/hv/mshv_trace.h b/drivers/hv/mshv_trace.h
index 6b8fa477fa3bf..e7280c47e579a 100644
--- a/drivers/hv/mshv_trace.h
+++ b/drivers/hv/mshv_trace.h
@@ -524,16 +524,16 @@ TRACE_EVENT(mshv_handle_gpa_intercept,
                    __entry->partition_id = partition_id;
                    __entry->vp_index = vp_index;
                    __entry->gfn = gfn;
-                   __entry->access_type = access_type;
+                   __entry->access_type = access_type == 
HV_INTERCEPT_ACCESS_READ ? 'R' :
+                                          (access_type == 
HV_INTERCEPT_ACCESS_WRITE ? 'W' :
+                                           (access_type == 
HV_INTERCEPT_ACCESS_EXECUTE ? 'X' : '?'));
                    __entry->handled = handled;
            ),
            TP_printk("partition_id=%llu vp_index=%u gfn=0x%llx access_type=%c 
handled=%d",
                    __entry->partition_id,
                    __entry->vp_index,
                    __entry->gfn,
-                   __entry->access_type == HV_INTERCEPT_ACCESS_READ ? 'R' :
-                                   (__entry->access_type == 
HV_INTERCEPT_ACCESS_WRITE ? 'W' :
-                                   (__entry->access_type == 
HV_INTERCEPT_ACCESS_READ ? 'X' : '?')),
+                   __entry->access_type,
                    __entry->handled
            )
 );



Reply via email to