From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Aneesh Kumar K.V" Date: Tue, 15 Oct 2013 05:19:43 +0000 Subject: Re: [PATCH 3/4] kvm: powerpc: define a linux pte lookup function Message-Id: <87wqlfyvds.fsf@linux.vnet.ibm.com> List-Id: References: <1381212212-29641-1-git-send-email-Bharat.Bhushan@freescale.com> <1381212212-29641-4-git-send-email-Bharat.Bhushan@freescale.com> <1381268203.7979.276.camel@snotra.buserror.net> <6A3DF150A5B70D4F9B66A25E3F7C888D071A8AD0@039-SN2MPN1-012.039d.mgd.msft.net> <1381340851.7979.327.camel@snotra.buserror.net> <20131010103540.GD9906@iris.ozlabs.ibm.com> In-Reply-To: <20131010103540.GD9906@iris.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Paul Mackerras , Scott Wood Cc: Bhushan Bharat-R65777 , Wood Scott-B07421 , "agraf@suse.de" , Yoder Stuart-B08248 , "kvm@vger.kernel.org" , "kvm-ppc@vger.kernel.org" Paul Mackerras writes: > On Wed, Oct 09, 2013 at 12:47:31PM -0500, Scott Wood wrote: >> On Wed, 2013-10-09 at 03:48 -0500, Bhushan Bharat-R65777 wrote: >> > >> > What lookup_linux_pte_and_update() does:- >> > - find_linux_pte_or_hugepte() >> > - does size and some other trivial checks >> > - Then atomically update the pte:- >> > => while() >> > => wait till _PAGE_BUSY is clear >> > => atomically update the pte >> > => if not updated then go back to while() above else break >> > >> > >> > While what lookup_linux_pte() does:- >> > - find_linux_pte_or_hugepte() >> > - does size and some other trivial checks >> > - wait till _PAGE_BUSY is clear >> > - return pte >> > >> > I am finding it difficult to call lookup_linux_pte() from lookup_linux_pte_and_update(). >> >> You could factor out a common lookup_linux_ptep(). > > I don't really think it's enough code to be worth wringing out the > last drop of duplication. However, if he removed the checks for > _PAGE_BUSY and _PAGE_PRESENT as I suggested in another mail, and made > it return the pte pointer rather than the value, it would then > essentially be a lookup_linux_ptep() as you suggest. We also need to check for _PAGE_SPLITTING before going ahead and using the pte value -aneesh From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Aneesh Kumar K.V" Subject: Re: [PATCH 3/4] kvm: powerpc: define a linux pte lookup function Date: Tue, 15 Oct 2013 10:37:43 +0530 Message-ID: <87wqlfyvds.fsf@linux.vnet.ibm.com> References: <1381212212-29641-1-git-send-email-Bharat.Bhushan@freescale.com> <1381212212-29641-4-git-send-email-Bharat.Bhushan@freescale.com> <1381268203.7979.276.camel@snotra.buserror.net> <6A3DF150A5B70D4F9B66A25E3F7C888D071A8AD0@039-SN2MPN1-012.039d.mgd.msft.net> <1381340851.7979.327.camel@snotra.buserror.net> <20131010103540.GD9906@iris.ozlabs.ibm.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Bhushan Bharat-R65777 , Wood Scott-B07421 , "agraf\@suse.de" , Yoder Stuart-B08248 , "kvm\@vger.kernel.org" , "kvm-ppc\@vger.kernel.org" To: Paul Mackerras , Scott Wood Return-path: In-Reply-To: <20131010103540.GD9906@iris.ozlabs.ibm.com> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Paul Mackerras writes: > On Wed, Oct 09, 2013 at 12:47:31PM -0500, Scott Wood wrote: >> On Wed, 2013-10-09 at 03:48 -0500, Bhushan Bharat-R65777 wrote: >> > >> > What lookup_linux_pte_and_update() does:- >> > - find_linux_pte_or_hugepte() >> > - does size and some other trivial checks >> > - Then atomically update the pte:- >> > => while() >> > => wait till _PAGE_BUSY is clear >> > => atomically update the pte >> > => if not updated then go back to while() above else break >> > >> > >> > While what lookup_linux_pte() does:- >> > - find_linux_pte_or_hugepte() >> > - does size and some other trivial checks >> > - wait till _PAGE_BUSY is clear >> > - return pte >> > >> > I am finding it difficult to call lookup_linux_pte() from lookup_linux_pte_and_update(). >> >> You could factor out a common lookup_linux_ptep(). > > I don't really think it's enough code to be worth wringing out the > last drop of duplication. However, if he removed the checks for > _PAGE_BUSY and _PAGE_PRESENT as I suggested in another mail, and made > it return the pte pointer rather than the value, it would then > essentially be a lookup_linux_ptep() as you suggest. We also need to check for _PAGE_SPLITTING before going ahead and using the pte value -aneesh