From: Hollis Blanchard Date: Tue, 07 Apr 2009 15:40:33 +0000 Subject: Re: [PATCH] Map guest (ts,tid) to individual shadow tid Message-Id: <1239118833.9183.50.camel@slate.austin.ibm.com> List-Id: References: <1239097890-19989-1-git-send-email-yu.liu@freescale.com> In-Reply-To: <1239097890-19989-1-git-send-email-yu.liu@freescale.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-ppc@vger.kernel.org On Tue, 2009-04-07 at 17:51 +0800, Liu Yu wrote: > Hi guys, > > Thanks to Hollis's idea. > This patch help to make KVMPPC be more friendly to OSes other than Linux. Wow, that was quick. :) Have you tested this code? Doesn't this break the assumption in kvmppc_e500_tlb1_invalidate() (and probably elsewhere) that stid = gtid? > Any (ts,tid) combination will be mapped to an individual shadow tid(stid). > Whenever the stid is exhausted, it needs to reset of stid and flush host TLB. What I was thinking was that KVM would participate in the host's normal PID allocation policy. Specifically, guest activity could cause the host to invoke steal_context_up/smp() (see switch_mmu_context() for reference). When you do that, there is no need for KVM to explicitly flush the TLB ever -- it's done as needed by steal_context*(). That's actually better than what we do today, because today we must flush all guest mappings every time we de-schedule a guest. In the new scheme, when (guest PIDs + host PIDs) < 255, we would never need to flush the TLB due to PID pressure. (Also, rather than an array, I would have created a hash table using include/linux/hash.h and include/linux/list.h. I haven't thought it through all the way though... I mean the tradeoffs of an array vs hash table here.) -- Hollis Blanchard IBM Linux Technology Center