Subject: Re: [PATCH v3 1/4] powerpc: Introduce local (non-broadcast) forms of tlb invalidates

From: Benjamin Herrenschmidt <[email-masked]>
Date: Fri, 05 Sep 2008 07:30:06 +1000

On Thu, 2008-09-04 at 21:17 +0200, Rafal Jaworowski wrote:
> Kumar Gala wrote:
> [...]
> > The intent of this change is to handle SMP based invalidates via IPIs instead
> > of broadcasts as the mechanism scales better for larger number of cores.
> 
> Hi Kumar,
> 
> How is the inter-IPI deadlock avoidance designed in this new approach? I don't
> know the close details of low-level Book-E VM design in Linux, but am thinking
> about a scenario when we have two TLB misses hitting almost immediately on two
> different cores and they both want to send a TLB invalidate IPI to each other.
> How do you manage this?

Simple.. Just look how it's done on x86 :-) The flush_tlb_* operations
happen with interrupt enabled and no major lock held. They shouldn't
deadlock.

> The reason I ask is we had similar considerations (and problems) when bringing
> SMP to the dual core e500 on FreeBSD and ended up not using IPIs, at least for
> now, because of such concerns (and actual problems of this kind).

Well, it depends how your VM is designed. The linux one has beeing doing
IPIs for invalidations forever on x86 so it's not hard to adapt.

Ben.