linux-mips
[Top] [All Lists]

Re: [RFC & PATCH] fixing tlb flush race problem on smp

To: Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [RFC & PATCH] fixing tlb flush race problem on smp
From: Jun Sun <jsun@mvista.com>
Date: Tue, 4 Feb 2003 16:02:50 -0800
Cc: Juan Quintela <quintela@mandrakesoft.com>, linux-mips@linux-mips.org, jsun@mvista.com, Ralf Baechle <ralf@linux-mips.org>
In-reply-to: <20030129090627.D7741@linux-mips.org>; from ralf@linux-mips.org on Wed, Jan 29, 2003 at 09:06:27AM +0100
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20030121143726.C16939@mvista.com> <86bs297hpd.fsf@trasno.mitica> <20030127170346.S11633@mvista.com> <20030129090627.D7741@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.2.5i
Here is a complete patch for both mips/mips64, 2.4 and 
2.5.  Of course only 2.4/mips combo is tested.

The clear_bit/set_bit actually need to be protected.
The flag setting needs to be in sync with the actual
hardware setting (set_entry_hi/set current pgd).  Otherwise
an tlb flushing IPI may does the wrong thing.

Jun

On Wed, Jan 29, 2003 at 09:06:27AM +0100, Ralf Baechle wrote:
> On Mon, Jan 27, 2003 at 05:03:46PM -0800, Jun Sun wrote:
> 
> > I also find a stupid typo and a subtle hole in my original patch.
> > Here is an updated version, for 2.4/mips only.  If it looks ok, I 
> > will extend to other sub-arches/trees.
> > 
> > This new one is pretty nice in that all mmu related operations
> > are put into one file and it is much easier to ensure correctness
> > later.
> 
> I like this one.
> 
> > +
> > +   /*
> > +    * Mark current->active_mm as not "active" anymore.
> > +    * We don't want to mislead possible IPI tlb flush routines.
> > +    */
> > +   clear_bit(cpu, &prev->cpu_vm_mask);
> > +   set_bit(cpu, &next->cpu_vm_mask);
> > +
> > +   local_irq_restore(flags);
> 
> I don't think it's necessary to protect the clear_bit and set_bit operations
> with local_irq_save ... local_irq_restore.
> 
> In addition because switch_mm is always called with interrupts enabled you
> can simplify that to local_irq_disable ... local_irq_enable.
> 
>   Ralf
> 

Attachment: 030204-2.4-smp-tlb-flush.patch
Description: Text document

Attachment: 030204-2.5-smp-tlb-flush.patch
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>