svn commit: r269782 - in head/sys/sparc64: include sparc64

Konstantin Belousov kostikbel at gmail.com
Tue Aug 12 09:07:41 UTC 2014


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.
> >   
> >   Reported and tested by:	dumbbell
> >   Diagnosed and reviewed by:	alc
> >   Sponsored by:	The FreeBSD Foundation
> 
> 
> This change fixes things on sparc64, but there is also an opportunity
> here to make sf_buf operations much faster on newer sparc64 hardware. 
> If someone is interested in doing this, then please e-mail me. 
> 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)
  
 #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;
 
 #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)
 
 #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
 
         return (sf->kva);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20140812/756e5b7e/attachment.sig>


More information about the svn-src-head mailing list