Merge v5.14-rc3 into usb-next
[linux-2.6-microblaze.git] / arch / s390 / kernel / ftrace.c
index ebc1284..2d8f595 100644 (file)
@@ -40,6 +40,7 @@
  * trampoline (ftrace_plt), which clobbers also r1.
  */
 
+void *ftrace_func __read_mostly = ftrace_stub;
 unsigned long ftrace_plt;
 
 int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
@@ -85,6 +86,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
 
 int ftrace_update_ftrace_func(ftrace_func_t func)
 {
+       ftrace_func = func;
        return 0;
 }
 
@@ -163,17 +165,26 @@ int ftrace_disable_ftrace_graph_caller(void)
 
 #ifdef CONFIG_KPROBES_ON_FTRACE
 void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
-               struct ftrace_ops *ops, struct pt_regs *regs)
+               struct ftrace_ops *ops, struct ftrace_regs *fregs)
 {
        struct kprobe_ctlblk *kcb;
-       struct kprobe *p = get_kprobe((kprobe_opcode_t *)ip);
+       struct pt_regs *regs;
+       struct kprobe *p;
+       int bit;
 
-       if (unlikely(!p) || kprobe_disabled(p))
+       bit = ftrace_test_recursion_trylock(ip, parent_ip);
+       if (bit < 0)
                return;
 
+       regs = ftrace_get_regs(fregs);
+       preempt_disable_notrace();
+       p = get_kprobe((kprobe_opcode_t *)ip);
+       if (unlikely(!p) || kprobe_disabled(p))
+               goto out;
+
        if (kprobe_running()) {
                kprobes_inc_nmissed_count(p);
-               return;
+               goto out;
        }
 
        __this_cpu_write(current_kprobe, p);
@@ -193,6 +204,9 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
                }
        }
        __this_cpu_write(current_kprobe, NULL);
+out:
+       preempt_enable_notrace();
+       ftrace_test_recursion_unlock(bit);
 }
 NOKPROBE_SYMBOL(kprobe_ftrace_handler);