[kgtp] r918 committed - Change code to ignore the task that read the /sys/kernel/debug/gtpfram...

  • From: kgtp@xxxxxxxxxxxxxx
  • To: kgtp@xxxxxxxxxxxxx
  • Date: Fri, 17 Feb 2012 14:50:15 +0000

Revision: 918
Author:   teawater
Date:     Fri Feb 17 06:49:57 2012
Log: Change code to ignore the task that read the /sys/kernel/debug/gtpframe_pipe in default. And add special trace state variable $pipe_trace to control it.

http://code.google.com/p/kgtp/source/detail?r=918

Modified:
 /trunk/UPDATE
 /trunk/gtp.c

=======================================
--- /trunk/UPDATE       Mon Feb 13 16:02:45 2012
+++ /trunk/UPDATE       Fri Feb 17 06:49:57 2012
@@ -7,6 +7,9 @@

 * Fix the bug that set the id of FID_PAGE_BEGIN inside gtp_rb.

+* Change code to ignore the task that read the /sys/kernel/debug/gtpframe_pipe + in default. And add special trace state variable $pipe_trace to control it.
+
 *** 20120131

 * https://lkml.org/lkml/2012/1/31/215
=======================================
--- /trunk/gtp.c        Sat Feb  4 00:32:45 2012
+++ /trunk/gtp.c        Fri Feb 17 06:49:57 2012
@@ -431,7 +431,8 @@
        GTP_VAR_HARDIRQ_COUNT_ID,
        GTP_VAR_SOFTIRQ_COUNT_ID,
        GTP_VAR_IRQ_COUNT_ID,
-       GTP_VAR_SPECIAL_MAX = GTP_VAR_IRQ_COUNT_ID,
+       GTP_VAR_PIPE_TRACE_ID,
+       GTP_VAR_SPECIAL_MAX = GTP_VAR_PIPE_TRACE_ID,
 };

 #define PREV_VAR       NULL
@@ -565,6 +566,15 @@
 #undef PREV_VAR
 #define PREV_VAR       (&gtp_var_no_self_trace)

+static struct gtp_var          gtp_var_pipe_trace = {
+       .next           = PREV_VAR,
+       .num            = GTP_VAR_PIPE_TRACE_ID,
+       .src            = "0:1:706970655f7472616365",
+       .per_cpu        = NULL,
+};
+#undef PREV_VAR
+#define PREV_VAR       (&gtp_var_pipe_trace)
+
 static struct gtp_var          gtp_var_cpu_number = {
        .next           = PREV_VAR,
        .num            = GTP_VAR_CPU_NUMBER_ID,
@@ -724,6 +734,8 @@
 static uint64_t                        gtp_start_last_errno;
 static int                     gtp_start_ignore_error;

+static int                     gtp_pipe_trace;
+
 #ifdef GTP_RB
 #include "gtp_rb.c"
 #endif
@@ -3392,15 +3404,15 @@
        if (gts->tpe->kpreg == 0)
                return;

-       if (gts->tpe->no_self_trace) {
-               if (get_current()->pid == gtp_gtp_pid
-                   || get_current()->pid == gtp_gtpframe_pid)
-                       return;
-
 #if defined(GTP_FTRACE_RING_BUFFER) || defined(GTP_RB)
-               if (get_current()->pid == gtp_gtpframe_pipe_pid)
-                       return;
+       if (!gtp_pipe_trace && get_current()->pid == gtp_gtpframe_pipe_pid)
+               return;
 #endif
+
+       if (gts->tpe->no_self_trace
+           && (get_current()->pid == gtp_gtp_pid
+               || get_current()->pid == gtp_gtpframe_pid)) {
+                       return;
        }

        if (gts->tpe->have_printk) {
@@ -6016,6 +6028,8 @@
                        var->val = val;
                if (num == GTP_VAR_IGNORE_ERROR_ID)
                        gtp_start_ignore_error = (int)val;
+               else if (num == GTP_VAR_PIPE_TRACE_ID)
+                       gtp_pipe_trace = (int)val;

                return 0;
        }
@@ -6679,6 +6693,9 @@
        } else if (num == GTP_VAR_IGNORE_ERROR_ID) {
                val = (uint64_t)gtp_start_ignore_error;
                goto output_value;
+       } else if (num == GTP_VAR_PIPE_TRACE_ID) {
+               val = (uint64_t)gtp_pipe_trace;
+               goto output_value;
        } else if (num == GTP_VAR_VERSION_ID) {
                val = (uint64_t)GTP_VERSION;
                goto output_value;
@@ -8902,6 +8919,7 @@
        }
        gtp_start_last_errno = 0;
        gtp_start_ignore_error = 0;
+       gtp_pipe_trace = 0;
 #ifdef GTP_RB
        gtp_traceframe_info = NULL;
        gtp_traceframe_info_len = 0;

Other related posts:

  • » [kgtp] r918 committed - Change code to ignore the task that read the /sys/kernel/debug/gtpfram... - kgtp