Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Aug 2014 12:07:32 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Alan Cox <alc@rice.edu>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r269782 - in head/sys/sparc64: include sparc64
Message-ID:  <20140812090732.GC2737@kib.kiev.ua>
In-Reply-To: <53E8F0D9.9080900@rice.edu>
References:  <53e7a4fc.2898.352aa941@svn.freebsd.org> <53E8F0D9.9080900@rice.edu>

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

--+xNpyl7Qekk2NvDX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Aug 11, 2014 at 11:35:37AM -0500, Alan Cox wrote:
> On 08/10/2014 11:59, Konstantin Belousov wrote:
> > Author: kib
> > Date: Sun Aug 10 16:59:39 2014
> > New Revision: 269782
> > URL: http://svnweb.freebsd.org/changeset/base/269782
> >
> > Log:
> >   On sparc64, do not keep mappings for the destroyed sf_bufs.  Sparc64
> >   pmap, unlike i386, and similar to i386/xen pv, does not tolerate
> >   abandoned mappings for the freed pages.
> >  =20
> >   Reported and tested by:	dumbbell
> >   Diagnosed and reviewed by:	alc
> >   Sponsored by:	The FreeBSD Foundation
>=20
>=20
> This change fixes things on sparc64, but there is also an opportunity
> here to make sf_buf operations much faster on newer sparc64 hardware.=20
> If someone is interested in doing this, then please e-mail me.=20
> Basically, if dcache_color_ignore is non-zero, then sparc64's direct map
> can be used.  It shouldn't be a difficult change.

The following patch should implement use of dcache_color_ignore,
like hw_direct_map on powerpc aim.  I did not found a way around
the machine/tlb.h hack.  The patch compiled on ppc64 and sparc64.

diff --git a/sys/powerpc/include/vmparam.h b/sys/powerpc/include/vmparam.h
index c46f395..965f8e4 100644
--- a/sys/powerpc/include/vmparam.h
+++ b/sys/powerpc/include/vmparam.h
@@ -210,5 +210,6 @@ struct pmap_physseg {
 #define	SFBUF
 #define	SFBUF_NOMD
 #define	SFBUF_OPTIONAL_DIRECT_MAP	hw_direct_map
+#define	SFBUF_PHYS_DMAP(x)		(x)
 =20
 #endif /* _MACHINE_VMPARAM_H_ */
diff --git a/sys/sparc64/include/vmparam.h b/sys/sparc64/include/vmparam.h
index 8e7d76c..cc97ade 100644
--- a/sys/sparc64/include/vmparam.h
+++ b/sys/sparc64/include/vmparam.h
@@ -241,5 +241,8 @@ extern vm_offset_t vm_max_kernel_address;
=20
 #define	SFBUF
 #define	SFBUF_MAP
+#define	SFBUF_OPTIONAL_DIRECT_MAP	dcache_color_ignore
+#include <machine/tlb.h>
+#define	SFBUF_PHYS_DMAP(x)		TLB_DIRECT_TO_PHYS(x)
=20
 #endif /* !_MACHINE_VMPARAM_H_ */
diff --git a/sys/sys/sf_buf.h b/sys/sys/sf_buf.h
index 8a6c56f..de164a1 100644
--- a/sys/sys/sf_buf.h
+++ b/sys/sys/sf_buf.h
@@ -112,7 +112,7 @@ sf_buf_kva(struct sf_buf *sf)
 {
 #ifdef SFBUF_OPTIONAL_DIRECT_MAP
 	if (SFBUF_OPTIONAL_DIRECT_MAP)
-		return (VM_PAGE_TO_PHYS((vm_page_t)sf));
+		return (SFBUF_PHYS_DMAP(VM_PAGE_TO_PHYS((vm_page_t)sf)));
 #endif
=20
         return (sf->kva);

--+xNpyl7Qekk2NvDX
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJT6dlUAAoJEJDCuSvBvK1Bu8kP+gIjsYUdftvk7YMY7moi4Pf7
FLY6+SOAi5ZlGNvyPXTVi/yeca73Vz15YSU1aS3X6LQXOLhX3CJ1EI39X/kSDMHc
Q3gxhu4ICxRvonX19ygUS1ET1clV8J32eSbDC1AVVAzqq5eunkSzAjFnFUSSqvwx
YChm8V3ZvnNR/4vCMc0NcpRu0L4ljWQzlj3WT5Zr66MayrJw37yTbLm1XfnZS70H
jdWneJ81FnUhDLHdK3XoPWwFFlhixZnA0NX5QwYATFD7Uw3VZDz5RTNJPXaj81l6
UCu5nyiBBeYGJkgWFFn2XWu5s9PHng1UNMs5hYopUBH3qQx4wWCM2rVq4bEQiLhS
jKDKjZPaQlvfpCO2Cwiby5UWNTguNW/exegyaSCVbom60h1PUHR315tv9wkQs8NK
dlDWuDXVFFP64kTTkqIid+i873qRA1/9v2Qa7s5Rotz4clGoS1iAjWrnaQjyj/TF
C+eSFVNLVXEg31HgENpzuLCWwv98JA3L66E0aPldL0QAPMsCRhTjlivQl45nRTXj
Fj/ioMJPEjYKbBXyw8sr02Y97nHcftGuNo2G8KTwGL5IA31ipDevHEJaTZR06kj8
pqogwbrhT59peTAUG0V++uhZt2D7ehZkVJosZcLbO/a3rsc4YcgvKGKEZvXW/oFg
pf8Igfi2TVpOtjj4GV4e
=6B2s
-----END PGP SIGNATURE-----

--+xNpyl7Qekk2NvDX--



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