[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200409193543.18115-2-mathieu.desnoyers@efficios.com>
Date: Thu, 9 Apr 2020 15:35:35 -0400
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Will Deacon <will@...nel.org>, akpm@...ux-foundation.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"K . Prasad" <prasad@...ux.vnet.ibm.com>,
Masami Hiramatsu <mhiramat@...nel.org>, rostedt@...dmis.org,
Alexei Starovoitov <ast@...nel.org>
Cc: linux-kernel@...r.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Ingo Molnar <mingo@...hat.com>
Subject: [RFC PATCH 1/9] tracepoint: call vmalloc_sync_mappings() on registration
Similarly to register_die_notifier(), tracepoints register callbacks
which can be invoked from execution contexts such as the page fault
handler and NMIs which should not generate a page fault. Those callbacks
can access virtual mappings and can be implemented in modules.
Calling vmalloc_sync_mappings() before registering a tracepoint callback
ensures that the virtual mappings are synchronized within each process
page tables, thus ensuring that no page fault will be triggered by the
callback.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
---
kernel/tracepoint.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 73956eaff8a9..82191a89c72e 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -14,6 +14,7 @@
#include <linux/sched/signal.h>
#include <linux/sched/task.h>
#include <linux/static_key.h>
+#include <linux/vmalloc.h>
extern tracepoint_ptr_t __start___tracepoints_ptrs[];
extern tracepoint_ptr_t __stop___tracepoints_ptrs[];
@@ -308,6 +309,7 @@ int tracepoint_probe_register_prio(struct tracepoint *tp, void *probe,
struct tracepoint_func tp_func;
int ret;
+ vmalloc_sync_mappings();
mutex_lock(&tracepoints_mutex);
tp_func.func = probe;
tp_func.data = data;
--
2.17.1
Powered by blists - more mailing lists