Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mshv: Add tracepoint for GPA intercept handling

Provide visibility into GPA intercept operations for debugging and
performance analysis of Microsoft Hypervisor guest memory management.

Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>

authored by

Stanislav Kinsburskii and committed by
Wei Liu
cfc42685 404cd6bf

+33 -2
+4 -2
drivers/hv/mshv_root_main.c
··· 674 674 675 675 region = mshv_partition_region_by_gfn_get(p, gfn); 676 676 if (!region) 677 - return false; 677 + goto out; 678 678 679 679 if (access_type == HV_INTERCEPT_ACCESS_WRITE && 680 680 !(region->hv_map_flags & HV_MAP_GPA_WRITABLE)) ··· 690 690 691 691 put_region: 692 692 mshv_region_put(region); 693 - 693 + out: 694 + trace_mshv_handle_gpa_intercept(p->pt_id, vp->vp_index, gfn, 695 + access_type, ret); 694 696 return ret; 695 697 } 696 698
+29
drivers/hv/mshv_trace.h
··· 12 12 #define _MSHV_TRACE_H_ 13 13 14 14 #include <linux/tracepoint.h> 15 + #include <hyperv/hvhdk.h> 15 16 16 17 #undef TRACE_INCLUDE_PATH 17 18 #define TRACE_INCLUDE_PATH ../../drivers/hv ··· 507 506 __entry->kicked_by_hv, 508 507 __entry->blocked, 509 508 __entry->irq_pending 509 + ) 510 + ); 511 + 512 + TRACE_EVENT(mshv_handle_gpa_intercept, 513 + TP_PROTO(u64 partition_id, u32 vp_index, u64 gfn, u8 access_type, bool handled), 514 + TP_ARGS(partition_id, vp_index, gfn, access_type, handled), 515 + TP_STRUCT__entry( 516 + __field(u64, partition_id) 517 + __field(u32, vp_index) 518 + __field(u64, gfn) 519 + __field(u8, access_type) 520 + __field(bool, handled) 521 + ), 522 + TP_fast_assign( 523 + __entry->partition_id = partition_id; 524 + __entry->vp_index = vp_index; 525 + __entry->gfn = gfn; 526 + __entry->access_type = access_type == HV_INTERCEPT_ACCESS_READ ? 'R' : 527 + (access_type == HV_INTERCEPT_ACCESS_WRITE ? 'W' : 528 + (access_type == HV_INTERCEPT_ACCESS_EXECUTE ? 'X' : '?')); 529 + __entry->handled = handled; 530 + ), 531 + TP_printk("partition_id=%llu vp_index=%u gfn=0x%llx access_type=%c handled=%d", 532 + __entry->partition_id, 533 + __entry->vp_index, 534 + __entry->gfn, 535 + __entry->access_type, 536 + __entry->handled 510 537 ) 511 538 ); 512 539