* [PATCH] mshv: Fix incorrect access type usage in GPA intercept trace event
@ 2026-04-22 3:00 Stanislav Kinsburskii
2026-04-22 6:25 ` Wei Liu
0 siblings, 1 reply; 2+ messages in thread
From: Stanislav Kinsburskii @ 2026-04-22 3:00 UTC (permalink / raw)
To: kys, haiyangz, wei.liu, decui, longli; +Cc: linux-hyperv, linux-kernel
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 <skinsburskii@linux.microsoft.com>
---
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
)
);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mshv: Fix incorrect access type usage in GPA intercept trace event
2026-04-22 3:00 [PATCH] mshv: Fix incorrect access type usage in GPA intercept trace event Stanislav Kinsburskii
@ 2026-04-22 6:25 ` Wei Liu
0 siblings, 0 replies; 2+ messages in thread
From: Wei Liu @ 2026-04-22 6:25 UTC (permalink / raw)
To: Stanislav Kinsburskii
Cc: kys, haiyangz, wei.liu, decui, longli, linux-hyperv, linux-kernel
On Wed, Apr 22, 2026 at 03:00:13AM +0000, Stanislav Kinsburskii wrote:
> 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")
This is not yet in Linus' tree.
I folded this into the original patch.
Wei
> Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
> ---
> 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
> )
> );
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-22 6:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-22 3:00 [PATCH] mshv: Fix incorrect access type usage in GPA intercept trace event Stanislav Kinsburskii
2026-04-22 6:25 ` Wei Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox