From f80957cc40a94a0cc7cfcb4c9ee193bcbd604021 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Wed, 27 Sep 2017 20:20:56 +0100 Subject: [PATCH] frace docs an mmap minor improvements --- ftrace.md | 5 ++--- kernel_module/mmap.c | 10 +++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ftrace.md b/ftrace.md index 2164290..24539ec 100644 --- a/ftrace.md +++ b/ftrace.md @@ -10,8 +10,6 @@ Trace a single function: # Clear previous trace. echo '' > trace - echo 1 > max_graph_depth - # List the available tracers, and pick one. cat available_tracers echo function > current_tracer @@ -29,7 +27,7 @@ Trace a single function: head trace # Observe trace continously, and drain seen events out. - cat trace_pipe + cat trace_pipe & Sample output: @@ -60,6 +58,7 @@ Sample output: Trace all possible functions, and draw a call graph: + echo 1 > max_graph_depth echo 1 > events/enable echo function_graph > current_tracer diff --git a/kernel_module/mmap.c b/kernel_module/mmap.c index f000f0b..72d8a34 100644 --- a/kernel_module/mmap.c +++ b/kernel_module/mmap.c @@ -3,10 +3,18 @@ Remember: mmap, like most fops, does not work with debugfs as of 4.9! https://pa Adapted from: https://coherentmusings.wordpress.com/2014/06/10/implementing-mmap-for-transferring-data-from-user-space-to-kernel-space/ + +Related: + +- https://stackoverflow.com/questions/10760479/mmap-kernel-buffer-to-user-space/10770582#10770582 +- https://stackoverflow.com/questions/1623008/allocating-memory-for-user-space-from-kernel-thread +- https://stackoverflow.com/questions/6967933/mmap-mapping-in-user-space-a-kernel-buffer-allocated-with-kmalloc +- https://github.com/jeremytrimble/ezdma +- https://github.com/simonjhall/dma +- https://github.com/ikwzm/udmabuf */ #include /* copy_from_user */ -#include #include #include #include /* min */