[RFC/PATCH v4 6/7] ARM: ARM11 MPCore: DMA_CACHE_RWFO operations are not preempt safe

Nicolas Pitre nico at fluxnic.net
Tue Oct 18 17:28:45 EDT 2011


On Tue, 18 Oct 2011, gdavis at mvista.com wrote:

> @@ -241,6 +247,13 @@ v6_dma_inv_range:
>  	blo	1b
>  	mov	r0, #0
>  	mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer
> +#if	defined(CONFIG_DMA_CACHE_RWFO) && defined(CONFIG_PREEMPT)
> +	str	r3, [ip, #TI_PREEMPT]		@ restore preempt count
> +	teq	r3, #0				@ preempt count == 0?
> +	ldreq	r3, [ip, #TI_FLAGS]		@ load flags if yes
> +	tst	r3, #_TIF_NEED_RESCHED		@ need resched?
> +	bne	preempt_schedule		@ ret via preempt_schedule

This is buggy.  If the preempt count is _not_ zero, you end up not 
loading the TI_FLAGS bits and testing _TIF_NEED_RESCHED against that 
non-zero preempt count.


Nicolas



More information about the linux-arm-kernel mailing list