Subject: Re: [PATCH 11/16] powerpc/mm: Add SMP support to no-hash TLB handling v3

From: Benjamin Herrenschmidt <[email-masked]>
Date: Tue, 16 Dec 2008 07:46:18 +1100

> > +void local_flush_tlb_mm(struct mm_struct *mm)
> > +{
> > +	unsigned int pid;
> > +
> > +	preempt_disable();
> > +	pid = mm->context.id;
> > +	if (pid != MMU_NO_CONTEXT)
> > +		_tlbil_pid(pid);
> > +	preempt_enable();
> > +}
> > +EXPORT_SYMBOL(local_flush_tlb_mm);
> 
> Do these really get called w/MMU_NO_CONTEXT?  What is the calling code  
> trying to flush under those situations?

A bit of paranoia but yes, I think they can. flush_* can be called on a
non-current mm, thus an mm without a context (because it's been stolen
mostly) due to calls to unmap_mapping_range() or something like that,
which can be called by some filesystems (especially network filesystems
trying to reflect remote changes on mmap'ed regions I think). Under some
circumstances, ptrace can also cause flushes of non-current mm's.
 
> 
> > Index: linux-work/arch/powerpc/include/asm/mmu.h
> > ===================================================================
> > --- linux-work.orig/arch/powerpc/include/asm/mmu.h	2008-12-15  
> > 14:36:20.000000000 +1100
> > +++ linux-work/arch/powerpc/include/asm/mmu.h	2008-12-15  
> > 14:36:20.000000000 +1100
> > @@ -15,6 +15,9 @@
> > #define MMU_FTR_TYPE_FSL_E		ASM_CONST(0x00000010)
> > #define MMU_FTR_HAS_HIGH_BATS		ASM_CONST(0x00010000)
> > #define MMU_FTR_BIG_PHYS		ASM_CONST(0x00020000)
> > +#define MMU_FTR_HAS_TLBIVAX_BCAST	ASM_CONST(0x00040000)
> > +#define MMU_FTR_HAS_TLBILX_PID		ASM_CONST(0x00080000)
> 
> Can we make these FTR_USE_ instead of FTR_HAS_.  On e500 we have  
> TLBIVAX_BCAST but dont plan to use it.  I'd prefer not to have to  
> answer questions about that.

Hehehe :-) I can change that easily yes.

> > +#define MMU_FTR_TLBIVAX_NEED_LOCK	ASM_CONST(0x00100000)
> 
> Is this really ivax lock or sync lock?

The whole thing. Not totally clear, you have a better name ? Some CPUs
want a lock on sync and some on ivax, I plan to lock the whole sequence.

Cheers,
Ben.