From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Ehrhardt Date: Mon, 11 Aug 2008 11:47:46 +0000 Subject: Re: [PATCH 4 of 5] kvm: ppc: Write only modified shadow entries into Message-Id: <48A026E2.8010701@linux.vnet.ibm.com> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: kvm-ppc@vger.kernel.org Liu Yu wrote: >> -----Original Message----- >> From: Christian Ehrhardt [mailto:ehrhardt@linux.vnet.ibm.com]=20 >> Sent: Monday, August 11, 2008 4:33 PM >> To: Liu Yu >> Cc: Hollis Blanchard; kvm-ppc@vger.kernel.org >> Subject: Re: [PATCH 4 of 5] kvm: ppc: Write only modified=20 >> shadow entries into theTLB on exit >> >> Liu Yu wrote: >> =20 >>> =20 >>> =20 >>>> -----Original Message----- >>>> From: kvm-ppc-owner@vger.kernel.org >>>> [mailto:kvm-ppc-owner@vger.kernel.org] On Behalf Of Hollis=20 >>>> =20 >> Blanchard >> =20 >>>> Sent: Saturday, July 26, 2008 2:55 AM >>>> To: avi@qumranet.com >>>> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org >>>> Subject: [PATCH 4 of 5] kvm: ppc: Write only modified=20 >>>> =20 >> shadow entries=20 >> =20 >>>> into theTLB on exit >>>> >>>> @@ -229,6 +235,7 @@ void kvmppc_mmu_priv_switch(struct kvm_v >>>> =20 >>>> kvmppc_44x_shadow_release(vcpu, i); >>>> stlbe->word0 =3D 0; >>>> + kvmppc_tlbe_set_modified(vcpu, i); >>>> KVMTRACE_5D(STLB_INVAL, vcpu, i, >>>> stlbe->tid, stlbe->word0, stlbe->word1, >>>> stlbe->word2, handler); >>>> =20 >>>> =20 >>> Can this place use "_tlbia()" instead? >>> =20 >>> =20 >> Hi Liu, >> when we exit&reenter a guest on the lightweight path this=20 >> patch saves us from rebuilding too much of the tlb. >> It's just the point of the patch to not invalidate all tlb=20 >> entries on every exit, but keeping as much as possible. >> Additionally I'm not even sure if tlbia is available on all=20 >> cores used. >> >> Am I overlooking something ? - what do you think would be the=20 >> benefit of using _tlbia() here? >> Do you mean the loop to clear up to the hwater mark where=20 >> this patch makes changes and not this patch itself? >> >> =20 > > Yes. > > When you set nearly all tlb entries modified in this loop, > you have to write all of them back before entering the guest in booke_int= errupts.S. > > So, why not "_tlbia()" here outside this loop, and don't set them modifie= d. > Then, you needn't write them back. > In fact, the shadow tlb entries are still consistent with the hardware, a= s all of them are invalidated. > > Am I overlooking something ? > =20 As Hollis wrote in his patch comment usually just one tlb entry is=20 modified which saves a lot of updates. If we invalidate all we later on would have to satisfy the misses we=20 cause by doing so. With some free time we could test _tlbia() here, but I expect it to be=20 slower by causing the need for tlb re-population compared to what we=20 save here. --=20 Gr=FCsse / regards,=20 Christian Ehrhardt IBM Linux Technology Center, Open Virtualization