From owner-freebsd-arm@FreeBSD.ORG Thu Jun 27 18:31:04 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 34B38836 for ; Thu, 27 Jun 2013 18:31:04 +0000 (UTC) (envelope-from zbb@semihalf.com) Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by mx1.freebsd.org (Postfix) with ESMTP id BA757185B for ; Thu, 27 Jun 2013 18:31:03 +0000 (UTC) Received: by mail-ee0-f49.google.com with SMTP id b57so568721eek.36 for ; Thu, 27 Jun 2013 11:31:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:organization:user-agent:mime-version:cc :subject:references:in-reply-to:content-type:x-gm-message-state; bh=b1ub4slu/R5Yrh0Jrk83O1JHmeJpnkAP/xbBtf5dFt4=; b=WGy8K7GSY5uoTdRYFkZfYc8gjxa7ysn2wI24aUssKMpquHu2KBup+EJ4K+JfUycLAe YSIFcHpJdvdXD2y/6D050gOYrPXVdTJBaZnPEzOi4Fci9y0PzLgvtSFnJ6+gerYBjTyj K5lsfVZItdshQLuICmh5JJZngA5ntY5FEXLxjQ8SYwOGz/jDouO2Qm9ovEC4eGZcqXGd Gpy4adBsQi6YMEAGVJ4hzDVQAYGIdmL9M1FwqkZnK57XtGI9vln2qpn6WiDlvnzcZYiA JSmvALq87D9Z7WlDXs5Lbb1XScjfK8XjUESZo+lhQ2z1wMzG4maYxCvtZU1oNqi11BBN zF5g== X-Received: by 10.14.7.2 with SMTP id 2mr9283723eeo.145.1372343492860; Thu, 27 Jun 2013 07:31:32 -0700 (PDT) Received: from [10.0.2.117] (cardhu.semihalf.com. [213.17.239.108]) by mx.google.com with ESMTPSA id cg12sm4204513eeb.7.2013.06.27.07.31.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Jun 2013 07:31:32 -0700 (PDT) Message-ID: <51CC4CC1.4020509@semihalf.com> Date: Thu, 27 Jun 2013 16:31:29 +0200 From: Zbyszek Bodek Organization: Semihalf User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 Subject: Re: New pmap-v6.c features and improvements References: <519B6B1C.9060008@semihalf.com> <20130522184232.GA437@jail.io> <519E0D62.5030708@semihalf.com> In-Reply-To: <519E0D62.5030708@semihalf.com> Content-Type: multipart/mixed; boundary="------------080505050701020808050602" X-Gm-Message-State: ALoCoQl6YYCQ9OhWdFWTAqeSkffyHabWYi2NsevOhNQTPU9NvPhOEdBwFy1NvsX7aKrBZMTgpbk8 Cc: freebsd-arm@FreeBSD.org, ray@freebsd.org X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 18:31:04 -0000 This is a multi-part message in MIME format. --------------080505050701020808050602 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 23.05.2013 14:36, Zbyszek Bodek wrote: > On 22.05.2013 20:42, Ruslan Bukin wrote: >> On Tue, May 21, 2013 at 02:39:56PM +0200, Zbyszek Bodek wrote: >>> Hello Everyone, >>> >>> I would like to introduce another pack of patches for pmap-v6.c and >>> related, that we created as a part of Semihalf work on Superpages >>> support. >>> >>> The patches include some major changes like: >>> >>> - Switch to AP[1:0] access permissions model >>> - Transition of the mapping related flags to PTE (stop using PVF_ flags >>> in pv_entry) >>> - Rework of the pmap_enter_locked() function >>> - pmap code optimizations >>> >>> And some minor clean-ups: >>> >>> - Get rid of the VERBOSE_INIT_ARM option >>> - Clean-ups, style and naming improvements to pmap >>> >>> Please check out the attachment for details. >>> >>> I will be happy to answer your questions and doubts if any. >>> >>> Best regards >>> Zbyszek Bodek >> >> I tested new patches with exynos5 and everything is OK. >> (I mean all works as usual) >> > > Hello. > > I'm happy to announce that code has been integrated to the FreeBSD HEAD. > Great thanks your help! > Hello Everyone, We have two micro patches for pmap-v6.c containing fix for 'modified' bit emulation and removal of the redundant PGA_WRITEABLE clearing. Please check out the attachment. These two are minimal changes and we would like to commit them soon, so we would be grateful if you could test them on your ARMv6/v7 platforms and give us your remarks. Best regards Zbyszek Bodek --------------080505050701020808050602 Content-Type: text/x-patch; name="0001-Fix-modified-bit-emulation-for-ARMv6-v7.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-modified-bit-emulation-for-ARMv6-v7.patch" >From e05345e92b3a32f2c71fc74c217c3ab4b516db12 Mon Sep 17 00:00:00 2001 From: Zbigniew Bodek Date: Wed, 19 Jun 2013 13:18:32 +0200 Subject: [PATCH 1/2] Fix modified bit emulation for ARMv6/v7 When doing pmap_enter_locked(), enable write permission only when access type indicates attempt to write. Otherwise, leave page read only but mark it writable in pv_flags. This will result in: 1. Marking page writable during pmap_enter() but only when ensured that it will be written right away so that we will not get redundant permissions fault on write attempt. 2. Keeping page read only when it is permitted to be written but there was no actual write attempt. Hence, we will get permissions fault on write access and mark page writable in pmap_fault_fixup() what will indicate modification status. Submitted by: Zbigniew Bodek Sponsored by: The FreeBSD Foundation, Semihalf --- sys/arm/arm/pmap-v6.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index 9e0b8bd..4ad0067 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -2801,8 +2801,13 @@ validate: } if (prot & VM_PROT_WRITE) { - /* Write enable */ - npte &= ~(L2_APX); + /* + * Enable write permission if the access type + * indicates write intention. Emulate modified + * bit otherwise. + */ + if ((access & VM_PROT_WRITE) != 0) + npte &= ~(L2_APX); if ((m->oflags & VPO_UNMANAGED) == 0) { vm_page_aflag_set(m, PGA_WRITEABLE); -- 1.8.2 --------------080505050701020808050602 Content-Type: text/x-patch; name="0002-Remove-redundant-clearing-of-the-PGA_WRITEABLE-flag-.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0002-Remove-redundant-clearing-of-the-PGA_WRITEABLE-flag-.pa"; filename*1="tch" >From 767546f938c8e45912fb999464b0b2bcae00c723 Mon Sep 17 00:00:00 2001 From: Zbigniew Bodek Date: Mon, 24 Jun 2013 19:09:16 +0200 Subject: [PATCH 2/2] Remove redundant clearing of the PGA_WRITEABLE flag in pmap_remove_all() This flag should already be cleared by pmap_nuke_pv() --- sys/arm/arm/pmap-v6.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index 4ad0067..c0f4c2c 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -2470,7 +2470,6 @@ pmap_remove_all(vm_page_t m) else cpu_tlb_flushD(); } - vm_page_aflag_clear(m, PGA_WRITEABLE); rw_wunlock(&pvh_global_lock); } -- 1.8.2 --------------080505050701020808050602--