Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys When using socket loaning, make sure the KVA used for th...
details: https://anonhg.NetBSD.org/src/rev/c3ce4e533847
branches: trunk
changeset: 773372:c3ce4e533847
user: matt <matt%NetBSD.org@localhost>
date: Wed Feb 01 02:27:23 2012 +0000
description:
When using socket loaning, make sure the KVA used for the loan has the same
color as the UVA being loaned.
diffstat:
sys/kern/uipc_socket.c | 11 ++++++-----
sys/nfs/nfs_serv.c | 7 ++++---
sys/sys/socketvar.h | 4 ++--
3 files changed, 12 insertions(+), 10 deletions(-)
diffs (92 lines):
diff -r 403b7ab8e64f -r c3ce4e533847 sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c Wed Feb 01 02:22:27 2012 +0000
+++ b/sys/kern/uipc_socket.c Wed Feb 01 02:27:23 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket.c,v 1.208 2012/01/27 19:48:40 para Exp $ */
+/* $NetBSD: uipc_socket.c,v 1.209 2012/02/01 02:27:23 matt Exp $ */
/*-
* Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.208 2012/01/27 19:48:40 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.209 2012/02/01 02:27:23 matt Exp $");
#include "opt_compat_netbsd.h"
#include "opt_sock_counters.h"
@@ -197,7 +197,7 @@
*/
vaddr_t
-sokvaalloc(vsize_t len, struct socket *so)
+sokvaalloc(vaddr_t sva, vsize_t len, struct socket *so)
{
vaddr_t lva;
@@ -212,7 +212,8 @@
* allocate kva.
*/
- lva = uvm_km_alloc(kernel_map, len, 0, UVM_KMF_VAONLY | UVM_KMF_WAITVA);
+ lva = uvm_km_alloc(kernel_map, len, atop(sva) & uvmexp.colormask,
+ UVM_KMF_COLORMATCH | UVM_KMF_VAONLY | UVM_KMF_WAITVA);
if (lva == 0) {
sokvaunreserve(len);
return (0);
@@ -349,7 +350,7 @@
KASSERT(npgs <= M_EXT_MAXPAGES);
- lva = sokvaalloc(len, so);
+ lva = sokvaalloc(sva, len, so);
if (lva == 0)
return 0;
diff -r 403b7ab8e64f -r c3ce4e533847 sys/nfs/nfs_serv.c
--- a/sys/nfs/nfs_serv.c Wed Feb 01 02:22:27 2012 +0000
+++ b/sys/nfs/nfs_serv.c Wed Feb 01 02:27:23 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_serv.c,v 1.162 2011/11/21 09:07:59 hannken Exp $ */
+/* $NetBSD: nfs_serv.c,v 1.163 2012/02/01 02:27:24 matt Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.162 2011/11/21 09:07:59 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.163 2012/02/01 02:27:24 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -699,7 +699,8 @@
KASSERT(npages <= M_EXT_MAXPAGES); /* XXX */
/* allocate kva for mbuf data */
- lva = sokvaalloc(npages << PAGE_SHIFT, slp->ns_so);
+ lva = sokvaalloc(pgoff, npages << PAGE_SHIFT,
+ slp->ns_so);
if (lva == 0) {
/* fall back to VOP_READ */
goto loan_fail;
diff -r 403b7ab8e64f -r c3ce4e533847 sys/sys/socketvar.h
--- a/sys/sys/socketvar.h Wed Feb 01 02:22:27 2012 +0000
+++ b/sys/sys/socketvar.h Wed Feb 01 02:27:23 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: socketvar.h,v 1.128 2011/12/21 19:27:47 christos Exp $ */
+/* $NetBSD: socketvar.h,v 1.129 2012/02/01 02:27:23 matt Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -508,7 +508,7 @@
#endif /* SOCKBUF_DEBUG */
/* sosend loan */
-vaddr_t sokvaalloc(vsize_t, struct socket *);
+vaddr_t sokvaalloc(vaddr_t, vsize_t, struct socket *);
void sokvafree(vaddr_t, vsize_t);
void soloanfree(struct mbuf *, void *, size_t, void *);
Home |
Main Index |
Thread Index |
Old Index