)]}'
{
  "commit": "c85a17e22695969aa24a7ffa40cf26d6e6fcfd50",
  "tree": "2073f145261c6cdad39818993ddb8c099f1498ff",
  "parents": [
    "44ad18e0a65e296b2e68a1452509f6222cdce743"
  ],
  "author": {
    "name": "Frederic Weisbecker",
    "email": "fweisbec@gmail.com",
    "time": "Sat Jun 20 05:45:14 2009 +0200"
  },
  "committer": {
    "name": "Frederic Weisbecker",
    "email": "fweisbec@gmail.com",
    "time": "Sat Jun 20 06:28:46 2009 +0200"
  },
  "message": "tracing/urgent: fix unbalanced ftrace_start_up\n\nPerfcounter reports the following stats for a wide system\nprofiling:\n\n #\n # (2364 samples)\n #\n # Overhead  Symbol\n # ........  ......\n #\n    15.40%  [k] mwait_idle_with_hints\n     8.29%  [k] read_hpet\n     5.75%  [k] ftrace_caller\n     3.60%  [k] ftrace_call\n     [...]\n\nThis snapshot has been taken while neither the function tracer nor\nthe function graph tracer was running.\nWith dynamic ftrace, such results show a wrong ftrace behaviour\nbecause all calls to ftrace_caller or ftrace_graph_caller (the patched\ncalls to mcount) are supposed to be patched into nop if none of those\ntracers are running.\n\nThe problem occurs after the first run of the function tracer. Once we\nlaunch it a second time, the callsites will never be nopped back,\nunless you set custom filters.\nFor example it happens during the self tests at boot time.\nThe function tracer selftest runs, and then the dynamic tracing is\ntested too. After that, the callsites are left un-nopped.\n\nThis is because the reset callback of the function tracer tries to\nunregister two ftrace callbacks in once: the common function tracer\nand the function tracer with stack backtrace, regardless of which\none is currently in use.\nIt then creates an unbalance on ftrace_start_up value which is expected\nto be zero when the last ftrace callback is unregistered. When it\nreaches zero, the FTRACE_DISABLE_CALLS is set on the next ftrace\ncommand, triggering the patching into nop. But since it becomes\nunbalanced, ie becomes lower than zero, if the kernel functions\nare patched again (as in every further function tracer runs), they\nwon\u0027t ever be nopped back.\n\nNote that ftrace_call and ftrace_graph_call are still patched back\nto ftrace_stub in the off case, but not the callers of ftrace_call\nand ftrace_graph_caller. It means that the tracing is well deactivated\nbut we waste a useless call into every kernel function.\n\nThis patch just unregisters the right ftrace_ops for the function\ntracer on its reset callback and ignores the other one which is\nnot registered, fixing the unbalance. The problem also happens\nis .30\n\nSigned-off-by: Frederic Weisbecker \u003cfweisbec@gmail.com\u003e\nCc: Steven Rostedt \u003crostedt@goodmis.org\u003e\nCc: stable@kernel.org\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c9a0b7df44ff98b38ce20bba58ac2d6d2e963ad4",
      "old_mode": 33188,
      "old_path": "kernel/trace/trace_functions.c",
      "new_id": "90f134764837e80f38d4c4f09caa5ab8ee1ce17a",
      "new_mode": 33188,
      "new_path": "kernel/trace/trace_functions.c"
    }
  ]
}
