Files
twx-linux/include/linux
Nicolas Pitre d6f029130f [PATCH] fix race with preempt_enable()
Currently a simple

	void foo(void) { preempt_enable(); }

produces the following code on ARM:

foo:
	bic	r3, sp, #8128
	bic	r3, r3, #63
	ldr	r2, [r3, #4]
	ldr	r1, [r3, #0]
	sub	r2, r2, #1
	tst	r1, #4
	str	r2, [r3, #4]
	blne	preempt_schedule
	mov	pc, lr

The problem is that the TIF_NEED_RESCHED flag is loaded _before_ the
preemption count is stored back, hence any interrupt coming within that
3 instruction window causing TIF_NEED_RESCHED to be set won't be
seen and scheduling won't happen as it should.

Nothing currently prevents gcc from performing that reordering.  There
is already a barrier() before the decrement of the preemption count, but
another one is needed between this and the TIF_NEED_RESCHED flag test
for proper code ordering.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Acked-by: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-12-22 09:17:39 -08:00
..
…
…
2005-11-28 21:00:29 +00:00
…
2005-11-13 18:14:17 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2005-11-13 18:14:10 -08:00
…
…
2005-11-09 07:55:59 -08:00
…
…
2005-11-10 02:26:41 +01:00
2005-11-22 19:39:30 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2005-12-15 02:20:15 +01:00
2005-11-08 17:14:08 +01:00
…
…
…
…
…
…
…
2005-11-08 09:40:47 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2005-11-07 14:18:56 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2005-12-12 08:57:43 -08:00
…
…
…
…
…
…
…
2005-11-28 14:42:23 -08:00
…
…
…
…
…
…
2005-11-07 18:18:11 -08:00
…
…
…
…
…
…
…
2005-11-09 07:56:00 -08:00
…
…
…
…
…
…
…
…
…
2005-12-19 23:12:09 -05:00
…
…
…
…
…
…
…
…
…
2005-11-13 18:14:12 -08:00
…
…
2005-12-12 08:57:45 -08:00
…
…
2005-11-13 18:14:15 -08:00
…
…
…
…
…
…
…
2005-11-07 07:54:09 -08:00
…
…
…
…
…
…
2005-11-07 07:53:42 -08:00
…
…
2005-11-07 07:53:39 -08:00
…
…
…
…
…
…
2005-11-07 07:53:46 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2005-11-07 07:53:41 -08:00
…
…
…
…
2005-11-07 07:53:37 -08:00
…
2005-11-20 21:25:15 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2005-12-05 13:42:06 -08:00
…
…
…
…
2005-11-10 17:14:59 -08:00
…
…
…
…
2005-12-12 08:57:42 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2005-11-23 23:04:28 -08:00
…
…
…
…
…
…
…
…
…
2005-11-07 07:53:41 -08:00
…
…
…
…
…
…
…
…
…
…
…