KVM: Add trace_kvm_vm_set_mem_attributes()
Add a tracing function that, for a guest memory range, displays the start and end addresses plus the per-page attributes being set. Signed-off-by: Liam Merwick <liam.merwick@oracle.com> Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com> Link: https://lore.kernel.org/r/20250609091121.2497429-3-liam.merwick@oracle.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
committed by
Sean Christopherson
parent
28224ef02b
commit
741e595f02
@@ -473,6 +473,33 @@ TRACE_EVENT(kvm_dirty_ring_exit,
|
||||
TP_printk("vcpu %d", __entry->vcpu_id)
|
||||
);
|
||||
|
||||
#ifdef CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES
|
||||
/*
|
||||
* @start: Starting address of guest memory range
|
||||
* @end: End address of guest memory range
|
||||
* @attr: The value of the attribute being set.
|
||||
*/
|
||||
TRACE_EVENT(kvm_vm_set_mem_attributes,
|
||||
TP_PROTO(gfn_t start, gfn_t end, unsigned long attr),
|
||||
TP_ARGS(start, end, attr),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(gfn_t, start)
|
||||
__field(gfn_t, end)
|
||||
__field(unsigned long, attr)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->start = start;
|
||||
__entry->end = end;
|
||||
__entry->attr = attr;
|
||||
),
|
||||
|
||||
TP_printk("%#016llx -- %#016llx [0x%lx]",
|
||||
__entry->start, __entry->end, __entry->attr)
|
||||
);
|
||||
#endif /* CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES */
|
||||
|
||||
TRACE_EVENT(kvm_unmap_hva_range,
|
||||
TP_PROTO(unsigned long start, unsigned long end),
|
||||
TP_ARGS(start, end),
|
||||
|
||||
@@ -2558,6 +2558,8 @@ static int kvm_vm_set_mem_attributes(struct kvm *kvm, gfn_t start, gfn_t end,
|
||||
|
||||
entry = attributes ? xa_mk_value(attributes) : NULL;
|
||||
|
||||
trace_kvm_vm_set_mem_attributes(start, end, attributes);
|
||||
|
||||
mutex_lock(&kvm->slots_lock);
|
||||
|
||||
/* Nothing to do if the entire range as the desired attributes. */
|
||||
|
||||
Reference in New Issue
Block a user