<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/samples/ftrace, branch v5.8</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.8</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.8'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-06-17T01:21:02Z</updated>
<entry>
<title>sample-trace-array: Remove trace_array 'sample-instance'</title>
<updated>2020-06-17T01:21:02Z</updated>
<author>
<name>Kefeng Wang</name>
<email>wangkefeng.wang@huawei.com</email>
</author>
<published>2020-06-09T13:52:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9fbc01cdba66e988122ccdc6094cfd85d9587769'/>
<id>urn:sha1:9fbc01cdba66e988122ccdc6094cfd85d9587769</id>
<content type='text'>
Remove trace_array 'sample-instance' if kthread_run fails
in sample_trace_array_init().

Link: https://lkml.kernel.org/r/20200609135200.2206726-1-wangkefeng.wang@huawei.com

Cc: stable@vger.kernel.org
Fixes: 89ed42495ef4a ("tracing: Sample module to demonstrate kernel access to Ftrace instances.")
Reviewed-by: Divya Indi &lt;divya.indi@oracle.com&gt;
Signed-off-by: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>sample-trace-array: Fix sleeping function called from invalid context</title>
<updated>2020-06-17T01:21:02Z</updated>
<author>
<name>Kefeng Wang</name>
<email>wangkefeng.wang@huawei.com</email>
</author>
<published>2020-06-10T01:12:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e9b7b1c0c103a623be1a65c39f98719803440871'/>
<id>urn:sha1:e9b7b1c0c103a623be1a65c39f98719803440871</id>
<content type='text'>
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:935
 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/5
 1 lock held by swapper/5/0:
  #0: ffff80001002bd90 (samples/ftrace/sample-trace-array.c:38){+.-.}-{0:0}, at: call_timer_fn+0x8/0x3e0
 CPU: 5 PID: 0 Comm: swapper/5 Not tainted 5.7.0+ #8
 Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
 Call trace:
  dump_backtrace+0x0/0x1a0
  show_stack+0x20/0x30
  dump_stack+0xe4/0x150
  ___might_sleep+0x160/0x200
  __might_sleep+0x58/0x90
  __mutex_lock+0x64/0x948
  mutex_lock_nested+0x3c/0x58
  __ftrace_set_clr_event+0x44/0x88
  trace_array_set_clr_event+0x24/0x38
  mytimer_handler+0x34/0x40 [sample_trace_array]

mutex_lock() will be called in interrupt context, using workqueue to fix it.

Link: https://lkml.kernel.org/r/20200610011244.2209486-1-wangkefeng.wang@huawei.com

Cc: stable@vger.kernel.org
Fixes: 89ed42495ef4 ("tracing: Sample module to demonstrate kernel access to Ftrace instances.")
Reviewed-by: Divya Indi &lt;divya.indi@oracle.com&gt;
Signed-off-by: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>samples/ftrace: Fix asm function ELF annotations</title>
<updated>2020-05-20T13:30:43Z</updated>
<author>
<name>Josh Poimboeuf</name>
<email>jpoimboe@redhat.com</email>
</author>
<published>2020-04-24T20:40:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9d907f1ae80b8a67d5397e26912b9d56d0b70a02'/>
<id>urn:sha1:9d907f1ae80b8a67d5397e26912b9d56d0b70a02</id>
<content type='text'>
Enable objtool coverage for the sample ftrace modules by adding ELF
annotations to the asm trampoline functions.

  samples/ftrace/ftrace-direct.o: warning: objtool: .text+0x0: unreachable instruction
  samples/ftrace/ftrace-direct-modify.o: warning: objtool: .text+0x0: unreachable instruction
  samples/ftrace/ftrace-direct-too.o: warning: objtool: .text+0x0: unreachable instruction

Reported-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Signed-off-by: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
</content>
</entry>
<entry>
<title>tracing: Sample module to demonstrate kernel access to Ftrace instances.</title>
<updated>2019-11-23T00:41:08Z</updated>
<author>
<name>Divya Indi</name>
<email>divya.indi@oracle.com</email>
</author>
<published>2019-11-20T19:08:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=89ed42495ef4a020435f2b999093bb5731eeb8b9'/>
<id>urn:sha1:89ed42495ef4a020435f2b999093bb5731eeb8b9</id>
<content type='text'>
This is a sample module to demonstrate the use of the newly introduced and
exported APIs to access Ftrace instances from within the kernel.

Newly introduced APIs used here -

1. Create/Lookup a trace array with the given name.
struct trace_array *trace_array_get_by_name(const char *name)

2. Destroy/Remove a trace array.
int trace_array_destroy(struct trace_array *tr)

4. Enable/Disable trace events:
int trace_array_set_clr_event(struct trace_array *tr, const char *system,
        const char *event, bool enable);

Exported APIs -
1. trace_printk equivalent for instances.
int trace_array_printk(struct trace_array *tr,
               unsigned long ip, const char *fmt, ...);

2. Helper function.
void trace_printk_init_buffers(void);

3. To decrement the reference counter.
void trace_array_put(struct trace_array *tr)

Sample output(contents of /sys/kernel/tracing/instances/sample-instance)
NOTE: Tracing disabled after ~5 sec)

                              _-----=&gt; irqs-off
                             / _----=&gt; need-resched
                            | / _---=&gt; hardirq/softirq
                            || / _--=&gt; preempt-depth
                            ||| /     delay
           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
              | |       |   ||||       |         |
sample-instance-1452  [002] ....    49.430948: simple_thread: trace_array_printk: count=0
sample-instance-1452  [002] ....    49.430951: sample_event: count value=0 at jiffies=4294716608
sample-instance-1452  [002] ....    50.454847: simple_thread: trace_array_printk: count=1
sample-instance-1452  [002] ....    50.454849: sample_event: count value=1 at jiffies=4294717632
sample-instance-1452  [002] ....    51.478748: simple_thread: trace_array_printk: count=2
sample-instance-1452  [002] ....    51.478750: sample_event: count value=2 at jiffies=4294718656
sample-instance-1452  [002] ....    52.502652: simple_thread: trace_array_printk: count=3
sample-instance-1452  [002] ....    52.502655: sample_event: count value=3 at jiffies=4294719680
sample-instance-1452  [002] ....    53.526533: simple_thread: trace_array_printk: count=4
sample-instance-1452  [002] ....    53.526535: sample_event: count value=4 at jiffies=4294720704
sample-instance-1452  [002] ....    54.550438: simple_thread: trace_array_printk: count=5
sample-instance-1452  [002] ....    55.574336: simple_thread: trace_array_printk: count=6

Link: http://lkml.kernel.org/r/1574276919-11119-3-git-send-email-divya.indi@oracle.com

Reviewed-by: Aruna Ramakrishna &lt;aruna.ramakrishna@oracle.com&gt;
Signed-off-by: Divya Indi &lt;divya.indi@oracle.com&gt;
[ Moved to samples/ftrace ]
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace/selftests: Fix spelling mistake "wakeing" -&gt; "waking"</title>
<updated>2019-11-15T16:30:38Z</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2019-11-15T08:59:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=760f8bc7c89c87bff9c01a8746e85dcc6e771ea8'/>
<id>urn:sha1:760f8bc7c89c87bff9c01a8746e85dcc6e771ea8</id>
<content type='text'>
There is a spelling mistake in a trace_printk message. As well as in
the selftests that search for this string.

Link: http://lkml.kernel.org/r/20191115085938.38947-1-colin.king@canonical.com
Link: http://lkml.kernel.org/r/20191115090356.39572-1-colin.king@canonical.com

Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace/samples: Add a sample module that implements modify_ftrace_direct()</title>
<updated>2019-11-15T03:45:47Z</updated>
<author>
<name>Steven Rostedt (VMware)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2019-11-14T19:41:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ae0cc3b7e7f5e37b946876e114068f92b33dfa5a'/>
<id>urn:sha1:ae0cc3b7e7f5e37b946876e114068f92b33dfa5a</id>
<content type='text'>
Add a sample module that tests modify_ftrace_direct(), and this can be used
by the selftests as well.

Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Add another example of register_ftrace_direct() use case</title>
<updated>2019-11-13T14:36:49Z</updated>
<author>
<name>Steven Rostedt (VMware)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2019-11-08T20:27:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=156473a0ff4f9c209114b4c3ad968099eb541e33'/>
<id>urn:sha1:156473a0ff4f9c209114b4c3ad968099eb541e33</id>
<content type='text'>
Add another module sample that registers a direct trampoline to a function
via register_ftrace_direct(). Having another module that does this allows to
test the use case of multiple direct callers registered, as more than one
direct caller goes into another path, and is needed to perform proper
testing of the register_ftrace_direct() call.

Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Add sample module that uses register_ftrace_direct()</title>
<updated>2019-11-13T14:36:49Z</updated>
<author>
<name>Steven Rostedt (VMware)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2019-11-08T18:12:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b06457c83af669bb9ef71f5b84a3132657dce8a1'/>
<id>urn:sha1:b06457c83af669bb9ef71f5b84a3132657dce8a1</id>
<content type='text'>
Add a sample module that shows a simple use case for
regsiter_ftrace_direct(), and how to use it.

Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
</feed>
