linux/include
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
..
acpi
asm-alpha [PATCH] mm: fill arch atomic64 gaps 2005-11-23 16:08:39 -08:00
asm-arm [ARM] 3205/1: Handle new EABI relocations when loading kernel modules. 2005-12-14 22:04:22 +00:00
asm-arm26
asm-cris
asm-frv [PATCH] FRV: Make the FRV arch work again 2005-11-28 14:42:23 -08:00
asm-generic Merge x86-64 update from Andi 2005-11-14 19:56:02 -08:00
asm-h8300
asm-i386 x86: Fix silly typo in recent <asm/signal.h> fixes 2005-11-17 10:04:31 -08:00
asm-ia64 [IA64] disable preemption in udelay() 2005-12-16 10:00:24 -08:00
asm-m32r [PATCH] m32r: M3A-2170(Mappi-III) IDE support 2005-11-28 14:42:24 -08:00
asm-m68k
asm-m68knommu
asm-mips [PATCH] ide: AU1200 IDE update 2005-12-15 02:17:46 +01:00
asm-parisc [PARISC] Always spinlock tlb flush operations to ensure preempt safety 2005-11-17 16:44:14 -05:00
asm-powerpc [PATCH] powerpc: Add missing icache flushes for hugepages 2005-12-09 16:30:48 +11:00
asm-ppc [PATCH] ppc: ppc4xx_dma DMA_MODE_{READ,WRITE} fix 2005-12-16 14:43:05 -08:00
asm-s390
asm-sh
asm-sh64
asm-sparc [PATCH] sun4c_memerr_reg __iomem annotations 2005-12-15 10:01:29 -08:00
asm-sparc64 [PATCH] sparc: convert IO remapping to VM_PFNMAP 2005-11-28 14:35:36 -08:00
asm-um [PATCH] uml: eliminate anonymous union and clean up symlink lossage 2005-11-22 09:13:41 -08:00
asm-v850 [PATCH] v850: use generic hardirq code 2005-11-15 08:59:20 -08:00
asm-x86_64 [PATCH] mm: fill arch atomic64 gaps 2005-11-23 16:08:39 -08:00
asm-xtensa
keys
linux [PATCH] fix race with preempt_enable() 2005-12-22 09:17:39 -08:00
math-emu
media [PATCH] V4L/DVB: (3086c) Whitespaces cleanups part 4 2005-12-12 08:57:44 -08:00
mtd
net [IPSEC]: Perform SA switchover immediately. 2005-12-19 14:23:23 -08:00
pcmcia
rdma
rxrpc
scsi [SCSI] fix for fc transport recursion problem. 2005-12-15 19:22:14 -08:00
sound
video