[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc1de769-a00e-b7cc-50cb-796560d79d89@gmail.com>
Date: Thu, 3 Oct 2019 00:04:56 +0200
From: Viktor Rosendahl <viktor.rosendahl@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
Joel Fernandes <joel@...lfernandes.org>
Subject: Re: [PATCH v7 1/4] ftrace: Implement fs notification for
tracing_max_latency
On 10/2/19 5:13 PM, Steven Rostedt wrote:
> On Fri, 20 Sep 2019 17:22:16 +0200
> "Viktor Rosendahl (BMW)" <viktor.rosendahl@...il.com> wrote:
>
>> 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().
>
> Can fsnotify() be called from irq context? If so, why have the work
> queue at all? Just do the work from the irq_work handler.
>
fsnotify() might sleep. It calls send_to_group(), which calls
inotify_handle_event() through a function pointer.
inotify_handle_event() calls kmalloc() without the GFP_ATOMIC flag.
There might be other reasons as well but the above is one that I have
seen a warning for, when enabling CONFIG_DEBUG_ATOMIC_SLEEP and trying
to call fsnotify() from an atomic context.
best regards,
Viktor
Powered by blists - more mailing lists