Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Make softint and callout MP-safe
details: https://anonhg.NetBSD.org/src/rev/997fa24a7707
branches: trunk
changeset: 358166:997fa24a7707
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Dec 15 07:29:11 2017 +0000
description:
Make softint and callout MP-safe
diffstat:
sys/net/bpf.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diffs (52 lines):
diff -r f3b0dcde7923 -r 997fa24a7707 sys/net/bpf.c
--- a/sys/net/bpf.c Fri Dec 15 05:01:16 2017 +0000
+++ b/sys/net/bpf.c Fri Dec 15 07:29:11 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf.c,v 1.221 2017/12/12 06:26:57 ozaki-r Exp $ */
+/* $NetBSD: bpf.c,v 1.222 2017/12/15 07:29:11 ozaki-r Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.221 2017/12/12 06:26:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.222 2017/12/15 07:29:11 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_bpf.h"
@@ -561,9 +561,10 @@
#endif
getnanotime(&d->bd_btime);
d->bd_atime = d->bd_mtime = d->bd_btime;
- callout_init(&d->bd_callout, 0);
+ callout_init(&d->bd_callout, CALLOUT_MPSAFE);
selinit(&d->bd_sel);
- d->bd_sih = softint_establish(SOFTINT_CLOCK, bpf_softintr, d);
+ d->bd_sih = softint_establish(SOFTINT_CLOCK|SOFTINT_MPSAFE,
+ bpf_softintr, d);
d->bd_jitcode = NULL;
d->bd_filter = NULL;
BPF_DLIST_ENTRY_INIT(d);
@@ -765,8 +766,10 @@
struct bpf_d *d;
d = cookie;
+ mutex_enter(d->bd_mtx);
if (d->bd_async)
fownsignal(d->bd_pgid, SIGIO, 0, 0, NULL);
+ mutex_exit(d->bd_mtx);
}
static void
@@ -1231,7 +1234,9 @@
break;
case FIOASYNC: /* Send signal on receive packets */
+ mutex_enter(d->bd_mtx);
d->bd_async = *(int *)addr;
+ mutex_exit(d->bd_mtx);
break;
case TIOCSPGRP: /* Process or group to send signals to */
Home |
Main Index |
Thread Index |
Old Index