]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
tracing: Replace kmap with copy_from_user() in trace_marker writing
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Thu, 8 Dec 2016 17:40:18 +0000 (12:40 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 9 Dec 2016 14:18:14 +0000 (09:18 -0500)
commit656c7f0d2d2b3237a31b105d5ed217a65350104f
tree19ec88d4f4a29c68f4c7ef650a929c82bb858fed
parent847fa1a6d3d00f3bdf68ef5fa4a786f644a0dd67
tracing: Replace kmap with copy_from_user() in trace_marker writing

Instead of using get_user_pages_fast() and kmap_atomic() when writing
to the trace_marker file, just allocate enough space on the ring buffer
directly, and write into it via copy_from_user().

Writing into the trace_marker file use to allocate a temporary buffer
to perform the copy_from_user(), as we didn't want to write into the
ring buffer if the copy failed. But as a trace_marker write is suppose
to be extremely fast, and allocating memory causes other tracepoints to
trigger, Peter Zijlstra suggested using get_user_pages_fast() and
kmap_atomic() to keep the user space pages in memory and reading it
directly. But Henrik Austad had issues with this because it required taking
the mm->mmap_sem and causing long delays with the write.

Instead, just allocate the space in the ring buffer and use
copy_from_user() directly. If it faults, return -EFAULT and write
"<faulted>" into the ring buffer.

Link: http://lkml.kernel.org/r/20161208124018.72dd0f86@gandalf.local.home
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Henrik Austad <henrik@austad.us>
Cc: Peter Zijlstra <peterz@infradead.org>
Updates: d696b58ca2c3ca "tracing: Do not allocate buffer for trace_marker"
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace.c