Re: [PATCH -rt] ARM TLB flush fix: don't forget to re-enable preemption

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Russell King
Date: Wednesday, May 23, 2007 - 9:25 am

On Wed, May 23, 2007 at 09:13:57AM -0700, Kevin Hilman wrote:

I don't see any reason for them to be - when switching to another process
we'll generally do a full TLB flush anyway, so what's the point in making
these flushes atomic?

Consider:

flush_tlb_page()
 first mcr - invalidates tlb single entry
	--- context switch, invalidates entire tlb, inc dsb ---
		something else runs
	--- context switch, invalidates entire tlb, inc dsb, again ---
 dsb

That context switch is harmless - we end up with the entire TLB being
invalidated and a DSB following.  Now consider:

flush_tlb_page()
	--- context switch, invalidates entire tlb, inc dsb ---
		something else runs
	--- context switch, invalidates entire tlb, inc dsb, again ---
 preempt_disable()
 first mcr - invalidates tlb single entry
 dsb
 preempt_enable()

Any difference?  No.  Without the preempt disable/enable fiddling?  No.

flush_tlb_page()
 preempt_disable()
 first mcr - invalidates tlb single entry
 dsb
 preempt_enable()
	--- context switch, invalidates entire tlb, inc dsb ---
		something else runs
	--- context switch, invalidates entire tlb, inc dsb, again ---

Any difference?  No.  Without the preempt disable/enable fiddling?  No.

In every case of a preemption occuring in the middle of a tlb operation,
the ultimate result is identical irrespective of preempt control
sprinkling.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH -rt] ARM TLB flush fix: don't forget to re-enab ..., Russell King, (Wed May 23, 9:25 am)