]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Fixes for tracepoint cleanup.
authorKris Van Hees <kris.van.hees@oracle.com>
Wed, 22 May 2013 23:25:48 +0000 (19:25 -0400)
committerKris Van Hees <kris.van.hees@oracle.com>
Wed, 22 May 2013 23:25:48 +0000 (19:25 -0400)
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 <kris.van.hees@oracle.com>
dtrace/fasttrap_dev.c

index cedf4ebf4966228d0056a51bbfc433b0f988821b..c399e311393f0cd3c59e55390a0bb3b6384c6ce6 100644 (file)
@@ -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);