Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/net/lib Prevent LWP migrations between CPUs during ...
details: https://anonhg.NetBSD.org/src/rev/6ea8aef102d6
branches: trunk
changeset: 344772:6ea8aef102d6
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Tue Apr 19 05:48:10 2016 +0000
description:
Prevent LWP migrations between CPUs during upper layer processing
This is a contract of psref(9) that is used by upper layer componenets,
e.g., bridge(4).
diffstat:
sys/rump/net/lib/libshmif/if_shmem.c | 8 ++++++--
sys/rump/net/lib/libvirtif/if_virt.c | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diffs (67 lines):
diff -r 402a2c88ac11 -r 6ea8aef102d6 sys/rump/net/lib/libshmif/if_shmem.c
--- a/sys/rump/net/lib/libshmif/if_shmem.c Tue Apr 19 04:13:56 2016 +0000
+++ b/sys/rump/net/lib/libshmif/if_shmem.c Tue Apr 19 05:48:10 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_shmem.c,v 1.65 2016/02/09 08:32:12 ozaki-r Exp $ */
+/* $NetBSD: if_shmem.c,v 1.66 2016/04/19 05:48:10 ozaki-r Exp $ */
/*
* Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.65 2016/02/09 08:32:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.66 2016/04/19 05:48:10 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -764,10 +764,14 @@
}
if (passup) {
+ int bound = curlwp->l_pflag & LP_BOUND;
ifp->if_ipackets++;
KERNEL_LOCK(1, NULL);
+ /* Prevent LWP migrations between CPUs for psref(9) */
+ curlwp->l_pflag |= LP_BOUND;
bpf_mtap(ifp, m);
if_input(ifp, m);
+ curlwp->l_pflag ^= bound ^ LP_BOUND;
KERNEL_UNLOCK_ONE(NULL);
m = NULL;
}
diff -r 402a2c88ac11 -r 6ea8aef102d6 sys/rump/net/lib/libvirtif/if_virt.c
--- a/sys/rump/net/lib/libvirtif/if_virt.c Tue Apr 19 04:13:56 2016 +0000
+++ b/sys/rump/net/lib/libvirtif/if_virt.c Tue Apr 19 05:48:10 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_virt.c,v 1.50 2016/02/09 08:32:12 ozaki-r Exp $ */
+/* $NetBSD: if_virt.c,v 1.51 2016/04/19 05:48:10 ozaki-r Exp $ */
/*
* Copyright (c) 2008, 2013 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.50 2016/02/09 08:32:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.51 2016/04/19 05:48:10 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -374,11 +374,15 @@
}
if (passup) {
+ int bound = curlwp->l_pflag & LP_BOUND;
ifp->if_ipackets++;
m->m_pkthdr.rcvif = ifp;
KERNEL_LOCK(1, NULL);
+ /* Prevent LWP migrations between CPUs for psref(9) */
+ curlwp->l_pflag |= LP_BOUND;
bpf_mtap(ifp, m);
if_input(ifp, m);
+ curlwp->l_pflag ^= bound ^ LP_BOUND;
KERNEL_UNLOCK_LAST(NULL);
} else {
m_freem(m);
Home |
Main Index |
Thread Index |
Old Index