From 6ff447b0904d87ef12a226d5b9837240378eb864 Mon Sep 17 00:00:00 2001 From: dv Date: Fri, 2 Sep 2022 17:46:37 +0000 Subject: [PATCH] vmm(4): add tracepoint for in/out handler. 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 | 8 +++++++- sys/dev/dt/dt_prov_static.c | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index a51c79272a9..c3d957cfb90 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -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 * @@ -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); diff --git a/sys/dev/dt/dt_prov_static.c b/sys/dev/dt/dt_prov_static.c index 611269fb390..96e6101e7ef 100644 --- a/sys/dev/dt/dt_prov_static.c +++ b/sys/dev/dt/dt_prov_static.c @@ -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 @@ -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__ */ /* -- 2.20.1