All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Will Deacon <will@kernel.org>,
	akpm@linux-foundation.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"K . Prasad" <prasad@linux.vnet.ibm.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	rostedt@goodmis.org, Alexei Starovoitov <ast@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Ingo Molnar <mingo@redhat.com>
Subject: [RFC PATCH 1/9] tracepoint: call vmalloc_sync_mappings() on registration
Date: Thu,  9 Apr 2020 15:35:35 -0400	[thread overview]
Message-ID: <20200409193543.18115-2-mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <20200409193543.18115-1-mathieu.desnoyers@efficios.com>

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@efficios.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.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


  reply	other threads:[~2020-04-09 19:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 19:35 [RFC PATCH 0/9] Export information needed by the LTTng kernel tracer Mathieu Desnoyers
2020-04-09 19:35 ` Mathieu Desnoyers [this message]
2020-04-09 19:35 ` [RFC PATCH 2/9] bpf: allow up to 13 arguments for tracepoints Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 3/9] writeback: tracing: pass global_wb_domain as tracepoint parameter Mathieu Desnoyers
2020-04-09 22:33   ` Alexei Starovoitov
2020-04-10 11:54     ` Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 4/9] stacktrace: export-GPL stack_trace_save_user Mathieu Desnoyers
2020-04-12  8:31   ` Christoph Hellwig
2020-04-09 19:35 ` [RFC PATCH 5/9] sched: export-GPL task_prio Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 6/9] mm: export-GPL get_pageblock_migratetype Mathieu Desnoyers
2020-04-12  8:14   ` Christoph Hellwig
2020-04-09 19:35 ` [RFC PATCH 7/9] block: genhd: export-GPL gendisk_name Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 8/9] block: genhd: export-GPL generic disk device type Mathieu Desnoyers
2020-04-10  6:33   ` Greg Kroah-Hartman
2020-04-10 13:31     ` Mathieu Desnoyers
2020-04-10 15:44     ` Steven Rostedt
2020-04-11  6:45       ` Greg Kroah-Hartman
2020-04-09 19:35 ` [RFC PATCH 9/9] block: genhd: export-GPL generic disk block class Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200409193543.18115-2-mathieu.desnoyers@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=akpm@linux-foundation.org \
    --cc=ast@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=prasad@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.