]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: arm64: Remove debug tracepoints
authorOliver Upton <oliver.upton@linux.dev>
Thu, 19 Dec 2024 22:41:06 +0000 (14:41 -0800)
committerMarc Zyngier <maz@kernel.org>
Fri, 20 Dec 2024 09:01:25 +0000 (09:01 +0000)
The debug tracepoints are a useless firehose of information that track
implementation detail rather than well-defined events. These are going
to be rather difficult to uphold now that the implementation is getting
redone, so throw them out instead of bending over backwards.

Tested-by: James Clark <james.clark@linaro.org>
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20241219224116.3941496-10-oliver.upton@linux.dev
[maz: fixed compilation after trace-ectomy]
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/debug.c
arch/arm64/kvm/sys_regs.c
arch/arm64/kvm/trace_handle_exit.h

index 548016439acaa73afc54508887a2d20ffb294f72..9979fc1a20bd3ad20eb688792c48cf35d8cc26f4 100644 (file)
@@ -14,7 +14,6 @@
 #include <asm/kvm_arm.h>
 #include <asm/kvm_emulate.h>
 
-#include "trace.h"
 
 /*
  * save/restore_guest_debug_regs
@@ -35,10 +34,6 @@ static void save_guest_debug_regs(struct kvm_vcpu *vcpu)
        u64 val = vcpu_read_sys_reg(vcpu, MDSCR_EL1);
 
        vcpu->arch.guest_debug_preserved.mdscr_el1 = val;
-
-       trace_kvm_arm_set_dreg32("Saved MDSCR_EL1",
-                               vcpu->arch.guest_debug_preserved.mdscr_el1);
-
        vcpu->arch.guest_debug_preserved.pstate_ss =
                                        (*vcpu_cpsr(vcpu) & DBG_SPSR_SS);
 }
@@ -49,9 +44,6 @@ static void restore_guest_debug_regs(struct kvm_vcpu *vcpu)
 
        vcpu_write_sys_reg(vcpu, val, MDSCR_EL1);
 
-       trace_kvm_arm_set_dreg32("Restored MDSCR_EL1",
-                               vcpu_read_sys_reg(vcpu, MDSCR_EL1));
-
        if (vcpu->arch.guest_debug_preserved.pstate_ss)
                *vcpu_cpsr(vcpu) |= DBG_SPSR_SS;
        else
@@ -110,8 +102,6 @@ static void kvm_arm_setup_mdcr_el2(struct kvm_vcpu *vcpu)
                write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2);
 
        preempt_enable();
-
-       trace_kvm_arm_set_dreg32("MDCR_EL2", vcpu->arch.mdcr_el2);
 }
 
 /**
@@ -158,8 +148,6 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
 {
        unsigned long mdscr;
 
-       trace_kvm_arm_setup_debug(vcpu, vcpu->guest_debug);
-
        kvm_arm_setup_mdcr_el2(vcpu);
 
        /* Check if we need to use the debug registers. */
@@ -209,8 +197,6 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
                        vcpu_write_sys_reg(vcpu, mdscr, MDSCR_EL1);
                }
 
-               trace_kvm_arm_set_dreg32("SPSR_EL2", *vcpu_cpsr(vcpu));
-
                /*
                 * HW Breakpoints and watchpoints
                 *
@@ -228,14 +214,6 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
                        vcpu->arch.debug_ptr = &vcpu->arch.external_debug_state;
                        vcpu_set_flag(vcpu, DEBUG_DIRTY);
 
-                       trace_kvm_arm_set_regset("BKPTS", get_num_brps(),
-                                               &vcpu->arch.debug_ptr->dbg_bcr[0],
-                                               &vcpu->arch.debug_ptr->dbg_bvr[0]);
-
-                       trace_kvm_arm_set_regset("WAPTS", get_num_wrps(),
-                                               &vcpu->arch.debug_ptr->dbg_wcr[0],
-                                               &vcpu->arch.debug_ptr->dbg_wvr[0]);
-
                /*
                 * The OS Lock blocks debug exceptions in all ELs when it is
                 * enabled. If the guest has enabled the OS Lock, constrain its
@@ -257,14 +235,10 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
        /* If KDE or MDE are set, perform a full save/restore cycle. */
        if (vcpu_read_sys_reg(vcpu, MDSCR_EL1) & (DBG_MDSCR_KDE | DBG_MDSCR_MDE))
                vcpu_set_flag(vcpu, DEBUG_DIRTY);
-
-       trace_kvm_arm_set_dreg32("MDSCR_EL1", vcpu_read_sys_reg(vcpu, MDSCR_EL1));
 }
 
 void kvm_arm_clear_debug(struct kvm_vcpu *vcpu)
 {
-       trace_kvm_arm_clear_debug(vcpu->guest_debug);
-
        /*
         * Restore the guest's debug registers if we were using them.
         */
@@ -286,14 +260,6 @@ void kvm_arm_clear_debug(struct kvm_vcpu *vcpu)
                 */
                if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW) {
                        kvm_arm_reset_debug_ptr(vcpu);
-
-                       trace_kvm_arm_set_regset("BKPTS", get_num_brps(),
-                                               &vcpu->arch.debug_ptr->dbg_bcr[0],
-                                               &vcpu->arch.debug_ptr->dbg_bvr[0]);
-
-                       trace_kvm_arm_set_regset("WAPTS", get_num_wrps(),
-                                               &vcpu->arch.debug_ptr->dbg_wcr[0],
-                                               &vcpu->arch.debug_ptr->dbg_wvr[0]);
                }
        }
 }
index e45a096be669249e3ab4269c16998ed465ccf410..8c5771572133a06a27d5aba35437ef25989d987a 100644 (file)
@@ -657,8 +657,6 @@ static bool trap_debug_regs(struct kvm_vcpu *vcpu,
                vcpu_set_flag(vcpu, DEBUG_DIRTY);
 
        kvm_debug_set_guest_ownership(vcpu);
-       trace_trap_reg(__func__, r->reg, p->is_write, p->regval);
-
        return true;
 }
 
@@ -711,8 +709,6 @@ static bool trap_bvr(struct kvm_vcpu *vcpu,
        else
                dbg_to_reg(vcpu, p, rd, dbg_reg);
 
-       trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg);
-
        return true;
 }
 
@@ -748,8 +744,6 @@ static bool trap_bcr(struct kvm_vcpu *vcpu,
        else
                dbg_to_reg(vcpu, p, rd, dbg_reg);
 
-       trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg);
-
        return true;
 }
 
@@ -785,9 +779,6 @@ static bool trap_wvr(struct kvm_vcpu *vcpu,
        else
                dbg_to_reg(vcpu, p, rd, dbg_reg);
 
-       trace_trap_reg(__func__, rd->CRm, p->is_write,
-               vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm]);
-
        return true;
 }
 
@@ -823,8 +814,6 @@ static bool trap_wcr(struct kvm_vcpu *vcpu,
        else
                dbg_to_reg(vcpu, p, rd, dbg_reg);
 
-       trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg);
-
        return true;
 }
 
index 064a58c19f4814490896b3af3967523cd47096bd..f85415db7713b7cab005fa5497e22412b9a6fee5 100644 (file)
@@ -46,38 +46,6 @@ TRACE_EVENT(kvm_hvc_arm64,
                  __entry->vcpu_pc, __entry->r0, __entry->imm)
 );
 
-TRACE_EVENT(kvm_arm_setup_debug,
-       TP_PROTO(struct kvm_vcpu *vcpu, __u32 guest_debug),
-       TP_ARGS(vcpu, guest_debug),
-
-       TP_STRUCT__entry(
-               __field(struct kvm_vcpu *, vcpu)
-               __field(__u32, guest_debug)
-       ),
-
-       TP_fast_assign(
-               __entry->vcpu = vcpu;
-               __entry->guest_debug = guest_debug;
-       ),
-
-       TP_printk("vcpu: %p, flags: 0x%08x", __entry->vcpu, __entry->guest_debug)
-);
-
-TRACE_EVENT(kvm_arm_clear_debug,
-       TP_PROTO(__u32 guest_debug),
-       TP_ARGS(guest_debug),
-
-       TP_STRUCT__entry(
-               __field(__u32, guest_debug)
-       ),
-
-       TP_fast_assign(
-               __entry->guest_debug = guest_debug;
-       ),
-
-       TP_printk("flags: 0x%08x", __entry->guest_debug)
-);
-
 /*
  * The dreg32 name is a leftover from a distant past. This will really
  * output a 64bit value...
@@ -99,49 +67,6 @@ TRACE_EVENT(kvm_arm_set_dreg32,
        TP_printk("%s: 0x%llx", __entry->name, __entry->value)
 );
 
-TRACE_DEFINE_SIZEOF(__u64);
-
-TRACE_EVENT(kvm_arm_set_regset,
-       TP_PROTO(const char *type, int len, __u64 *control, __u64 *value),
-       TP_ARGS(type, len, control, value),
-       TP_STRUCT__entry(
-               __field(const char *, name)
-               __field(int, len)
-               __array(u64, ctrls, 16)
-               __array(u64, values, 16)
-       ),
-       TP_fast_assign(
-               __entry->name = type;
-               __entry->len = len;
-               memcpy(__entry->ctrls, control, len << 3);
-               memcpy(__entry->values, value, len << 3);
-       ),
-       TP_printk("%d %s CTRL:%s VALUE:%s", __entry->len, __entry->name,
-               __print_array(__entry->ctrls, __entry->len, sizeof(__u64)),
-               __print_array(__entry->values, __entry->len, sizeof(__u64)))
-);
-
-TRACE_EVENT(trap_reg,
-       TP_PROTO(const char *fn, int reg, bool is_write, u64 write_value),
-       TP_ARGS(fn, reg, is_write, write_value),
-
-       TP_STRUCT__entry(
-               __field(const char *, fn)
-               __field(int, reg)
-               __field(bool, is_write)
-               __field(u64, write_value)
-       ),
-
-       TP_fast_assign(
-               __entry->fn = fn;
-               __entry->reg = reg;
-               __entry->is_write = is_write;
-               __entry->write_value = write_value;
-       ),
-
-       TP_printk("%s %s reg %d (0x%016llx)", __entry->fn,  __entry->is_write?"write to":"read from", __entry->reg, __entry->write_value)
-);
-
 TRACE_EVENT(kvm_handle_sys_reg,
        TP_PROTO(unsigned long hsr),
        TP_ARGS(hsr),