<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/trace, branch v3.2.2</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/kernel/trace?h=v3.2.2</id>
<link rel='self' href='https://git.amat.us/linux/atom/kernel/trace?h=v3.2.2'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-01-26T00:13:29Z</updated>
<entry>
<title>ftrace: Fix unregister ftrace_ops accounting</title>
<updated>2012-01-26T00:13:29Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@redhat.com</email>
</author>
<published>2011-12-05T17:22:48Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=afe62ad1ea1e3e6e9f36ad115ad435a587cb23e7'/>
<id>urn:sha1:afe62ad1ea1e3e6e9f36ad115ad435a587cb23e7</id>
<content type='text'>
commit 30fb6aa74011dcf595f306ca2727254d708b786e upstream.

Multiple users of the function tracer can register their functions
with the ftrace_ops structure. The accounting within ftrace will
update the counter on each function record that is being traced.
When the ftrace_ops filtering adds or removes functions, the
function records will be updated accordingly if the ftrace_ops is
still registered.

When a ftrace_ops is removed, the counter of the function records,
that the ftrace_ops traces, are decremented. When they reach zero
the functions that they represent are modified to stop calling the
mcount code.

When changes are made, the code is updated via stop_machine() with
a command passed to the function to tell it what to do. There is an
ENABLE and DISABLE command that tells the called function to enable
or disable the functions. But the ENABLE is really a misnomer as it
should just update the records, as records that have been enabled
and now have a count of zero should be disabled.

The DISABLE command is used to disable all functions regardless of
their counter values. This is the big off switch and is not the
complement of the ENABLE command.

To make matters worse, when a ftrace_ops is unregistered and there
is another ftrace_ops registered, neither the DISABLE nor the
ENABLE command are set when calling into the stop_machine() function
and the records will not be updated to match their counter. A command
is passed to that function that will update the mcount code to call
the registered callback directly if it is the only one left. This
means that the ftrace_ops that is still registered will have its callback
called by all functions that have been set for it as well as the ftrace_ops
that was just unregistered.

Here's a way to trigger this bug. Compile the kernel with
CONFIG_FUNCTION_PROFILER set and with CONFIG_FUNCTION_GRAPH not set:

 CONFIG_FUNCTION_PROFILER=y
 # CONFIG_FUNCTION_GRAPH is not set

This will force the function profiler to use the function tracer instead
of the function graph tracer.

  # cd /sys/kernel/debug/tracing
  # echo schedule &gt; set_ftrace_filter
  # echo function &gt; current_tracer
  # cat set_ftrace_filter
 schedule
  # cat trace
 # tracer: nop
 #
 # entries-in-buffer/entries-written: 692/68108025   #P:4
 #
 #                              _-----=&gt; irqs-off
 #                             / _----=&gt; need-resched
 #                            | / _---=&gt; hardirq/softirq
 #                            || / _--=&gt; preempt-depth
 #                            ||| /     delay
 #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
 #              | |       |   ||||       |         |
      kworker/0:2-909   [000] ....   531.235574: schedule &lt;-worker_thread
           &lt;idle&gt;-0     [001] .N..   531.235575: schedule &lt;-cpu_idle
      kworker/0:2-909   [000] ....   531.235597: schedule &lt;-worker_thread
             sshd-2563  [001] ....   531.235647: schedule &lt;-schedule_hrtimeout_range_clock

  # echo 1 &gt; function_profile_enabled
  # echo 0 &gt; function_porfile_enabled
  # cat set_ftrace_filter
 schedule
  # cat trace
 # tracer: function
 #
 # entries-in-buffer/entries-written: 159701/118821262   #P:4
 #
 #                              _-----=&gt; irqs-off
 #                             / _----=&gt; need-resched
 #                            | / _---=&gt; hardirq/softirq
 #                            || / _--=&gt; preempt-depth
 #                            ||| /     delay
 #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
 #              | |       |   ||||       |         |
           &lt;idle&gt;-0     [002] ...1   604.870655: local_touch_nmi &lt;-cpu_idle
           &lt;idle&gt;-0     [002] d..1   604.870655: enter_idle &lt;-cpu_idle
           &lt;idle&gt;-0     [002] d..1   604.870656: atomic_notifier_call_chain &lt;-enter_idle
           &lt;idle&gt;-0     [002] d..1   604.870656: __atomic_notifier_call_chain &lt;-atomic_notifier_call_chain

The same problem could have happened with the trace_probe_ops,
but they are modified with the set_frace_filter file which does the
update at closure of the file.

The simple solution is to change ENABLE to UPDATE and call it every
time an ftrace_ops is unregistered.

Link: http://lkml.kernel.org/r/1323105776-26961-3-git-send-email-jolsa@redhat.com

Signed-off-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>ftrace: Fix hash record accounting bug</title>
<updated>2011-12-05T18:28:47Z</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2011-11-05T00:32:39Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ddf6e0e50723b62ac76ed18eb53e9417c6eefba7'/>
<id>urn:sha1:ddf6e0e50723b62ac76ed18eb53e9417c6eefba7</id>
<content type='text'>
If the set_ftrace_filter is cleared by writing just whitespace to
it, then the filter hash refcounts will be decremented but not
updated. This causes two bugs:

1) No functions will be enabled for tracing when they all should be

2) If the users clears the set_ftrace_filter twice, it will crash ftrace:

------------[ cut here ]------------
WARNING: at /home/rostedt/work/git/linux-trace.git/kernel/trace/ftrace.c:1384 __ftrace_hash_rec_update.part.27+0x157/0x1a7()
Modules linked in:
Pid: 2330, comm: bash Not tainted 3.1.0-test+ #32
Call Trace:
 [&lt;ffffffff81051828&gt;] warn_slowpath_common+0x83/0x9b
 [&lt;ffffffff8105185a&gt;] warn_slowpath_null+0x1a/0x1c
 [&lt;ffffffff810ba362&gt;] __ftrace_hash_rec_update.part.27+0x157/0x1a7
 [&lt;ffffffff810ba6e8&gt;] ? ftrace_regex_release+0xa7/0x10f
 [&lt;ffffffff8111bdfe&gt;] ? kfree+0xe5/0x115
 [&lt;ffffffff810ba51e&gt;] ftrace_hash_move+0x2e/0x151
 [&lt;ffffffff810ba6fb&gt;] ftrace_regex_release+0xba/0x10f
 [&lt;ffffffff8112e49a&gt;] fput+0xfd/0x1c2
 [&lt;ffffffff8112b54c&gt;] filp_close+0x6d/0x78
 [&lt;ffffffff8113a92d&gt;] sys_dup3+0x197/0x1c1
 [&lt;ffffffff8113a9a6&gt;] sys_dup2+0x4f/0x54
 [&lt;ffffffff8150cac2&gt;] system_call_fastpath+0x16/0x1b
---[ end trace 77a3a7ee73794a02 ]---

Link: http://lkml.kernel.org/r/20111101141420.GA4918@debian

Reported-by: Rabin Vincent &lt;rabin@rab.in&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Remove force undef config value left for testing</title>
<updated>2011-12-05T18:28:45Z</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2011-11-04T14:45:23Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c7c6ec8becaf742b223c7b491f4893014be23a07'/>
<id>urn:sha1:c7c6ec8becaf742b223c7b491f4893014be23a07</id>
<content type='text'>
A forced undef of a config value was used for testing and was
accidently left in during the final commit. This causes x86 to
run slower than needed while running function tracing as well
as causes the function graph selftest to fail when DYNMAIC_FTRACE
is not set. This is because the code in MCOUNT expects the ftrace
code to be processed with the config value set that happened to
be forced not set.

The forced config option was left in by:
    commit 6331c28c962561aee59e5a493b7556a4bb585957
    ftrace: Fix dynamic selftest failure on some archs

Link: http://lkml.kernel.org/r/20111102150255.GA6973@debian

Cc: stable@vger.kernel.org
Reported-by: Rabin Vincent &lt;rabin@rab.in&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Restore system filter behavior</title>
<updated>2011-12-05T18:28:45Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2011-11-01T01:09:35Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=27b14b56af081ec7edeefb3a38b2c9577cc5ef48'/>
<id>urn:sha1:27b14b56af081ec7edeefb3a38b2c9577cc5ef48</id>
<content type='text'>
Though not all events have field 'prev_pid', it was allowed to do this:

  # echo 'prev_pid == 100' &gt; events/sched/filter

but commit 75b8e98263fdb0bfbdeba60d4db463259f1fe8a2 (tracing/filter: Swap
entire filter of events) broke it without any reason.

Link: http://lkml.kernel.org/r/4EAF46CF.8040408@cn.fujitsu.com

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: fix event_subsystem ref counting</title>
<updated>2011-12-05T18:28:44Z</updated>
<author>
<name>Ilya Dryomov</name>
<email>idryomov@gmail.com</email>
</author>
<published>2011-10-31T09:07:42Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=cb59974742aea24adf6637eb0c4b8e7b48bca6fb'/>
<id>urn:sha1:cb59974742aea24adf6637eb0c4b8e7b48bca6fb</id>
<content type='text'>
Fix a bug introduced by e9dbfae5, which prevents event_subsystem from
ever being released.

Ref_count was added to keep track of subsystem users, not for counting
events.  Subsystem is created with ref_count = 1, so there is no need to
increment it for every event, we have nr_events for that.  Fix this by
touching ref_count only when we actually have a new user -
subsystem_open().

Cc: stable@vger.kernel.org
Signed-off-by: Ilya Dryomov &lt;idryomov@gmail.com&gt;
Link: http://lkml.kernel.org/r/1320052062-7846-1-git-send-email-idryomov@gmail.com
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>trace_events_filter: Use rcu_assign_pointer() when setting ftrace_event_call-&gt;filter</title>
<updated>2011-12-02T03:16:47Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-11-23T16:49:49Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d3d9acf646679c1981032b0985b386d12fccc60c'/>
<id>urn:sha1:d3d9acf646679c1981032b0985b386d12fccc60c</id>
<content type='text'>
ftrace_event_call-&gt;filter is sched RCU protected but didn't use
rcu_assign_pointer().  Use it.

TODO: Add proper __rcu annotation to call-&gt;filter and all its users.

-v2: Use RCU_INIT_POINTER() for %NULL clearing as suggested by Eric.

Link: http://lkml.kernel.org/r/20111123164949.GA29639@google.com

Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: stable@kernel.org # (2.6.39+)
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>kernel: Fix files explicitly needing EXPORT_SYMBOL infrastructure</title>
<updated>2011-10-31T23:30:05Z</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2011-05-26T20:00:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6e5fdeedca610df600aabc393c4b1f44b128fe49'/>
<id>urn:sha1:6e5fdeedca610df600aabc393c4b1f44b128fe49</id>
<content type='text'>
These files were getting &lt;linux/module.h&gt; via an implicit non-obvious
path, but we want to crush those out of existence since they cost
time during compiles of processing thousands of lines of headers
for no reason.  Give them the lightweight header that just contains
the EXPORT_SYMBOL infrastructure.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>kernel: Add &lt;linux/module.h&gt; to files using it implicitly</title>
<updated>2011-10-31T13:20:12Z</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2011-05-26T21:53:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=56d82e000cdfb51aa92241d4682302f78c35cd92'/>
<id>urn:sha1:56d82e000cdfb51aa92241d4682302f78c35cd92</id>
<content type='text'>
These files are doing things like module_put and try_module_get
so they need to call out the module.h for explicit inclusion,
rather than getting it via &lt;linux/device.h&gt; which we ideally want
to remove the module.h inclusion from.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2011-10-26T15:03:38Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2011-10-26T15:03:38Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7115e3fcf45514db7525a05365b10454ff7f345e'/>
<id>urn:sha1:7115e3fcf45514db7525a05365b10454ff7f345e</id>
<content type='text'>
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (121 commits)
  perf symbols: Increase symbol KSYM_NAME_LEN size
  perf hists browser: Refuse 'a' hotkey on non symbolic views
  perf ui browser: Use libslang to read keys
  perf tools: Fix tracing info recording
  perf hists browser: Elide DSO column when it is set to just one DSO, ditto for threads
  perf hists: Don't consider filtered entries when calculating column widths
  perf hists: Don't decay total_period for filtered entries
  perf hists browser: Honour symbol_conf.show_{nr_samples,total_period}
  perf hists browser: Do not exit on tab key with single event
  perf annotate browser: Don't change selection line when returning from callq
  perf tools: handle endianness of feature bitmap
  perf tools: Add prelink suggestion to dso update message
  perf script: Fix unknown feature comment
  perf hists browser: Apply the dso and thread filters when merging new batches
  perf hists: Move the dso and thread filters from hist_browser
  perf ui browser: Honour the xterm colors
  perf top tui: Give color hints just on the percentage, like on --stdio
  perf ui browser: Make the colors configurable and change the defaults
  perf tui: Remove unneeded call to newtCls on startup
  perf hists: Don't format the percentage on hist_entry__snprintf
  ...

Fix up conflicts in arch/x86/kernel/kprobes.c manually.

Ingo's tree did the insane "add volatile to const array", which just
doesn't make sense ("volatile const"?).  But we could remove the const
*and* make the array volatile to make doubly sure that gcc doesn't
optimize it away..

Also fix up kernel/trace/ring_buffer.c non-data-conflicts manually: the
reader_lock has been turned into a raw lock by the core locking merge,
and there was a new user of it introduced in this perf core merge.  Make
sure that new use also uses the raw accessor functions.
</content>
</entry>
<entry>
<title>Merge branch 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2011-10-26T14:17:32Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2011-10-26T14:17:32Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=3cfef9524677a4ecb392d6fbffe6ebce6302f1d4'/>
<id>urn:sha1:3cfef9524677a4ecb392d6fbffe6ebce6302f1d4</id>
<content type='text'>
* 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (27 commits)
  rtmutex: Add missing rcu_read_unlock() in debug_rt_mutex_print_deadlock()
  lockdep: Comment all warnings
  lib: atomic64: Change the type of local lock to raw_spinlock_t
  locking, lib/atomic64: Annotate atomic64_lock::lock as raw
  locking, x86, iommu: Annotate qi-&gt;q_lock as raw
  locking, x86, iommu: Annotate irq_2_ir_lock as raw
  locking, x86, iommu: Annotate iommu-&gt;register_lock as raw
  locking, dma, ipu: Annotate bank_lock as raw
  locking, ARM: Annotate low level hw locks as raw
  locking, drivers/dca: Annotate dca_lock as raw
  locking, powerpc: Annotate uic-&gt;lock as raw
  locking, x86: mce: Annotate cmci_discover_lock as raw
  locking, ACPI: Annotate c3_lock as raw
  locking, oprofile: Annotate oprofilefs lock as raw
  locking, video: Annotate vga console lock as raw
  locking, latencytop: Annotate latency_lock as raw
  locking, timer_stats: Annotate table_lock as raw
  locking, rwsem: Annotate inner lock as raw
  locking, semaphores: Annotate inner lock as raw
  locking, sched: Annotate thread_group_cputimer as raw
  ...

Fix up conflicts in kernel/posix-cpu-timers.c manually: making
cputimer-&gt;cputime a raw lock conflicted with the ABBA fix in commit
bcd5cff7216f ("cputimer: Cure lock inversion").
</content>
</entry>
</feed>
