Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jun 2013 16:31:29 +0200
From:      Zbyszek Bodek <zbb@semihalf.com>
Cc:        freebsd-arm@FreeBSD.org, ray@freebsd.org
Subject:   Re: New pmap-v6.c features and improvements
Message-ID:  <51CC4CC1.4020509@semihalf.com>
In-Reply-To: <519E0D62.5030708@semihalf.com>
References:  <519B6B1C.9060008@semihalf.com> <20130522184232.GA437@jail.io> <519E0D62.5030708@semihalf.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <zbb@semihalf.com>
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 <zbb@semihalf.com>
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 <zbb@semihalf.com>
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51CC4CC1.4020509>