Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Aug 2013 16:19:52 +0200
From:      Zbigniew Bodek <zbb@semihalf.com>
To:        "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Cc:        ray@freebsd.org, Alan Cox <alc@cs.rice.edu>
Subject:   Re: New pmap-v6.c features and improvements
Message-ID:  <CAG7dG%2BwoHUZp8M_KSMkDy_YNyoC3sLT9qwY_orVqk%2BAoeFpNEA@mail.gmail.com>
In-Reply-To: <51F68F58.8060600@semihalf.com>
References:  <519B6B1C.9060008@semihalf.com> <20130522184232.GA437@jail.io> <519E0D62.5030708@semihalf.com> <51CC4CC1.4020509@semihalf.com> <51D57456.9080504@semihalf.com> <B6F68E56-7452-44D4-9C9D-195221B06380@bsdimp.com> <51F68F58.8060600@semihalf.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
2013/7/29 Zbyszek Bodek <zbb@semihalf.com>

> On 04.07.2013 19:34, Warner Losh wrote:
> >
> > On Jul 4, 2013, at 7:10 AM, Zbyszek Bodek wrote:
> >
> >> On 27.06.2013 16:31, Zbyszek Bodek wrote:
> >>> 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.
> >>>
> >>
> >> Hello,
> >>
> >> Because there were no objections, we've integrated the patches:
> >>
> >> http://svnweb.freebsd.org/base?view=revision&revision=252694
> >> http://svnweb.freebsd.org/base?view=revision&revision=252695
> >
> Hello Everyone,
>
> I'm sending another set of fixes for pmap-v6.c
> Please see attachment.
>
> 0012 - Removal of the costly, frequent sweeping through the
>        pv_entries whenever pmap_nuke_pv(), pmap_modify_pv(), etc.
>        are called. This also makes order with clearing PGA_WRITEABLE
>        aflag as well as with the pmap_statistics related to the
>        wired_count.
> 0013 - Fix for pamp_set_prot() where not all of the protection bits were
>        cleared before the actual configuration. L2_XN is not icluded to
>        the L2_S_PROT mask to maintain consistency between PROT_MASKS for
>        L2 and L1 descriptors - contain only kernel/user and
>        read/write permissions bits.
> 0014 - Fix for pmap_change_wiring() where "wired" indicator of type
>        boolean was being used as a "wired flag" passed to
>        pmap_modify_pv() which was obviously not a valid PVF_WIRED flag.
>
> Please test those patches on your ARM-based machines and send your
> feedback. We will also appreciate your reviews and remarks.
>
> Thank you in advance for your help.
>
>
Hello,

Are there any updates in this topic?
In addition, I'm attaching two more minor improvements, this time:

0015 - small clean-ups in pmap_clearbit() that in general gives one relevant
           improvement which is to skip redundant "dirty" setting for a
page.
0016 - removal of the unused pv_kva field from the md_page structure

If there are no objections to that and earlier presented changes we would
like to
integrate them to the HEAD soon.

Best regards
Zbyszek Bodek

[-- Attachment #2 --]
From f92f68202d6dae4b30d6bd88ca79b3b226ea0cda Mon Sep 17 00:00:00 2001
From: Zbigniew Bodek <zbb@semihalf.com>
Date: Mon, 29 Jul 2013 19:18:22 +0200
Subject: [PATCH 1/2] Simplify and clean-up redundant statements from ARMv6/v7
 pmap_clearbit()

PVF_MOD is an unused flag kept just to indicate what is to be cleared
since PTE's L2_APX shows modification status. What more, there is no need
for calling vm_page_dirty() when clearing "modified" flag as it is already
set for that page in pmap_fault_fixup() or pmap_enter() thanks to
"modified" bit emulation.
There is also no need for checking PTE's "referenced" or "writeable" flags.
If there is a request to clear a particular flag, just do it.

Submitted by:   Zbigniew Bodek <zbb@semihalf.com>
Sponsored by:   The FreeBSD Foundation, Semihalf
---
 sys/arm/arm/pmap-v6.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c
index 3142f56..2852f12 100644
--- a/sys/arm/arm/pmap-v6.c
+++ b/sys/arm/arm/pmap-v6.c
@@ -900,9 +900,6 @@ pmap_clearbit(struct vm_page *m, u_int maskbits)
 
 	rw_wlock(&pvh_global_lock);
 
-	if (maskbits & PVF_WRITE)
-		maskbits |= PVF_MOD;
-
 	if (TAILQ_EMPTY(&m->md.pv_list)) {
 		rw_wunlock(&pvh_global_lock);
 		return (0);
@@ -924,14 +921,12 @@ pmap_clearbit(struct vm_page *m, u_int maskbits)
 		ptep = &l2b->l2b_kva[l2pte_index(va)];
 		npte = opte = *ptep;
 
-		if ((maskbits & (PVF_WRITE|PVF_MOD)) && L2_S_WRITABLE(opte)) {
-			vm_page_dirty(m);
-
+		if (maskbits & (PVF_WRITE | PVF_MOD)) {
 			/* make the pte read only */
 			npte |= L2_APX;
 		}
 
-		if ((maskbits & PVF_REF) && L2_S_REFERENCED(opte)) {
+		if (maskbits & PVF_REF) {
 			/*
 			 * Clear referenced flag in PTE so that we
 			 * will take a flag fault the next time the mapping
-- 
1.8.2


[-- Attachment #3 --]
From 278d58c41d24147428e1a9b91af48de92d0071a6 Mon Sep 17 00:00:00 2001
From: Zbigniew Bodek <zbb@semihalf.com>
Date: Wed, 31 Jul 2013 19:19:28 +0200
Subject: [PATCH 2/2] Stop using redundant pv_kva field in md_page structure
 for ARMv6/v7

This variable is complitely useless in current pmap-v6.c implementation,
hence delete it to save some space on each vm_page.

Submitted by:   Zbigniew Bodek <zbb@semihalf.com>
Sponsored by:   The FreeBSD Foundation, Semihalf
---
 sys/arm/arm/pmap-v6.c  | 2 +-
 sys/arm/include/pmap.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c
index 2852f12..aef4ce3 100644
--- a/sys/arm/arm/pmap-v6.c
+++ b/sys/arm/arm/pmap-v6.c
@@ -4368,6 +4368,6 @@ pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma)
 	 * uncacheable, being careful to sync caches and PTEs (and maybe
 	 * invalidate TLB?) for any current mapping it modifies.
 	 */
-	if (m->md.pv_kva != 0 || TAILQ_FIRST(&m->md.pv_list) != NULL)
+	if (TAILQ_FIRST(&m->md.pv_list) != NULL)
 		panic("Can't change memattr on page with existing mappings");
 }
diff --git a/sys/arm/include/pmap.h b/sys/arm/include/pmap.h
index b416169..780ed9b 100644
--- a/sys/arm/include/pmap.h
+++ b/sys/arm/include/pmap.h
@@ -121,7 +121,9 @@ struct	pv_chunk;
 struct	md_page {
 	int pvh_attrs;
 	vm_memattr_t	 pv_memattr;
+#if (ARM_MMU_V6 + ARM_MMU_V7) == 0
 	vm_offset_t pv_kva;		/* first kernel VA mapping */
+#endif
 	TAILQ_HEAD(,pv_entry)	pv_list;
 };
 
-- 
1.8.2

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG7dG%2BwoHUZp8M_KSMkDy_YNyoC3sLT9qwY_orVqk%2BAoeFpNEA>