<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/kernel/trace/trace.c, branch docs-5.6</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=docs-5.6</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=docs-5.6'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2019-12-06T09:02:35+00:00</updated>
<entry>
<title>Fix up for "printk: Drop pr_warning definition"</title>
<updated>2019-12-06T09:02:35+00:00</updated>
<author>
<name>Stephen Rothwell</name>
<email>sfr@canb.auug.org.au</email>
</author>
<published>2019-12-05T22:25:03+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=ee19545220a8663f0ca58c3427bc08fd6a104a42'/>
<id>urn:sha1:ee19545220a8663f0ca58c3427bc08fd6a104a42</id>
<content type='text'>
Link: http://lkml.kernel.org/r/20191206092503.303d6a57@canb.auug.org.au
Cc: Linux Next Mailing List &lt;linux-next@vger.kernel.org&gt;
Cc: Linux Kernel Mailing List &lt;linux-kernel@vger.kernel.org&gt;
Cc: "Steven Rostedt (VMware)" &lt;rostedt@goodmis.org&gt;
Cc: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
</content>
</entry>
<entry>
<title>tracing: Do not create directories if lockdown is in affect</title>
<updated>2019-12-04T13:27:15+00:00</updated>
<author>
<name>Steven Rostedt (VMware)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2019-12-02T21:25:27+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=a356646a56857c2e5ad875beec734d7145ecd49a'/>
<id>urn:sha1:a356646a56857c2e5ad875beec734d7145ecd49a</id>
<content type='text'>
If lockdown is disabling tracing on boot up, it prevents the tracing files
from even bering created. But when that happens, there's several places that
will give a warning that the files were not created as that is usually a
sign of a bug.

Add in strategic locations where a check is made to see if tracing is
disabled by lockdown, and if it is, do not go further, and fail silently
(but print that tracing is disabled by lockdown, without doing a WARN_ON()).

Cc: Matthew Garrett &lt;mjg59@google.com&gt;
Fixes: 17911ff38aa5 ("tracing: Add locked_down checks to the open calls of files created for tracefs")
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Adding new functions for kernel access to Ftrace instances</title>
<updated>2019-11-23T00:41:08+00:00</updated>
<author>
<name>Divya Indi</name>
<email>divya.indi@oracle.com</email>
</author>
<published>2019-11-20T19:08:38+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=28879787147358e8ffcae397f11748de3dd26577'/>
<id>urn:sha1:28879787147358e8ffcae397f11748de3dd26577</id>
<content type='text'>
Adding 2 new functions -
1) struct trace_array *trace_array_get_by_name(const char *name);

Return pointer to a trace array with given name. If it does not exist,
create and return pointer to the new trace array.

2) int trace_array_set_clr_event(struct trace_array *tr,
const char *system ,const char *event, bool enable);

Enable/Disable events to this trace array.

Additionally,
- To handle reference counters, export trace_array_put()
- Due to introduction of the above 2 new functions, we no longer need to
  export - ftrace_set_clr_event &amp; trace_array_create APIs.

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

Signed-off-by: Divya Indi &lt;divya.indi@oracle.com&gt;
Reviewed-by: Aruna Ramakrishna &lt;aruna.ramakrishna@oracle.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: use kvcalloc for tgid_map array allocation</title>
<updated>2019-11-14T18:15:11+00:00</updated>
<author>
<name>Yuming Han</name>
<email>yuming.han@unisoc.com</email>
</author>
<published>2019-10-24T03:34:30+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=6ee40511cb838f9ced002dff7131bca87e3ccbdd'/>
<id>urn:sha1:6ee40511cb838f9ced002dff7131bca87e3ccbdd</id>
<content type='text'>
Fail to allocate memory for tgid_map, because it requires order-6 page.
detail as:

c3 sh: page allocation failure: order:6,
   mode:0x140c0c0(GFP_KERNEL), nodemask=(null)
c3 sh cpuset=/ mems_allowed=0
c3 CPU: 3 PID: 5632 Comm: sh Tainted: G        W  O    4.14.133+ #10
c3 Hardware name: Generic DT based system
c3 Backtrace:
c3 [&lt;c010bdbc&gt;] (dump_backtrace) from [&lt;c010c08c&gt;](show_stack+0x18/0x1c)
c3 [&lt;c010c074&gt;] (show_stack) from [&lt;c0993c54&gt;](dump_stack+0x84/0xa4)
c3 [&lt;c0993bd0&gt;] (dump_stack) from [&lt;c0229858&gt;](warn_alloc+0xc4/0x19c)
c3 [&lt;c0229798&gt;] (warn_alloc) from [&lt;c022a6e4&gt;](__alloc_pages_nodemask+0xd18/0xf28)
c3 [&lt;c02299cc&gt;] (__alloc_pages_nodemask) from [&lt;c0248344&gt;](kmalloc_order+0x20/0x38)
c3 [&lt;c0248324&gt;] (kmalloc_order) from [&lt;c0248380&gt;](kmalloc_order_trace+0x24/0x108)
c3 [&lt;c024835c&gt;] (kmalloc_order_trace) from [&lt;c01e6078&gt;](set_tracer_flag+0xb0/0x158)
c3 [&lt;c01e5fc8&gt;] (set_tracer_flag) from [&lt;c01e6404&gt;](trace_options_core_write+0x7c/0xcc)
c3 [&lt;c01e6388&gt;] (trace_options_core_write) from [&lt;c0278b1c&gt;](__vfs_write+0x40/0x14c)
c3 [&lt;c0278adc&gt;] (__vfs_write) from [&lt;c0278e10&gt;](vfs_write+0xc4/0x198)
c3 [&lt;c0278d4c&gt;] (vfs_write) from [&lt;c027906c&gt;](SyS_write+0x6c/0xd0)
c3 [&lt;c0279000&gt;] (SyS_write) from [&lt;c01079a0&gt;](ret_fast_syscall+0x0/0x54)

Switch to use kvcalloc to avoid unexpected allocation failures.

Link: http://lkml.kernel.org/r/1571888070-24425-1-git-send-email-chunyan.zhang@unisoc.com

Signed-off-by: Yuming Han &lt;yuming.han@unisoc.com&gt;
Signed-off-by: Chunyan Zhang &lt;chunyan.zhang@unisoc.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Adding NULL checks for trace_array descriptor pointer</title>
<updated>2019-11-13T14:37:29+00:00</updated>
<author>
<name>Divya Indi</name>
<email>divya.indi@oracle.com</email>
</author>
<published>2019-08-14T17:55:25+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=953ae45a0c25e09428d4a03d7654f97ab8a36647'/>
<id>urn:sha1:953ae45a0c25e09428d4a03d7654f97ab8a36647</id>
<content type='text'>
As part of commit f45d1225adb0 ("tracing: Kernel access to Ftrace
instances") we exported certain functions. Here, we are adding some additional
NULL checks to ensure safe usage by users of these APIs.

Link: http://lkml.kernel.org/r/1565805327-579-4-git-send-email-divya.indi@oracle.com

Signed-off-by: Divya Indi &lt;divya.indi@oracle.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Verify if trace array exists before destroying it.</title>
<updated>2019-11-13T14:37:29+00:00</updated>
<author>
<name>Divya Indi</name>
<email>divya.indi@oracle.com</email>
</author>
<published>2019-08-14T17:55:24+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=e585e6469d6f476b82aa148dc44aaf7ae269a4e2'/>
<id>urn:sha1:e585e6469d6f476b82aa148dc44aaf7ae269a4e2</id>
<content type='text'>
A trace array can be destroyed from userspace or kernel. Verify if the
trace array exists before proceeding to destroy/remove it.

Link: http://lkml.kernel.org/r/1565805327-579-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;
[ Removed unneeded braces ]
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Use CONFIG_PREEMPTION</title>
<updated>2019-11-13T14:37:28+00:00</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>bigeasy@linutronix.de</email>
</author>
<published>2019-10-15T19:18:20+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=9c34fc4b7e903117cc27712b9e6c8690debb7e95'/>
<id>urn:sha1:9c34fc4b7e903117cc27712b9e6c8690debb7e95</id>
<content type='text'>
CONFIG_PREEMPTION is selected by CONFIG_PREEMPT and by CONFIG_PREEMPT_RT.
Both PREEMPT and PREEMPT_RT require the same functionality which today
depends on CONFIG_PREEMPT.

Add additional header output for PREEMPT_RT.
Link: http://lkml.kernel.org/r/20191015191821.11479-34-bigeasy@linutronix.de

Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Implement fs notification for tracing_max_latency</title>
<updated>2019-11-13T14:37:28+00:00</updated>
<author>
<name>Viktor Rosendahl (BMW)</name>
<email>viktor.rosendahl@gmail.com</email>
</author>
<published>2019-10-08T22:08:21+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=91edde2e6ae1dd5e33812f076f3fe4cb7ccbfdd0'/>
<id>urn:sha1:91edde2e6ae1dd5e33812f076f3fe4cb7ccbfdd0</id>
<content type='text'>
This patch implements the feature that the tracing_max_latency file,
e.g. /sys/kernel/debug/tracing/tracing_max_latency will receive
notifications through the fsnotify framework when a new latency is
available.

One particularly interesting use of this facility is when enabling
threshold tracing, through /sys/kernel/debug/tracing/tracing_thresh,
together with the preempt/irqsoff tracers. This makes it possible to
implement a user space program that can, with equal probability,
obtain traces of latencies that occur immediately after each other in
spite of the fact that the preempt/irqsoff tracers operate in overwrite
mode.

This facility works with the hwlat, preempt/irqsoff, and wakeup
tracers.

The tracers may call the latency_fsnotify() from places such as
__schedule() or do_idle(); this makes it impossible to call
queue_work() directly without risking a deadlock. The same would
happen with a softirq,  kernel thread or tasklet. For this reason we
use the irq_work mechanism to call queue_work().

This patch creates a new workqueue. The reason for doing this is that
I wanted to use the WQ_UNBOUND and WQ_HIGHPRI flags.  My thinking was
that WQ_UNBOUND might help with the latency in some important cases.

If we use:

queue_work(system_highpri_wq, &amp;tr-&gt;fsnotify_work);

then the work will (almost) always execute on the same CPU but if we are
unlucky that CPU could be too busy while there could be another CPU in
the system that would be able to process the work soon enough.

queue_work_on() could be used to queue the work on another CPU but it
seems difficult to select the right CPU.

Link: http://lkml.kernel.org/r/20191008220824.7911-2-viktor.rosendahl@gmail.com

Reviewed-by: Joel Fernandes (Google) &lt;joel@joelfernandes.org&gt;
Signed-off-by: Viktor Rosendahl (BMW) &lt;viktor.rosendahl@gmail.com&gt;
[ Added max() to have one compare for max latency ]
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Add information on number of page groups allocated</title>
<updated>2019-11-13T14:37:28+00:00</updated>
<author>
<name>Steven Rostedt (VMware)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2019-10-01T18:38:07+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=da537f0aef1372c5204356a7df06be8769467b7b'/>
<id>urn:sha1:da537f0aef1372c5204356a7df06be8769467b7b</id>
<content type='text'>
Looking for ways to shrink the size of the dyn_ftrace structure, knowing the
information about how many pages and the number of groups of those pages, is
useful in working out the best ways to save on memory.

This adds one info print on how many groups of pages were used to allocate
the ftrace dyn_ftrace structures, and also shows the number of pages and
groups in the dyn_ftrace_total_info (which is used for debugging).

Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Initialize iter-&gt;seq after zeroing in tracing_read_pipe()</title>
<updated>2019-10-13T00:49:34+00:00</updated>
<author>
<name>Petr Mladek</name>
<email>pmladek@suse.com</email>
</author>
<published>2019-10-11T14:21:34+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=d303de1fcf344ff7c15ed64c3f48a991c9958775'/>
<id>urn:sha1:d303de1fcf344ff7c15ed64c3f48a991c9958775</id>
<content type='text'>
A customer reported the following softlockup:

[899688.160002] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [test.sh:16464]
[899688.160002] CPU: 0 PID: 16464 Comm: test.sh Not tainted 4.12.14-6.23-azure #1 SLE12-SP4
[899688.160002] RIP: 0010:up_write+0x1a/0x30
[899688.160002] Kernel panic - not syncing: softlockup: hung tasks
[899688.160002] RIP: 0010:up_write+0x1a/0x30
[899688.160002] RSP: 0018:ffffa86784d4fde8 EFLAGS: 00000257 ORIG_RAX: ffffffffffffff12
[899688.160002] RAX: ffffffff970fea00 RBX: 0000000000000001 RCX: 0000000000000000
[899688.160002] RDX: ffffffff00000001 RSI: 0000000000000080 RDI: ffffffff970fea00
[899688.160002] RBP: ffffffffffffffff R08: ffffffffffffffff R09: 0000000000000000
[899688.160002] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8b59014720d8
[899688.160002] R13: ffff8b59014720c0 R14: ffff8b5901471090 R15: ffff8b5901470000
[899688.160002]  tracing_read_pipe+0x336/0x3c0
[899688.160002]  __vfs_read+0x26/0x140
[899688.160002]  vfs_read+0x87/0x130
[899688.160002]  SyS_read+0x42/0x90
[899688.160002]  do_syscall_64+0x74/0x160

It caught the process in the middle of trace_access_unlock(). There is
no loop. So, it must be looping in the caller tracing_read_pipe()
via the "waitagain" label.

Crashdump analyze uncovered that iter-&gt;seq was completely zeroed
at this point, including iter-&gt;seq.seq.size. It means that
print_trace_line() was never able to print anything and
there was no forward progress.

The culprit seems to be in the code:

	/* reset all but tr, trace, and overruns */
	memset(&amp;iter-&gt;seq, 0,
	       sizeof(struct trace_iterator) -
	       offsetof(struct trace_iterator, seq));

It was added by the commit 53d0aa773053ab182877 ("ftrace:
add logic to record overruns"). It was v2.6.27-rc1.
It was the time when iter-&gt;seq looked like:

     struct trace_seq {
	unsigned char		buffer[PAGE_SIZE];
	unsigned int		len;
     };

There was no "size" variable and zeroing was perfectly fine.

The solution is to reinitialize the structure after or without
zeroing.

Link: http://lkml.kernel.org/r/20191011142134.11997-1-pmladek@suse.com

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