lkml.org 
[lkml]   [2021]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/2] ftrace: prevent preemption in perf_ftrace_function_call()
    On Tue, Oct 12, 2021 at 01:40:31PM +0800, 王贇 wrote:

    > diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
    > index 6aed10e..33c2f76 100644
    > --- a/kernel/trace/trace_event_perf.c
    > +++ b/kernel/trace/trace_event_perf.c
    > @@ -441,12 +441,19 @@ void perf_trace_buf_update(void *record, u16 type)
    > if (!rcu_is_watching())
    > return;
    >
    > + /*
    > + * Prevent CPU changing from now on. rcu must
    > + * be in watching if the task was migrated and
    > + * scheduled.
    > + */
    > + preempt_disable_notrace();
    > +
    > if ((unsigned long)ops->private != smp_processor_id())
    > - return;
    > + goto out;
    >
    > bit = ftrace_test_recursion_trylock(ip, parent_ip);
    > if (bit < 0)
    > - return;
    > + goto out;
    >
    > event = container_of(ops, struct perf_event, ftrace_ops);
    >

    This seems rather daft, wouldn't it be easier to just put that check
    under the recursion thing?

    \
     
     \ /
      Last update: 2021-10-12 13:22    [W:2.928 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site