CVS commit: src/sys/arch/amd64/conf
Module Name:src Committed By: para Date: Thu May 25 05:54:29 UTC 2017 Modified Files: src/sys/arch/amd64/conf: ALL GENERIC Log Message: follow u3ginit driver rename to umodeswitch To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/arch/amd64/conf/ALL cvs rdiff -u -r1.457 -r1.458 src/sys/arch/amd64/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/conf/ALL diff -u src/sys/arch/amd64/conf/ALL:1.57 src/sys/arch/amd64/conf/ALL:1.58 --- src/sys/arch/amd64/conf/ALL:1.57 Wed Apr 26 18:20:01 2017 +++ src/sys/arch/amd64/conf/ALL Thu May 25 05:54:29 2017 @@ -1,4 +1,4 @@ -# $NetBSD: ALL,v 1.57 2017/04/26 18:20:01 christos Exp $ +# $NetBSD: ALL,v 1.58 2017/05/25 05:54:29 para Exp $ # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # # ALL machine description file @@ -17,7 +17,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "ALL-$Revision: 1.57 $" +#ident "ALL-$Revision: 1.58 $" maxusers 64 # estimated number of users @@ -1313,7 +1313,7 @@ radio* at udsbr? ugen* at uhub? port ? # USB 3G datacards -u3ginit* at uhub? port ? +umodeswitch* at uhub? port ? u3g* at uhub? port ? ucom* at u3g? Index: src/sys/arch/amd64/conf/GENERIC diff -u src/sys/arch/amd64/conf/GENERIC:1.457 src/sys/arch/amd64/conf/GENERIC:1.458 --- src/sys/arch/amd64/conf/GENERIC:1.457 Tue Apr 18 19:09:12 2017 +++ src/sys/arch/amd64/conf/GENERIC Thu May 25 05:54:29 2017 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.457 2017/04/18 19:09:12 riastradh Exp $ +# $NetBSD: GENERIC,v 1.458 2017/05/25 05:54:29 para Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.457 $" +#ident "GENERIC-$Revision: 1.458 $" maxusers 64 # estimated number of users @@ -1052,7 +1052,7 @@ radio* at udsbr? ugen* at uhub? port ? # USB 3G datacards -u3ginit* at uhub? port ? +umodeswitch* at uhub? port ? u3g* at uhub? port ? ucom* at u3g?
CVS commit: src/sys/opencrypto
Module Name:src Committed By: knakahara Date: Thu May 25 05:24:57 UTC 2017 Modified Files: src/sys/opencrypto: crypto.c cryptodev.c cryptodev.h Log Message: add cryptkop alloc/free KPI instead of manipulating cryptkop_pool directly. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/opencrypto/crypto.c cvs rdiff -u -r1.90 -r1.91 src/sys/opencrypto/cryptodev.c cvs rdiff -u -r1.33 -r1.34 src/sys/opencrypto/cryptodev.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/opencrypto/crypto.c diff -u src/sys/opencrypto/crypto.c:1.75 src/sys/opencrypto/crypto.c:1.76 --- src/sys/opencrypto/crypto.c:1.75 Wed May 24 10:05:09 2017 +++ src/sys/opencrypto/crypto.c Thu May 25 05:24:57 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: crypto.c,v 1.75 2017/05/24 10:05:09 knakahara Exp $ */ +/* $NetBSD: crypto.c,v 1.76 2017/05/25 05:24:57 knakahara Exp $ */ /* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $ */ /* $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */ @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.75 2017/05/24 10:05:09 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.76 2017/05/25 05:24:57 knakahara Exp $"); #include #include @@ -1076,7 +1076,7 @@ crypto_kinvoke(struct cryptkop *krp, int /* Sanity checks. */ if (krp->krp_callback == NULL) { cv_destroy(>krp_cv); - pool_put(_pool, krp); + crypto_kfreereq(krp); return EINVAL; } @@ -1262,6 +1262,54 @@ crypto_getreq(int num) } /* + * Release a set of asymmetric crypto descriptors. + * Currently, support one descriptor only. + */ +void +crypto_kfreereq(struct cryptkop *krp) +{ + + if (krp == NULL) + return; + + DPRINTF("krp %p\n", krp); + + /* sanity check */ + if (krp->krp_flags & CRYPTO_F_ONRETQ) { + panic("crypto_kfreereq() freeing krp on RETQ\n"); + } + + pool_put(_pool, krp); +} + +/* + * Acquire a set of asymmetric crypto descriptors. + * Currently, support one descriptor only. + */ +struct cryptkop * +crypto_kgetreq(int num __unused, int prflags) +{ + struct cryptkop *krp; + + /* + * When crp_ret_kq is full, we restrict here to avoid crp_ret_kq + * overflow by error callback. + */ + if (CRYPTO_Q_IS_FULL(crp_ret_kq)) { + CRYPTO_Q_INC_DROPS(crp_ret_kq); + return NULL; + } + + krp = pool_get(_pool, prflags); + if (krp == NULL) { + return NULL; + } + memset(krp, 0, sizeof(struct cryptkop)); + + return krp; +} + +/* * Invoke the callback on behalf of the driver. */ void Index: src/sys/opencrypto/cryptodev.c diff -u src/sys/opencrypto/cryptodev.c:1.90 src/sys/opencrypto/cryptodev.c:1.91 --- src/sys/opencrypto/cryptodev.c:1.90 Wed May 17 06:33:04 2017 +++ src/sys/opencrypto/cryptodev.c Thu May 25 05:24:57 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: cryptodev.c,v 1.90 2017/05/17 06:33:04 knakahara Exp $ */ +/* $NetBSD: cryptodev.c,v 1.91 2017/05/25 05:24:57 knakahara Exp $ */ /* $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $ */ /* $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $ */ @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.90 2017/05/17 06:33:04 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.91 2017/05/25 05:24:57 knakahara Exp $"); #include #include @@ -855,7 +855,11 @@ cryptodev_key(struct crypt_kop *kop) return EINVAL; } - krp = pool_get(_pool, PR_WAITOK); + krp = crypto_kgetreq(1, PR_WAITOK); + if (krp == NULL) { + /* limited by opencrypto.crypto_ret_kq.maxlen */ + return ENOMEM; + } (void)memset(krp, 0, sizeof *krp); cv_init(>krp_cv, "crykdev"); krp->krp_op = kop->crk_op; @@ -923,7 +927,7 @@ fail: } } cv_destroy(>krp_cv); - pool_put(_pool, krp); + crypto_kfreereq(krp); DPRINTF("error=0x%08x\n", error); return error; } @@ -1435,7 +1439,11 @@ cryptodev_mkey(struct fcrypt *fcr, struc continue; } - krp = pool_get(_pool, PR_WAITOK); + krp = crypto_kgetreq(1, PR_WAITOK); + if (krp == NULL) { + /* limited by opencrypto.crypto_ret_kq.maxlen */ + continue; + } (void)memset(krp, 0, sizeof *krp); cv_init(>krp_cv, "crykdev"); krp->krp_op = kop[req].crk_op; @@ -1493,7 +1501,7 @@ fail: } } cv_destroy(>krp_cv); -pool_put(_pool, krp); +crypto_kfreereq(krp); } } error = 0; @@ -1912,7 +1920,7 @@ fail: } } cv_destroy(>krp_cv); -pool_put(_pool, krp); +crypto_kfreereq(krp); req++; } } @@ -2012,7 +2020,7 @@ fail: } } cv_destroy(>krp_cv); - pool_put(_pool, krp); + crypto_kfreereq(krp); return 0; } } Index: src/sys/opencrypto/cryptodev.h diff -u src/sys/opencrypto/cryptodev.h:1.33 src/sys/opencrypto/cryptodev.h:1.34 --- src/sys/opencrypto/cryptodev.h:1.33 Thu May 25 05:22:55 2017 +++ src/sys/opencrypto/cryptodev.h Thu May 25 05:24:57 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: cryptodev.h,v 1.33
CVS commit: src/sys/opencrypto
Module Name:src Committed By: knakahara Date: Thu May 25 05:22:56 UTC 2017 Modified Files: src/sys/opencrypto: cryptodev.h Log Message: remove obsoleted declarations. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/opencrypto/cryptodev.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/opencrypto/cryptodev.h diff -u src/sys/opencrypto/cryptodev.h:1.32 src/sys/opencrypto/cryptodev.h:1.33 --- src/sys/opencrypto/cryptodev.h:1.32 Wed May 17 06:33:04 2017 +++ src/sys/opencrypto/cryptodev.h Thu May 25 05:22:55 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: cryptodev.h,v 1.32 2017/05/17 06:33:04 knakahara Exp $ */ +/* $NetBSD: cryptodev.h,v 1.33 2017/05/25 05:22:55 knakahara Exp $ */ /* $FreeBSD: src/sys/opencrypto/cryptodev.h,v 1.2.2.6 2003/07/02 17:04:50 sam Exp $ */ /* $OpenBSD: cryptodev.h,v 1.33 2002/07/17 23:52:39 art Exp $ */ @@ -603,8 +603,6 @@ void cuio_copyback(struct uio *, int, in int cuio_apply(struct uio *, int, int, int (*f)(void *, void *, unsigned int), void *); -extern int crypto_ret_q_remove(struct cryptop *); -extern int crypto_ret_kq_remove(struct cryptkop *); extern void crypto_freereq(struct cryptop *crp); extern struct cryptop *crypto_getreq(int num);
CVS commit: src/sys/netipsec
Module Name:src Committed By: ozaki-r Date: Thu May 25 04:45:59 UTC 2017 Modified Files: src/sys/netipsec: keysock.c Log Message: Support SO_OVERFLOWED on PF_KEY sockets The original author is hsuenaga@IIJ To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/netipsec/keysock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netipsec/keysock.c diff -u src/sys/netipsec/keysock.c:1.57 src/sys/netipsec/keysock.c:1.58 --- src/sys/netipsec/keysock.c:1.57 Thu May 25 04:35:02 2017 +++ src/sys/netipsec/keysock.c Thu May 25 04:45:59 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: keysock.c,v 1.57 2017/05/25 04:35:02 ozaki-r Exp $ */ +/* $NetBSD: keysock.c,v 1.58 2017/05/25 04:45:59 ozaki-r Exp $ */ /* $FreeBSD: src/sys/netipsec/keysock.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */ /* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */ @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.57 2017/05/25 04:35:02 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.58 2017/05/25 04:45:59 ozaki-r Exp $"); /* This code has derived from sys/net/rtsock.c on FreeBSD2.2.5 */ @@ -191,6 +191,7 @@ key_sendup0( PFKEY_STATINC(PFKEY_STAT_IN_NOMEM); m_freem(m); error = ENOBUFS; + rp->rcb_socket->so_rcv.sb_overflowed++; } else error = 0; sorwakeup(rp->rcb_socket);
CVS commit: src/sys/netipsec
Module Name:src Committed By: ozaki-r Date: Thu May 25 04:35:02 UTC 2017 Modified Files: src/sys/netipsec: keysock.c Log Message: Warn if failed to send up a PF_KEY message To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/netipsec/keysock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netipsec/keysock.c diff -u src/sys/netipsec/keysock.c:1.56 src/sys/netipsec/keysock.c:1.57 --- src/sys/netipsec/keysock.c:1.56 Thu May 25 04:19:50 2017 +++ src/sys/netipsec/keysock.c Thu May 25 04:35:02 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: keysock.c,v 1.56 2017/05/25 04:19:50 ozaki-r Exp $ */ +/* $NetBSD: keysock.c,v 1.57 2017/05/25 04:35:02 ozaki-r Exp $ */ /* $FreeBSD: src/sys/netipsec/keysock.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */ /* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */ @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.56 2017/05/25 04:19:50 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.57 2017/05/25 04:35:02 ozaki-r Exp $"); /* This code has derived from sys/net/rtsock.c on FreeBSD2.2.5 */ @@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: keysock.c,v #include #include #include +#include #include #include @@ -184,6 +185,9 @@ key_sendup0( (struct sockaddr *)_src, m, sbprio); if (!ok) { + log(LOG_WARNING, + "%s: couldn't send PF_KEY message to the socket\n", + __func__); PFKEY_STATINC(PFKEY_STAT_IN_NOMEM); m_freem(m); error = ENOBUFS;
CVS commit: src/sys/netipsec
Module Name:src Committed By: ozaki-r Date: Thu May 25 04:19:50 UTC 2017 Modified Files: src/sys/netipsec: keysock.c Log Message: KNF: remove extra leading whitespaces To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/netipsec/keysock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netipsec/keysock.c diff -u src/sys/netipsec/keysock.c:1.55 src/sys/netipsec/keysock.c:1.56 --- src/sys/netipsec/keysock.c:1.55 Tue May 16 03:05:28 2017 +++ src/sys/netipsec/keysock.c Thu May 25 04:19:50 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: keysock.c,v 1.55 2017/05/16 03:05:28 ozaki-r Exp $ */ +/* $NetBSD: keysock.c,v 1.56 2017/05/25 04:19:50 ozaki-r Exp $ */ /* $FreeBSD: src/sys/netipsec/keysock.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */ /* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */ @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.55 2017/05/16 03:05:28 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.56 2017/05/25 04:19:50 ozaki-r Exp $"); /* This code has derived from sys/net/rtsock.c on FreeBSD2.2.5 */ @@ -183,7 +183,7 @@ key_sendup0( ok = sbappendaddrchain(>rcb_socket->so_rcv, (struct sockaddr *)_src, m, sbprio); - if (!ok) { + if (!ok) { PFKEY_STATINC(PFKEY_STAT_IN_NOMEM); m_freem(m); error = ENOBUFS;
CVS commit: src/sys/netipsec
Module Name:src Committed By: ozaki-r Date: Thu May 25 03:36:36 UTC 2017 Modified Files: src/sys/netipsec: key.c Log Message: Protect acqtree and regtree with a mutex (key_mtx) The data structures aren't used in any performance-sensitive paths, so just using a mutex to protect them is good enough. To generate a diff of this commit: cvs rdiff -u -r1.140 -r1.141 src/sys/netipsec/key.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netipsec/key.c diff -u src/sys/netipsec/key.c:1.140 src/sys/netipsec/key.c:1.141 --- src/sys/netipsec/key.c:1.140 Tue May 23 09:08:45 2017 +++ src/sys/netipsec/key.c Thu May 25 03:36:36 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: key.c,v 1.140 2017/05/23 09:08:45 ozaki-r Exp $ */ +/* $NetBSD: key.c,v 1.141 2017/05/25 03:36:36 ozaki-r Exp $ */ /* $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $ */ /* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */ @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.140 2017/05/23 09:08:45 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.141 2017/05/25 03:36:36 ozaki-r Exp $"); /* * This code is referd to RFC 2367 @@ -154,6 +154,11 @@ static LIST_HEAD(_acqtree, secacq) acqtr static LIST_HEAD(_spacqtree, secspacq) spacqtree; /* SP acquiring list */ #endif +/* + * Protect regtree, acqtree and items stored in the lists. + */ +static kmutex_t key_mtx __cacheline_aligned; + /* search order for SAs */ /* * This order is important because we must select the oldest SA @@ -4669,13 +4674,17 @@ key_timehandler_work(struct work *wk, vo { struct secacq *acq, *nextacq; +restart: + mutex_enter(_mtx); LIST_FOREACH_SAFE(acq, , chain, nextacq) { if (now - acq->created > key_blockacq_lifetime) { - KASSERT(__LIST_CHAINED(acq)); LIST_REMOVE(acq, chain); + mutex_exit(_mtx); kmem_free(acq, sizeof(*acq)); + goto restart; } } + mutex_exit(_mtx); } #endif @@ -4903,12 +4912,14 @@ key_getspi(struct socket *so, struct mbu /* delete the entry in acqtree */ if (mhp->msg->sadb_msg_seq != 0) { struct secacq *acq; + mutex_enter(_mtx); acq = key_getacqbyseq(mhp->msg->sadb_msg_seq); if (acq != NULL) { /* reset counter in order to deletion by timehandler. */ acq->created = time_uptime; acq->count = 0; } + mutex_exit(_mtx); } #endif @@ -6226,6 +6237,7 @@ key_acquire(const struct secasindex *sai * managed with ACQUIRING list. */ /* Get an entry to check whether sending message or not. */ + mutex_enter(_mtx); newacq = key_getacq(saidx); if (newacq != NULL) { if (key_blockacq_count < newacq->count) { @@ -6245,11 +6257,9 @@ key_acquire(const struct secasindex *sai /* add to acqtree */ LIST_INSERT_HEAD(, newacq, chain); } -#endif - -#ifndef IPSEC_NONBLOCK_ACQUIRE seq = newacq->seq; + mutex_exit(_mtx); #else seq = (acq_seq = (acq_seq == ~0 ? 1 : ++acq_seq)); #endif @@ -6408,6 +6418,8 @@ key_getacq(const struct secasindex *said { struct secacq *acq; + KASSERT(mutex_owned(_mtx)); + LIST_FOREACH(acq, , chain) { if (key_cmpsaidx(saidx, >saidx, CMP_EXACTLY)) return acq; @@ -6421,6 +6433,8 @@ key_getacqbyseq(u_int32_t seq) { struct secacq *acq; + KASSERT(mutex_owned(_mtx)); + LIST_FOREACH(acq, , chain) { if (acq->seq == seq) return acq; @@ -6511,8 +6525,10 @@ key_acquire2(struct socket *so, struct m return 0; } + mutex_enter(_mtx); acq = key_getacqbyseq(mhp->msg->sadb_msg_seq); if (acq == NULL) { + mutex_exit(_mtx); /* * the specified larval SA is already gone, or we got * a bogus sequence number. we can silently ignore it. @@ -6524,6 +6540,7 @@ key_acquire2(struct socket *so, struct m /* reset acq counter in order to deletion by timehander. */ acq->created = time_uptime; acq->count = 0; + mutex_exit(_mtx); #endif m_freem(m); return 0; @@ -6622,22 +6639,26 @@ key_register(struct socket *so, struct m if (mhp->msg->sadb_msg_satype == SADB_SATYPE_UNSPEC) goto setmsg; + /* Allocate regnode in advance, out of mutex */ + newreg = kmem_zalloc(sizeof(*newreg), KM_SLEEP); + /* check whether existing or not */ + mutex_enter(_mtx); LIST_FOREACH(reg, [mhp->msg->sadb_msg_satype], chain) { if (reg->so == so) { IPSECLOG(LOG_DEBUG, "socket exists already.\n"); + mutex_exit(_mtx); + kmem_free(newreg, sizeof(*newreg)); return key_senderror(so, m, EEXIST); } } - /* create regnode */ - newreg = kmem_zalloc(sizeof(*newreg), KM_SLEEP); - newreg->so = so; ((struct keycb *)sotorawcb(so))->kp_registered++; /* add regnode to regtree. */ LIST_INSERT_HEAD([mhp->msg->sadb_msg_satype], newreg, chain); + mutex_exit(_mtx); setmsg: { @@ -6763,14 +6784,16 @@ key_freereg(struct socket *so) * one socket is registered to multiple type of SA. */ for (i = 0; i <= SADB_SATYPE_MAX; i++) { +
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Thu May 25 02:43:43 UTC 2017 Modified Files: src/sys/netinet: in.c Log Message: Fix that a fresh in_ifaddr is unexpectedly freed before activating it An in_ifaddr object is initialized with refcnt=0 and the refcnt is incremented when being enqueued to the lists. However before enqueuing it, in_ifinit can hold and refelease a reference to it, i.e., call ifaref and ifafree, resulting in that the object is freed in ifafree because its refcnt is decremented to 0. It can be reproduced by doing: ifconfig tun0 create ifconfig tun1 create ifconfig tun0 10.1 10.2 ifconfig tun1 10.2 10.1 ifconfig # Cause a kernel panic (may depend on environmemts) We need to initialize a created in_ifaddr object with refcnt=1 to make the object survive over in_ifinit. The issue is found by ryo@ To generate a diff of this commit: cvs rdiff -u -r1.201 -r1.202 src/sys/netinet/in.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in.c diff -u src/sys/netinet/in.c:1.201 src/sys/netinet/in.c:1.202 --- src/sys/netinet/in.c:1.201 Fri May 12 17:53:53 2017 +++ src/sys/netinet/in.c Thu May 25 02:43:43 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: in.c,v 1.201 2017/05/12 17:53:53 ryo Exp $ */ +/* $NetBSD: in.c,v 1.202 2017/05/25 02:43:43 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.201 2017/05/12 17:53:53 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.202 2017/05/25 02:43:43 ozaki-r Exp $"); #include "arp.h" @@ -495,6 +495,11 @@ in_control0(struct socket *so, u_long cm IN_ADDRHASH_ENTRY_INIT(ia); IN_ADDRLIST_ENTRY_INIT(ia); ifa_psref_init(>ia_ifa); + /* + * We need a reference to make ia survive over in_ifinit + * that does ifaref and ifafree. + */ + ifaref(>ia_ifa); newifaddr = 1; } @@ -681,6 +686,8 @@ in_control0(struct socket *so, u_long cm TAILQ_INSERT_TAIL(_ifaddrhead, ia, ia_list); IN_ADDRLIST_WRITER_INSERT_TAIL(ia); in_addrhash_insert_locked(ia); + /* Release a reference that is held just after creation. */ + ifafree(>ia_ifa); mutex_exit(_ifaddr_lock); } else if (need_reinsert) { in_addrhash_insert(ia);
CVS commit: src/sys/kern
Module Name:src Committed By: pgoyette Date: Thu May 25 02:28:07 UTC 2017 Modified Files: src/sys/kern: vfs_bio.c Log Message: When logging a history record for biowait(), include the return address as a parameter, to identify to which of the many calls to biowait() the record refers. To generate a diff of this commit: cvs rdiff -u -r1.272 -r1.273 src/sys/kern/vfs_bio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_bio.c diff -u src/sys/kern/vfs_bio.c:1.272 src/sys/kern/vfs_bio.c:1.273 --- src/sys/kern/vfs_bio.c:1.272 Wed Apr 5 20:15:49 2017 +++ src/sys/kern/vfs_bio.c Thu May 25 02:28:07 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_bio.c,v 1.272 2017/04/05 20:15:49 jdolecek Exp $ */ +/* $NetBSD: vfs_bio.c,v 1.273 2017/05/25 02:28:07 pgoyette Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -123,7 +123,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.272 2017/04/05 20:15:49 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.273 2017/05/25 02:28:07 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_bufcache.h" @@ -1530,8 +1530,8 @@ biowait(buf_t *bp) mutex_enter(bp->b_objlock); - BIOHIST_CALLARGS(biohist, "bp=%p, oflags=0x%x", - bp, bp->b_oflags, 0, 0); + BIOHIST_CALLARGS(biohist, "bp=%p, oflags=0x%x, ret_addr %p", + bp, bp->b_oflags, __builtin_return_address(0), 0); while (!ISSET(bp->b_oflags, BO_DONE | BO_DELWRI)) { BIOHIST_LOG(biohist, "waiting bp=%p", bp, 0, 0, 0);
CVS commit: src/doc
Module Name:src Committed By: christos Date: Thu May 25 00:12:34 UTC 2017 Modified Files: src/doc: 3RDPARTY CHANGES Log Message: add file To generate a diff of this commit: cvs rdiff -u -r1.1442 -r1.1443 src/doc/3RDPARTY cvs rdiff -u -r1.2284 -r1.2285 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/3RDPARTY diff -u src/doc/3RDPARTY:1.1442 src/doc/3RDPARTY:1.1443 --- src/doc/3RDPARTY:1.1442 Wed May 10 07:05:17 2017 +++ src/doc/3RDPARTY Wed May 24 20:12:34 2017 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1442 2017/05/10 11:05:17 roy Exp $ +# $NetBSD: 3RDPARTY,v 1.1443 2017/05/25 00:12:34 christos Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -425,8 +425,8 @@ Notes: Please use "expat" as the vendor tag for CVS imports. Package: file -Version: 5.30 -Current Vers: 5.30 +Version: 5.31 +Current Vers: 5.31 Maintainer: Christos Zoulas <chris...@zoulas.com> Archive Site: ftp://ftp.astron.com/pub/file/ Home Page: http://www.darwinsys.com/file/ Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2284 src/doc/CHANGES:1.2285 --- src/doc/CHANGES:1.2284 Sun May 21 11:36:37 2017 +++ src/doc/CHANGES Wed May 24 20:12:34 2017 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2284 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2285 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -518,3 +518,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0: [riastradh 20170521] src: Remove MKCRYPTO option and always include cryptography. [riastradh 20170521] + file(1): Upgraded to 5.31. [christos 20170524]
CVS commit: src/external/bsd/file
Module Name:src Committed By: christos Date: Thu May 25 00:11:27 UTC 2017 Modified Files: src/external/bsd/file/dist: ChangeLog Makefile.in aclocal.m4 configure configure.ac src/external/bsd/file/dist/doc: file.1 magic.5 src/external/bsd/file/dist/magic: Makefile.am Makefile.in src/external/bsd/file/dist/magic/magdir: apple archive diff filesystems geo jpeg netbsd os9 pgp src/external/bsd/file/dist/src: apprentice.c cdf.c cdf_time.c compress.c der.c file.h funcs.c print.c readcdf.c readelf.c softmagic.c src/external/bsd/file/dist/tests: Makefile.in src/external/bsd/file/include: config.h Log Message: merge 5.31 To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/bsd/file/dist/ChangeLog cvs rdiff -u -r1.13 -r1.14 src/external/bsd/file/dist/Makefile.in cvs rdiff -u -r1.10 -r1.11 src/external/bsd/file/dist/aclocal.m4 cvs rdiff -u -r1.16 -r1.17 src/external/bsd/file/dist/configure cvs rdiff -u -r1.12 -r1.13 src/external/bsd/file/dist/configure.ac cvs rdiff -u -r1.18 -r1.19 src/external/bsd/file/dist/doc/file.1 cvs rdiff -u -r1.15 -r1.16 src/external/bsd/file/dist/doc/magic.5 cvs rdiff -u -r1.12 -r1.13 src/external/bsd/file/dist/magic/Makefile.am cvs rdiff -u -r1.15 -r1.16 src/external/bsd/file/dist/magic/Makefile.in cvs rdiff -u -r1.6 -r1.7 src/external/bsd/file/dist/magic/magdir/apple cvs rdiff -u -r1.11 -r1.12 src/external/bsd/file/dist/magic/magdir/archive \ src/external/bsd/file/dist/magic/magdir/filesystems cvs rdiff -u -r1.4 -r1.5 src/external/bsd/file/dist/magic/magdir/diff \ src/external/bsd/file/dist/magic/magdir/os9 \ src/external/bsd/file/dist/magic/magdir/pgp cvs rdiff -u -r1.3 -r1.4 src/external/bsd/file/dist/magic/magdir/geo \ src/external/bsd/file/dist/magic/magdir/jpeg \ src/external/bsd/file/dist/magic/magdir/netbsd cvs rdiff -u -r1.17 -r1.18 src/external/bsd/file/dist/src/apprentice.c cvs rdiff -u -r1.13 -r1.14 src/external/bsd/file/dist/src/cdf.c \ src/external/bsd/file/dist/src/readcdf.c cvs rdiff -u -r1.7 -r1.8 src/external/bsd/file/dist/src/cdf_time.c cvs rdiff -u -r1.12 -r1.13 src/external/bsd/file/dist/src/compress.c cvs rdiff -u -r1.2 -r1.3 src/external/bsd/file/dist/src/der.c cvs rdiff -u -r1.15 -r1.16 src/external/bsd/file/dist/src/file.h \ src/external/bsd/file/dist/src/softmagic.c cvs rdiff -u -r1.11 -r1.12 src/external/bsd/file/dist/src/funcs.c cvs rdiff -u -r1.10 -r1.11 src/external/bsd/file/dist/src/print.c cvs rdiff -u -r1.14 -r1.15 src/external/bsd/file/dist/src/readelf.c cvs rdiff -u -r1.10 -r1.11 src/external/bsd/file/dist/tests/Makefile.in cvs rdiff -u -r1.9 -r1.10 src/external/bsd/file/include/config.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/file/dist/ChangeLog diff -u src/external/bsd/file/dist/ChangeLog:1.4 src/external/bsd/file/dist/ChangeLog:1.5 --- src/external/bsd/file/dist/ChangeLog:1.4 Fri Feb 10 12:53:24 2017 +++ src/external/bsd/file/dist/ChangeLog Wed May 24 20:11:26 2017 @@ -1,3 +1,9 @@ +2017-03-17 20:32 Christos Zoulas+ + * remove trailing spaces from magic files + * refactor is_tar + * better bounds checks for cdf + 2017-02-10 12:24 Christos Zoulas * release 5.30 Index: src/external/bsd/file/dist/Makefile.in diff -u src/external/bsd/file/dist/Makefile.in:1.13 src/external/bsd/file/dist/Makefile.in:1.14 --- src/external/bsd/file/dist/Makefile.in:1.13 Fri Feb 10 12:53:24 2017 +++ src/external/bsd/file/dist/Makefile.in Wed May 24 20:11:26 2017 @@ -327,8 +327,8 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = MAINT -#SUBDIRS = src magic tests doc python SUBDIRS = src +#SUBDIRS = src magic tests doc python all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive Index: src/external/bsd/file/dist/aclocal.m4 diff -u src/external/bsd/file/dist/aclocal.m4:1.10 src/external/bsd/file/dist/aclocal.m4:1.11 --- src/external/bsd/file/dist/aclocal.m4:1.10 Fri Feb 10 12:53:24 2017 +++ src/external/bsd/file/dist/aclocal.m4 Wed May 24 20:11:26 2017 @@ -21,7 +21,7 @@ If you have problems, you may need to re To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # visibility.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2005, 2008, 2010-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2008, 2010-2016 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. Index: src/external/bsd/file/dist/configure diff -u src/external/bsd/file/dist/configure:1.16 src/external/bsd/file/dist/configure:1.17 --- src/external/bsd/file/dist/configure:1.16 Fri Feb 10 12:56:27 2017 +++
CVS import: src/external/bsd/file/dist
Module Name:src Committed By: christos Date: Wed May 24 23:59:59 UTC 2017 Update of /cvsroot/src/external/bsd/file/dist In directory ivanova.netbsd.org:/tmp/cvs-serv4 Log Message: Import file-5.31; mostly oss-fuzz found bugs. Status: Vendor Tag: CHRISTOS Release Tags: FILE5_31 U src/external/bsd/file/dist/Makefile.am C src/external/bsd/file/dist/configure U src/external/bsd/file/dist/acinclude.m4 C src/external/bsd/file/dist/configure.ac C src/external/bsd/file/dist/aclocal.m4 C src/external/bsd/file/dist/Makefile.in U src/external/bsd/file/dist/config.h.in U src/external/bsd/file/dist/AUTHORS U src/external/bsd/file/dist/COPYING C src/external/bsd/file/dist/ChangeLog U src/external/bsd/file/dist/INSTALL U src/external/bsd/file/dist/NEWS U src/external/bsd/file/dist/README U src/external/bsd/file/dist/TODO U src/external/bsd/file/dist/compile U src/external/bsd/file/dist/config.guess U src/external/bsd/file/dist/config.sub U src/external/bsd/file/dist/depcomp U src/external/bsd/file/dist/install-sh U src/external/bsd/file/dist/ltmain.sh U src/external/bsd/file/dist/missing U src/external/bsd/file/dist/MAINT U src/external/bsd/file/dist/m4/lt~obsolete.m4 U src/external/bsd/file/dist/m4/libtool.m4 U src/external/bsd/file/dist/m4/ltoptions.m4 U src/external/bsd/file/dist/m4/ltsugar.m4 U src/external/bsd/file/dist/m4/ltversion.m4 U src/external/bsd/file/dist/src/getopt_long.c U src/external/bsd/file/dist/src/Makefile.am U src/external/bsd/file/dist/src/Makefile.in U src/external/bsd/file/dist/src/asctime_r.c U src/external/bsd/file/dist/src/asprintf.c U src/external/bsd/file/dist/src/ctime_r.c U src/external/bsd/file/dist/src/dprintf.c U src/external/bsd/file/dist/src/fmtcheck.c U src/external/bsd/file/dist/src/getline.c U src/external/bsd/file/dist/src/localtime_r.c U src/external/bsd/file/dist/src/gmtime_r.c U src/external/bsd/file/dist/src/strcasestr.c U src/external/bsd/file/dist/src/pread.c U src/external/bsd/file/dist/src/mygetopt.h U src/external/bsd/file/dist/src/strlcat.c U src/external/bsd/file/dist/src/strlcpy.c U src/external/bsd/file/dist/src/vasprintf.c U src/external/bsd/file/dist/src/magic.c C src/external/bsd/file/dist/src/apprentice.c C src/external/bsd/file/dist/src/softmagic.c U src/external/bsd/file/dist/src/ascmagic.c U src/external/bsd/file/dist/src/encoding.c C src/external/bsd/file/dist/src/compress.c C src/external/bsd/file/dist/src/print.c U src/external/bsd/file/dist/src/is_tar.c C src/external/bsd/file/dist/src/readelf.c U src/external/bsd/file/dist/src/fsmagic.c C src/external/bsd/file/dist/src/funcs.c C src/external/bsd/file/dist/src/file.h U src/external/bsd/file/dist/src/readelf.h U src/external/bsd/file/dist/src/tar.h U src/external/bsd/file/dist/src/apptype.c C src/external/bsd/file/dist/src/der.c U src/external/bsd/file/dist/src/der.h U src/external/bsd/file/dist/src/file_opts.h U src/external/bsd/file/dist/src/elfclass.h C src/external/bsd/file/dist/src/cdf.c C src/external/bsd/file/dist/src/cdf_time.c C src/external/bsd/file/dist/src/readcdf.c U src/external/bsd/file/dist/src/cdf.h U src/external/bsd/file/dist/src/file.c U src/external/bsd/file/dist/src/magic.h.in C src/external/bsd/file/dist/magic/Makefile.am C src/external/bsd/file/dist/magic/Makefile.in U src/external/bsd/file/dist/magic/Header U src/external/bsd/file/dist/magic/Localstuff U src/external/bsd/file/dist/magic/magdir/adventure U src/external/bsd/file/dist/magic/magdir/acorn U src/external/bsd/file/dist/magic/magdir/adi U src/external/bsd/file/dist/magic/magdir/animation U src/external/bsd/file/dist/magic/magdir/algol68 U src/external/bsd/file/dist/magic/magdir/allegro U src/external/bsd/file/dist/magic/magdir/alliant U src/external/bsd/file/dist/magic/magdir/amanda U src/external/bsd/file/dist/magic/magdir/amigaos U src/external/bsd/file/dist/magic/magdir/android N src/external/bsd/file/dist/magic/magdir/apache U src/external/bsd/file/dist/magic/magdir/aout C src/external/bsd/file/dist/magic/magdir/apple U src/external/bsd/file/dist/magic/magdir/apl U src/external/bsd/file/dist/magic/magdir/bioinformatics U src/external/bsd/file/dist/magic/magdir/blackberry U src/external/bsd/file/dist/magic/magdir/application U src/external/bsd/file/dist/magic/magdir/applix U src/external/bsd/file/dist/magic/magdir/apt C src/external/bsd/file/dist/magic/magdir/archive U src/external/bsd/file/dist/magic/magdir/assembler U src/external/bsd/file/dist/magic/magdir/asterix U src/external/bsd/file/dist/magic/magdir/att3b U src/external/bsd/file/dist/magic/magdir/audio U src/external/bsd/file/dist/magic/magdir/basis U src/external/bsd/file/dist/magic/magdir/ber U src/external/bsd/file/dist/magic/magdir/bflt U src/external/bsd/file/dist/magic/magdir/blcr U src/external/bsd/file/dist/magic/magdir/communications U src/external/bsd/file/dist/magic/magdir/blender U src/external/bsd/file/dist/magic/magdir/bsi U src/external/bsd/file/dist/magic/magdir/blit U
CVS commit: src
Module Name:src Committed By: joerg Date: Wed May 24 21:45:40 UTC 2017 Modified Files: src/lib/libc/compiler_rt: Makefile.inc src/sys/external/bsd/compiler_rt/dist/lib/builtins: clear_cache.c Log Message: Add __clear_cache implementatin for SPARC/SPARC64. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/lib/libc/compiler_rt/Makefile.inc cvs rdiff -u -r1.1.1.4 -r1.2 \ src/sys/external/bsd/compiler_rt/dist/lib/builtins/clear_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/compiler_rt/Makefile.inc diff -u src/lib/libc/compiler_rt/Makefile.inc:1.31 src/lib/libc/compiler_rt/Makefile.inc:1.32 --- src/lib/libc/compiler_rt/Makefile.inc:1.31 Wed Mar 30 07:25:33 2016 +++ src/lib/libc/compiler_rt/Makefile.inc Wed May 24 21:45:40 2017 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.31 2016/03/30 07:25:33 martin Exp $ +# $NetBSD: Makefile.inc,v 1.32 2017/05/24 21:45:40 joerg Exp $ COMPILER_RT_SRCDIR= ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist @@ -242,6 +242,11 @@ GENERIC_SRCS+= \ clear_cache.c .endif +.if ${LIBC_MACHINE_CPU} == "sparc" || ${LIBC_MACHINE_CPU} == "sparc64" +GENERIC_SRCS+= \ + clear_cache.c +.endif + .if ${LIBC_MACHINE_CPU} == "arm" .if !empty(LIBC_MACHINE_ARCH:Mearm*) GENERIC_SRCS+= \ Index: src/sys/external/bsd/compiler_rt/dist/lib/builtins/clear_cache.c diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/clear_cache.c:1.1.1.4 src/sys/external/bsd/compiler_rt/dist/lib/builtins/clear_cache.c:1.2 --- src/sys/external/bsd/compiler_rt/dist/lib/builtins/clear_cache.c:1.1.1.4 Sat Feb 27 18:59:29 2016 +++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/clear_cache.c Wed May 24 21:45:40 2017 @@ -147,6 +147,13 @@ void __clear_cache(void *start, void *en for (addr = xstart; addr < xend; addr += icache_line_size) __asm __volatile("ic ivau, %0" :: "r"(addr)); __asm __volatile("isb sy"); +#elif defined(__sparc__) + uintptr_t xstart = (uintptr_t) start & ~(uintptr_t)3; + uintptr_t xend = (uintptr_t) end; + + for (; xstart < xend; xstart += 4) { +__asm __volatile("flush %0" :: "r" (xstart)); + } #else #if __APPLE__ /* On Darwin, sys_icache_invalidate() provides this functionality */
CVS commit: src/sys/dev/usb
Module Name:src Committed By: christos Date: Wed May 24 20:23:58 UTC 2017 Modified Files: src/sys/dev/usb: files.usb u3g.c Added Files: src/sys/dev/usb: umodeswitch.c Log Message: split the mode switch part of the u3g driver into a separate file so that others can use it. To generate a diff of this commit: cvs rdiff -u -r1.144 -r1.145 src/sys/dev/usb/files.usb cvs rdiff -u -r1.33 -r1.34 src/sys/dev/usb/u3g.c cvs rdiff -u -r0 -r1.1 src/sys/dev/usb/umodeswitch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/files.usb diff -u src/sys/dev/usb/files.usb:1.144 src/sys/dev/usb/files.usb:1.145 --- src/sys/dev/usb/files.usb:1.144 Fri May 19 20:56:32 2017 +++ src/sys/dev/usb/files.usb Wed May 24 16:23:58 2017 @@ -1,4 +1,4 @@ -# $NetBSD: files.usb,v 1.144 2017/05/20 00:56:32 pgoyette Exp $ +# $NetBSD: files.usb,v 1.145 2017/05/24 20:23:58 christos Exp $ # # Config file and device description for machine-independent USB code. # Included by ports that need it. Ports that use it must provide @@ -272,6 +272,11 @@ file dev/usb/emdtv_ir.c emdtv # Misc # +# Mode switch usb driver +device umodeswitch +attach umodeswitch at usbdevif +file dev/usb/umodeswitch.c umodeswitch + # Diamond Multimedia Rio 500 device urio attach urio at usbdevif @@ -298,11 +303,9 @@ attach ugensa at usbdevif file dev/usb/ugensa.c ugensa # 3G Modem -device u3g: ucombus +device u3g: ucombus, umodeswitch attach u3g at usbifif -device u3ginit -attach u3ginit at usbdevif -file dev/usb/u3g.c u3g | u3ginit +file dev/usb/u3g.c u3g # YAP phone firmware loader device uyap: ezload Index: src/sys/dev/usb/u3g.c diff -u src/sys/dev/usb/u3g.c:1.33 src/sys/dev/usb/u3g.c:1.34 --- src/sys/dev/usb/u3g.c:1.33 Thu May 4 10:21:01 2017 +++ src/sys/dev/usb/u3g.c Wed May 24 16:23:58 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: u3g.c,v 1.33 2017/05/04 14:21:01 hauke Exp $ */ +/* $NetBSD: u3g.c,v 1.34 2017/05/24 20:23:58 christos Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.33 2017/05/04 14:21:01 hauke Exp $"); +__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.34 2017/05/24 20:23:58 christos Exp $"); #include #include @@ -137,19 +137,13 @@ struct u3g_softc { * interface attribute so that a match will claim the entire USB device * for itself. This is used for when a device needs to be mode-switched * and ensures any other interfaces present cannot be claimed by other - * drivers while the mode-switch is in progress. + * drivers while the mode-switch is in progress. This is implemented by + * the umodeswitch driver. * * The second personality uses the 'usbifif' interface attribute so that * it can claim the 3G modem interfaces for itself, leaving others (such * as the mass storage interfaces on some devices) for other drivers. */ -static int u3ginit_match(device_t, cfdata_t, void *); -static void u3ginit_attach(device_t, device_t, void *); -static int u3ginit_detach(device_t, int); - -CFATTACH_DECL2_NEW(u3ginit, 0, u3ginit_match, -u3ginit_attach, u3ginit_detach, NULL, NULL, NULL); - static int u3g_match(device_t, cfdata_t, void *); static void u3g_attach(device_t, device_t, void *); @@ -266,411 +260,6 @@ static const struct usb_devno u3g_devs[] { USB_VENDOR_4GSYSTEMS, USB_PRODUCT_4GSYSTEMS_XSSTICK_W14 }, }; -static int -send_bulkmsg(struct usbd_device *dev, void *cmd, size_t cmdlen) -{ - struct usbd_interface *iface; - usb_interface_descriptor_t *id; - usb_endpoint_descriptor_t *ed; - struct usbd_pipe *pipe; - struct usbd_xfer *xfer; - int err, i; - - /* Move the device into the configured state. */ - err = usbd_set_config_index(dev, 0, 0); - if (err) { - aprint_error("u3ginit: failed to set config index\n"); - return UMATCH_NONE; - } - - err = usbd_device2interface_handle(dev, 0, ); - if (err != 0) { - aprint_error("u3ginit: failed to get interface\n"); - return UMATCH_NONE; - } - - id = usbd_get_interface_descriptor(iface); - ed = NULL; - for (i = 0 ; i < id->bNumEndpoints ; i++) { - ed = usbd_interface2endpoint_descriptor(iface, i); - if (ed == NULL) - continue; - if (UE_GET_DIR(ed->bEndpointAddress) != UE_DIR_OUT) - continue; - if ((ed->bmAttributes & UE_XFERTYPE) == UE_BULK) - break; - } - - if (i == id->bNumEndpoints) - return UMATCH_NONE; - - err = usbd_open_pipe(iface, ed->bEndpointAddress, - USBD_EXCLUSIVE_USE, ); - if (err != 0) { - aprint_error("u3ginit: failed to open bulk transfer pipe %d\n", - ed->bEndpointAddress); - return UMATCH_NONE; - } - - int error = usbd_create_xfer(pipe, cmdlen, 0, 0, ); - if (!error) { - - usbd_setup_xfer(xfer, NULL, cmd, cmdlen, - USBD_SYNCHRONOUS, USBD_DEFAULT_TIMEOUT, NULL); - - err = usbd_transfer(xfer); - -#if 0 /* XXXpooka: at least my huawei "fails" this always, but still detaches */ - if (err) - aprint_error("u3ginit:
CVS commit: src/sys/arch
Module Name:src Committed By: christos Date: Wed May 24 20:23:04 UTC 2017 Modified Files: src/sys/arch/evbarm/conf: HPT5325 SHEEVAPLUG src/sys/arch/evbppc/conf: OPENBLOCKS266_OPT src/sys/arch/hppa/conf: GENERIC src/sys/arch/i386/conf: ALL GENERIC src/sys/arch/macppc/conf: GENERIC Log Message: rename u3ginit driver to umodeswitch To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/arch/evbarm/conf/HPT5325 cvs rdiff -u -r1.54 -r1.55 src/sys/arch/evbarm/conf/SHEEVAPLUG cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hppa/conf/GENERIC cvs rdiff -u -r1.417 -r1.418 src/sys/arch/i386/conf/ALL cvs rdiff -u -r1.1154 -r1.1155 src/sys/arch/i386/conf/GENERIC cvs rdiff -u -r1.328 -r1.329 src/sys/arch/macppc/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/conf/HPT5325 diff -u src/sys/arch/evbarm/conf/HPT5325:1.31 src/sys/arch/evbarm/conf/HPT5325:1.32 --- src/sys/arch/evbarm/conf/HPT5325:1.31 Sun Feb 19 02:47:00 2017 +++ src/sys/arch/evbarm/conf/HPT5325 Wed May 24 16:23:04 2017 @@ -1,4 +1,4 @@ -# $NetBSD: HPT5325,v 1.31 2017/02/19 07:47:00 rin Exp $ +# $NetBSD: HPT5325,v 1.32 2017/05/24 20:23:04 christos Exp $ # # This configuration supports for HP T5325 Thin Client # @@ -392,7 +392,7 @@ usscanner* at uhub? port ? ugen* at uhub? port ? # USB 3G datacards -#u3ginit* at uhub? port ? +#umodeswitch* at uhub? port ? #u3g* at uhub? port ? #ucom* at u3g? Index: src/sys/arch/evbarm/conf/SHEEVAPLUG diff -u src/sys/arch/evbarm/conf/SHEEVAPLUG:1.54 src/sys/arch/evbarm/conf/SHEEVAPLUG:1.55 --- src/sys/arch/evbarm/conf/SHEEVAPLUG:1.54 Wed Mar 22 18:53:06 2017 +++ src/sys/arch/evbarm/conf/SHEEVAPLUG Wed May 24 16:23:04 2017 @@ -1,4 +1,4 @@ -# $NetBSD: SHEEVAPLUG,v 1.54 2017/03/22 22:53:06 sevan Exp $ +# $NetBSD: SHEEVAPLUG,v 1.55 2017/05/24 20:23:04 christos Exp $ # # This configuration supports for generically Marvell SheevaPlug # @@ -392,7 +392,7 @@ radio* at udsbr? ugen* at uhub? port ? # USB 3G datacards -u3ginit* at uhub? port ? +umodeswitch* at uhub? port ? u3g* at uhub? port ? ucom* at u3g? Index: src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT diff -u src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT:1.22 src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT:1.23 --- src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT:1.22 Tue Dec 13 15:42:17 2016 +++ src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT Wed May 24 16:23:04 2017 @@ -1,4 +1,4 @@ -# $NetBSD: OPENBLOCKS266_OPT,v 1.22 2016/12/13 20:42:17 christos Exp $ +# $NetBSD: OPENBLOCKS266_OPT,v 1.23 2017/05/24 20:23:04 christos Exp $ # include "arch/evbppc/conf/OPENBLOCKS266" @@ -288,7 +288,7 @@ radio* at udsbr? ugen* at uhub? port ? # USB 3G datacards -u3ginit* at uhub? port ? +umodeswitch* at uhub? port ? u3g* at uhub? port ? ucom* at u3g? Index: src/sys/arch/hppa/conf/GENERIC diff -u src/sys/arch/hppa/conf/GENERIC:1.11 src/sys/arch/hppa/conf/GENERIC:1.12 --- src/sys/arch/hppa/conf/GENERIC:1.11 Tue Dec 13 15:42:18 2016 +++ src/sys/arch/hppa/conf/GENERIC Wed May 24 16:23:04 2017 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.11 2016/12/13 20:42:18 christos Exp $ +# $NetBSD: GENERIC,v 1.12 2017/05/24 20:23:04 christos Exp $ # # GENERIC machine description file # @@ -23,7 +23,7 @@ include "arch/hppa/conf/std.hppa" options INCLUDE_CONFIG_FILE # embed config file in kernel binary options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel -#ident "GENERIC-$Revision: 1.11 $" +#ident "GENERIC-$Revision: 1.12 $" maxusers 32 # estimated number of users @@ -701,7 +701,7 @@ radio* at udsbr? ugen* at uhub? port ? # USB 3G datacards -u3ginit* at uhub? port ? +umodeswitch* at uhub? port ? u3g* at uhub? port ? ucom* at u3g? Index: src/sys/arch/i386/conf/ALL diff -u src/sys/arch/i386/conf/ALL:1.417 src/sys/arch/i386/conf/ALL:1.418 --- src/sys/arch/i386/conf/ALL:1.417 Tue Apr 18 15:09:12 2017 +++ src/sys/arch/i386/conf/ALL Wed May 24 16:23:04 2017 @@ -1,4 +1,4 @@ -# $NetBSD: ALL,v 1.417 2017/04/18 19:09:12 riastradh Exp $ +# $NetBSD: ALL,v 1.418 2017/05/24 20:23:04 christos Exp $ # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # # ALL machine description file @@ -17,7 +17,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "ALL-$Revision: 1.417 $" +#ident "ALL-$Revision: 1.418 $" maxusers 64 # estimated number of users @@ -1433,7 +1433,7 @@ radio* at udsbr? ugen* at uhub? port ? # USB 3G datacards -u3ginit* at uhub? port ? +umodeswitch* at uhub? port ? u3g* at uhub? port ? ucom* at u3g? Index: src/sys/arch/i386/conf/GENERIC diff -u src/sys/arch/i386/conf/GENERIC:1.1154 src/sys/arch/i386/conf/GENERIC:1.1155 --- src/sys/arch/i386/conf/GENERIC:1.1154 Tue Apr 18 15:09:12 2017 +++
CVS commit: src/sys/opencrypto
Module Name:src Committed By: knakahara Date: Wed May 24 10:05:09 UTC 2017 Modified Files: src/sys/opencrypto: crypto.c files.opencrypto Log Message: make the default values of q_maxlen build parameters. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/opencrypto/crypto.c cvs rdiff -u -r1.25 -r1.26 src/sys/opencrypto/files.opencrypto Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/opencrypto/crypto.c diff -u src/sys/opencrypto/crypto.c:1.74 src/sys/opencrypto/crypto.c:1.75 --- src/sys/opencrypto/crypto.c:1.74 Wed May 24 09:57:36 2017 +++ src/sys/opencrypto/crypto.c Wed May 24 10:05:09 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: crypto.c,v 1.74 2017/05/24 09:57:36 knakahara Exp $ */ +/* $NetBSD: crypto.c,v 1.75 2017/05/24 10:05:09 knakahara Exp $ */ /* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $ */ /* $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */ @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.74 2017/05/24 09:57:36 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.75 2017/05/24 10:05:09 knakahara Exp $"); #include #include @@ -131,9 +131,8 @@ static TAILQ_HEAD(krprethead, cryptkop) #define DEFINIT_CRYPTO_Q_DROPS(name) \ static int crypto_##name##_drops = 0 -#define CRYPTO_Q_MAXLEN 0 -#define DEFINIT_CRYPTO_Q_MAXLEN(name)\ - static int crypto_##name##_maxlen = CRYPTO_Q_MAXLEN +#define DEFINIT_CRYPTO_Q_MAXLEN(name, defval) \ + static int crypto_##name##_maxlen = defval #define CRYPTO_Q_INC(name) \ do { \ @@ -166,12 +165,18 @@ DEFINIT_CRYPTO_Q_LEN(crp_ret_kq); DEFINIT_CRYPTO_Q_DROPS(crp_ret_q); DEFINIT_CRYPTO_Q_DROPS(crp_ret_kq); +#ifndef CRYPTO_RET_Q_MAXLEN +#define CRYPTO_RET_Q_MAXLEN 0 +#endif +#ifndef CRYPTO_RET_KQ_MAXLEN +#define CRYPTO_RET_KQ_MAXLEN 0 +#endif /* * queue length limit. * default value is 0. <=0 means unlimited. */ -DEFINIT_CRYPTO_Q_MAXLEN(crp_ret_q); -DEFINIT_CRYPTO_Q_MAXLEN(crp_ret_kq); +DEFINIT_CRYPTO_Q_MAXLEN(crp_ret_q, CRYPTO_RET_Q_MAXLEN); +DEFINIT_CRYPTO_Q_MAXLEN(crp_ret_kq, CRYPTO_RET_KQ_MAXLEN); /* * TODO: Index: src/sys/opencrypto/files.opencrypto diff -u src/sys/opencrypto/files.opencrypto:1.25 src/sys/opencrypto/files.opencrypto:1.26 --- src/sys/opencrypto/files.opencrypto:1.25 Sat Nov 19 22:51:30 2011 +++ src/sys/opencrypto/files.opencrypto Wed May 24 10:05:09 2017 @@ -1,4 +1,4 @@ -# $NetBSD: files.opencrypto,v 1.25 2011/11/19 22:51:30 tls Exp $ +# $NetBSD: files.opencrypto,v 1.26 2017/05/24 10:05:09 knakahara Exp $ # # @@ -28,3 +28,4 @@ file opencrypto/cryptodev.c crypto file opencrypto/ocryptodev.c crypto & compat_50 defflag opt_ocf.h CRYPTO_DEBUG CRYPTO_TIMING +defparam opt_ocf.h CRYPTO_RET_Q_MAXLEN CRYPTO_RET_KQ_MAXLEN
CVS commit: src/sys/opencrypto
Module Name:src Committed By: knakahara Date: Wed May 24 09:57:36 UTC 2017 Modified Files: src/sys/opencrypto: crypto.c Log Message: implement crypto_ret_q limitation. original code is implemented by hsuenaga@IIJ. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/opencrypto/crypto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/opencrypto/crypto.c diff -u src/sys/opencrypto/crypto.c:1.73 src/sys/opencrypto/crypto.c:1.74 --- src/sys/opencrypto/crypto.c:1.73 Wed May 24 09:54:35 2017 +++ src/sys/opencrypto/crypto.c Wed May 24 09:57:36 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: crypto.c,v 1.73 2017/05/24 09:54:35 knakahara Exp $ */ +/* $NetBSD: crypto.c,v 1.74 2017/05/24 09:57:36 knakahara Exp $ */ /* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $ */ /* $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */ @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.73 2017/05/24 09:54:35 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.74 2017/05/24 09:57:36 knakahara Exp $"); #include #include @@ -145,6 +145,15 @@ static TAILQ_HEAD(krprethead, cryptkop) crypto_##name##_len--; \ } while(0); +#define CRYPTO_Q_INC_DROPS(name) \ + do { \ + crypto_##name##_drops++; \ + } while(0); + +#define CRYPTO_Q_IS_FULL(name) \ + (crypto_##name##_maxlen > 0\ + && (crypto_##name##_len > crypto_##name##_maxlen)) + /* * current queue length. */ @@ -1217,6 +1226,15 @@ crypto_getreq(int num) struct cryptodesc *crd; struct cryptop *crp; + /* + * When crp_ret_q is full, we restrict here to avoid crp_ret_q overflow + * by error callback. + */ + if (CRYPTO_Q_IS_FULL(crp_ret_q)) { + CRYPTO_Q_INC_DROPS(crp_ret_q); + return NULL; + } + crp = pool_get(_pool, 0); if (crp == NULL) { return NULL;
CVS commit: src/sys/fs/union
Module Name:src Committed By: hannken Date: Wed May 24 09:55:19 UTC 2017 Modified Files: src/sys/fs/union: union_vnops.c Log Message: Use VCALL() to lock or unlock the lower node. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/fs/union/union_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/union/union_vnops.c diff -u src/sys/fs/union/union_vnops.c:1.68 src/sys/fs/union/union_vnops.c:1.69 --- src/sys/fs/union/union_vnops.c:1.68 Sun May 7 08:22:40 2017 +++ src/sys/fs/union/union_vnops.c Wed May 24 09:55:18 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: union_vnops.c,v 1.68 2017/05/07 08:22:40 hannken Exp $ */ +/* $NetBSD: union_vnops.c,v 1.69 2017/05/24 09:55:18 hannken Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995 @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.68 2017/05/07 08:22:40 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.69 2017/05/24 09:55:18 hannken Exp $"); #include #include @@ -1600,12 +1600,14 @@ union_lock1(struct vnode *vp, struct vno { struct vop_lock_args ap; - if (lockvp == vp) { - ap.a_vp = vp; - ap.a_flags = flags; + ap.a_desc = VDESC(vop_lock); + ap.a_vp = lockvp; + ap.a_flags = flags; + + if (lockvp == vp) return genfs_lock(); - } else - return VOP_LOCK(lockvp, flags); + else + return VCALL(ap.a_vp, VOFFSET(vop_lock), ); } static int @@ -1613,11 +1615,13 @@ union_unlock1(struct vnode *vp, struct v { struct vop_unlock_args ap; - if (lockvp == vp) { - ap.a_vp = vp; + ap.a_desc = VDESC(vop_unlock); + ap.a_vp = lockvp; + + if (lockvp == vp) return genfs_unlock(); - } else - return VOP_UNLOCK(lockvp); + else + return VCALL(ap.a_vp, VOFFSET(vop_unlock), ); } int
CVS commit: src/sys/opencrypto
Module Name:src Committed By: knakahara Date: Wed May 24 09:54:35 UTC 2017 Modified Files: src/sys/opencrypto: crypto.c Log Message: add crypto_ret_{,k}q length sysctl entries and statistics codes. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/opencrypto/crypto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/opencrypto/crypto.c diff -u src/sys/opencrypto/crypto.c:1.72 src/sys/opencrypto/crypto.c:1.73 --- src/sys/opencrypto/crypto.c:1.72 Wed May 24 05:11:29 2017 +++ src/sys/opencrypto/crypto.c Wed May 24 09:54:35 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: crypto.c,v 1.72 2017/05/24 05:11:29 knakahara Exp $ */ +/* $NetBSD: crypto.c,v 1.73 2017/05/24 09:54:35 knakahara Exp $ */ /* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $ */ /* $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */ @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.72 2017/05/24 05:11:29 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.73 2017/05/24 09:54:35 knakahara Exp $"); #include #include @@ -125,6 +125,92 @@ static TAILQ_HEAD(crprethead, cryptop) c static TAILQ_HEAD(krprethead, cryptkop) crp_ret_kq = TAILQ_HEAD_INITIALIZER(crp_ret_kq); +#define DEFINIT_CRYPTO_Q_LEN(name) \ + static int crypto_##name##_len = 0 + +#define DEFINIT_CRYPTO_Q_DROPS(name) \ + static int crypto_##name##_drops = 0 + +#define CRYPTO_Q_MAXLEN 0 +#define DEFINIT_CRYPTO_Q_MAXLEN(name)\ + static int crypto_##name##_maxlen = CRYPTO_Q_MAXLEN + +#define CRYPTO_Q_INC(name) \ + do { \ + crypto_##name##_len++; \ + } while(0); + +#define CRYPTO_Q_DEC(name) \ + do { \ + crypto_##name##_len--; \ + } while(0); + +/* + * current queue length. + */ +DEFINIT_CRYPTO_Q_LEN(crp_ret_q); +DEFINIT_CRYPTO_Q_LEN(crp_ret_kq); + +/* + * queue dropped count. + */ +DEFINIT_CRYPTO_Q_DROPS(crp_ret_q); +DEFINIT_CRYPTO_Q_DROPS(crp_ret_kq); + +/* + * queue length limit. + * default value is 0. <=0 means unlimited. + */ +DEFINIT_CRYPTO_Q_MAXLEN(crp_ret_q); +DEFINIT_CRYPTO_Q_MAXLEN(crp_ret_kq); + +/* + * TODO: + * make percpu + */ +static int +sysctl_opencrypto_q_len(SYSCTLFN_ARGS) +{ + int error; + + error = sysctl_lookup(SYSCTLFN_CALL(rnode)); + if (error || newp == NULL) + return error; + + return 0; +} + +/* + * TODO: + * make percpu + */ +static int +sysctl_opencrypto_q_drops(SYSCTLFN_ARGS) +{ + int error; + + error = sysctl_lookup(SYSCTLFN_CALL(rnode)); + if (error || newp == NULL) + return error; + + return 0; +} + +/* + * need to make percpu? + */ +static int +sysctl_opencrypto_q_maxlen(SYSCTLFN_ARGS) +{ + int error; + + error = sysctl_lookup(SYSCTLFN_CALL(rnode)); + if (error || newp == NULL) + return error; + + return 0; +} + /* * Crypto op and desciptor data structures are allocated * from separate private zones(FreeBSD)/pools(netBSD/OpenBSD) . @@ -152,6 +238,8 @@ int crypto_devallowsoft = 1; /* only use static void sysctl_opencrypto_setup(struct sysctllog **clog) { + const struct sysctlnode *ocnode; + const struct sysctlnode *retqnode, *retkqnode; sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, @@ -174,6 +262,69 @@ sysctl_opencrypto_setup(struct sysctllog "asymmetric crypto support"), NULL, 0, _devallowsoft, 0, CTL_KERN, CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, NULL, , + CTLFLAG_PERMANENT, + CTLTYPE_NODE, "opencrypto", + SYSCTL_DESCR("opencrypto related entries"), + NULL, 0, NULL, 0, + CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, , , + CTLFLAG_PERMANENT, + CTLTYPE_NODE, "crypto_ret_q", + SYSCTL_DESCR("crypto_ret_q related entries"), + NULL, 0, NULL, 0, + CTL_CREATE, CTL_EOL); + sysctl_createv(clog, 0, , NULL, + CTLFLAG_PERMANENT|CTLFLAG_READONLY, + CTLTYPE_INT, "len", + SYSCTL_DESCR("Current queue length"), + sysctl_opencrypto_q_len, 0, + (void *)_crp_ret_q_len, 0, + CTL_CREATE, CTL_EOL); + sysctl_createv(clog, 0, , NULL, + CTLFLAG_PERMANENT|CTLFLAG_READONLY, + CTLTYPE_INT, "drops", + SYSCTL_DESCR("Crypto requests dropped due to full ret queue"), + sysctl_opencrypto_q_drops, 0, + (void *)_crp_ret_q_drops, 0, + CTL_CREATE, CTL_EOL); + sysctl_createv(clog, 0, , NULL, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_INT, "maxlen", + SYSCTL_DESCR("Maximum allowed queue length"), + sysctl_opencrypto_q_maxlen, 0, + (void *)_crp_ret_q_maxlen, 0, + CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, , , + CTLFLAG_PERMANENT, + CTLTYPE_NODE, "crypto_ret_kq", + SYSCTL_DESCR("crypto_ret_kq related entries"), + NULL, 0, NULL, 0, + CTL_CREATE, CTL_EOL); + sysctl_createv(clog, 0, , NULL, +
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: hannken Date: Wed May 24 09:54:40 UTC 2017 Modified Files: src/sys/miscfs/genfs: layer_vnops.c Log Message: Protect layer_getpages against vnodes disappearing during a forced unmount. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/miscfs/genfs/layer_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/miscfs/genfs/layer_vnops.c diff -u src/sys/miscfs/genfs/layer_vnops.c:1.64 src/sys/miscfs/genfs/layer_vnops.c:1.65 --- src/sys/miscfs/genfs/layer_vnops.c:1.64 Sun May 7 08:21:57 2017 +++ src/sys/miscfs/genfs/layer_vnops.c Wed May 24 09:54:40 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: layer_vnops.c,v 1.64 2017/05/07 08:21:57 hannken Exp $ */ +/* $NetBSD: layer_vnops.c,v 1.65 2017/05/24 09:54:40 hannken Exp $ */ /* * Copyright (c) 1999 National Aeronautics & Space Administration @@ -170,7 +170,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.64 2017/05/07 08:21:57 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.65 2017/05/24 09:54:40 hannken Exp $"); #include #include @@ -183,6 +183,7 @@ __KERNEL_RCSID(0, "$NetBSD: layer_vnops. #include #include #include +#include #include #include @@ -790,6 +791,8 @@ layer_getpages(void *v) int a_flags; } */ *ap = v; struct vnode *vp = ap->a_vp; + struct mount *mp = vp->v_mount; + int error; KASSERT(mutex_owned(vp->v_interlock)); @@ -800,7 +803,19 @@ layer_getpages(void *v) KASSERT(vp->v_interlock == ap->a_vp->v_interlock); /* Just pass the request on to the underlying layer. */ - return VCALL(ap->a_vp, VOFFSET(vop_getpages), ap); + mutex_exit(vp->v_interlock); + fstrans_start(mp, FSTRANS_SHARED); + mutex_enter(vp->v_interlock); + if (mp == vp->v_mount) { + /* Will release the interlock. */ + error = VCALL(ap->a_vp, VOFFSET(vop_getpages), ap); + } else { + mutex_exit(vp->v_interlock); + error = ENOENT; + } + fstrans_done(mp); + + return error; } int
CVS commit: src/sys
Module Name:src Committed By: hannken Date: Wed May 24 09:53:55 UTC 2017 Modified Files: src/sys/kern: vfs_mount.c vfs_subr.c src/sys/miscfs/genfs: genfs_vfsops.c src/sys/sys: mount.h param.h Log Message: With dounmount() working on a suspended file system remove no longer needed fields mnt_busynest and mnt_unmounting from struct mount. Welcome to 7.99.73 To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/sys/kern/vfs_mount.c cvs rdiff -u -r1.465 -r1.466 src/sys/kern/vfs_subr.c cvs rdiff -u -r1.6 -r1.7 src/sys/miscfs/genfs/genfs_vfsops.c cvs rdiff -u -r1.227 -r1.228 src/sys/sys/mount.h cvs rdiff -u -r1.539 -r1.540 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_mount.c diff -u src/sys/kern/vfs_mount.c:1.63 src/sys/kern/vfs_mount.c:1.64 --- src/sys/kern/vfs_mount.c:1.63 Wed May 24 09:52:59 2017 +++ src/sys/kern/vfs_mount.c Wed May 24 09:53:55 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_mount.c,v 1.63 2017/05/24 09:52:59 hannken Exp $ */ +/* $NetBSD: vfs_mount.c,v 1.64 2017/05/24 09:53:55 hannken Exp $ */ /*- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.63 2017/05/24 09:52:59 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.64 2017/05/24 09:53:55 hannken Exp $"); #include #include @@ -158,7 +158,6 @@ vfs_mountalloc(struct vfsops *vfsops, vn mp->mnt_op = vfsops; mp->mnt_refcnt = 1; TAILQ_INIT(>mnt_vnodelist); - mutex_init(>mnt_unmounting, MUTEX_DEFAULT, IPL_NONE); mutex_init(>mnt_renamelock, MUTEX_DEFAULT, IPL_NONE); mutex_init(>mnt_updating, MUTEX_DEFAULT, IPL_NONE); mp->mnt_vnodecovered = vp; @@ -298,7 +297,6 @@ vfs_rele(struct mount *mp) */ KASSERT(mp->mnt_refcnt == 0); specificdata_fini(mount_specificdata_domain, >mnt_specdataref); - mutex_destroy(>mnt_unmounting); mutex_destroy(>mnt_updating); mutex_destroy(>mnt_renamelock); if (mp->mnt_op != NULL) { @@ -325,23 +323,14 @@ _vfs_busy(struct mount *mp, bool wait) if (wait) { fstrans_start(mp, FSTRANS_SHARED); - mutex_enter(>mnt_unmounting); } else { if (fstrans_start_nowait(mp, FSTRANS_SHARED)) return EBUSY; - if (!mutex_tryenter(>mnt_unmounting)) { - fstrans_done(mp); - return EBUSY; - } } if (__predict_false((mp->mnt_iflag & IMNT_GONE) != 0)) { - mutex_exit(>mnt_unmounting); fstrans_done(mp); return ENOENT; } - ++mp->mnt_busynest; - KASSERT(mp->mnt_busynest != 0); - mutex_exit(>mnt_unmounting); vfs_ref(mp); return 0; } @@ -371,10 +360,6 @@ vfs_unbusy(struct mount *mp) KASSERT(mp->mnt_refcnt > 0); - mutex_enter(>mnt_unmounting); - KASSERT(mp->mnt_busynest != 0); - mp->mnt_busynest--; - mutex_exit(>mnt_unmounting); fstrans_done(mp); vfs_rele(mp); } @@ -874,23 +859,7 @@ dounmount(struct mount *mp, int flags, s return error; } - /* - * Abort unmount attempt when the filesystem is in use - */ - mutex_enter(>mnt_unmounting); - if (mp->mnt_busynest != 0) { - mutex_exit(>mnt_unmounting); - vfs_resume(mp); - return EBUSY; - } - - /* - * Abort unmount attempt when the filesystem is not mounted - */ - if ((mp->mnt_iflag & IMNT_GONE) != 0) { - mutex_exit(>mnt_unmounting); - return ENOENT; - } + KASSERT((mp->mnt_iflag & IMNT_GONE) == 0); used_syncer = (mp->mnt_iflag & IMNT_ONWORKLIST) != 0; used_extattr = mp->mnt_flag & MNT_EXTATTR; @@ -911,7 +880,6 @@ dounmount(struct mount *mp, int flags, s } if (error) { mp->mnt_iflag &= ~IMNT_UNMOUNT; - mutex_exit(>mnt_unmounting); if ((mp->mnt_flag & (MNT_RDONLY | MNT_ASYNC)) == 0) vfs_syncer_add_to_worklist(mp); mp->mnt_flag |= async; @@ -928,15 +896,11 @@ dounmount(struct mount *mp, int flags, s mutex_exit(>mnt_updating); /* - * release mnt_umounting lock here, because other code calls - * vfs_busy() while holding the mountlist_lock. - * * mark filesystem as gone to prevent further umounts * after mnt_umounting lock is gone, this also prevents * vfs_busy() from succeeding. */ mp->mnt_iflag |= IMNT_GONE; - mutex_exit(>mnt_unmounting); vfs_resume(mp); if ((coveredvp = mp->mnt_vnodecovered) != NULLVP) { Index: src/sys/kern/vfs_subr.c diff -u src/sys/kern/vfs_subr.c:1.465 src/sys/kern/vfs_subr.c:1.466 --- src/sys/kern/vfs_subr.c:1.465 Wed May 24 09:52:59 2017 +++ src/sys/kern/vfs_subr.c Wed May 24 09:53:55 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_subr.c,v 1.465 2017/05/24 09:52:59 hannken Exp $ */ +/* $NetBSD: vfs_subr.c,v 1.466 2017/05/24 09:53:55 hannken Exp $ */ /*- * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.465 2017/05/24 09:52:59 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.466 2017/05/24 09:53:55 hannken Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@
CVS commit: src/sys
Module Name:src Committed By: hannken Date: Wed May 24 09:53:00 UTC 2017 Modified Files: src/sys/kern: vfs_mount.c vfs_subr.c src/sys/sys: mount.h Log Message: Remove the syncer dance from dounmount(). The syncer skips unmounting file systems as they are suspended. Remove now unused syncer_mutex. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/kern/vfs_mount.c cvs rdiff -u -r1.464 -r1.465 src/sys/kern/vfs_subr.c cvs rdiff -u -r1.226 -r1.227 src/sys/sys/mount.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_mount.c diff -u src/sys/kern/vfs_mount.c:1.62 src/sys/kern/vfs_mount.c:1.63 --- src/sys/kern/vfs_mount.c:1.62 Wed May 17 12:45:03 2017 +++ src/sys/kern/vfs_mount.c Wed May 24 09:52:59 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_mount.c,v 1.62 2017/05/17 12:45:03 hannken Exp $ */ +/* $NetBSD: vfs_mount.c,v 1.63 2017/05/24 09:52:59 hannken Exp $ */ /*- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.62 2017/05/17 12:45:03 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.63 2017/05/24 09:52:59 hannken Exp $"); #include #include @@ -869,15 +869,8 @@ dounmount(struct mount *mp, int flags, s } mountlist_iterator_destroy(iter); - /* - * XXX Freeze syncer. Must do this before locking the - * mount point. See dounmount() for details. - */ - mutex_enter(_mutex); - error = vfs_suspend(mp, 0); if (error) { - mutex_exit(_mutex); return error; } @@ -887,7 +880,6 @@ dounmount(struct mount *mp, int flags, s mutex_enter(>mnt_unmounting); if (mp->mnt_busynest != 0) { mutex_exit(>mnt_unmounting); - mutex_exit(_mutex); vfs_resume(mp); return EBUSY; } @@ -897,28 +889,12 @@ dounmount(struct mount *mp, int flags, s */ if ((mp->mnt_iflag & IMNT_GONE) != 0) { mutex_exit(>mnt_unmounting); - mutex_exit(_mutex); return ENOENT; } used_syncer = (mp->mnt_iflag & IMNT_ONWORKLIST) != 0; used_extattr = mp->mnt_flag & MNT_EXTATTR; - /* - * XXX Syncer must be frozen when we get here. This should really - * be done on a per-mountpoint basis, but the syncer doesn't work - * like that. - * - * The caller of dounmount() must acquire syncer_mutex because - * the syncer itself acquires locks in syncer_mutex -> vfs_busy - * order, and we must preserve that order to avoid deadlock. - * - * So, if the file system did not use the syncer, now is - * the time to release the syncer_mutex. - */ - if (used_syncer == 0) { - mutex_exit(_mutex); - } mp->mnt_iflag |= IMNT_UNMOUNT; mutex_enter(>mnt_updating); async = mp->mnt_flag & MNT_ASYNC; @@ -941,8 +917,6 @@ dounmount(struct mount *mp, int flags, s mp->mnt_flag |= async; mutex_exit(>mnt_updating); vfs_resume(mp); - if (used_syncer) - mutex_exit(_mutex); if (used_extattr) { if (start_extattr(mp) != 0) mp->mnt_flag &= ~MNT_EXTATTR; @@ -973,8 +947,6 @@ dounmount(struct mount *mp, int flags, s mountlist_remove(mp); if (TAILQ_FIRST(>mnt_vnodelist) != NULL) panic("unmount: dangling vnode"); - if (used_syncer) - mutex_exit(_mutex); vfs_hooks_unmount(mp); fstrans_unmount(mp); Index: src/sys/kern/vfs_subr.c diff -u src/sys/kern/vfs_subr.c:1.464 src/sys/kern/vfs_subr.c:1.465 --- src/sys/kern/vfs_subr.c:1.464 Sun May 7 08:26:58 2017 +++ src/sys/kern/vfs_subr.c Wed May 24 09:52:59 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_subr.c,v 1.464 2017/05/07 08:26:58 hannken Exp $ */ +/* $NetBSD: vfs_subr.c,v 1.465 2017/05/24 09:52:59 hannken Exp $ */ /*- * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.464 2017/05/07 08:26:58 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.465 2017/05/24 09:52:59 hannken Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -568,7 +568,6 @@ time_t dirdelay = 15; /* time to dela time_t metadelay = 10; /* time to delay syncing metadata */ time_t lockdelay = 1; /* time to delay if locking fails */ -kmutex_t syncer_mutex; /* used to freeze syncer, long term */ static kmutex_t syncer_data_lock; /* short term lock on data structs */ static int syncer_delayno = 0; @@ -590,7 +589,6 @@ vn_initialize_syncerd(void) for (i = 0; i < syncer_last; i++) TAILQ_INIT(_workitem_pending[i]); - mutex_init(_mutex, MUTEX_DEFAULT, IPL_NONE); mutex_init(_data_lock, MUTEX_DEFAULT, IPL_NONE); } @@ -767,8 +765,6 @@ sched_sync(void *arg) bool synced; for (;;) { - mutex_enter(_mutex); - starttime = time_second; /* @@ -830,7 +826,6 @@ sched_sync(void *arg) synced ? syncdelay : lockdelay); } } - mutex_exit(_mutex); /* * If it has taken us less than a second to process the Index: src/sys/sys/mount.h diff -u src/sys/sys/mount.h:1.226
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: ozaki-r Date: Wed May 24 09:34:48 UTC 2017 Modified Files: src/tests/net/ipsec: t_ipsec_misc.sh Log Message: Enable DEBUG to know what is happening on anita/sparc To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/ipsec/t_ipsec_misc.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/ipsec/t_ipsec_misc.sh diff -u src/tests/net/ipsec/t_ipsec_misc.sh:1.3 src/tests/net/ipsec/t_ipsec_misc.sh:1.4 --- src/tests/net/ipsec/t_ipsec_misc.sh:1.3 Thu May 18 14:43:42 2017 +++ src/tests/net/ipsec/t_ipsec_misc.sh Wed May 24 09:34:48 2017 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_misc.sh,v 1.3 2017/05/18 14:43:42 ozaki-r Exp $ +# $NetBSD: t_ipsec_misc.sh,v 1.4 2017/05/24 09:34:48 ozaki-r Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -29,7 +29,7 @@ SOCK_LOCAL=unix://ipsec_local SOCK_PEER=unix://ipsec_peer BUS=./bus_ipsec -DEBUG=${DEBUG:-false} +DEBUG=${DEBUG:-true} setup_sasp() {
CVS commit: src/sys/net
Module Name:src Committed By: pgoyette Date: Wed May 24 06:52:14 UTC 2017 Modified Files: src/sys/net: if_tun.c Log Message: Call cv_destroy() to deactivate the tun_cv before calling kmem_intr_free() to deallocate the containing memory chunk (the tunnel's softc). Otherwise a LOCKDEBUG kernel will panic in tun_clone_destroy(). Fixes PR kern/52255 To generate a diff of this commit: cvs rdiff -u -r1.138 -r1.139 src/sys/net/if_tun.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_tun.c diff -u src/sys/net/if_tun.c:1.138 src/sys/net/if_tun.c:1.139 --- src/sys/net/if_tun.c:1.138 Sun Jan 29 18:30:33 2017 +++ src/sys/net/if_tun.c Wed May 24 06:52:14 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: if_tun.c,v 1.138 2017/01/29 18:30:33 maya Exp $ */ +/* $NetBSD: if_tun.c,v 1.139 2017/05/24 06:52:14 pgoyette Exp $ */ /* * Copyright (c) 1988, Julian Onions@@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.138 2017/01/29 18:30:33 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.139 2017/05/24 06:52:14 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -303,6 +303,7 @@ tun_clone_destroy(struct ifnet *ifp) softint_disestablish(tp->tun_osih); softint_disestablish(tp->tun_isih); mutex_destroy(>tun_lock); + cv_destroy(>tun_cv); kmem_free(tp, sizeof(*tp)); }
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Wed May 24 06:51:27 UTC 2017 Modified Files: src/sys/dev/pci: pci_subr.c pcireg.h Log Message: Decode TPH Requester Control register. To generate a diff of this commit: cvs rdiff -u -r1.181 -r1.182 src/sys/dev/pci/pci_subr.c cvs rdiff -u -r1.128 -r1.129 src/sys/dev/pci/pcireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/pci_subr.c diff -u src/sys/dev/pci/pci_subr.c:1.181 src/sys/dev/pci/pci_subr.c:1.182 --- src/sys/dev/pci/pci_subr.c:1.181 Mon May 22 04:21:20 2017 +++ src/sys/dev/pci/pci_subr.c Wed May 24 06:51:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_subr.c,v 1.181 2017/05/22 04:21:20 msaitoh Exp $ */ +/* $NetBSD: pci_subr.c,v 1.182 2017/05/24 06:51:27 msaitoh Exp $ */ /* * Copyright (c) 1997 Zubin D. Dittia. All rights reserved. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.181 2017/05/22 04:21:20 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.182 2017/05/24 06:51:27 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_pci.h" @@ -3410,6 +3410,40 @@ pci_conf_print_tph_req_cap(const pcireg_ (unsigned char)__SHIFTOUT(reg, PCI_TPH_REQ_CAP_STTBLLOC))); size = __SHIFTOUT(reg, PCI_TPH_REQ_CAP_STTBLSIZ) + 1; printf(" ST Table Size: %d\n", size); + + reg = regs[o2i(extcapoff + PCI_TPH_REQ_CTL)]; + printf("TPH Requester Control register: 0x%08x\n", reg); + printf(" ST Mode Select: "); + switch (__SHIFTOUT(reg, PCI_TPH_REQ_CTL_STSEL)) { + case PCI_TPH_REQ_CTL_STSEL_NO: + printf("No ST Mode\n"); + break; + case PCI_TPH_REQ_CTL_STSEL_IV: + printf("Interrupt Vector Mode\n"); + break; + case PCI_TPH_REQ_CTL_STSEL_DS: + printf("Device Specific Mode\n"); + break; + default: + printf("(reserved vaule)\n"); + break; + } + printf(" TPH Requester Enable: "); + switch (__SHIFTOUT(reg, PCI_TPH_REQ_CTL_TPHREQEN)) { + case PCI_TPH_REQ_CTL_TPHREQEN_NO: /* 0x0 */ + printf("Not permitted\n"); + break; + case PCI_TPH_REQ_CTL_TPHREQEN_TPH: + printf("TPH and not Extended TPH\n"); + break; + case PCI_TPH_REQ_CTL_TPHREQEN_ETPH: + printf("TPH and Extended TPH"); + break; + default: + printf("(reserved vaule)\n"); + break; + } + for (i = 0; i < size ; i += 2) { reg = regs[o2i(extcapoff + PCI_TPH_REQ_STTBL + i / 2)]; for (j = 0; j < 2 ; j++) { Index: src/sys/dev/pci/pcireg.h diff -u src/sys/dev/pci/pcireg.h:1.128 src/sys/dev/pci/pcireg.h:1.129 --- src/sys/dev/pci/pcireg.h:1.128 Fri Apr 21 09:01:52 2017 +++ src/sys/dev/pci/pcireg.h Wed May 24 06:51:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pcireg.h,v 1.128 2017/04/21 09:01:52 msaitoh Exp $ */ +/* $NetBSD: pcireg.h,v 1.129 2017/05/24 06:51:27 msaitoh Exp $ */ /* * Copyright (c) 1995, 1996, 1999, 2000 @@ -1856,8 +1856,15 @@ struct pci_rom { #define PCI_TPH_REQ_CAP_STTBLLOC __BITS(10, 9) /* ST Table Location */ #define PCI_TPH_REQ_CAP_STTBLSIZ __BITS(26, 16) /* ST Table Size */ #define PCI_TPH_REQ_CTL 0x08 /* TPH Requester Control */ -#define PCI_TPH_REQ_CTL_STSEL _BITS(2, 0) /* ST Mode Select */ -#define PCI_TPH_REQ_CTL_TPHREQEN _BITS(9, 8) /* TPH Requester Enable */ +#define PCI_TPH_REQ_CTL_STSEL __BITS(2, 0) /* ST Mode Select */ +#define PCI_TPH_REQ_CTL_STSEL_NO 0 /* No ST Mode */ +#define PCI_TPH_REQ_CTL_STSEL_IV 1 /* Interrupt Vector Mode */ +#define PCI_TPH_REQ_CTL_STSEL_DS 2 /* Device Specific Mode */ +#define PCI_TPH_REQ_CTL_TPHREQEN __BITS(9, 8) /* TPH Requester Enable */ +#define PCI_TPH_REQ_CTL_TPHREQEN_NO 0 /* Not permitted */ +#define PCI_TPH_REQ_CTL_TPHREQEN_TPH 1 /* TPH and no extended TPH */ +#define PCI_TPH_REQ_CTL_TPHREQEN_RSVD 2 /* Reserved */ +#define PCI_TPH_REQ_CTL_TPHREQEN_ETPH 3 /* TPH and Extended TPH */ #define PCI_TPH_REQ_STTBL 0x0c /* TPH ST Table */ /*
CVS commit: src/sys/arch/arm/arm32
Module Name:src Committed By: skrll Date: Wed May 24 06:31:07 UTC 2017 Modified Files: src/sys/arch/arm/arm32: pmap.c Log Message: Check the "Havard TLB" maintenance operations if the "Unified TLB" maintenance opeations don't include invalidate by ASID. Some CPUs, e.g. Cortex-A8, have Havard TLBs and report ASID operations this way. To generate a diff of this commit: cvs rdiff -u -r1.348 -r1.349 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.348 src/sys/arch/arm/arm32/pmap.c:1.349 --- src/sys/arch/arm/arm32/pmap.c:1.348 Wed May 24 06:27:33 2017 +++ src/sys/arch/arm/arm32/pmap.c Wed May 24 06:31:07 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.348 2017/05/24 06:27:33 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.349 2017/05/24 06:31:07 skrll Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -217,7 +217,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.348 2017/05/24 06:27:33 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.349 2017/05/24 06:31:07 skrll Exp $"); //#define PMAP_DEBUG #ifdef PMAP_DEBUG @@ -7524,6 +7524,8 @@ pmap_pte_init_armv7(void) */ if (__SHIFTOUT(armreg_mmfr2_read(), __BITS(16,19)) >= 2) { arm_has_tlbiasid_p = true; + } else if (__SHIFTOUT(armreg_mmfr2_read(), __BITS(12,15)) >= 2) { + arm_has_tlbiasid_p = true; } pte_l1_s_prot_u = L1_S_PROT_U_armv7;
CVS commit: src/sys/arch/arm/arm32
Module Name:src Committed By: skrll Date: Wed May 24 06:27:33 UTC 2017 Modified Files: src/sys/arch/arm/arm32: pmap.c Log Message: Move closer to the common pmap by using the same pmap_remove_all optimisation where TLB flushes are avoided by clever ASID assignment. pmap_remove_all_complete can now be removed. To generate a diff of this commit: cvs rdiff -u -r1.347 -r1.348 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.347 src/sys/arch/arm/arm32/pmap.c:1.348 --- src/sys/arch/arm/arm32/pmap.c:1.347 Mon May 22 06:35:04 2017 +++ src/sys/arch/arm/arm32/pmap.c Wed May 24 06:27:33 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.347 2017/05/22 06:35:04 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.348 2017/05/24 06:27:33 skrll Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -217,7 +217,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.347 2017/05/22 06:35:04 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.348 2017/05/24 06:27:33 skrll Exp $"); //#define PMAP_DEBUG #ifdef PMAP_DEBUG @@ -485,6 +485,11 @@ EVCNT_ATTACH_STATIC(pmap_ev_activations) #define PMAPCOUNT(x) ((void)0) #endif +#ifdef ARM_MMU_EXTENDED +void pmap_md_pdetab_activate(pmap_t, struct lwp *); +void pmap_md_pdetab_deactivate(pmap_t pm); +#endif + /* * pmap copy/zero page, and mem(5) hook point */ @@ -3411,14 +3416,6 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_ void pmap_remove(pmap_t pm, vaddr_t sva, vaddr_t eva) { - vaddr_t next_bucket; - u_int cleanlist_idx, total, cnt; - struct { - vaddr_t va; - pt_entry_t *ptep; - } cleanlist[PMAP_REMOVE_CLEAN_LIST_SIZE]; - u_int mappings; - UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist); UVMHIST_LOG(maphist, " (pm=%p, sva=%#x, eva=%#x)", pm, sva, eva, 0); @@ -3427,22 +3424,27 @@ pmap_remove(pmap_t pm, vaddr_t sva, vadd */ pmap_acquire_pmap_lock(pm); +#ifndef ARM_MMU_EXTENDED + u_int cleanlist_idx, total, cnt; + struct { + vaddr_t va; + pt_entry_t *ptep; + } cleanlist[PMAP_REMOVE_CLEAN_LIST_SIZE]; + if (pm->pm_remove_all || !pmap_is_cached(pm)) { cleanlist_idx = PMAP_REMOVE_CLEAN_LIST_SIZE + 1; -#ifndef ARM_MMU_EXTENDED if (pm->pm_cstate.cs_tlb == 0) pm->pm_remove_all = true; -#endif } else cleanlist_idx = 0; - total = 0; +#endif while (sva < eva) { /* * Do one L2 bucket's worth at a time. */ - next_bucket = L2_NEXT_BUCKET_VA(sva); + vaddr_t next_bucket = L2_NEXT_BUCKET_VA(sva); if (next_bucket > eva) next_bucket = eva; @@ -3453,9 +3455,9 @@ pmap_remove(pmap_t pm, vaddr_t sva, vadd } pt_entry_t *ptep = >l2b_kva[l2pte_index(sva)]; + u_int mappings = 0; - for (mappings = 0; - sva < next_bucket; + for (;sva < next_bucket; sva += PAGE_SIZE, ptep += PAGE_SIZE / L2_S_SIZE) { pt_entry_t opte = *ptep; @@ -3502,13 +3504,12 @@ pmap_remove(pmap_t pm, vaddr_t sva, vadd } #ifdef ARM_MMU_EXTENDED - if (pm == pmap_kernel()) { -l2pte_reset(ptep); -PTE_SYNC(ptep); - pmap_tlb_flush_SE(pm, sva, flags); -continue; + l2pte_reset(ptep); + PTE_SYNC(ptep); + if (__predict_false(pm->pm_remove_all == false)) { +pmap_tlb_flush_SE(pm, sva, flags); } -#endif +#else if (cleanlist_idx < PMAP_REMOVE_CLEAN_LIST_SIZE) { /* Add to the clean list. */ cleanlist[cleanlist_idx].ptep = ptep; @@ -3540,8 +3541,10 @@ pmap_remove(pmap_t pm, vaddr_t sva, vadd pmap_tlb_flush_SE(pm, sva, flags); } } +#endif } +#ifndef ARM_MMU_EXTENDED /* * Deal with any left overs */ @@ -3550,10 +3553,6 @@ pmap_remove(pmap_t pm, vaddr_t sva, vadd for (cnt = 0; cnt < cleanlist_idx; cnt++) { l2pte_reset(cleanlist[cnt].ptep); PTE_SYNC_CURRENT(pm, cleanlist[cnt].ptep); -#ifdef ARM_MMU_EXTENDED -vaddr_t clva = cleanlist[cnt].va; -pmap_tlb_flush_SE(pm, clva, PVF_REF); -#else vaddr_t va = cleanlist[cnt].va; if (pm->pm_cstate.cs_all != 0) { vaddr_t clva = va & ~PAGE_MASK; @@ -3565,7 +3564,6 @@ pmap_remove(pmap_t pm, vaddr_t sva, vadd pmap_tlb_flush_SE(pm, clva, PVF_REF | flags); } -#endif /* ARM_MMU_EXTENDED */ } /* @@ -3584,7 +3582,7 @@ pmap_remove(pmap_t pm, vaddr_t sva, vadd pm->pm_remove_all = true; } } - +#endif /* ARM_MMU_EXTENDED */ pmap_free_l2_bucket(pm, l2b, mappings); pm->pm_stats.resident_count -= mappings / (PAGE_SIZE/L2_S_SIZE); @@ -4768,20 +4766,86 @@ pmap_unwire(pmap_t pm, vaddr_t va) pmap_release_pmap_lock(pm); } +#ifdef ARM_MMU_EXTENDED void -pmap_activate(struct lwp *l) +pmap_md_pdetab_activate(pmap_t pm, struct lwp *l) { + UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist); + + /* + * Assume that TTBR1 has only global mappings and TTBR0 only + * has non-global mappings. To prevent speculation from doing + * evil things we disable translation