From 0ae6857148f68539a40877df4c718940b1844a81 Mon Sep 17 00:00:00 2001 From: jasper Date: Mon, 25 Oct 2021 17:15:29 +0000 Subject: [PATCH] remove dtp_mtx which protected dtp_ref; the code is always called with KERNEL_LOCK() held discussed with and OK mpi@ --- sys/dev/dt/dt_prov_kprobe.c | 15 +-------------- sys/dev/dt/dtvar.h | 3 +-- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/sys/dev/dt/dt_prov_kprobe.c b/sys/dev/dt/dt_prov_kprobe.c index f239ad15e9c..5275b61e01d 100644 --- a/sys/dev/dt/dt_prov_kprobe.c +++ b/sys/dev/dt/dt_prov_kprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dt_prov_kprobe.c,v 1.1 2021/09/03 16:45:45 jasper Exp $ */ +/* $OpenBSD: dt_prov_kprobe.c,v 1.2 2021/10/25 17:15:29 jasper Exp $ */ /* * Copyright (c) 2020 Tom Rollet @@ -243,7 +243,6 @@ dt_prov_kprobe_alloc(struct dt_probe *dtp, struct dt_softc *sc, return ENOMEM; /* Patch only if it's first pcb referencing this probe */ - mtx_enter(&dtp->dtp_mtx); dtp->dtp_ref++; KASSERT(dtp->dtp_ref != 0); @@ -252,7 +251,6 @@ dt_prov_kprobe_alloc(struct dt_probe *dtp, struct dt_softc *sc, db_write_bytes(dtp->dtp_addr, BKPT_SIZE, &patch); intr_restore(s); } - mtx_leave(&dtp->dtp_mtx); dp->dp_filter = dtrq->dtrq_filter; dp->dp_evtflags = dtrq->dtrq_evtflags & DTEVT_PROV_KPROBE; @@ -282,7 +280,6 @@ dt_prov_kprobe_dealloc(struct dt_probe *dtp, struct dt_softc *sc, } else KASSERT(0 && "Trying to dealloc not yet implemented probe type"); - mtx_enter(&dtp->dtp_mtx); dtp->dtp_ref--; if (dtp->dtp_ref == 0) { @@ -291,8 +288,6 @@ dt_prov_kprobe_dealloc(struct dt_probe *dtp, struct dt_softc *sc, intr_restore(s); } - mtx_leave(&dtp->dtp_mtx); - /* Deallocation of PCB is done by dt_pcb_purge when closing the dev */ return 0; } @@ -417,8 +412,6 @@ dt_prov_kprobe_patch_all_entry(void) for (i = 0; i < PPTMASK; ++i) { SLIST_FOREACH(kprobe_dtp, &dtpf_entry[i], kprobe_next) { dtp = kprobe_dtp->dtp; - - mtx_enter(&dtp->dtp_mtx); dtp->dtp_ref++; if (dtp->dtp_ref == 1) { @@ -427,8 +420,6 @@ dt_prov_kprobe_patch_all_entry(void) db_write_bytes(dtp->dtp_addr, BKPT_SIZE, &patch); intr_restore(s); } - - mtx_leave(&dtp->dtp_mtx); } } } @@ -445,8 +436,6 @@ dt_prov_kprobe_depatch_all_entry(void) for (i = 0; i < PPTMASK; ++i) { SLIST_FOREACH(kprobe_dtp, &dtpf_entry[i], kprobe_next) { dtp = kprobe_dtp->dtp; - - mtx_enter(&dtp->dtp_mtx); dtp->dtp_ref--; if (dtp->dtp_ref == 0) { @@ -455,8 +444,6 @@ dt_prov_kprobe_depatch_all_entry(void) db_write_bytes(dtp->dtp_addr, SSF_SIZE, &patch); intr_restore(s); } - - mtx_leave(&dtp->dtp_mtx); } } diff --git a/sys/dev/dt/dtvar.h b/sys/dev/dt/dtvar.h index db47cfd4ea5..e90e44f28ed 100644 --- a/sys/dev/dt/dtvar.h +++ b/sys/dev/dt/dtvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dtvar.h,v 1.8 2021/09/03 16:45:45 jasper Exp $ */ +/* $OpenBSD: dtvar.h,v 1.9 2021/10/25 17:15:29 jasper Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot @@ -215,7 +215,6 @@ struct dt_probe { const char *dtp_name; /* [I] probe name */ uint32_t dtp_pbn; /* [I] unique ID */ volatile uint32_t dtp_recording; /* [d] is it recording? */ - struct mutex dtp_mtx; unsigned dtp_ref; /* [m] # of PCBs referencing the probe */ /* Provider specific fields. */ -- 2.20.1