From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Russell King <linux@arm.linux.org.uk>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
Paul Turner <pjt@google.com>, Andrew Hunter <ahh@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Andy Lutomirski <luto@amacapital.net>,
Andi Kleen <andi@firstfloor.org>,
Dave Watson <davejwatson@fb.com>, Chris Lameter <cl@linux.com>,
Ben Maurer <bmaurer@fb.com>, Steven Rostedt <rostedt@goodmis.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Josh Triplett <josh@joshtriplett.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Michael Kerrisk <mtk.manpages@gmail.com>,
Boqun Feng <boqun.feng@gmail.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: [RFC PATCH v7 2/7] tracing: instrument restartable sequences
Date: Thu, 21 Jul 2016 17:14:17 -0400 [thread overview]
Message-ID: <1469135662-31512-3-git-send-email-mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <1469135662-31512-1-git-send-email-mathieu.desnoyers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Paul Turner <pjt@google.com>
CC: Andrew Hunter <ahh@google.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Andy Lutomirski <luto@amacapital.net>
CC: Andi Kleen <andi@firstfloor.org>
CC: Dave Watson <davejwatson@fb.com>
CC: Chris Lameter <cl@linux.com>
CC: Ingo Molnar <mingo@redhat.com>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Ben Maurer <bmaurer@fb.com>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
CC: Josh Triplett <josh@joshtriplett.org>
CC: Linus Torvalds <torvalds@linux-foundation.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Russell King <linux@arm.linux.org.uk>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
CC: Michael Kerrisk <mtk.manpages@gmail.com>
CC: Boqun Feng <boqun.feng@gmail.com>
CC: linux-api@vger.kernel.org
---
include/trace/events/rseq.h | 60 +++++++++++++++++++++++++++++++++++++++++++++
kernel/rseq.c | 18 +++++++++++---
2 files changed, 75 insertions(+), 3 deletions(-)
create mode 100644 include/trace/events/rseq.h
diff --git a/include/trace/events/rseq.h b/include/trace/events/rseq.h
new file mode 100644
index 0000000..83fd31e
--- /dev/null
+++ b/include/trace/events/rseq.h
@@ -0,0 +1,60 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM rseq
+
+#if !defined(_TRACE_RSEQ_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_RSEQ_H
+
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(rseq_inc,
+
+ TP_PROTO(uint32_t event_counter, int ret),
+
+ TP_ARGS(event_counter, ret),
+
+ TP_STRUCT__entry(
+ __field(uint32_t, event_counter)
+ __field(int, ret)
+ ),
+
+ TP_fast_assign(
+ __entry->event_counter = event_counter;
+ __entry->ret = ret;
+ ),
+
+ TP_printk("event_counter=%u ret=%d",
+ __entry->event_counter, __entry->ret)
+);
+
+TRACE_EVENT(rseq_ip_fixup,
+
+ TP_PROTO(void __user *regs_ip, void __user *post_commit_ip,
+ void __user *abort_ip, uint32_t kevcount, int ret),
+
+ TP_ARGS(regs_ip, post_commit_ip, abort_ip, kevcount, ret),
+
+ TP_STRUCT__entry(
+ __field(void __user *, regs_ip)
+ __field(void __user *, post_commit_ip)
+ __field(void __user *, abort_ip)
+ __field(uint32_t, kevcount)
+ __field(int, ret)
+ ),
+
+ TP_fast_assign(
+ __entry->regs_ip = regs_ip;
+ __entry->post_commit_ip = post_commit_ip;
+ __entry->abort_ip = abort_ip;
+ __entry->kevcount = kevcount;
+ __entry->ret = ret;
+ ),
+
+ TP_printk("regs_ip=%p post_commit_ip=%p abort_ip=%p kevcount=%u ret=%d",
+ __entry->regs_ip, __entry->post_commit_ip, __entry->abort_ip,
+ __entry->kevcount, __entry->ret)
+);
+
+#endif /* _TRACE_SOCK_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/kernel/rseq.c b/kernel/rseq.c
index e1c847b..cab326a 100644
--- a/kernel/rseq.c
+++ b/kernel/rseq.c
@@ -29,6 +29,9 @@
#include <linux/rseq.h>
#include <asm/ptrace.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/rseq.h>
+
/*
* Each restartable sequence assembly block defines a "struct rseq_cs"
* structure which describes the post_commit_ip address, and the
@@ -90,8 +93,12 @@
static int rseq_increment_event_counter(struct task_struct *t)
{
- if (__put_user(++t->rseq_event_counter,
- &t->rseq->u.e.event_counter))
+ int ret;
+
+ ret = __put_user(++t->rseq_event_counter,
+ &t->rseq->u.e.event_counter);
+ trace_rseq_inc(t->rseq_event_counter, ret);
+ if (ret)
return -1;
return 0;
}
@@ -134,8 +141,13 @@ static int rseq_ip_fixup(struct pt_regs *regs)
struct task_struct *t = current;
void __user *post_commit_ip = NULL;
void __user *abort_ip = NULL;
+ int ret;
- if (rseq_get_rseq_cs(t, &post_commit_ip, &abort_ip))
+ ret = rseq_get_rseq_cs(t, &post_commit_ip, &abort_ip);
+ trace_rseq_ip_fixup((void __user *)instruction_pointer(regs),
+ post_commit_ip, abort_ip, t->rseq_event_counter,
+ ret);
+ if (ret)
return -1;
/* Handle potentially being within a critical section. */
--
2.1.4
next prev parent reply other threads:[~2016-07-21 21:14 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 21:14 [RFC PATCH v7 0/7] Restartable sequences system call Mathieu Desnoyers
2016-07-21 21:14 ` Mathieu Desnoyers [this message]
2016-07-21 21:14 ` [RFC PATCH v7 3/7] Restartable sequences: ARM 32 architecture support Mathieu Desnoyers
[not found] ` <1469135662-31512-1-git-send-email-mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-07-21 21:14 ` [RFC PATCH v7 1/7] Restartable sequences system call Mathieu Desnoyers
[not found] ` <1469135662-31512-2-git-send-email-mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-07-25 23:02 ` Andy Lutomirski
[not found] ` <CALCETrVq3hgLbADcx_4g6gGgp7Hf-WnnWA8gg68tPZTv2wfbDg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-26 3:02 ` Mathieu Desnoyers
[not found] ` <1806206514.82247.1469502139408.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-08-03 12:27 ` Peter Zijlstra
2016-08-03 16:37 ` Andy Lutomirski
2016-08-03 18:31 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1608031330000.14875-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-08-04 5:01 ` Andy Lutomirski
[not found] ` <CALCETrWw0M9YLWTR7_ruxY8cW9_5XRONdw1QN+_pBp0Y63L8pA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-04 4:27 ` Boqun Feng
2016-08-04 5:03 ` Andy Lutomirski
[not found] ` <CALCETrW7t89BWXW5JbWyLVciKS1HJMXe7feopM31wkqL4AtoFA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-09 16:13 ` Boqun Feng
2016-08-10 8:01 ` Andy Lutomirski
2016-08-10 17:40 ` Mathieu Desnoyers
2016-08-10 17:33 ` Mathieu Desnoyers
[not found] ` <1918884375.7403.1470850424697.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-08-11 4:54 ` Boqun Feng
2016-08-10 8:13 ` Andy Lutomirski
2016-08-03 18:29 ` Christoph Lameter
[not found] ` <alpine.DEB.2.20.1608031325040.14875-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-08-10 16:47 ` Mathieu Desnoyers
2016-08-10 16:59 ` Christoph Lameter
2016-07-27 15:03 ` Boqun Feng
[not found] ` <20160727150352.GA32142-jkllrLZ6VuqyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2016-07-27 15:05 ` [RFC 1/4] rseq/param_test: Convert test_data_entry::count to intptr_t Boqun Feng
2016-07-27 15:05 ` [RFC 2/4] Restartable sequences: powerpc architecture support Boqun Feng
2016-07-28 3:13 ` Mathieu Desnoyers
2016-07-27 15:05 ` [RFC 3/4] Restartable sequences: Wire up powerpc system call Boqun Feng
[not found] ` <20160727150517.26983-3-boqun.feng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-07-28 3:13 ` Mathieu Desnoyers
2016-07-27 15:05 ` [RFC 4/4] Restartable sequences: Add self-tests for PPC Boqun Feng
2016-07-28 2:59 ` Mathieu Desnoyers
[not found] ` <389340521.403.1469674785661.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-07-28 4:43 ` Boqun Feng
2016-07-28 7:37 ` [RFC v2] " Boqun Feng
[not found] ` <20160728073723.3884-1-boqun.feng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-07-28 14:04 ` Mathieu Desnoyers
[not found] ` <20160728044304.GC24740-jkllrLZ6VuqyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2016-07-28 13:42 ` [RFC 4/4] " Mathieu Desnoyers
[not found] ` <20160727150517.26983-1-boqun.feng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-07-28 3:07 ` [RFC 1/4] rseq/param_test: Convert test_data_entry::count to intptr_t Mathieu Desnoyers
2016-07-28 3:10 ` [RFC PATCH v7 1/7] Restartable sequences system call Mathieu Desnoyers
2016-08-03 13:19 ` Peter Zijlstra
2016-08-03 14:53 ` Paul E. McKenney
[not found] ` <20160803131940.GM6862-ndre7Fmf5hadTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2016-08-03 15:45 ` Boqun Feng
2016-08-07 15:36 ` Mathieu Desnoyers
[not found] ` <468742193.3955.1470584184630.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-08-07 23:35 ` Boqun Feng
[not found] ` <20160807233543.GB13232-jkllrLZ6VuqyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2016-08-09 13:22 ` Mathieu Desnoyers
2016-08-09 20:06 ` Mathieu Desnoyers
2016-08-10 8:10 ` Andy Lutomirski
[not found] ` <CALCETrUTpq6qX5SS170y_VtwiPc-SeR03bt-1Q98n+YMZMqopA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-10 19:04 ` Mathieu Desnoyers
2016-08-10 19:16 ` Andy Lutomirski
2016-08-10 20:06 ` Mathieu Desnoyers
[not found] ` <1224101037.7764.1470859581723.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-08-10 20:09 ` Andy Lutomirski
2016-08-10 21:01 ` Mathieu Desnoyers
[not found] ` <1327322278.7807.1470862882633.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-08-11 7:23 ` Andy Lutomirski
[not found] ` <656745027.6624.1470773200334.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-08-09 21:33 ` Peter Zijlstra
[not found] ` <20160809213314.GK30192-ndre7Fmf5hadTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2016-08-09 22:41 ` Mathieu Desnoyers
2016-08-10 7:50 ` Peter Zijlstra
2016-08-10 13:26 ` Mathieu Desnoyers
2016-08-10 13:33 ` Peter Zijlstra
2016-08-10 14:04 ` Mathieu Desnoyers
2016-08-10 8:43 ` Peter Zijlstra
2016-08-10 13:57 ` Mathieu Desnoyers
2016-08-10 14:28 ` Peter Zijlstra
2016-08-10 14:44 ` Mathieu Desnoyers
2016-08-10 13:29 ` Peter Zijlstra
2016-07-21 21:14 ` [RFC PATCH v7 4/7] Restartable sequences: wire up ARM 32 " Mathieu Desnoyers
2016-07-21 21:14 ` [RFC PATCH v7 5/7] Restartable sequences: x86 32/64 architecture support Mathieu Desnoyers
2016-07-21 21:14 ` [RFC PATCH v7 6/7] Restartable sequences: wire up x86 32/64 system call Mathieu Desnoyers
2016-07-21 21:14 ` [RFC PATCH v7 7/7] Restartable sequences: self-tests Mathieu Desnoyers
[not found] ` <CO1PR15MB09822FC140F84DCEEF2004CDDD0B0@CO1PR15MB0982.namprd15.prod.outlook.com>
[not found] ` <CO1PR15MB09822FC140F84DCEEF2004CDDD0B0-K8OqZrtvGWNkuEq+M2l22od3EbNNOtPMvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-07-24 3:09 ` Mathieu Desnoyers
[not found] ` <1590181502.79032.1469329777708.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-07-24 18:01 ` Dave Watson
[not found] ` <CO1PR15MB09825505EBF36E0C56AA037ADD0C0-K8OqZrtvGWNkuEq+M2l22od3EbNNOtPMvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-07-25 16:43 ` Mathieu Desnoyers
2016-08-11 23:26 ` Mathieu Desnoyers
[not found] ` <374861479.8581.1470957990793.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-08-12 1:28 ` Boqun Feng
2016-08-12 3:10 ` Mathieu Desnoyers
[not found] ` <365498072.8664.1470971438957.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-08-12 3:13 ` Mathieu Desnoyers
2016-08-12 5:30 ` Boqun Feng
[not found] ` <20160812053008.GA18611-jkllrLZ6VuqyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2016-08-12 16:35 ` Boqun Feng
[not found] ` <20160812163542.GB18611-jkllrLZ6VuqyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2016-08-12 18:11 ` Mathieu Desnoyers
[not found] ` <434180831.9286.1471025505641.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-08-13 1:28 ` Boqun Feng
[not found] ` <20160813012834.GC18611-jkllrLZ6VuqyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2016-08-14 15:02 ` Mathieu Desnoyers
[not found] ` <832944127.9855.1471186940516.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-08-15 0:56 ` Boqun Feng
[not found] ` <20160815005607.GD18611-jkllrLZ6VuqyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2016-08-15 18:06 ` Mathieu Desnoyers
2016-08-12 19:36 ` Mathieu Desnoyers
[not found] ` <753387169.9345.1471030573282.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2016-08-12 20:05 ` Dave Watson
[not found] ` <CO1PR15MB0982484D57E73C83E6E6DB75DD1F0-K8OqZrtvGWNkuEq+M2l22od3EbNNOtPMvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-14 17:09 ` Mathieu Desnoyers
2016-07-25 18:12 ` 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=1469135662-31512-3-git-send-email-mathieu.desnoyers@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=ahh@google.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=bmaurer@fb.com \
--cc=boqun.feng@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=cl@linux.com \
--cc=davejwatson@fb.com \
--cc=hpa@zytor.com \
--cc=josh@joshtriplett.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=mtk.manpages@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).