Files
linux/include/asm-generic
Peter Zijlstra 9b4f68fbb4 UPSTREAM: sched/preempt: Fix preempt_count manipulations
Vikram reported that his ARM64 compiler managed to 'optimize' away the
preempt_count manipulations in code like:

	preempt_enable_no_resched();
	put_user();
	preempt_disable();

Irrespective of that fact that that is horrible code that should be
fixed for many reasons, it does highlight a deficiency in the generic
preempt_count manipulators. As it is never right to combine/elide
preempt_count manipulations like this.

Therefore sprinkle some volatile in the two generic accessors to
ensure the compiler is aware of the fact that the preempt_count is
observed outside of the regular program-order view and thus cannot be
optimized away like this.

x86; the only arch not using the generic code is not affected as we
do all this in asm in order to use the segment base per-cpu stuff.

Change-Id: I13da06ddb17c533b8150f008514a4c74723b1742
Reported-by: Vikram Mulukutla <markivx@codeaurora.org>
Tested-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: a787870924 ("sched, arch: Create asm/preempt.h")
Link: http://lkml.kernel.org/r/20160516131751.GH3205@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
(cherry picked from commit 2e636d5e66c35dfcbaf617aa8fa963f6847478fe)
2016-11-08 10:21:07 +08:00
..
2015-07-27 14:06:24 +02:00
2015-11-11 15:57:28 +08:00
2014-04-07 16:36:10 -07:00
2015-11-11 15:57:28 +08:00
2015-11-11 15:57:28 +08:00
2015-11-11 15:57:28 +08:00
2015-05-12 10:46:53 +02:00
2015-11-11 15:57:28 +08:00
2015-11-11 15:54:30 +08:00
2012-10-02 18:01:56 +01:00
2012-12-09 23:14:14 +01:00
2014-11-23 13:01:47 +01:00
2013-01-03 15:57:16 -08:00
2015-08-25 09:59:45 +02:00
2015-11-10 16:32:11 -08:00
2014-06-17 19:12:40 -04:00
2015-11-11 15:57:28 +08:00
2014-01-13 10:43:41 +08:00
2014-05-15 00:32:09 +01:00
2015-09-05 13:19:09 +02:00
2015-11-11 15:57:28 +08:00
2015-11-11 15:57:28 +08:00
2015-11-11 15:57:28 +08:00
2012-11-29 00:01:23 -05:00
2015-11-11 15:57:28 +08:00
2015-11-11 15:57:28 +08:00
2013-02-14 09:21:15 -05:00
2015-11-23 09:44:58 +01:00
2015-11-11 15:57:28 +08:00