lkml.org 
[lkml]   [2014]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] sched/clock: prevent tracing recursion in sched_clock_cpu()
    On Thu, 06 Mar 2014 14:25:28 +0900
    Fernando Luis Vázquez Cao <fernando_b1@lab.ntt.co.jp> wrote:

    > From: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
    >
    > Prevent tracing of preempt_disable/enable() in sched_clock_cpu().
    > When CONFIG_DEBUG_PREEMPT is enabled, preempt_disable/enable() are
    > traced and this causes trace_clock() users (and probably others) to
    > go into an infinite recursion. Systems with a stable sched_clock()
    > are not affected.
    >
    > This problem is similar to that fixed by upstream commit 95ef1e52922
    > ("KVM guest: prevent tracing recursion with kvmclock").

    Also similar to: 569d6557ab957.

    Acked-by: Steven Rostedt <rostedt@goodmis.org>

    -- Steve

    >
    > Cc: Linus Torvalds <torvalds@linux-foundation.org>
    > Cc: Andrew Morton <akpm@linux-foundation.org>
    > Cc: Ingo Molnar <mingo@kernel.org>
    > Cc: Steven Rostedt <rostedt@goodmis.org>
    > Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
    > ---
    >
    > diff -urNp linux-3.14-rc5-orig/kernel/sched/clock.c linux-3.14-rc5/kernel/sched/clock.c
    > --- linux-3.14-rc5-orig/kernel/sched/clock.c 2014-03-06 13:37:43.567720550 +0900
    > +++ linux-3.14-rc5/kernel/sched/clock.c 2014-03-06 13:41:56.937100949 +0900
    > @@ -301,14 +301,14 @@ u64 sched_clock_cpu(int cpu)
    > if (unlikely(!sched_clock_running))
    > return 0ull;
    >
    > - preempt_disable();
    > + preempt_disable_notrace();
    > scd = cpu_sdc(cpu);
    >
    > if (cpu != smp_processor_id())
    > clock = sched_clock_remote(scd);
    > else
    > clock = sched_clock_local(scd);
    > - preempt_enable();
    > + preempt_enable_notrace();
    >
    > return clock;
    > }
    >

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2014-03-06 12:21    [W:4.207 / U:0.620 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site