From: Kris Van Hees Date: Wed, 22 May 2013 23:25:48 +0000 (-0400) Subject: Fixes for tracepoint cleanup. X-Git-Tag: v4.1.12-111.0.20170907_2225~3^2~3^2~156 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=08465d1dcb94de00bf55e79eb4550d96924f69ca;p=users%2Fjedix%2Flinux-maple.git Fixes for tracepoint cleanup. Various fixes to handle tracepoint cleanup. It is important to note that it is most common that USDT providers will be cleaned up (asynchronously) when the process/task they relate to is already gone. We therefore cannot use a (pid, addr) pair to identify the tracepoint for removal. The new implementation stores the (inode, offset) pair calculated right before registering the uprobe, so that we can use that same pair again when unregistering. Signed-off-by: Kris Van Hees --- diff --git a/dtrace/fasttrap_dev.c b/dtrace/fasttrap_dev.c index cedf4ebf49662..c399e311393f0 100644 --- a/dtrace/fasttrap_dev.c +++ b/dtrace/fasttrap_dev.c @@ -434,7 +434,7 @@ pr_info("fasttrap_tracepoint_disable(PID %d, PC %ld)\n", pid, pc); mutex_unlock(&bucket->ftb_mtx); pr_info("fasttrap_tracepoint_disable: Disabling tracepoint for PID %d, PC %ld\n", pid, pc); - dtrace_tracepoint_disable(pid, pc, &tp->ftt_mtp); + dtrace_tracepoint_disable(pid, &tp->ftt_mtp); /* * Remove the probe from the hash table of active tracepoints. @@ -545,6 +545,7 @@ static int fasttrap_pid_enable(void *arg, dtrace_id_t id, void *parg) * created so far for this probe. */ while (i >= 0) { +pr_info("%s: Calling fasttrap_tracepoint_disable()...\n", __FUNCTION__); fasttrap_tracepoint_disable(probe, i); i--; } @@ -566,9 +567,9 @@ static int fasttrap_pid_enable(void *arg, dtrace_id_t id, void *parg) #ifdef FIXME mutex_enter(&p->p_lock); sprunlock(p); +#endif probe->ftp_enabled = 1; -#endif return 0; } @@ -587,9 +588,13 @@ pr_info(" Locked ftp_mtx...\n"); /* * Disable all the associated tracepoints (for fully enabled probes). */ +pr_info("%s: probe->ftp_enabled = %d\n", __FUNCTION__, probe->ftp_enabled); if (probe->ftp_enabled) { for (i = 0; i < probe->ftp_ntps; i++) +{ +pr_info("%s: Calling fasttrap_tracepoint_disable()...\n", __FUNCTION__); fasttrap_tracepoint_disable(probe, i); +} } ASSERT(prov->ftp_rcount > 0); @@ -1132,6 +1137,7 @@ static void fasttrap_pid_cleanup_cb(struct work_struct *work) { pr_info("fasttrap_pid_cleanup_cb: [CPU%02d] fasttrap_cleanup_work = %d, fasttrap_cleanup_state = %d -> nothing to do\n", smp_processor_id(), fasttrap_cleanup_work, fasttrap_cleanup_state); mutex_unlock(&fasttrap_cleanup_mtx); + in = 0; return; } pr_info("fasttrap_pid_cleanup_cb: [CPU%02d] fasttrap_cleanup_work = %d\n", smp_processor_id(), fasttrap_cleanup_work);