Disable sosend_loan() in sys/kern/uipc_socket.c temporarily on CPUs
which have virtual address indexed cache and whose pmaps don't always allow normal shared mappings even for read only pages. In future, these pmaps should be rewritten to handle such read only shared mappings properly like ARM pmap, but currently we just disable sosend_loan() to avoid unnecessary uncached mappings and cache flushes on MIPS3 CPUs, or map/unmap thrashing on SH4. Discussed with thorpej a while ago.
This commit is contained in:
parent
52e78d1891
commit
7cb169d2dd
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.c,v 1.167 2006/03/30 05:57:01 gdamore Exp $ */
|
||||
/* $NetBSD: pmap.c,v 1.168 2006/11/18 14:25:39 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
|
||||
@ -74,7 +74,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.167 2006/03/30 05:57:01 gdamore Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.168 2006/11/18 14:25:39 tsutsui Exp $");
|
||||
|
||||
/*
|
||||
* Manages physical address maps.
|
||||
@ -132,6 +132,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.167 2006/03/30 05:57:01 gdamore Exp $");
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
#include <sys/socketvar.h> /* XXX: for sock_loan_thresh */
|
||||
|
||||
#include <uvm/uvm.h>
|
||||
|
||||
@ -518,6 +519,27 @@ pmap_init(void)
|
||||
* Now it is safe to enable pv entry recording.
|
||||
*/
|
||||
pmap_initialized = TRUE;
|
||||
|
||||
#ifdef MIPS3
|
||||
if (MIPS_HAS_R4K_MMU) {
|
||||
/*
|
||||
* XXX
|
||||
* Disable sosend_loan() in src/sys/kern/uipc_socket.c
|
||||
* on MIPS3 CPUs to avoid possible virtual cache aliases
|
||||
* and uncached mappings in pmap_enter_pv().
|
||||
*
|
||||
* Ideally, read only shared mapping won't cause aliases
|
||||
* so pmap_enter_pv() should handle any shared read only
|
||||
* mappings without uncached ops like ARM pmap.
|
||||
*
|
||||
* On the other hand, R4000 and R4400 have the virtual
|
||||
* coherency exceptions which will happen even on read only
|
||||
* mappings, so we always have to disable sosend_loan()
|
||||
* on such CPUs.
|
||||
*/
|
||||
sock_loan_thresh = -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.c,v 1.57 2006/10/24 01:56:33 uwe Exp $ */
|
||||
/* $NetBSD: pmap.c,v 1.58 2006/11/18 14:25:39 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -37,12 +37,13 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.57 2006/10/24 01:56:33 uwe Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.58 2006/11/18 14:25:39 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/pool.h>
|
||||
#include <sys/msgbuf.h>
|
||||
#include <sys/socketvar.h> /* XXX: for sock_loan_thresh */
|
||||
|
||||
#include <uvm/uvm.h>
|
||||
|
||||
@ -221,6 +222,23 @@ pmap_init()
|
||||
pool_init(&__pmap_pv_pool, sizeof(struct pv_entry), 0, 0, 0, "pvpl",
|
||||
&pmap_pv_page_allocator);
|
||||
pool_setlowat(&__pmap_pv_pool, 16);
|
||||
|
||||
#ifdef SH4
|
||||
if (SH_HAS_VIRTUAL_ALIAS) {
|
||||
/*
|
||||
* XXX
|
||||
* Disable sosend_loan() in src/sys/kern/uipc_socket.c
|
||||
* on SH4 to avoid possible virtual cache aliases and
|
||||
* unnecessary map/unmap thrashing in __pmap_pv_enter().
|
||||
* (also see comments in __pmap_pv_enter())
|
||||
*
|
||||
* Ideally, read only shared mapping won't cause aliases
|
||||
* so __pmap_pv_enter() should handle any shared read only
|
||||
* mappings like ARM pmap.
|
||||
*/
|
||||
sock_loan_thresh = -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
pmap_t
|
||||
|
Loading…
Reference in New Issue
Block a user