<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/trace/trace.c, branch v5.5</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.5</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.5'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-01-20T21:18:14Z</updated>
<entry>
<title>tracing: Do not set trace clock if tracefs lockdown is in effect</title>
<updated>2020-01-20T21:18:14Z</updated>
<author>
<name>Masami Ichikawa</name>
<email>masami256@gmail.com</email>
</author>
<published>2020-01-16T13:12:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bf24daac8f2bd5b8affaec03c2be1d20bcdd6837'/>
<id>urn:sha1:bf24daac8f2bd5b8affaec03c2be1d20bcdd6837</id>
<content type='text'>
When trace_clock option is not set and unstable clcok detected,
tracing_set_default_clock() sets trace_clock(ThinkPad A285 is one of
case). In that case, if lockdown is in effect, null pointer
dereference error happens in ring_buffer_set_clock().

Link: http://lkml.kernel.org/r/20200116131236.3866925-1-masami256@gmail.com

Cc: stable@vger.kernel.org
Fixes: 17911ff38aa58 ("tracing: Add locked_down checks to the open calls of files created for tracefs")
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1788488
Signed-off-by: Masami Ichikawa &lt;masami256@gmail.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Fix lock inversion in trace_event_enable_tgid_record()</title>
<updated>2019-12-21T21:05:13Z</updated>
<author>
<name>Prateek Sood</name>
<email>prsood@codeaurora.org</email>
</author>
<published>2019-12-10T09:15:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3a53acf1d9bea11b57c1f6205e3fe73f9d8a3688'/>
<id>urn:sha1:3a53acf1d9bea11b57c1f6205e3fe73f9d8a3688</id>
<content type='text'>
       Task T2                             Task T3
trace_options_core_write()            subsystem_open()

 mutex_lock(trace_types_lock)           mutex_lock(event_mutex)

 set_tracer_flag()

   trace_event_enable_tgid_record()       mutex_lock(trace_types_lock)

    mutex_lock(event_mutex)

This gives a circular dependency deadlock between trace_types_lock and
event_mutex. To fix this invert the usage of trace_types_lock and
event_mutex in trace_options_core_write(). This keeps the sequence of
lock usage consistent.

Link: http://lkml.kernel.org/r/0101016eef175e38-8ca71caf-a4eb-480d-a1e6-6f0bbc015495-000000@us-west-2.amazonses.com

Cc: stable@vger.kernel.org
Fixes: d914ba37d7145 ("tracing: Add support for recording tgid of tasks")
Signed-off-by: Prateek Sood &lt;prsood@codeaurora.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>Fix up for "printk: Drop pr_warning definition"</title>
<updated>2019-12-06T09:02:35Z</updated>
<author>
<name>Stephen Rothwell</name>
<email>sfr@canb.auug.org.au</email>
</author>
<published>2019-12-05T22:25:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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:15Z</updated>
<author>
<name>Steven Rostedt (VMware)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2019-12-02T21:25:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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:08Z</updated>
<author>
<name>Divya Indi</name>
<email>divya.indi@oracle.com</email>
</author>
<published>2019-11-20T19:08:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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:11Z</updated>
<author>
<name>Yuming Han</name>
<email>yuming.han@unisoc.com</email>
</author>
<published>2019-10-24T03:34:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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:29Z</updated>
<author>
<name>Divya Indi</name>
<email>divya.indi@oracle.com</email>
</author>
<published>2019-08-14T17:55:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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:29Z</updated>
<author>
<name>Divya Indi</name>
<email>divya.indi@oracle.com</email>
</author>
<published>2019-08-14T17:55:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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:28Z</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>bigeasy@linutronix.de</email>
</author>
<published>2019-10-15T19:18:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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:28Z</updated>
<author>
<name>Viktor Rosendahl (BMW)</name>
<email>viktor.rosendahl@gmail.com</email>
</author>
<published>2019-10-08T22:08:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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>
</feed>
