From owner-freebsd-mips@FreeBSD.ORG Thu Aug 5 10:56:59 2010 Return-Path: Delivered-To: mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2299D106567B for ; Thu, 5 Aug 2010 10:56:59 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id AD16C8FC1F for ; Thu, 5 Aug 2010 10:56:57 +0000 (UTC) Received: by wyj26 with SMTP id 26so8062101wyj.13 for ; Thu, 05 Aug 2010 03:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=hX13BXhp8LUGMyjJpisF/w8DLNk7DH7V3q1gQuAkaGc=; b=efdlJ+mEHyJipd3Q3N7zVw1wNwC0MAGMnPCMeVnpSL35AKOj1gGxyb80Ytb5FjSTJt Qad14bBWkDfBIDeqx/0rYQsVhxOZ+0kmmrRAlXJUwi6vjjAUuGstyZT1x8/FFxTaGkLL c4ItaA5VeJPqga7Lhn/NVdKKWNGG7t7fsC0XQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=FIzbWdw7P8ZdW/9WnHLomC8C8kVcBuSIAecGGLIHkRTsGweFI3PPjWONWPk/zkNuX9 mEDt3rPKtmmHPp4xwAz4e8O+5qxgjGTbF+sgnBj1NEEQt0USMKLhWRK8Z0UgOkd2sgoP lKQb3Oh9576zmZtxAHEd+4tHNgFEQQPrkt/h0= MIME-Version: 1.0 Received: by 10.216.167.72 with SMTP id h50mr8930475wel.103.1281005814738; Thu, 05 Aug 2010 03:56:54 -0700 (PDT) Received: by 10.216.160.10 with HTTP; Thu, 5 Aug 2010 03:56:54 -0700 (PDT) In-Reply-To: <4C5A569B.9090401@cs.rice.edu> References: <201008041412.o74ECAix092415@svn.freebsd.org> <4C5A569B.9090401@cs.rice.edu> Date: Thu, 5 Aug 2010 16:26:54 +0530 Message-ID: From: "Jayachandran C." To: Alan Cox Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "Jayachandran C." , mips@freebsd.org Subject: Re: svn commit: r210846 - in head/sys/mips: include mips X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2010 10:56:59 -0000 On Thu, Aug 5, 2010 at 11:43 AM, Alan Cox wrote: > Just an observation ... > > Jayachandran C. wrote: >> >> Author: jchandra >> Date: Wed Aug =A04 14:12:09 2010 >> New Revision: 210846 >> URL: http://svn.freebsd.org/changeset/base/210846 >> >> Log: >> =A0Add 3 level page tables for MIPS in n64. >> =A0 =A0- 32 bit compilation will still use old 2 level page tables >> =A0- re-arrange pmap code so that adding another level is easier >> =A0- pmap code for 3 level page tables for n64 >> =A0- update TLB handler to traverse 3 levels in n64 >> =A0 =A0Reviewed by: =A0 =A0 =A0 =A0jmallett >> > > [snip] >> >> =A0- =A0 =A0 =A0 =A0 =A0 =A0 =A0if (pbits !=3D *pte) { >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!atomic_cmpset_int((u_= int *)pte, obits, >> pbits)) >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto retry= ; >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pmap_update_page(pmap, sva= , pbits); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Skip invalid PTEs */ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!pte_test(pte, PTE_V)) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 continue; >> +retry: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 obits =3D pbits =3D *pte; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pa =3D TLBLO_PTE_TO_PA(pbi= ts); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (page_is_managed(pa) &&= pte_test(&pbits, >> PTE_D)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 m =3D PHYS= _TO_VM_PAGE(pa); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 vm_page_di= rty(m); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 m->md.pv_f= lags &=3D ~PV_TABLE_MOD; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pte_clear(&pbits, PTE_D); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pte_set(&pbits, PTE_RO); >> + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (pbits !=3D *pte) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!atomi= c_cmpset_int((u_int *)pte, >> obits, pbits)) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 goto retry; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pmap_updat= e_page(pmap, sva, pbits); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} >> > > MIPS doesn't really need to use atomic_cmpset_int() in situations like th= is > because the software dirty bit emulation in trap.c acquires the pmap lock= . > =A0Atomics like this appear to be a carryover from i386 where the > hardware-managed TLB might concurrently set the modified bit. Then I guess we should be able to use *pte directly, without pbits, obits and the retry loop. Will try this change... Thanks, JC.