tracing: instrument restartable sequences
[deliverable/linux.git] / kernel / rseq.c
index 32bc1d27a6b1c535cc0600bbcfa5612ac7b9d9d8..a102fcc9994e4680dc812e827d9ffe531f5348e7 100644 (file)
@@ -32,6 +32,9 @@
 #include <linux/types.h>
 #include <asm/ptrace.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/rseq.h>
+
 /*
  * The restartable sequences mechanism is the overlap of two distinct
  * restart mechanisms: a sequence counter tracking preemption and signal
@@ -137,6 +140,7 @@ static bool rseq_update_cpu_id_event_counter(struct task_struct *t)
        u.e.event_counter = ++t->rseq_event_counter;
        if (__put_user(u.v, &t->rseq->u.v))
                return false;
+       trace_rseq_update(t);
        return true;
 }
 
@@ -168,8 +172,13 @@ static bool rseq_ip_fixup(struct pt_regs *regs)
        void __user *start_ip = NULL;
        void __user *post_commit_ip = NULL;
        void __user *abort_ip = NULL;
+       bool ret;
 
-       if (!rseq_get_rseq_cs(t, &start_ip, &post_commit_ip, &abort_ip))
+       ret = rseq_get_rseq_cs(t, &start_ip, &post_commit_ip, &abort_ip);
+       trace_rseq_ip_fixup((void __user *)instruction_pointer(regs),
+               start_ip, post_commit_ip, abort_ip, t->rseq_event_counter,
+               ret);
+       if (!ret)
                return false;
 
        /* Handle potentially not being within a critical section. */
This page took 0.025236 seconds and 5 git commands to generate.