Commit 71fdb70e authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

sched/clock: Fix clear_sched_clock_stable() preempt wobbly

Paul reported a problems with clear_sched_clock_stable(). Since we run
all of __clear_sched_clock_stable() from workqueue context, there's a
preempt problem.

Solve it by only running the static_key_disable() from workqueue.
Reported-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: fweisbec@gmail.com
Link: http://lkml.kernel.org/r/20170313124621.GA3328@twins.programming.kicks-ass.netSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 093b995e
...@@ -141,7 +141,14 @@ static void __set_sched_clock_stable(void) ...@@ -141,7 +141,14 @@ static void __set_sched_clock_stable(void)
tick_dep_clear(TICK_DEP_BIT_CLOCK_UNSTABLE); tick_dep_clear(TICK_DEP_BIT_CLOCK_UNSTABLE);
} }
static void __clear_sched_clock_stable(struct work_struct *work) static void __sched_clock_work(struct work_struct *work)
{
static_branch_disable(&__sched_clock_stable);
}
static DECLARE_WORK(sched_clock_work, __sched_clock_work);
static void __clear_sched_clock_stable(void)
{ {
struct sched_clock_data *scd = this_scd(); struct sched_clock_data *scd = this_scd();
...@@ -160,11 +167,11 @@ static void __clear_sched_clock_stable(struct work_struct *work) ...@@ -160,11 +167,11 @@ static void __clear_sched_clock_stable(struct work_struct *work)
scd->tick_gtod, gtod_offset, scd->tick_gtod, gtod_offset,
scd->tick_raw, raw_offset); scd->tick_raw, raw_offset);
static_branch_disable(&__sched_clock_stable);
tick_dep_set(TICK_DEP_BIT_CLOCK_UNSTABLE); tick_dep_set(TICK_DEP_BIT_CLOCK_UNSTABLE);
}
static DECLARE_WORK(sched_clock_work, __clear_sched_clock_stable); if (sched_clock_stable())
schedule_work(&sched_clock_work);
}
void clear_sched_clock_stable(void) void clear_sched_clock_stable(void)
{ {
...@@ -173,7 +180,7 @@ void clear_sched_clock_stable(void) ...@@ -173,7 +180,7 @@ void clear_sched_clock_stable(void)
smp_mb(); /* matches sched_clock_init_late() */ smp_mb(); /* matches sched_clock_init_late() */
if (sched_clock_running == 2) if (sched_clock_running == 2)
schedule_work(&sched_clock_work); __clear_sched_clock_stable();
} }
void sched_clock_init_late(void) void sched_clock_init_late(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment