Thread (9 messages) 9 messages, 4 authors, 2018-12-04

Re: [PATCH 3/3] arm64: ftrace: add cond_resched() to func ftrace_make_(call|nop)

From: Anders Roxell <hidden>
Date: 2018-12-04 18:07:31
Also in: lkml

On Tue, 4 Dec 2018 at 18:26, Steven Rostedt [off-list ref] wrote:
On Tue, 4 Dec 2018 11:12:43 +0000
Will Deacon [off-list ref] wrote:
quoted
quoted
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 8ef9fc226037..42e89397778b 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2393,11 +2393,14 @@ void __weak ftrace_replace_code(int enable)
 {
    struct dyn_ftrace *rec;
    struct ftrace_page *pg;
+   bool schedulable;
    int failed;

    if (unlikely(ftrace_disabled))
            return;

+   schedulable = !irqs_disabled() & !preempt_count();
Looks suspiciously like a bitwise preemptible() to me!
Ah, thanks. Yeah, that should have been &&. But what did you expect.
I didn't even compile this ;-)
quoted
quoted
+
    do_for_each_ftrace_rec(pg, rec) {

            if (rec->flags & FTRACE_FL_DISABLED)
@@ -2409,6 +2412,8 @@ void __weak ftrace_replace_code(int enable)
                    /* Stop processing */
                    return;
            }
+           if (schedulable)
+                   cond_resched();
    } while_for_each_ftrace_rec();
 }
If this solves the problem in core code, them I'm all for it. Otherwise, I
was thinking of rolling our own ftrace_replace_code() for arm64, but that's
going to involve a fair amount of duplication.
If it does, then I'll add it. Or take a patch for it ;-)
I tested your patch. it worked.

I'll send a patch shortly.

Cheers,
Anders

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help