Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Oct 2009 15:56:00 +0400
From:      Stanislav Sedov <stas@FreeBSD.org>
To:        Tom Judge <tom@tomjudge.com>
Cc:        freebsd-arm@freebsd.org, cognet@FreeBSD.org
Subject:   Re: [patch] Compilation problems in sys/arm/arm/pmap.c when PMAP_DEBUG  is defined.
Message-ID:  <20091002155600.2c2f615d.stas@FreeBSD.org>
In-Reply-To: <4AC599FC.1070304@tomjudge.com>
References:  <4AC599FC.1070304@tomjudge.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Signature=_Fri__2_Oct_2009_15_56_00_+0400_PhnE7R=+KxvjIANj
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, 02 Oct 2009 06:13:16 +0000
Tom Judge <tom@tomjudge.com> mentioned:

> Hi,
>=20
> I ran into some issues this evening while I was building some kernels=20
> with PMAP_DEBUG defined.
>=20
> I have attached a patch that addresses the problems with the DPRINTF=20
> sections. (The first 2 hunks should probably be ignored).
>=20
> However there are 2 warnings about unused functions when PMAP_INLINE is=20
> defined as "". I did not know what the correct fix for this was so I=20
> defined PMAP_INLINE to __inline even when PMAP_DEBUG was set, which=20
> seemed to hide the problem again.
>=20

Actually, these two functions with PMAP_INLINE prefixes are unused.  I
believe we can drop them.

Olivier, what do you think about the following patch?

Index: sys/arm/arm/pmap.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/arm/arm/pmap.c	(revision 197707)
+++ sys/arm/arm/pmap.c	(working copy)
@@ -203,7 +203,6 @@
 static void		pmap_fix_cache(struct vm_page *, pmap_t, vm_offset_t);
 static void		pmap_alloc_l1(pmap_t);
 static void		pmap_free_l1(pmap_t);
-static void		pmap_use_l1(pmap_t);
=20
 static int		pmap_clearbit(struct vm_page *, u_int);
=20
@@ -829,47 +828,6 @@
 	mtx_unlock(&l1_lru_lock);
 }
=20
-static PMAP_INLINE void
-pmap_use_l1(pmap_t pm)
-{
-	struct l1_ttable *l1;
-
-	/*
-	 * Do nothing if we're in interrupt context.
-	 * Access to an L1 by the kernel pmap must not affect
-	 * the LRU list.
-	 */
-	if (pm =3D=3D pmap_kernel())
-		return;
-
-	l1 =3D pm->pm_l1;
-
-	/*
-	 * If the L1 is not currently on the LRU list, just return
-	 */
-	if (l1->l1_domain_use_count =3D=3D PMAP_DOMAINS)
-		return;
-
-	mtx_lock(&l1_lru_lock);
-
-	/*
-	 * Check the use count again, now that we've acquired the lock
-	 */
-	if (l1->l1_domain_use_count =3D=3D PMAP_DOMAINS) {
-		mtx_unlock(&l1_lru_lock);
-		return;
-	}
-
-	/*
-	 * Move the L1 to the back of the LRU list
-	 */
-	TAILQ_REMOVE(&l1_lru_list, l1, l1_lru);
-	TAILQ_INSERT_TAIL(&l1_lru_list, l1, l1_lru);
-
-	mtx_unlock(&l1_lru_lock);
-}
-
-
 /*
  * Returns a pointer to the L2 bucket associated with the specified pmap
  * and VA, or NULL if no L2 bucket exists for the address.
@@ -1311,16 +1269,6 @@
 	}
 }
=20
-static PMAP_INLINE void
-pmap_dcache_wbinv_all(pmap_t pm)
-{
-
-	if (pmap_is_current(pm)) {
-		cpu_dcache_wbinv_all();
-		cpu_l2cache_wbinv_all();
-	}
-}
-
 /*
  * PTE_SYNC_CURRENT:
  *
@@ -1914,7 +1862,7 @@
 {
 	int shpgperproc =3D PMAP_SHPGPERPROC;
=20
-	PDEBUG(1, printf("pmap_init: phys_start =3D %08x\n"));
+	PDEBUG(1, printf("pmap_init: phys_start =3D %08x\n", PHYSADDR));
=20
 	/*
 	 * init the pv free list
@@ -2373,8 +2321,8 @@
 	vm_size_t size;
 	int l1idx, l2idx, l2next =3D 0;
=20
-	PDEBUG(1, printf("firstaddr =3D %08x, loadaddr =3D %08x\n",
-	    firstaddr, loadaddr));
+	PDEBUG(1, printf("firstaddr =3D %08x, lastaddr =3D %08x\n",
+	    firstaddr, lastaddr));
 =09
 	virtual_avail =3D firstaddr;
 	kernel_pmap->pm_l1 =3D l1;
@@ -4246,96 +4194,7 @@
 	pmap_zero_page(m);
 }
=20
-#if 0
 /*
- * pmap_clean_page()
- *
- * This is a local function used to work out the best strategy to clean
- * a single page referenced by its entry in the PV table. It's used by
- * pmap_copy_page, pmap_zero page and maybe some others later on.
- *
- * Its policy is effectively:
- *  o If there are no mappings, we don't bother doing anything with the ca=
che.
- *  o If there is one mapping, we clean just that page.
- *  o If there are multiple mappings, we clean the entire cache.
- *
- * So that some functions can be further optimised, it returns 0 if it did=
n't
- * clean the entire cache, or 1 if it did.
- *
- * XXX One bug in this routine is that if the pv_entry has a single page
- * mapped at 0x00000000 a whole cache clean will be performed rather than
- * just the 1 page. Since this should not occur in everyday use and if it =
does
- * it will just result in not the most efficient clean for the page.
- */
-static int
-pmap_clean_page(struct pv_entry *pv, boolean_t is_src)
-{
-	pmap_t pm, pm_to_clean =3D NULL;
-	struct pv_entry *npv;
-	u_int cache_needs_cleaning =3D 0;
-	u_int flags =3D 0;
-	vm_offset_t page_to_clean =3D 0;
-
-	if (pv =3D=3D NULL) {
-		/* nothing mapped in so nothing to flush */
-		return (0);
-	}
-
-	/*
-	 * Since we flush the cache each time we change to a different
-	 * user vmspace, we only need to flush the page if it is in the
-	 * current pmap.
-	 */
-	if (curthread)
-		pm =3D vmspace_pmap(curproc->p_vmspace);
-	else
-		pm =3D pmap_kernel();
-
-	for (npv =3D pv; npv; npv =3D TAILQ_NEXT(npv, pv_list)) {
-		if (npv->pv_pmap =3D=3D pmap_kernel() || npv->pv_pmap =3D=3D pm) {
-			flags |=3D npv->pv_flags;
-			/*
-			 * The page is mapped non-cacheable in=20
-			 * this map.  No need to flush the cache.
-			 */
-			if (npv->pv_flags & PVF_NC) {
-#ifdef DIAGNOSTIC
-				if (cache_needs_cleaning)
-					panic("pmap_clean_page: "
-					    "cache inconsistency");
-#endif
-				break;
-			} else if (is_src && (npv->pv_flags & PVF_WRITE) =3D=3D 0)
-				continue;
-			if (cache_needs_cleaning) {
-				page_to_clean =3D 0;
-				break;
-			} else {
-				page_to_clean =3D npv->pv_va;
-				pm_to_clean =3D npv->pv_pmap;
-			}
-			cache_needs_cleaning =3D 1;
-		}
-	}
-	if (page_to_clean) {
-		if (PV_BEEN_EXECD(flags))
-			pmap_idcache_wbinv_range(pm_to_clean, page_to_clean,
-			    PAGE_SIZE);
-		else
-			pmap_dcache_wb_range(pm_to_clean, page_to_clean,
-			    PAGE_SIZE, !is_src, (flags & PVF_WRITE) =3D=3D 0);
-	} else if (cache_needs_cleaning) {
-		if (PV_BEEN_EXECD(flags))
-			pmap_idcache_wbinv_all(pm);
-		else
-			pmap_dcache_wbinv_all(pm);
-		return (1);
-	}
-	return (0);
-}
-#endif
-
-/*
  *	pmap_copy_page copies the specified (machine independent)
  *	page by mapping the page into virtual memory and using
  *	bcopy to copy the page, one machine dependent page at a


--=20
Stanislav Sedov
ST4096-RIPE

--Signature=_Fri__2_Oct_2009_15_56_00_+0400_PhnE7R=+KxvjIANj
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----

iQIcBAEBAgAGBQJKxepVAAoJEKN82nOYvCd0cQoP/RVV0j3Hj6Jt1giEfanEcfCK
PL+xtfXQhbyuwTH+fVAJcCdQN1iK1OzufWj5pLg62EM0ckLUsKmPRdvdEQGCoJUZ
3xYeSinPRtPrk53mzKEQ/OUbyJIOutmHmjlI/2feSHudZvS+8GTRDDeA8b7Tiwq3
mDaU1jCgcioh22ou1BvRMT65ejAASISA6Q8s5VSwCHXSbrYw9gP6QeuSZv8Nxxbq
5XVZJOOgl1+KkM0Im6Q7sq33ssYOAZCBLgH9UFlYFSY1U1dIaGedCP7/zQ8hcViJ
QT6Elq3d0f7rSE22zHThsAr1cEcMPOyrxyLzM1xyfawJY1OjiZWTJJHu1mGc0NHw
hcGxrh+I0POC1tUBobgXGePHcvFI0L6zB44RwgP+4STOSvsQjbxYUWzpB992qe9y
8UiUpfPPKAoyg2e4Z4KGjxAnRtIw+5RcsAYBUSzBlOpIezZ4Devt2oCjZUf6btfd
SbbFGj9wf5m+FRv9hF8vdrQSzzSQw0s3II4Xs8gVNW1YwrrRXBVQq2EtKqs7/JqE
+NJhBxSP5fXD5gFSzI1JRTyMBH1Gp0j3d2OdeSh/U2CqzrvuULXaVGDm0fzKphoe
8k+RAybILbump+hAOTmZKsB+mm71tnrF5JnTLOCUhFv2GtjifIX9MXmvdp9iOKqV
udjWI1C5T6/6IdpBt7ZZ
=iM/H
-----END PGP SIGNATURE-----

--Signature=_Fri__2_Oct_2009_15_56_00_+0400_PhnE7R=+KxvjIANj--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091002155600.2c2f615d.stas>