vmm(4): add tracepoint for in/out handler.
authordv <dv@openbsd.org>
Fri, 2 Sep 2022 17:46:37 +0000 (17:46 +0000)
committerdv <dv@openbsd.org>
Fri, 2 Sep 2022 17:46:37 +0000 (17:46 +0000)
Inserts a new static dt(4) tracepoint in vmm(4) to report details
on in/out instructions (direction, port, and data).

ok mlarkin@

sys/arch/amd64/amd64/vmm.c
sys/dev/dt/dt_prov_static.c

index a51c792..c3d957c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: vmm.c,v 1.321 2022/09/01 22:01:40 dv Exp $    */
+/*     $OpenBSD: vmm.c,v 1.322 2022/09/02 17:46:37 dv Exp $    */
 /*
  * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
  *
@@ -6081,6 +6081,9 @@ svm_handle_inout(struct vcpu *vcpu)
        /* Data */
        vcpu->vc_exit.vei.vei_data = vmcb->v_rax;
 
+       TRACEPOINT(vmm, inout, vcpu, vcpu->vc_exit.vei.vei_port,
+           vcpu->vc_exit.vei.vei_dir, vcpu->vc_exit.vei.vei_data);
+
        vcpu->vc_gueststate.vg_rip += insn_length;
 
        return (0);
@@ -6137,6 +6140,9 @@ vmx_handle_inout(struct vcpu *vcpu)
        /* Data */
        vcpu->vc_exit.vei.vei_data = (uint32_t)vcpu->vc_gueststate.vg_rax;
 
+       TRACEPOINT(vmm, inout, vcpu, vcpu->vc_exit.vei.vei_port,
+           vcpu->vc_exit.vei.vei_dir, vcpu->vc_exit.vei.vei_data);
+
        vcpu->vc_gueststate.vg_rip += insn_length;
 
        return (0);
index 611269f..96e6101 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dt_prov_static.c,v 1.15 2022/08/29 07:51:45 bluhm Exp $ */
+/*     $OpenBSD: dt_prov_static.c,v 1.16 2022/09/02 17:46:37 dv Exp $ */
 
 /*
  * Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
@@ -75,6 +75,7 @@ DT_STATIC_PROBE4(vfs, cleaner, "long", "int", "long", "long");
  */
 DT_STATIC_PROBE2(vmm, guest_enter, "void *", "void *");
 DT_STATIC_PROBE3(vmm, guest_exit, "void *", "void *", "uint64_t");
+DT_STATIC_PROBE4(vmm, inout, "void *", "uint16_t", "uint8_t", "uint32_t");
 #endif /* __amd64__ */
 
 /*