From owner-svn-src-user@FreeBSD.ORG Sun Jun 14 23:27:58 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B636D106564A; Sun, 14 Jun 2009 23:27:58 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A58EF8FC0C; Sun, 14 Jun 2009 23:27:58 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5ENRwHf065151; Sun, 14 Jun 2009 23:27:58 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5ENRw9a065150; Sun, 14 Jun 2009 23:27:58 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906142327.n5ENRw9a065150@svn.freebsd.org> From: Kip Macy Date: Sun, 14 Jun 2009 23:27:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194221 - user/kmacy/releng_7_2_fcs/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2009 23:27:59 -0000 Author: kmacy Date: Sun Jun 14 23:27:58 2009 New Revision: 194221 URL: http://svn.freebsd.org/changeset/base/194221 Log: use local variable Modified: user/kmacy/releng_7_2_fcs/sys/net/if_var.h Modified: user/kmacy/releng_7_2_fcs/sys/net/if_var.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/if_var.h Sun Jun 14 23:27:09 2009 (r194220) +++ user/kmacy/releng_7_2_fcs/sys/net/if_var.h Sun Jun 14 23:27:58 2009 (r194221) @@ -579,7 +579,7 @@ drbr_enqueue(struct ifnet *ifp, struct b return (error); } #endif - if ((error = buf_ring_enqueue(br, m, m->m_pkthdr.len)) == ENOBUFS) { + if ((error = buf_ring_enqueue(br, m, len)) == ENOBUFS) { br->br_drops++; m_freem(m); } else From owner-svn-src-user@FreeBSD.ORG Sun Jun 14 23:28:25 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D7A7106564A; Sun, 14 Jun 2009 23:28:25 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 326CD8FC0A; Sun, 14 Jun 2009 23:28:25 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5ENSPP1065199; Sun, 14 Jun 2009 23:28:25 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5ENSPjB065198; Sun, 14 Jun 2009 23:28:25 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906142328.n5ENSPjB065198@svn.freebsd.org> From: Kip Macy Date: Sun, 14 Jun 2009 23:28:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194222 - user/kmacy/releng_7_2_fcs/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2009 23:28:25 -0000 Author: kmacy Date: Sun Jun 14 23:28:24 2009 New Revision: 194222 URL: http://svn.freebsd.org/changeset/base/194222 Log: remove ppp parts as they're slated for removal Deleted: user/kmacy/releng_7_2_fcs/sys/net/if_ppp.c user/kmacy/releng_7_2_fcs/sys/net/if_ppp.h user/kmacy/releng_7_2_fcs/sys/net/if_pppvar.h user/kmacy/releng_7_2_fcs/sys/net/ppp_comp.h user/kmacy/releng_7_2_fcs/sys/net/ppp_deflate.c user/kmacy/releng_7_2_fcs/sys/net/ppp_tty.c From owner-svn-src-user@FreeBSD.ORG Sun Jun 14 23:29:07 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7716106566C; Sun, 14 Jun 2009 23:29:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C7B18FC12; Sun, 14 Jun 2009 23:29:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5ENT7af065245; Sun, 14 Jun 2009 23:29:07 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5ENT7hx065244; Sun, 14 Jun 2009 23:29:07 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906142329.n5ENT7hx065244@svn.freebsd.org> From: Kip Macy Date: Sun, 14 Jun 2009 23:29:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194223 - user/kmacy/releng_7_2_fcs/sys/modules/if_ppp X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2009 23:29:08 -0000 Author: kmacy Date: Sun Jun 14 23:29:07 2009 New Revision: 194223 URL: http://svn.freebsd.org/changeset/base/194223 Log: remove ppp from build Deleted: user/kmacy/releng_7_2_fcs/sys/modules/if_ppp/ From owner-svn-src-user@FreeBSD.ORG Sun Jun 14 23:32:43 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD14B106566B; Sun, 14 Jun 2009 23:32:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC1A88FC08; Sun, 14 Jun 2009 23:32:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5ENWhL5065354; Sun, 14 Jun 2009 23:32:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5ENWhTx065351; Sun, 14 Jun 2009 23:32:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906142332.n5ENWhTx065351@svn.freebsd.org> From: Kip Macy Date: Sun, 14 Jun 2009 23:32:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194224 - user/kmacy/releng_7_2_fcs/sys/libkern/zlib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2009 23:32:44 -0000 Author: kmacy Date: Sun Jun 14 23:32:43 2009 New Revision: 194224 URL: http://svn.freebsd.org/changeset/base/194224 Log: fix const warnings Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/uncompr.c user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zlib.h user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.h Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/uncompr.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/libkern/zlib/uncompr.c Sun Jun 14 23:29:07 2009 (r194223) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/uncompr.c Sun Jun 14 23:32:43 2009 (r194224) @@ -32,7 +32,7 @@ int ZEXPORT uncompress (dest, destLen, s z_stream stream; int err; - stream.next_in = (Bytef*)source; + stream.next_in = (Bytef*)(uintptr_t)source; stream.avail_in = (uInt)sourceLen; /* Check for source > 64K on 16-bit machine: */ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zlib.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zlib.h Sun Jun 14 23:29:07 2009 (r194223) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zlib.h Sun Jun 14 23:32:43 2009 (r194224) @@ -30,7 +30,7 @@ #ifndef ZLIB_H #define ZLIB_H - +#include #include #ifdef __cplusplus Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.h Sun Jun 14 23:29:07 2009 (r194223) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.h Sun Jun 14 23:32:43 2009 (r194224) @@ -61,7 +61,7 @@ extern const char * const z_errmsg[10]; #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] #define ERR_RETURN(strm,err) \ - return (strm->msg = (char*)ERR_MSG(err), (err)) + return (strm->msg = (char*)(uintptr_t)ERR_MSG(err), (err)) /* To be used only when the state is known to be valid */ /* common constants */ From owner-svn-src-user@FreeBSD.ORG Mon Jun 15 00:17:22 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B042106564A; Mon, 15 Jun 2009 00:17:22 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A1698FC0A; Mon, 15 Jun 2009 00:17:22 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5F0HMnR069449; Mon, 15 Jun 2009 00:17:22 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5F0HM2D069448; Mon, 15 Jun 2009 00:17:22 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906150017.n5F0HM2D069448@svn.freebsd.org> From: Kip Macy Date: Mon, 15 Jun 2009 00:17:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194226 - user/kmacy/releng_7_2_fcs/sys/netinet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2009 00:17:22 -0000 Author: kmacy Date: Mon Jun 15 00:17:22 2009 New Revision: 194226 URL: http://svn.freebsd.org/changeset/base/194226 Log: comment out SCTP NAT bits Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_fw_nat.c Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_fw_nat.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/ip_fw_nat.c Sun Jun 14 23:44:06 2009 (r194225) +++ user/kmacy/releng_7_2_fcs/sys/netinet/ip_fw_nat.c Mon Jun 15 00:17:22 2009 (r194226) @@ -326,10 +326,15 @@ ipfw_nat(struct ip_fw_args *args, struct else retval = LibAliasOut(t->lib, c, mcl->m_len + M_TRAILINGSPACE(mcl)); +#ifdef notyet + /* + * We don't need SCTP nat support + */ if (retval == PKT_ALIAS_RESPOND) { m->m_flags |= M_SKIP_FIREWALL; retval = PKT_ALIAS_OK; } +#endif if (retval != PKT_ALIAS_OK && retval != PKT_ALIAS_FOUND_HEADER_FRAGMENT) { /* XXX - should i add some logging? */ From owner-svn-src-user@FreeBSD.ORG Mon Jun 15 20:00:19 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF902106566C; Mon, 15 Jun 2009 20:00:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD49D8FC1A; Mon, 15 Jun 2009 20:00:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5FK0JE3099941; Mon, 15 Jun 2009 20:00:19 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5FK0JqK099940; Mon, 15 Jun 2009 20:00:19 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906152000.n5FK0JqK099940@svn.freebsd.org> From: Kip Macy Date: Mon, 15 Jun 2009 20:00:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194260 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2009 20:00:20 -0000 Author: kmacy Date: Mon Jun 15 20:00:19 2009 New Revision: 194260 URL: http://svn.freebsd.org/changeset/base/194260 Log: make tx reclaim and tx coalesce threshold values tunables and read-write sysctls Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Mon Jun 15 19:50:03 2009 (r194259) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Mon Jun 15 20:00:19 2009 (r194260) @@ -78,12 +78,38 @@ TUNABLE_INT("hw.cxgb.txq_mr_size", &cxgb SYSCTL_UINT(_hw_cxgb, OID_AUTO, txq_mr_size, CTLFLAG_RDTUN, &cxgb_txq_buf_ring_size, 0, "size of per-queue mbuf ring"); -static int cxgb_pcpu_tx_coalesce_force = 0; -TUNABLE_INT("hw.cxgb.tx_coalesce_force", &cxgb_pcpu_tx_coalesce_force); -SYSCTL_UINT(_hw_cxgb, OID_AUTO, tx_coalesce, CTLFLAG_RW, - &cxgb_pcpu_tx_coalesce_force, 0, +static int cxgb_tx_coalesce_force = 0; +TUNABLE_INT("hw.cxgb.tx_coalesce_force", &cxgb_tx_coalesce_force); +SYSCTL_UINT(_hw_cxgb, OID_AUTO, tx_coalesce_force, CTLFLAG_RW, + &cxgb_tx_coalesce_force, 0, "coalesce small packets into a single work request regardless of ring state"); +#define COALESCE_START_DEFAULT TX_ETH_Q_SIZE>>1 +#define COALESCE_START_MAX (TX_ETH_Q_SIZE-(TX_ETH_Q_SIZE>>3)) +#define COALESCE_STOP_DEFAULT TX_ETH_Q_SIZE>>2 +#define COALESCE_STOP_MIN TX_ETH_Q_SIZE>>5 +#define TX_RECLAIM_DEFAULT TX_ETH_Q_SIZE>>5 +#define TX_RECLAIM_MAX TX_ETH_Q_SIZE>>2 +#define TX_RECLAIM_MIN TX_ETH_Q_SIZE>>6 + + +static int cxgb_tx_coalesce_enable_start = COALESCE_START_DEFAULT; +TUNABLE_INT("hw.cxgb.tx_coalesce_enable_start", + &cxgb_tx_coalesce_enable_start); +SYSCTL_UINT(_hw_cxgb, OID_AUTO, tx_coalesce_enable_start, CTLFLAG_RW, + &cxgb_tx_coalesce_enable_start, 0, + "coalesce enable threshold"); +static int cxgb_tx_coalesce_enable_stop = COALESCE_STOP_DEFAULT; +TUNABLE_INT("hw.cxgb.tx_coalesce_enable_stop", &cxgb_tx_coalesce_enable_stop); +SYSCTL_UINT(_hw_cxgb, OID_AUTO, tx_coalesce_enable_stop, CTLFLAG_RW, + &cxgb_tx_coalesce_enable_stop, 0, + "coalesce disable threshold"); +static int cxgb_tx_reclaim_threshold = TX_RECLAIM_DEFAULT; +TUNABLE_INT("hw.cxgb.tx_reclaim_threshold", &cxgb_tx_reclaim_threshold); +SYSCTL_UINT(_hw_cxgb, OID_AUTO, tx_reclaim_threshold, CTLFLAG_RW, + &cxgb_tx_reclaim_threshold, 0, + "tx cleaning minimum threshold"); + /* * XXX don't re-enable this until TOE stops assuming * we have an m_ext @@ -97,7 +123,7 @@ int fl_q_size = 0; int jumbo_q_size = 0; extern int cxgb_use_16k_clusters; -extern int cxgb_pcpu_cache_enable; +extern int cxgb_cache_enable; extern int nmbjumbo4; extern int nmbjumbo9; extern int nmbjumbo16; @@ -232,22 +258,26 @@ check_pkt_coalesce(struct sge_qset *qs) struct sge_txq *txq; uint8_t *fill; - if (__predict_false(cxgb_pcpu_tx_coalesce_force)) + if (__predict_false(cxgb_tx_coalesce_force)) return (1); txq = &qs->txq[TXQ_ETH]; sc = qs->port->adapter; fill = &sc->tunq_fill[qs->idx]; + if (cxgb_tx_coalesce_enable_start > COALESCE_START_MAX) + cxgb_tx_coalesce_enable_start = COALESCE_START_MAX; + if (cxgb_tx_coalesce_enable_stop < COALESCE_STOP_MIN) + cxgb_tx_coalesce_enable_start = COALESCE_STOP_MIN; /* * if the hardware transmit queue is more than 1/8 full * we mark it as coalescing - we drop back from coalescing * when we go below 1/32 full and there are no packets enqueued, * this provides us with some degree of hysteresis */ - if (*fill != 0 && (txq->in_use < (txq->size>>5)) && + if (*fill != 0 && (txq->in_use <= cxgb_tx_coalesce_enable_stop) && TXQ_RING_EMPTY(qs) && (qs->coalescing == 0)) *fill = 0; - else if (*fill == 0 && (txq->in_use >= (txq->size>>3))) + else if (*fill == 0 && (txq->in_use >= cxgb_tx_coalesce_enable_start)) *fill = 1; return (sc->tunq_coalesce); @@ -340,6 +370,10 @@ reclaim_completed_tx(struct sge_qset *qs struct sge_txq *q = &qs->txq[queue]; int reclaim = desc_reclaimable(q); + if ((cxgb_tx_reclaim_threshold > TX_RECLAIM_MAX) || + (cxgb_tx_reclaim_threshold < TX_RECLAIM_MIN)) + cxgb_tx_reclaim_threshold = TX_RECLAIM_DEFAULT; + if (reclaim < reclaim_min) return (0); @@ -1563,10 +1597,12 @@ cxgb_tx_watchdog(void *arg) struct sge_qset *qs = arg; struct sge_txq *txq = &qs->txq[TXQ_ETH]; - if (qs->coalescing != 0 && (txq->in_use < (txq->size>>5)) && - TXQ_RING_EMPTY(qs)) + if (qs->coalescing != 0 && + (txq->in_use <= cxgb_tx_coalesce_enable_stop) && + TXQ_RING_EMPTY(qs)) qs->coalescing = 0; - else if (qs->coalescing == 0 && (txq->in_use >= (txq->size>>3))) + else if (qs->coalescing == 0 && + (txq->in_use >= cxgb_tx_coalesce_enable_start)) qs->coalescing = 1; if (TXQ_TRYLOCK(qs)) { qs->qs_flags |= QS_FLUSHING; @@ -1575,7 +1611,7 @@ cxgb_tx_watchdog(void *arg) TXQ_UNLOCK(qs); } if (qs->port->ifp->if_drv_flags & IFF_DRV_RUNNING) - callout_reset_on(&txq->txq_watchdog, hz, cxgb_tx_watchdog, + callout_reset_on(&txq->txq_watchdog, hz/4, cxgb_tx_watchdog, qs, txq->txq_watchdog.c_cpu); } @@ -1615,7 +1651,7 @@ cxgb_start_locked(struct sge_qset *qs) !TXQ_RING_EMPTY(qs) && (ifp->if_drv_flags & IFF_DRV_RUNNING) && pi->link_config.link_ok) { - reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>5), TXQ_ETH); + reclaim_completed_tx(qs, cxgb_tx_reclaim_threshold, TXQ_ETH); if ((m_head = cxgb_dequeue(qs)) == NULL) break; @@ -1692,7 +1728,7 @@ cxgb_transmit_locked(struct ifnet *ifp, } else if ((error = drbr_enqueue(ifp, br, m)) != 0) return (error); - reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); + reclaim_completed_tx(qs, cxgb_tx_reclaim_threshold, TXQ_ETH); if (!TXQ_RING_EMPTY(qs) && pi->link_config.link_ok && (!check_pkt_coalesce(qs) || (drbr_inuse(ifp, br) >= 7))) cxgb_start_locked(qs); From owner-svn-src-user@FreeBSD.ORG Tue Jun 16 03:49:59 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AFFC1065676; Tue, 16 Jun 2009 03:49:59 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89D238FC14; Tue, 16 Jun 2009 03:49:59 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5G3nxOT011186; Tue, 16 Jun 2009 03:49:59 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5G3nx72011185; Tue, 16 Jun 2009 03:49:59 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906160349.n5G3nx72011185@svn.freebsd.org> From: Kip Macy Date: Tue, 16 Jun 2009 03:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194279 - user/kmacy/releng_7_2_fcs/sys/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2009 03:49:59 -0000 Author: kmacy Date: Tue Jun 16 03:49:59 2009 New Revision: 194279 URL: http://svn.freebsd.org/changeset/base/194279 Log: remove old cxgb files Modified: user/kmacy/releng_7_2_fcs/sys/conf/files Modified: user/kmacy/releng_7_2_fcs/sys/conf/files ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/conf/files Tue Jun 16 02:36:49 2009 (r194278) +++ user/kmacy/releng_7_2_fcs/sys/conf/files Tue Jun 16 03:49:59 2009 (r194279) @@ -685,8 +685,6 @@ dev/cxgb/cxgb_offload.c optional cxgb p compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/cxgb_sge.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" -dev/cxgb/cxgb_multiq.c optional cxgb pci \ - compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_mc5.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_vsc7323.c optional cxgb pci \ @@ -705,8 +703,6 @@ dev/cxgb/common/cxgb_tn1010.c optional c compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/sys/uipc_mvec.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" -dev/cxgb/sys/cxgb_support.c optional cxgb pci \ - compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/cxgb_t3fw.c optional cxgb cxgb_t3fw \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cy/cy.c optional cy From owner-svn-src-user@FreeBSD.ORG Tue Jun 16 03:51:38 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D07E1106564A; Tue, 16 Jun 2009 03:51:38 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A485D8FC0A; Tue, 16 Jun 2009 03:51:38 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5G3pcwB011260; Tue, 16 Jun 2009 03:51:38 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5G3pcrb011258; Tue, 16 Jun 2009 03:51:38 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906160351.n5G3pcrb011258@svn.freebsd.org> From: Kip Macy Date: Tue, 16 Jun 2009 03:51:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194280 - in user/kmacy/releng_7_2_fcs/sys: cddl/contrib/opensolaris/uts/common/fs/zfs conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2009 03:51:39 -0000 Author: kmacy Date: Tue Jun 16 03:51:38 2009 New Revision: 194280 URL: http://svn.freebsd.org/changeset/base/194280 Log: enable UMA use for allocation Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c user/kmacy/releng_7_2_fcs/sys/conf/kern.pre.mk Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Tue Jun 16 03:49:59 2009 (r194279) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Tue Jun 16 03:51:38 2009 (r194280) @@ -91,13 +91,6 @@ zio_init(void) #ifdef ZIO_USE_UMA size_t c; #endif -#if 0 - vmem_t *data_alloc_arena = NULL; - -#ifdef _KERNEL - data_alloc_arena = zio_alloc_arena; -#endif -#endif zio_cache = kmem_cache_create("zio_cache", sizeof (zio_t), 0, NULL, NULL, NULL, NULL, NULL, 0); @@ -135,7 +128,7 @@ zio_init(void) (void) sprintf(name, "zio_data_buf_%lu", (ulong_t)size); zio_data_buf_cache[c] = kmem_cache_create(name, size, - align, NULL, NULL, NULL, NULL, data_alloc_arena, + align, NULL, NULL, NULL, NULL, NULL, KMC_NODEBUG); } } Modified: user/kmacy/releng_7_2_fcs/sys/conf/kern.pre.mk ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/conf/kern.pre.mk Tue Jun 16 03:49:59 2009 (r194279) +++ user/kmacy/releng_7_2_fcs/sys/conf/kern.pre.mk Tue Jun 16 03:51:38 2009 (r194280) @@ -123,7 +123,7 @@ INCLUDES+= -I$S/gnu/fs/xfs/FreeBSD -I$S/ CFLAGS= ${COPTFLAGS} ${C_DIALECT} ${DEBUG} ${CWARNFLAGS} CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -ZFS_CFLAGS= -DFREEBSD_NAMECACHE -DBUILDING_ZFS -D_KERNEL +ZFS_CFLAGS= -DFREEBSD_NAMECACHE -DBUILDING_ZFS -D_KERNEL -DZIO_USE_UMA ZFS_CFLAGS+=-DHAVE_KERNEL_OPTION_HEADERS -nostdinc ZFS_CFLAGS+=-mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -ffreestanding ZFS_CFLAGS+=${COPTFLAGS} ${ZFS_C_DIALECT} ${DEBUG} ${CWARNFLAGS} From owner-svn-src-user@FreeBSD.ORG Tue Jun 16 22:35:16 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2D0C106566C; Tue, 16 Jun 2009 22:35:16 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77FC78FC08; Tue, 16 Jun 2009 22:35:16 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5GMZGiB053949; Tue, 16 Jun 2009 22:35:16 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5GMZGU4053948; Tue, 16 Jun 2009 22:35:16 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200906162235.n5GMZGU4053948@svn.freebsd.org> From: Peter Wemm Date: Tue, 16 Jun 2009 22:35:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194308 - user/peter X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2009 22:35:17 -0000 Author: peter Date: Tue Jun 16 22:35:16 2009 New Revision: 194308 URL: http://svn.freebsd.org/changeset/base/194308 Log: Test commit Added: user/peter/foo.txt (contents, props changed) Added: user/peter/foo.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/peter/foo.txt Tue Jun 16 22:35:16 2009 (r194308) @@ -0,0 +1,2 @@ +$FreeBSD$ +Hi From owner-svn-src-user@FreeBSD.ORG Tue Jun 16 22:55:11 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 402E3106564A; Tue, 16 Jun 2009 22:55:11 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DA918FC16; Tue, 16 Jun 2009 22:55:11 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5GMtBm9054582; Tue, 16 Jun 2009 22:55:11 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5GMtBQI054580; Tue, 16 Jun 2009 22:55:11 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906162255.n5GMtBQI054580@svn.freebsd.org> From: Kip Macy Date: Tue, 16 Jun 2009 22:55:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194311 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2009 22:55:11 -0000 Author: kmacy Date: Tue Jun 16 22:55:10 2009 New Revision: 194311 URL: http://svn.freebsd.org/changeset/base/194311 Log: parallelize locking on ARC states Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Jun 16 22:45:33 2009 (r194310) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Jun 16 22:55:10 2009 (r194311) @@ -218,13 +218,31 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, mdcomp_di * second level ARC benefit from these fast lookups. */ +#define ARCS_LOCK_PAD 128 +struct arcs_lock { + kmutex_t arcs_lock; +#ifdef _KERNEL + unsigned char pad[(ARCS_LOCK_PAD - sizeof (kmutex_t))]; +#endif +}; + +/* + * must be power of two for mask use to work + * + */ +#define ARC_BUFC_NUMDATALISTS 16 +#define ARC_BUFC_NUMMETADATALISTS 16 +#define ARC_BUFC_NUMLISTS (ARC_BUFC_NUMMETADATALISTS+ARC_BUFC_NUMDATALISTS) + typedef struct arc_state { - list_t arcs_list[ARC_BUFC_NUMTYPES]; /* list of evictable buffers */ uint64_t arcs_lsize[ARC_BUFC_NUMTYPES]; /* amount of evictable data */ uint64_t arcs_size; /* total amount of data in this state */ - kmutex_t arcs_mtx __aligned(128); + list_t arcs_lists[ARC_BUFC_NUMLISTS]; /* list of evictable buffers */ + struct arcs_lock arcs_locks[ARC_BUFC_NUMLISTS] __aligned(128); } arc_state_t; +#define ARCS_LOCK(s, i) &((s)->arcs_locks[(i)].arcs_lock) + /* The 6 states: */ static arc_state_t ARC_anon; static arc_state_t ARC_mru; @@ -959,21 +977,41 @@ arc_buf_freeze(arc_buf_t *buf) } static void +get_buf_info(arc_buf_hdr_t *ab, arc_state_t *state, list_t **list, kmutex_t **lock) +{ + uint64_t buf_hashid = buf_hash(ab->b_spa, &ab->b_dva, ab->b_birth); + + if (ab->b_type == ARC_BUFC_METADATA) + buf_hashid &= (ARC_BUFC_NUMMETADATALISTS-1); + else { + buf_hashid &= (ARC_BUFC_NUMDATALISTS-1); + buf_hashid += ARC_BUFC_NUMMETADATALISTS; + } + + *list = &state->arcs_lists[buf_hashid]; + *lock = ARCS_LOCK(state, buf_hashid); +} + + +static void add_reference(arc_buf_hdr_t *ab, kmutex_t *hash_lock, void *tag) { + ASSERT(MUTEX_HELD(hash_lock)); if ((refcount_add(&ab->b_refcnt, tag) == 1) && (ab->b_state != arc_anon)) { + list_t *list; + kmutex_t *lock; uint64_t delta = ab->b_size * ab->b_datacnt; - list_t *list = &ab->b_state->arcs_list[ab->b_type]; uint64_t *size = &ab->b_state->arcs_lsize[ab->b_type]; - ASSERT(!MUTEX_HELD(&ab->b_state->arcs_mtx)); - mutex_enter(&ab->b_state->arcs_mtx); + get_buf_info(ab, ab->b_state, &list, &lock); + ASSERT(!MUTEX_HELD(lock)); + mutex_enter(lock); ASSERT(list_link_active(&ab->b_arc_node)); list_remove(list, ab); - mutex_exit(&ab->b_state->arcs_mtx); + mutex_exit(lock); if (GHOST_STATE(ab->b_state)) { ASSERT3U(ab->b_datacnt, ==, 0); @@ -1001,12 +1039,16 @@ remove_reference(arc_buf_hdr_t *ab, kmut if (((cnt = refcount_remove(&ab->b_refcnt, tag)) == 0) && (state != arc_anon)) { uint64_t *size = &state->arcs_lsize[ab->b_type]; + list_t *list; + kmutex_t *lock; - ASSERT(!MUTEX_HELD(&state->arcs_mtx)); - mutex_enter(&state->arcs_mtx); + get_buf_info(ab, state, &list, &lock); + + ASSERT(!MUTEX_HELD(lock)); + mutex_enter(lock); ASSERT(!list_link_active(&ab->b_arc_node)); - list_insert_head(&state->arcs_list[ab->b_type], ab); - mutex_exit(&state->arcs_mtx); + list_insert_head(list, ab); + mutex_exit(lock); ASSERT(ab->b_datacnt > 0); atomic_add_64(size, ab->b_size * ab->b_datacnt); @@ -1024,6 +1066,8 @@ arc_change_state(arc_state_t *new_state, arc_state_t *old_state = ab->b_state; int64_t refcnt = refcount_count(&ab->b_refcnt); uint64_t from_delta, to_delta; + list_t *list; + kmutex_t *lock; ASSERT(MUTEX_HELD(hash_lock)); ASSERT(new_state != old_state); @@ -1038,14 +1082,17 @@ arc_change_state(arc_state_t *new_state, */ if (refcnt == 0) { if (old_state != arc_anon) { - int use_mutex = !MUTEX_HELD(&old_state->arcs_mtx); + int use_mutex; uint64_t *size = &old_state->arcs_lsize[ab->b_type]; + get_buf_info(ab, old_state, &list, &lock); + use_mutex = !MUTEX_HELD(lock); + if (use_mutex) - mutex_enter(&old_state->arcs_mtx); + mutex_enter(lock); ASSERT(list_link_active(&ab->b_arc_node)); - list_remove(&old_state->arcs_list[ab->b_type], ab); + list_remove(list, ab); /* * If prefetching out of the ghost cache, @@ -1060,16 +1107,20 @@ arc_change_state(arc_state_t *new_state, atomic_add_64(size, -from_delta); if (use_mutex) - mutex_exit(&old_state->arcs_mtx); + mutex_exit(lock); } if (new_state != arc_anon) { - int use_mutex = !MUTEX_HELD(&new_state->arcs_mtx); + int use_mutex; uint64_t *size = &new_state->arcs_lsize[ab->b_type]; + get_buf_info(ab, new_state, &list, &lock); + use_mutex = !MUTEX_HELD(lock); + + if (use_mutex) - mutex_enter(&new_state->arcs_mtx); + mutex_enter(lock); - list_insert_head(&new_state->arcs_list[ab->b_type], ab); + list_insert_head(list, ab); /* ghost elements have a ghost size */ if (GHOST_STATE(new_state)) { @@ -1080,7 +1131,7 @@ arc_change_state(arc_state_t *new_state, atomic_add_64(size, to_delta); if (use_mutex) - mutex_exit(&new_state->arcs_mtx); + mutex_exit(lock); } } @@ -1471,17 +1522,42 @@ arc_evict(arc_state_t *state, spa_t *spa arc_state_t *evicted_state; uint64_t bytes_evicted = 0, skipped = 0, missed = 0; arc_buf_hdr_t *ab, *ab_prev = NULL; - list_t *list = &state->arcs_list[type]; + list_t *evicted_list, *list, *evicted_list_start, *list_start; + kmutex_t *lock, *evicted_lock; kmutex_t *hash_lock; boolean_t have_lock; void *stolen = NULL; + static int evict_metadata_offset, evict_data_offset; + int idx, offset, list_count, count; ASSERT(state == arc_mru || state == arc_mfu); evicted_state = (state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost; + + if (type == ARC_BUFC_METADATA) { + offset = 0; + list_count = ARC_BUFC_NUMMETADATALISTS; + list_start = &state->arcs_lists[0]; + evicted_list_start = &evicted_state->arcs_lists[0]; + idx = evict_metadata_offset; + } else { + offset = ARC_BUFC_NUMMETADATALISTS; - mutex_enter(&state->arcs_mtx); - mutex_enter(&evicted_state->arcs_mtx); + list_start = &state->arcs_lists[offset]; + evicted_list_start = &evicted_state->arcs_lists[offset]; + list_count = ARC_BUFC_NUMDATALISTS; + idx = evict_data_offset; + } + count = 0; + +evict_start: + list = &list_start[idx]; + evicted_list = &evicted_list_start[idx]; + lock = ARCS_LOCK(state, (offset + idx)); + evicted_lock = ARCS_LOCK(evicted_state, (offset + idx)); + + mutex_enter(lock); + mutex_enter(evicted_lock); for (ab = list_tail(list); ab; ab = ab_prev) { ab_prev = list_prev(list, ab); @@ -1549,13 +1625,24 @@ arc_evict(arc_state_t *state, spa_t *spa } } - mutex_exit(&evicted_state->arcs_mtx); - mutex_exit(&state->arcs_mtx); - - if (bytes_evicted < bytes) - dprintf("only evicted %lld bytes from %x", - (longlong_t)bytes_evicted, state); - + mutex_exit(evicted_lock); + mutex_exit(lock); + + idx = ((idx + 1)&(list_count-1)); + count++; + + if (bytes_evicted < bytes) { + if (count < list_count) + goto evict_start; + else + dprintf("only evicted %lld bytes from %x", + (longlong_t)bytes_evicted, state); + } + if (type == ARC_BUFC_METADATA) + evict_metadata_offset = idx; + else + evict_data_offset = idx; + if (skipped) ARCSTAT_INCR(arcstat_evict_skip, skipped); @@ -1594,14 +1681,28 @@ static void arc_evict_ghost(arc_state_t *state, spa_t *spa, int64_t bytes) { arc_buf_hdr_t *ab, *ab_prev; - list_t *list = &state->arcs_list[ARC_BUFC_DATA]; - kmutex_t *hash_lock; + list_t *list, *list_start; + kmutex_t *hash_lock, *lock; uint64_t bytes_deleted = 0; uint64_t bufs_skipped = 0; + static int evict_offset; + int list_count, idx = evict_offset; + int offset, count = 0; ASSERT(GHOST_STATE(state)); -top: - mutex_enter(&state->arcs_mtx); + + /* + * data lists come after metadata lists + */ + list_start = &state->arcs_lists[ARC_BUFC_NUMMETADATALISTS]; + list_count = ARC_BUFC_NUMDATALISTS; + offset = ARC_BUFC_NUMMETADATALISTS; + +evict_start: + list = &list_start[idx]; + lock = ARCS_LOCK(state, idx + offset); + + mutex_enter(lock); for (ab = list_tail(list); ab; ab = ab_prev) { ab_prev = list_prev(list, ab); if (spa && ab->b_spa != spa) @@ -1631,20 +1732,31 @@ top: break; } else { if (bytes < 0) { - mutex_exit(&state->arcs_mtx); + /* + * we're draining the ARC, retry + */ + mutex_exit(lock); mutex_enter(hash_lock); mutex_exit(hash_lock); - goto top; + goto evict_start; } bufs_skipped += 1; } } - mutex_exit(&state->arcs_mtx); - - if (list == &state->arcs_list[ARC_BUFC_DATA] && + mutex_exit(lock); + idx = ((idx + 1)&(ARC_BUFC_NUMDATALISTS-1)); + count++; + + if (count < list_count) + goto evict_start; + + evict_offset = idx; + if ((uintptr_t)list > (uintptr_t)&state->arcs_lists[ARC_BUFC_NUMMETADATALISTS] && (bytes < 0 || bytes_deleted < bytes)) { - list = &state->arcs_list[ARC_BUFC_METADATA]; - goto top; + list_start = &state->arcs_lists[0]; + list_count = ARC_BUFC_NUMMETADATALISTS; + offset = count = 0; + goto evict_start; } if (bufs_skipped) { @@ -1758,22 +1870,22 @@ restart: void arc_flush(spa_t *spa) { - while (list_head(&arc_mru->arcs_list[ARC_BUFC_DATA])) { + while (arc_mru->arcs_lsize[ARC_BUFC_DATA]) { (void) arc_evict(arc_mru, spa, -1, FALSE, ARC_BUFC_DATA); if (spa) break; } - while (list_head(&arc_mru->arcs_list[ARC_BUFC_METADATA])) { + while (arc_mru->arcs_lsize[ARC_BUFC_METADATA]) { (void) arc_evict(arc_mru, spa, -1, FALSE, ARC_BUFC_METADATA); if (spa) break; } - while (list_head(&arc_mfu->arcs_list[ARC_BUFC_DATA])) { + while (arc_mfu->arcs_lsize[ARC_BUFC_DATA]) { (void) arc_evict(arc_mfu, spa, -1, FALSE, ARC_BUFC_DATA); if (spa) break; } - while (list_head(&arc_mfu->arcs_list[ARC_BUFC_METADATA])) { + while (arc_mfu->arcs_lsize[ARC_BUFC_METADATA]) { (void) arc_evict(arc_mfu, spa, -1, FALSE, ARC_BUFC_METADATA); if (spa) break; @@ -2830,7 +2942,9 @@ arc_buf_evict(arc_buf_t *buf) arc_buf_hdr_t *hdr; kmutex_t *hash_lock; arc_buf_t **bufp; - + list_t *list, *evicted_list; + kmutex_t *lock, *evicted_lock; + rw_enter(&buf->b_lock, RW_WRITER); hdr = buf->b_hdr; if (hdr == NULL) { @@ -2878,16 +2992,18 @@ arc_buf_evict(arc_buf_t *buf) evicted_state = (old_state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost; - mutex_enter(&old_state->arcs_mtx); - mutex_enter(&evicted_state->arcs_mtx); + get_buf_info(hdr, old_state, &list, &lock); + get_buf_info(hdr, evicted_state, &evicted_list, &evicted_lock); + mutex_enter(lock); + mutex_enter(evicted_lock); arc_change_state(evicted_state, hdr, hash_lock); ASSERT(HDR_IN_HASH_TABLE(hdr)); hdr->b_flags |= ARC_IN_HASH_TABLE; hdr->b_flags &= ~ARC_BUF_AVAILABLE; - mutex_exit(&evicted_state->arcs_mtx); - mutex_exit(&old_state->arcs_mtx); + mutex_exit(evicted_lock); + mutex_exit(lock); } mutex_exit(hash_lock); rw_exit(&buf->b_lock); @@ -3434,6 +3550,8 @@ arc_lowmem(void *arg __unused, int howto void arc_init(void) { + int i; + mutex_init(&arc_reclaim_thr_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&arc_reclaim_thr_cv, NULL, CV_DEFAULT, NULL); mutex_init(&arc_lowmem_lock, NULL, MUTEX_DEFAULT, NULL); @@ -3508,33 +3626,34 @@ arc_init(void) arc_l2c_only = &ARC_l2c_only; arc_size = 0; - mutex_init(&arc_anon->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_mru->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_mru_ghost->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_mfu->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_mfu_ghost->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_l2c_only->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); - - list_create(&arc_mru->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mru->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mfu->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mfu->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_l2c_only->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + for (i = 0; i < ARC_BUFC_NUMLISTS; i++) { + + mutex_init(&arc_anon->arcs_locks[i].arcs_lock, + NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_mru->arcs_locks[i].arcs_lock, + NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_mru_ghost->arcs_locks[i].arcs_lock, + NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_mfu->arcs_locks[i].arcs_lock, + NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_mfu_ghost->arcs_locks[i].arcs_lock, + NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_l2c_only->arcs_locks[i].arcs_lock, + NULL, MUTEX_DEFAULT, NULL); + + list_create(&arc_mru->arcs_lists[i], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + list_create(&arc_mru_ghost->arcs_lists[i], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + list_create(&arc_mfu->arcs_lists[i], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + list_create(&arc_mfu_ghost->arcs_lists[i], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + list_create(&arc_mfu_ghost->arcs_lists[i], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + list_create(&arc_l2c_only->arcs_lists[i], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + } buf_init(); @@ -3587,7 +3706,8 @@ arc_init(void) void arc_fini(void) { - + int i; + mutex_enter(&arc_reclaim_thr_lock); arc_thread_exit = 1; cv_signal(&arc_reclaim_thr_cv); @@ -3608,21 +3728,19 @@ arc_fini(void) mutex_destroy(&arc_reclaim_thr_lock); cv_destroy(&arc_reclaim_thr_cv); - list_destroy(&arc_mru->arcs_list[ARC_BUFC_METADATA]); - list_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]); - list_destroy(&arc_mfu->arcs_list[ARC_BUFC_METADATA]); - list_destroy(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA]); - list_destroy(&arc_mru->arcs_list[ARC_BUFC_DATA]); - list_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA]); - list_destroy(&arc_mfu->arcs_list[ARC_BUFC_DATA]); - list_destroy(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA]); - - mutex_destroy(&arc_anon->arcs_mtx); - mutex_destroy(&arc_mru->arcs_mtx); - mutex_destroy(&arc_mru_ghost->arcs_mtx); - mutex_destroy(&arc_mfu->arcs_mtx); - mutex_destroy(&arc_mfu_ghost->arcs_mtx); - + for (i = 0; i < ARC_BUFC_NUMLISTS; i++) { + list_destroy(&arc_mru->arcs_lists[i]); + list_destroy(&arc_mru_ghost->arcs_lists[i]); + list_destroy(&arc_mfu->arcs_lists[i]); + list_destroy(&arc_mfu_ghost->arcs_lists[i]); + + mutex_destroy(&arc_anon->arcs_locks[i].arcs_lock); + mutex_destroy(&arc_mru->arcs_locks[i].arcs_lock); + mutex_destroy(&arc_mru_ghost->arcs_locks[i].arcs_lock); + mutex_destroy(&arc_mfu->arcs_locks[i].arcs_lock); + mutex_destroy(&arc_mfu_ghost->arcs_locks[i].arcs_lock); + } + mutex_destroy(&zfs_write_limit_lock); buf_fini(); @@ -4017,26 +4135,26 @@ static list_t * l2arc_list_locked(int list_num, kmutex_t **lock) { list_t *list; - - ASSERT(list_num >= 0 && list_num <= 3); - - switch (list_num) { - case 0: - list = &arc_mfu->arcs_list[ARC_BUFC_METADATA]; - *lock = &arc_mfu->arcs_mtx; - break; - case 1: - list = &arc_mru->arcs_list[ARC_BUFC_METADATA]; - *lock = &arc_mru->arcs_mtx; - break; - case 2: - list = &arc_mfu->arcs_list[ARC_BUFC_DATA]; - *lock = &arc_mfu->arcs_mtx; - break; - case 3: - list = &arc_mru->arcs_list[ARC_BUFC_DATA]; - *lock = &arc_mru->arcs_mtx; - break; + int idx; + + ASSERT(list_num >= 0 && list_num <= 2*ARC_BUFC_NUMLISTS); + + if (list_num < ARC_BUFC_NUMMETADATALISTS) { + list = &arc_mfu->arcs_lists[list_num]; + *lock = ARCS_LOCK(arc_mfu, list_num); + } else if (list_num < ARC_BUFC_NUMMETADATALISTS*2) { + idx = list_num - ARC_BUFC_NUMMETADATALISTS; + list = &arc_mru->arcs_lists[idx]; + *lock = ARCS_LOCK(arc_mru, idx); + } else if (list_num < (ARC_BUFC_NUMMETADATALISTS*2 + + ARC_BUFC_NUMDATALISTS)) { + idx = list_num - ARC_BUFC_NUMLISTS; + list = &arc_mfu->arcs_lists[idx]; + *lock = ARCS_LOCK(arc_mfu, idx); + } else { + idx = list_num - ARC_BUFC_NUMLISTS - ARC_BUFC_NUMMETADATALISTS; + list = &arc_mru->arcs_lists[idx]; + *lock = ARCS_LOCK(arc_mru, idx); } ASSERT(!(MUTEX_HELD(*lock))); @@ -4207,7 +4325,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de * Copy buffers for L2ARC writing. */ mutex_enter(&l2arc_buflist_mtx); - for (try = 0; try <= 3; try++) { + for (try = 0; try <= 2*ARC_BUFC_NUMLISTS; try++) { list = l2arc_list_locked(try, &list_lock); passed_sz = 0; From owner-svn-src-user@FreeBSD.ORG Tue Jun 16 23:29:52 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE4FB106564A; Tue, 16 Jun 2009 23:29:52 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 924798FC19; Tue, 16 Jun 2009 23:29:52 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5GNTqYd055432; Tue, 16 Jun 2009 23:29:52 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5GNTqx9055429; Tue, 16 Jun 2009 23:29:52 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906162329.n5GNTqx9055429@svn.freebsd.org> From: Kip Macy Date: Tue, 16 Jun 2009 23:29:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194314 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2009 23:29:53 -0000 Author: kmacy Date: Tue Jun 16 23:29:52 2009 New Revision: 194314 URL: http://svn.freebsd.org/changeset/base/194314 Log: switch to read-only acquisition at moderately contended points Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Jun 16 23:02:46 2009 (r194313) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Jun 16 23:29:52 2009 (r194314) @@ -116,12 +116,12 @@ dbuf_find(dnode_t *dn, uint8_t level, ui mutex_enter(DBUF_HASH_MUTEX(h, idx)); for (db = h->hash_table[idx]; db != NULL; db = db->db_hash_next) { if (DBUF_EQUAL(db, os, obj, level, blkid)) { - mutex_enter(&db->db_mtx); + rw_enter(&db->db_mtx, RW_READER); if (db->db_state != DB_EVICTING) { mutex_exit(DBUF_HASH_MUTEX(h, idx)); return (db); } - mutex_exit(&db->db_mtx); + rw_exit(&db->db_mtx); } } mutex_exit(DBUF_HASH_MUTEX(h, idx)); Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Jun 16 23:02:46 2009 (r194313) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Jun 16 23:29:52 2009 (r194314) @@ -621,16 +621,16 @@ dnode_hold_impl(objset_impl_t *os, uint6 } } - mutex_enter(&dn->dn_mtx); + rw_enter(&dn->dn_mtx, RW_READER); type = dn->dn_type; if (dn->dn_free_txg || ((flag & DNODE_MUST_BE_ALLOCATED) && type == DMU_OT_NONE) || ((flag & DNODE_MUST_BE_FREE) && type != DMU_OT_NONE)) { - mutex_exit(&dn->dn_mtx); + rw_exit(&dn->dn_mtx); dbuf_rele(db, FTAG); return (type == DMU_OT_NONE ? ENOENT : EEXIST); } - mutex_exit(&dn->dn_mtx); + rw_exit(&dn->dn_mtx); if (refcount_add(&dn->dn_holds, tag) == 1) dbuf_add_ref(db, dn); From owner-svn-src-user@FreeBSD.ORG Tue Jun 16 23:57:51 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2680106566B; Tue, 16 Jun 2009 23:57:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D070A8FC13; Tue, 16 Jun 2009 23:57:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5GNvpKw056336; Tue, 16 Jun 2009 23:57:51 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5GNvpPm056334; Tue, 16 Jun 2009 23:57:51 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906162357.n5GNvpPm056334@svn.freebsd.org> From: Kip Macy Date: Tue, 16 Jun 2009 23:57:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194315 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2009 23:57:52 -0000 Author: kmacy Date: Tue Jun 16 23:57:51 2009 New Revision: 194315 URL: http://svn.freebsd.org/changeset/base/194315 Log: revert change - lock may already be held Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Jun 16 23:29:52 2009 (r194314) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Jun 16 23:57:51 2009 (r194315) @@ -621,16 +621,16 @@ dnode_hold_impl(objset_impl_t *os, uint6 } } - rw_enter(&dn->dn_mtx, RW_READER); + mutex_enter(&dn->dn_mtx); type = dn->dn_type; if (dn->dn_free_txg || ((flag & DNODE_MUST_BE_ALLOCATED) && type == DMU_OT_NONE) || ((flag & DNODE_MUST_BE_FREE) && type != DMU_OT_NONE)) { - rw_exit(&dn->dn_mtx); + mutex_exit(&dn->dn_mtx); dbuf_rele(db, FTAG); return (type == DMU_OT_NONE ? ENOENT : EEXIST); } - rw_exit(&dn->dn_mtx); + mutex_exit(&dn->dn_mtx); if (refcount_add(&dn->dn_holds, tag) == 1) dbuf_add_ref(db, dn); From owner-svn-src-user@FreeBSD.ORG Wed Jun 17 00:35:21 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E217F106564A; Wed, 17 Jun 2009 00:35:21 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B56108FC14; Wed, 17 Jun 2009 00:35:21 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5H0ZLL8057142; Wed, 17 Jun 2009 00:35:21 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5H0ZLmF057139; Wed, 17 Jun 2009 00:35:21 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906170035.n5H0ZLmF057139@svn.freebsd.org> From: Kip Macy Date: Wed, 17 Jun 2009 00:35:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194316 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 00:35:22 -0000 Author: kmacy Date: Wed Jun 17 00:35:21 2009 New Revision: 194316 URL: http://svn.freebsd.org/changeset/base/194316 Log: dbuf acquisition can be nested Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Jun 16 23:57:51 2009 (r194315) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jun 17 00:35:21 2009 (r194316) @@ -116,12 +116,12 @@ dbuf_find(dnode_t *dn, uint8_t level, ui mutex_enter(DBUF_HASH_MUTEX(h, idx)); for (db = h->hash_table[idx]; db != NULL; db = db->db_hash_next) { if (DBUF_EQUAL(db, os, obj, level, blkid)) { - rw_enter(&db->db_mtx, RW_READER); + mutex_enter(&db->db_mtx); if (db->db_state != DB_EVICTING) { mutex_exit(DBUF_HASH_MUTEX(h, idx)); return (db); } - rw_exit(&db->db_mtx); + mutex_exit(&db->db_mtx); } } mutex_exit(DBUF_HASH_MUTEX(h, idx)); Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Jun 16 23:57:51 2009 (r194315) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Wed Jun 17 00:35:21 2009 (r194316) @@ -621,16 +621,16 @@ dnode_hold_impl(objset_impl_t *os, uint6 } } - mutex_enter(&dn->dn_mtx); + rw_enter(&dn->dn_mtx, RW_READER); type = dn->dn_type; if (dn->dn_free_txg || ((flag & DNODE_MUST_BE_ALLOCATED) && type == DMU_OT_NONE) || ((flag & DNODE_MUST_BE_FREE) && type != DMU_OT_NONE)) { - mutex_exit(&dn->dn_mtx); + rw_exit(&dn->dn_mtx); dbuf_rele(db, FTAG); return (type == DMU_OT_NONE ? ENOENT : EEXIST); } - mutex_exit(&dn->dn_mtx); + rw_exit(&dn->dn_mtx); if (refcount_add(&dn->dn_holds, tag) == 1) dbuf_add_ref(db, dn); From owner-svn-src-user@FreeBSD.ORG Wed Jun 17 03:29:00 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1C261065675; Wed, 17 Jun 2009 03:29:00 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFC788FC14; Wed, 17 Jun 2009 03:29:00 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5H3T0J0061345; Wed, 17 Jun 2009 03:29:00 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5H3T0MZ061342; Wed, 17 Jun 2009 03:29:00 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906170329.n5H3T0MZ061342@svn.freebsd.org> From: Kip Macy Date: Wed, 17 Jun 2009 03:29:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194328 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 03:29:01 -0000 Author: kmacy Date: Wed Jun 17 03:29:00 2009 New Revision: 194328 URL: http://svn.freebsd.org/changeset/base/194328 Log: increase the size of mutex arrays Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jun 17 03:15:23 2009 (r194327) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jun 17 03:29:00 2009 (r194328) @@ -230,8 +230,8 @@ struct arcs_lock { * must be power of two for mask use to work * */ -#define ARC_BUFC_NUMDATALISTS 16 -#define ARC_BUFC_NUMMETADATALISTS 16 +#define ARC_BUFC_NUMDATALISTS 256 +#define ARC_BUFC_NUMMETADATALISTS 256 #define ARC_BUFC_NUMLISTS (ARC_BUFC_NUMMETADATALISTS+ARC_BUFC_NUMDATALISTS) typedef struct arc_state { @@ -541,7 +541,7 @@ struct ht_lock { #endif }; -#define BUF_LOCKS 256 +#define BUF_LOCKS 512 typedef struct buf_hash_table { uint64_t ht_mask; arc_buf_hdr_t **ht_table; From owner-svn-src-user@FreeBSD.ORG Wed Jun 17 07:03:03 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F093C106568B; Wed, 17 Jun 2009 07:03:03 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF47F8FC13; Wed, 17 Jun 2009 07:03:03 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5H733mk065537; Wed, 17 Jun 2009 07:03:03 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5H733VI065534; Wed, 17 Jun 2009 07:03:03 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200906170703.n5H733VI065534@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 17 Jun 2009 07:03:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194335 - user/des/fmerge X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 07:03:04 -0000 Author: des Date: Wed Jun 17 07:03:03 2009 New Revision: 194335 URL: http://svn.freebsd.org/changeset/base/194335 Log: Reimplement in Perl, with a nicer syntax. Added: user/des/fmerge/fmerge.pl (contents, props changed) Deleted: user/des/fmerge/fmerge.sh Modified: user/des/fmerge/Makefile Modified: user/des/fmerge/Makefile ============================================================================== --- user/des/fmerge/Makefile Wed Jun 17 06:47:05 2009 (r194334) +++ user/des/fmerge/Makefile Wed Jun 17 07:03:03 2009 (r194335) @@ -1,6 +1,6 @@ # $FreeBSD$ -SCRIPTS = fmerge +SCRIPTS = fmerge.pl .include "${.CURDIR}/../Makefile.inc" .include Added: user/des/fmerge/fmerge.pl ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fmerge/fmerge.pl Wed Jun 17 07:03:03 2009 (r194335) @@ -0,0 +1,167 @@ +#!/usr/bin/perl -w +#- +# Copyright (c) 2009 Dag-Erling Coïdan Smørgrav +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer +# in this position and unchanged. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +use strict; +use warnings; + +our $already; + +our $branch = "head"; +our $target = "."; +our @revs; + +our $svn_path; +our $svn_url; +our $svn_root; +our $svn_branch; + +sub svn_check($;$) { + my ($cond, $msg) = @_; + + die(($msg || "something is rotten in the state of subversion") . "\n") + unless $cond; +} + +sub svn_do(@) { + my @argv = @_; + + print(join(' ', "svn", @argv), "\n"); + system("svn", @argv); +} + +sub svn_info() { + local *PIPE; + + open(PIPE, "-|", "svn", "info", $target) + or die("fmerge: could not run svn\n"); + while () { + chomp(); + my ($key, $value) = split(/:\s+/, $_, 2); + next unless $key && $value; + if ($key eq "Path") { + svn_check($value eq $target); + } elsif ($key eq "URL") { + $svn_url = $value; + } elsif ($key eq "Repository Root") { + $svn_root = $value; + } + } + close(PIPE); + + svn_check($svn_url =~ m@^\Q$svn_root\E(/.*)$@); + $svn_path = $1; + svn_check($svn_path =~ s@^/(\w+/\d+(?:\.\d+)*)/?@@); + $svn_branch = $1; +} + +sub fmerge() { + foreach my $rev (@revs) { + my ($m, $n) = @{$rev}; + my @argv = ("merge"); + if ($already) { + push(@argv, "--record-only"); + } + push(@argv, + "-r$m:$n", + "$svn_root/$branch/$svn_path", + $target); + svn_do(@argv); + } +} + +sub usage() { + + print(STDERR "usage: fmerge REVISIONS [from BRANCH] [into DIR]\n"); + exit 1; +} + +MAIN:{ + if (@ARGV < 1) { + usage(); + } + if ($ARGV[0] eq "already") { + $already = 1; + shift; + } + if ($ARGV[0] eq "all") { + shift; + } else { + while (@ARGV && $ARGV[0] =~ m/^r?\d+(,r?\d+)*$/) { + foreach my $rev (split(',', $ARGV[0])) { + if ($rev =~ m/^[cr]?(\d+)$/) { + push(@revs, [ $1 - 1, $1 ]); + } elsif ($rev =~ m/^[cr]?-(\d+)$/) { + push(@revs, [ $1, $1 - 1 ]); + } elsif ($rev =~ m/^r?(\d+)[-:](\d+)$/) { + push(@revs, [ $1, $2 ]); + } else { + usage(); + } + } + shift; + } + } + + if (@ARGV > 0) { + if (@ARGV < 2) { + usage(); + } + if ($ARGV[0] ne "from") { + usage(); + } + shift; + $branch = $ARGV[0]; + shift; + } + + if (@ARGV > 0) { + if (@ARGV < 2) { + usage(); + } + if ($ARGV[0] ne "into") { + usage(); + } + shift; + $target = $ARGV[0]; + shift; + if (!-d $target) { + usage(); + } + } + + if (@ARGV > 0) { + usage(); + } + + svn_info(); + fmerge(); +} + +1; From owner-svn-src-user@FreeBSD.ORG Wed Jun 17 10:57:48 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 030BA106564A; Wed, 17 Jun 2009 10:57:48 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5C828FC14; Wed, 17 Jun 2009 10:57:47 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5HAvlxV072916; Wed, 17 Jun 2009 10:57:47 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5HAvlW6072914; Wed, 17 Jun 2009 10:57:47 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200906171057.n5HAvlW6072914@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 17 Jun 2009 10:57:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194345 - user/des/fmerge X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 10:57:48 -0000 Author: des Date: Wed Jun 17 10:57:47 2009 New Revision: 194345 URL: http://svn.freebsd.org/changeset/base/194345 Log: Add "pretend" and "debug" options, and try to guess the branch by looking at existing mergeinfo; if there isn't any, fall back to the previous behavior of assuming it's a stable / releng / release branch. Modified: user/des/fmerge/fmerge.pl Modified: user/des/fmerge/fmerge.pl ============================================================================== --- user/des/fmerge/fmerge.pl Wed Jun 17 10:48:32 2009 (r194344) +++ user/des/fmerge/fmerge.pl Wed Jun 17 10:57:47 2009 (r194345) @@ -32,6 +32,8 @@ use strict; use warnings; our $already; +our $debug; +our $pretend; our $branch = "head"; our $target = "."; @@ -42,30 +44,51 @@ our $svn_url; our $svn_root; our $svn_branch; +sub info(@) { + print(STDOUT join(' ', @_), "\n"); +} + +sub debug(@) { + info(@_) + if $debug; +} + sub svn_check($;$) { my ($cond, $msg) = @_; - die(($msg || "something is rotten in the state of subversion") . "\n") unless $cond; } sub svn_do(@) { my @argv = @_; + info("svn", @argv); + system("svn", @argv) + unless $pretend; +} - print(join(' ', "svn", @argv), "\n"); - system("svn", @argv); +sub svn_merge(@) { + unshift(@_, "--record-only") + if $already; + unshift(@_, "merge"); + goto &svn_do; } -sub svn_info() { - local *PIPE; +sub svn_catch(@) { + my (@argv) = @_; - open(PIPE, "-|", "svn", "info", $target) + open(my $fh, "-|", "svn", @argv) or die("fmerge: could not run svn\n"); - while () { + return $fh; +} + +sub examine() { + my $fh = svn_catch("info", $target); + while (<$fh>) { chomp(); my ($key, $value) = split(/:\s+/, $_, 2); next unless $key && $value; if ($key eq "Path") { + debug("'$value' eq '$target'?"); svn_check($value eq $target); } elsif ($key eq "URL") { $svn_url = $value; @@ -73,26 +96,42 @@ sub svn_info() { $svn_root = $value; } } - close(PIPE); + close($fh); svn_check($svn_url =~ m@^\Q$svn_root\E(/.*)$@); $svn_path = $1; - svn_check($svn_path =~ s@^/(\w+/\d+(?:\.\d+)*)/?@@); - $svn_branch = $1; + + $fh = svn_catch("propget", "svn:mergeinfo", $target); + while (<$fh>) { + chomp(); + debug("'$_' =~ m\@\Q/$branch\E((?:/[\\w.-]+)*):\@"); + next unless m@\Q/$branch\E((?:/[\w.-]+)*):@; + my $subdir = $1; + debug("'$svn_path' =~ m\@^((?:/[\\w.-]+)+)\Q$subdir\E\$\@"); + next unless $svn_path =~ m@^((?:/[\w.-]+)+)\Q$subdir\E$@; + $svn_path = $subdir; + $svn_branch = $1; + last; + } + close($fh); + if (!$svn_branch) { + # try to guess a stable / releng / release branch + debug("'$svn_path' =~ s\@^/([\\w+.-]/\\d+(?:\\.\\d+)*)/?\@\@"); + $svn_path =~ s@^/(\w+/\d+(?:\.\d+)*)/?@@; + $svn_branch = $1; + } + svn_check($svn_branch); + debug("svn_branch = '$svn_branch'"); + debug("svn_path = '$svn_path'"); } sub fmerge() { + if (!@revs) { + svn_merge("$svn_root/$branch/$svn_path", $target); + } foreach my $rev (@revs) { my ($m, $n) = @{$rev}; - my @argv = ("merge"); - if ($already) { - push(@argv, "--record-only"); - } - push(@argv, - "-r$m:$n", - "$svn_root/$branch/$svn_path", - $target); - svn_do(@argv); + svn_merge("-r$m:$n", "$svn_root/$branch/$svn_path", $target); } } @@ -103,14 +142,22 @@ sub usage() { } MAIN:{ + while (@ARGV) { + if ($ARGV[0] eq 'already') { + $already++; + } elsif ($ARGV[0] eq 'debug') { + $debug++; + } elsif ($ARGV[0] eq 'pretend') { + $pretend++; + } else { + last; + } + shift; + } if (@ARGV < 1) { usage(); } - if ($ARGV[0] eq "already") { - $already = 1; - shift; - } - if ($ARGV[0] eq "all") { + if ($ARGV[0] eq 'all') { shift; } else { while (@ARGV && $ARGV[0] =~ m/^r?\d+(,r?\d+)*$/) { @@ -133,7 +180,7 @@ MAIN:{ if (@ARGV < 2) { usage(); } - if ($ARGV[0] ne "from") { + if ($ARGV[0] ne 'from') { usage(); } shift; @@ -145,7 +192,7 @@ MAIN:{ if (@ARGV < 2) { usage(); } - if ($ARGV[0] ne "into") { + if ($ARGV[0] ne 'into') { usage(); } shift; @@ -160,7 +207,7 @@ MAIN:{ usage(); } - svn_info(); + examine(); fmerge(); } From owner-svn-src-user@FreeBSD.ORG Wed Jun 17 11:12:49 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 239EB106564A; Wed, 17 Jun 2009 11:12:49 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 127F98FC15; Wed, 17 Jun 2009 11:12:49 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5HBClYs073310; Wed, 17 Jun 2009 11:12:47 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5HBClIF073308; Wed, 17 Jun 2009 11:12:47 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200906171112.n5HBClIF073308@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 17 Jun 2009 11:12:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194346 - user/des/fmerge X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 11:12:49 -0000 Author: des Date: Wed Jun 17 11:12:47 2009 New Revision: 194346 URL: http://svn.freebsd.org/changeset/base/194346 Log: cleanup Modified: user/des/fmerge/fmerge.pl Modified: user/des/fmerge/fmerge.pl ============================================================================== --- user/des/fmerge/fmerge.pl Wed Jun 17 10:57:47 2009 (r194345) +++ user/des/fmerge/fmerge.pl Wed Jun 17 11:12:47 2009 (r194346) @@ -55,28 +55,29 @@ sub debug(@) { sub svn_check($;$) { my ($cond, $msg) = @_; - die(($msg || "something is rotten in the state of subversion") . "\n") + die(($msg || 'something is rotten in the state of subversion') . "\n") unless $cond; } sub svn_do(@) { my @argv = @_; - info("svn", @argv); - system("svn", @argv) + info('svn', @argv); + system('svn', @argv) unless $pretend; } sub svn_merge(@) { - unshift(@_, "--record-only") + unshift(@_, '--record-only') if $already; - unshift(@_, "merge"); + unshift(@_, 'merge'); goto &svn_do; } sub svn_catch(@) { my (@argv) = @_; - open(my $fh, "-|", "svn", @argv) + debug('svn', @argv); + open(my $fh, '-|', 'svn', @argv) or die("fmerge: could not run svn\n"); return $fh; } @@ -87,12 +88,12 @@ sub examine() { chomp(); my ($key, $value) = split(/:\s+/, $_, 2); next unless $key && $value; - if ($key eq "Path") { + if ($key eq 'Path') { debug("'$value' eq '$target'?"); svn_check($value eq $target); - } elsif ($key eq "URL") { + } elsif ($key eq 'URL') { $svn_url = $value; - } elsif ($key eq "Repository Root") { + } elsif ($key eq 'Repository Root') { $svn_root = $value; } } @@ -101,7 +102,7 @@ sub examine() { svn_check($svn_url =~ m@^\Q$svn_root\E(/.*)$@); $svn_path = $1; - $fh = svn_catch("propget", "svn:mergeinfo", $target); + $fh = svn_catch('propget', 'svn:mergeinfo', $target); while (<$fh>) { chomp(); debug("'$_' =~ m\@\Q/$branch\E((?:/[\\w.-]+)*):\@"); From owner-svn-src-user@FreeBSD.ORG Wed Jun 17 11:38:16 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A885E1065672; Wed, 17 Jun 2009 11:38:16 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9705E8FC1C; Wed, 17 Jun 2009 11:38:16 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5HBcGwI074180; Wed, 17 Jun 2009 11:38:16 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5HBcGcJ074178; Wed, 17 Jun 2009 11:38:16 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200906171138.n5HBcGcJ074178@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 17 Jun 2009 11:38:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194349 - user/des/fmerge X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 11:38:17 -0000 Author: des Date: Wed Jun 17 11:38:16 2009 New Revision: 194349 URL: http://svn.freebsd.org/changeset/base/194349 Log: Fix parsing of from / into. Modified: user/des/fmerge/fmerge.pl Modified: user/des/fmerge/fmerge.pl ============================================================================== --- user/des/fmerge/fmerge.pl Wed Jun 17 11:34:13 2009 (r194348) +++ user/des/fmerge/fmerge.pl Wed Jun 17 11:38:16 2009 (r194349) @@ -145,15 +145,17 @@ sub usage() { MAIN:{ while (@ARGV) { if ($ARGV[0] eq 'already') { + shift; $already++; } elsif ($ARGV[0] eq 'debug') { + shift; $debug++; } elsif ($ARGV[0] eq 'pretend') { + shift; $pretend++; } else { last; } - shift; } if (@ARGV < 1) { usage(); @@ -177,37 +179,29 @@ MAIN:{ } } - if (@ARGV > 0) { - if (@ARGV < 2) { - usage(); - } - if ($ARGV[0] ne 'from') { - usage(); - } - shift; - $branch = $ARGV[0]; - shift; - } - - if (@ARGV > 0) { - if (@ARGV < 2) { - usage(); - } - if ($ARGV[0] ne 'into') { - usage(); - } - shift; - $target = $ARGV[0]; - shift; - if (!-d $target) { + while (@ARGV) { + if ($ARGV[0] eq 'from') { + shift; + if (@ARGV < 1) { + usage(); + } + $branch = $ARGV[0]; + shift; + } elsif ($ARGV[0] eq 'into') { + shift; + if (@ARGV < 1) { + usage(); + } + $target = $ARGV[0]; + shift; + if (!-d $target) { + usage(); + } + } else { usage(); } } - if (@ARGV > 0) { - usage(); - } - examine(); fmerge(); } From owner-svn-src-user@FreeBSD.ORG Wed Jun 17 20:29:56 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6DD01065677; Wed, 17 Jun 2009 20:29:56 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4A078FC23; Wed, 17 Jun 2009 20:29:56 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5HKTuED087271; Wed, 17 Jun 2009 20:29:56 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5HKTuC5087269; Wed, 17 Jun 2009 20:29:56 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906172029.n5HKTuC5087269@svn.freebsd.org> From: Kip Macy Date: Wed, 17 Jun 2009 20:29:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194396 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 20:29:57 -0000 Author: kmacy Date: Wed Jun 17 20:29:56 2009 New Revision: 194396 URL: http://svn.freebsd.org/changeset/base/194396 Log: don't block on pre-fetch Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Wed Jun 17 20:28:07 2009 (r194395) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Wed Jun 17 20:29:56 2009 (r194396) @@ -305,7 +305,10 @@ dmu_zfetch_find(zfetch_t *zf, zstream_t * modified in a number of different ways. */ - rw_enter(&zf->zf_rwlock, RW_READER); + if (rw_tryenter(&zf->zf_rwlock, RW_READER) == 0) { + rc = 1; + goto out; + } top: for (zs = list_head(&zf->zf_stream); zs; From owner-svn-src-user@FreeBSD.ORG Wed Jun 17 21:03:27 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D171A1065700; Wed, 17 Jun 2009 21:03:27 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BEA298FC17; Wed, 17 Jun 2009 21:03:27 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5HL3Rl1088185; Wed, 17 Jun 2009 21:03:27 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5HL3RBJ088182; Wed, 17 Jun 2009 21:03:27 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906172103.n5HL3RBJ088182@svn.freebsd.org> From: Kip Macy Date: Wed, 17 Jun 2009 21:03:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194399 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 21:03:28 -0000 Author: kmacy Date: Wed Jun 17 21:03:27 2009 New Revision: 194399 URL: http://svn.freebsd.org/changeset/base/194399 Log: don't unlock if we don't have the lock Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Wed Jun 17 20:56:03 2009 (r194398) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Wed Jun 17 21:03:27 2009 (r194399) @@ -305,10 +305,9 @@ dmu_zfetch_find(zfetch_t *zf, zstream_t * modified in a number of different ways. */ - if (rw_tryenter(&zf->zf_rwlock, RW_READER) == 0) { - rc = 1; - goto out; - } + if (rw_tryenter(&zf->zf_rwlock, RW_READER) == 0) + return (1); + top: for (zs = list_head(&zf->zf_stream); zs; From owner-svn-src-user@FreeBSD.ORG Wed Jun 17 21:48:20 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22E5B106566B; Wed, 17 Jun 2009 21:48:20 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB9CA8FC14; Wed, 17 Jun 2009 21:48:19 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5HLmJpj089292; Wed, 17 Jun 2009 21:48:19 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5HLmJmZ089291; Wed, 17 Jun 2009 21:48:19 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200906172148.n5HLmJmZ089291@svn.freebsd.org> From: "George V. Neville-Neil" Date: Wed, 17 Jun 2009 21:48:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194403 - in user/gnn: . fasttrap X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 21:48:20 -0000 Author: gnn Date: Wed Jun 17 21:48:19 2009 New Revision: 194403 URL: http://svn.freebsd.org/changeset/base/194403 Log: Create a work area for importing and porting the fasttrap provider from DTrace. Added: user/gnn/ user/gnn/fasttrap/ (props changed) - copied from r194402, head/ From owner-svn-src-user@FreeBSD.ORG Thu Jun 18 04:42:48 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01C4D106566B; Thu, 18 Jun 2009 04:42:48 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4C458FC14; Thu, 18 Jun 2009 04:42:47 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5I4glbQ097799; Thu, 18 Jun 2009 04:42:47 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5I4glV9097797; Thu, 18 Jun 2009 04:42:47 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906180442.n5I4glV9097797@svn.freebsd.org> From: Kip Macy Date: Thu, 18 Jun 2009 04:42:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194413 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2009 04:42:48 -0000 Author: kmacy Date: Thu Jun 18 04:42:47 2009 New Revision: 194413 URL: http://svn.freebsd.org/changeset/base/194413 Log: validate link before trying to send packets Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 18 02:51:43 2009 (r194412) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 18 04:42:47 2009 (r194413) @@ -1645,7 +1645,10 @@ cxgb_start_locked(struct sge_qset *qs) if (qs->qs_flags & (QS_FLUSHING|QS_TIMEOUT)) reclaim_completed_tx(qs, 0, TXQ_ETH); - + + if (!pi->link_config.link_ok) + return; + TXQ_LOCK_ASSERT(qs); while ((txq->in_use - in_use_init < txmax) && !TXQ_RING_EMPTY(qs) && @@ -1674,7 +1677,8 @@ cxgb_start_locked(struct sge_qset *qs) m_head = NULL; } - if (!TXQ_RING_EMPTY(qs) && callout_pending(&txq->txq_timer) == 0) + if (!TXQ_RING_EMPTY(qs) && callout_pending(&txq->txq_timer) == 0 && + pi->link_config.link_ok) callout_reset_on(&txq->txq_timer, 1, cxgb_tx_timeout, qs, txq->txq_timer.c_cpu); if (m_head != NULL) @@ -1745,7 +1749,8 @@ cxgb_transmit(struct ifnet *ifp, struct struct port_info *pi = ifp->if_softc; int error, qidx = pi->first_qset; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 + ||(!pi->link_config.link_ok)) { m_freem(m); return (0); } From owner-svn-src-user@FreeBSD.ORG Thu Jun 18 19:41:04 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D65A1065672; Thu, 18 Jun 2009 19:41:04 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 881AB8FC16; Thu, 18 Jun 2009 19:41:04 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5IJf4MU020840; Thu, 18 Jun 2009 19:41:04 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5IJf4EM020820; Thu, 18 Jun 2009 19:41:04 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200906181941.n5IJf4EM020820@svn.freebsd.org> From: "George V. Neville-Neil" Date: Thu, 18 Jun 2009 19:41:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194455 - in user/gnn/fasttrap: . bin/sh cddl/contrib/opensolaris include/rpc lib/libc/rpc lib/libusb sys/cddl/contrib/opensolaris sys/dev/if_ndis sys/dev/xen/netfront sys/dev/xen/xenpc... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2009 19:41:05 -0000 Author: gnn Date: Thu Jun 18 19:41:04 2009 New Revision: 194455 URL: http://svn.freebsd.org/changeset/base/194455 Log: IFC sync with the head of the tree Modified: user/gnn/fasttrap/ (props changed) user/gnn/fasttrap/bin/sh/input.c user/gnn/fasttrap/cddl/contrib/opensolaris/ (props changed) user/gnn/fasttrap/include/rpc/svc_dg.h user/gnn/fasttrap/lib/libc/rpc/svc_dg.c user/gnn/fasttrap/lib/libc/rpc/svc_generic.c user/gnn/fasttrap/lib/libusb/ (props changed) user/gnn/fasttrap/sys/cddl/contrib/opensolaris/ (props changed) user/gnn/fasttrap/sys/dev/if_ndis/if_ndis.c user/gnn/fasttrap/sys/dev/xen/netfront/ (props changed) user/gnn/fasttrap/sys/dev/xen/xenpci/ (props changed) user/gnn/fasttrap/sys/fs/nfsclient/nfs_clbio.c user/gnn/fasttrap/sys/fs/nfsclient/nfs_clkrpc.c user/gnn/fasttrap/sys/fs/nfsserver/nfs_nfsdkrpc.c user/gnn/fasttrap/sys/geom/label/g_label_gpt.c user/gnn/fasttrap/sys/modules/dtrace/dtnfsclient/ (props changed) user/gnn/fasttrap/sys/modules/ip6_mroute_mod/ (props changed) user/gnn/fasttrap/sys/modules/ipmi/ipmi_linux/ (props changed) user/gnn/fasttrap/sys/netinet/ipfw/ip_dummynet.c (props changed) user/gnn/fasttrap/sys/netinet/ipfw/ip_fw2.c (props changed) user/gnn/fasttrap/sys/netinet/ipfw/ip_fw_pfil.c (props changed) user/gnn/fasttrap/sys/nfsclient/nfs_bio.c user/gnn/fasttrap/sys/nfsserver/nfs_srvkrpc.c user/gnn/fasttrap/sys/nlm/nlm_prot_impl.c user/gnn/fasttrap/sys/rpc/svc.c user/gnn/fasttrap/sys/rpc/svc_generic.c user/gnn/fasttrap/sys/rpc/svc_vc.c user/gnn/fasttrap/sys/vm/uma_core.c user/gnn/fasttrap/tools/regression/lib/msun/test-conj.t (props changed) user/gnn/fasttrap/tools/tools/ath/common/dumpregs.h (props changed) user/gnn/fasttrap/tools/tools/ath/common/dumpregs_5210.c (props changed) user/gnn/fasttrap/tools/tools/ath/common/dumpregs_5211.c (props changed) user/gnn/fasttrap/tools/tools/ath/common/dumpregs_5212.c (props changed) user/gnn/fasttrap/tools/tools/ath/common/dumpregs_5416.c (props changed) user/gnn/fasttrap/tools/tools/nanobsd/nanobsd.sh user/gnn/fasttrap/usr.bin/ncal/ncal.c user/gnn/fasttrap/usr.sbin/makefs/ffs/ffs_bswap.c (props changed) user/gnn/fasttrap/usr.sbin/makefs/ffs/ffs_subr.c (props changed) user/gnn/fasttrap/usr.sbin/makefs/ffs/ufs_bswap.h (props changed) user/gnn/fasttrap/usr.sbin/makefs/getid.c (props changed) user/gnn/fasttrap/usr.sbin/mountd/mountd.c Modified: user/gnn/fasttrap/bin/sh/input.c ============================================================================== --- user/gnn/fasttrap/bin/sh/input.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/bin/sh/input.c Thu Jun 18 19:41:04 2009 (r194455) @@ -118,9 +118,9 @@ INIT { } RESET { + popallfiles(); if (exception != EXSHELLPROC) parselleft = parsenleft = 0; /* clear input buffer */ - popallfiles(); } SHELLPROC { Modified: user/gnn/fasttrap/include/rpc/svc_dg.h ============================================================================== --- user/gnn/fasttrap/include/rpc/svc_dg.h Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/include/rpc/svc_dg.h Thu Jun 18 19:41:04 2009 (r194455) @@ -46,6 +46,7 @@ struct svc_dg_data { XDR su_xdrs; /* XDR handle */ char su_verfbody[MAX_AUTH_BYTES]; /* verifier body */ void *su_cache; /* cached data, NULL if none */ + struct netbuf su_srcaddr; /* dst address of last msg */ }; #define __rpcb_get_dg_xidp(x) (&((struct svc_dg_data *)(x)->xp_p2)->su_xid) Modified: user/gnn/fasttrap/lib/libc/rpc/svc_dg.c ============================================================================== --- user/gnn/fasttrap/lib/libc/rpc/svc_dg.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/lib/libc/rpc/svc_dg.c Thu Jun 18 19:41:04 2009 (r194455) @@ -97,8 +97,9 @@ int svc_dg_enablecache(SVCXPRT *, u_int) */ static const char svc_dg_str[] = "svc_dg_create: %s"; static const char svc_dg_err1[] = "could not get transport information"; -static const char svc_dg_err2[] = " transport does not support data transfer"; +static const char svc_dg_err2[] = "transport does not support data transfer"; static const char svc_dg_err3[] = "getsockname failed"; +static const char svc_dg_err4[] = "cannot set IP_RECVDSTADDR"; static const char __no_mem_str[] = "out of memory"; SVCXPRT * @@ -156,6 +157,23 @@ svc_dg_create(fd, sendsize, recvsize) xprt->xp_ltaddr.len = slen; memcpy(xprt->xp_ltaddr.buf, &ss, slen); + if (ss.ss_family == AF_INET) { + struct sockaddr_in *sin; + static const int true_value = 1; + + sin = (struct sockaddr_in *)(void *)&ss; + if (sin->sin_addr.s_addr == INADDR_ANY) { + su->su_srcaddr.buf = mem_alloc(sizeof (ss)); + su->su_srcaddr.maxlen = sizeof (ss); + + if (_setsockopt(fd, IPPROTO_IP, IP_RECVDSTADDR, + &true_value, sizeof(true_value))) { + warnx(svc_dg_str, svc_dg_err4); + goto freedata_nowarn; + } + } + } + xprt_register(xprt); return (xprt); freedata: @@ -197,13 +215,15 @@ svc_dg_recvfrom(int fd, char *buf, int b msg.msg_iovlen = 1; msg.msg_namelen = *raddrlen; msg.msg_name = (char *)raddr; - msg.msg_control = (caddr_t)tmp; - msg.msg_controllen = CMSG_LEN(sizeof(*lin)); + if (laddr != NULL) { + msg.msg_control = (caddr_t)tmp; + msg.msg_controllen = CMSG_LEN(sizeof(*lin)); + } rlen = _recvmsg(fd, &msg, 0); if (rlen >= 0) *raddrlen = msg.msg_namelen; - if (rlen == -1 || !laddr || + if (rlen == -1 || laddr == NULL || msg.msg_controllen < sizeof(struct cmsghdr) || msg.msg_flags & MSG_CTRUNC) return rlen; @@ -214,18 +234,19 @@ svc_dg_recvfrom(int fd, char *buf, int b cmsg->cmsg_type == IP_RECVDSTADDR) { have_lin = TRUE; memcpy(&lin->sin_addr, - (struct in_addr *)CMSG_DATA(cmsg), sizeof(struct in_addr)); + (struct in_addr *)CMSG_DATA(cmsg), + sizeof(struct in_addr)); break; } } - if (!have_lin) - return rlen; - lin->sin_family = AF_INET; lin->sin_port = 0; *laddrlen = sizeof(struct sockaddr_in); + if (!have_lin) + lin->sin_addr.s_addr = INADDR_ANY; + return rlen; } @@ -246,7 +267,7 @@ again: alen = sizeof (struct sockaddr_storage); rlen = svc_dg_recvfrom(xprt->xp_fd, rpc_buffer(xprt), su->su_iosz, (struct sockaddr *)(void *)&ss, &alen, - (struct sockaddr *)xprt->xp_ltaddr.buf, &xprt->xp_ltaddr.len); + (struct sockaddr *)su->su_srcaddr.buf, &su->su_srcaddr.len); if (rlen == -1 && errno == EINTR) goto again; if (rlen == -1 || (rlen < (ssize_t)(4 * sizeof (u_int32_t)))) @@ -300,7 +321,8 @@ svc_dg_sendto(int fd, char *buf, int buf msg.msg_namelen = raddrlen; msg.msg_name = (char *)raddr; - if (laddr->sa_family == AF_INET && lin->s_addr != INADDR_ANY) { + if (laddr != NULL && laddr->sa_family == AF_INET && + lin->s_addr != INADDR_ANY) { msg.msg_control = (caddr_t)tmp; msg.msg_controllen = CMSG_LEN(sizeof(*lin)); cmsg = CMSG_FIRSTHDR(&msg); @@ -346,8 +368,8 @@ svc_dg_reply(xprt, msg) if (svc_dg_sendto(xprt->xp_fd, rpc_buffer(xprt), slen, (struct sockaddr *)xprt->xp_rtaddr.buf, (socklen_t)xprt->xp_rtaddr.len, - (struct sockaddr *)xprt->xp_ltaddr.buf, - xprt->xp_ltaddr.len) == (ssize_t) slen) { + (struct sockaddr *)su->su_srcaddr.buf, + (socklen_t)su->su_srcaddr.len) == (ssize_t) slen) { stat = TRUE; if (su->su_cache) cache_set(xprt, slen); @@ -393,6 +415,8 @@ svc_dg_destroy(xprt) (void)_close(xprt->xp_fd); XDR_DESTROY(&(su->su_xdrs)); (void) mem_free(rpc_buffer(xprt), su->su_iosz); + if (su->su_srcaddr.buf) + (void) mem_free(su->su_srcaddr.buf, su->su_srcaddr.maxlen); (void) mem_free(su, sizeof (*su)); if (xprt->xp_rtaddr.buf) (void) mem_free(xprt->xp_rtaddr.buf, xprt->xp_rtaddr.maxlen); Modified: user/gnn/fasttrap/lib/libc/rpc/svc_generic.c ============================================================================== --- user/gnn/fasttrap/lib/libc/rpc/svc_generic.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/lib/libc/rpc/svc_generic.c Thu Jun 18 19:41:04 2009 (r194455) @@ -199,7 +199,6 @@ svc_tli_create(fd, nconf, bindaddr, send struct __rpc_sockinfo si; struct sockaddr_storage ss; socklen_t slen; - static const int true_value = 1; if (fd == RPC_ANYFD) { if (nconf == NULL) { @@ -226,14 +225,6 @@ svc_tli_create(fd, nconf, bindaddr, send } } - if (si.si_af == AF_INET && si.si_socktype == SOCK_DGRAM) { - if (_setsockopt(fd, IPPROTO_IP, IP_RECVDSTADDR, - &true_value, sizeof(true_value))) { - warnx("svc_tli_create: cannot set IP_RECVDSTADDR"); - return (NULL); - } - } - /* * If the fd is unbound, try to bind it. */ Modified: user/gnn/fasttrap/sys/dev/if_ndis/if_ndis.c ============================================================================== --- user/gnn/fasttrap/sys/dev/if_ndis/if_ndis.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/sys/dev/if_ndis/if_ndis.c Thu Jun 18 19:41:04 2009 (r194455) @@ -2277,6 +2277,7 @@ ndis_setstate_80211(sc) struct ndis_softc *sc; { struct ieee80211com *ic; + struct ieee80211vap *vap; ndis_80211_macaddr bssid; ndis_80211_config config; int rval = 0, len; @@ -2285,6 +2286,7 @@ ndis_setstate_80211(sc) ifp = sc->ifp; ic = ifp->if_l2com; + vap = TAILQ_FIRST(&ic->ic_vaps); if (!NDIS_INITIALIZED(sc)) { DPRINTF(("%s: NDIS not initialized\n", __func__)); @@ -2313,7 +2315,7 @@ ndis_setstate_80211(sc) /* Set power management */ len = sizeof(arg); - if (ic->ic_flags & IEEE80211_F_PMGTON) + if (vap->iv_flags & IEEE80211_F_PMGTON) arg = NDIS_80211_POWERMODE_FAST_PSP; else arg = NDIS_80211_POWERMODE_CAM; @@ -2737,9 +2739,9 @@ ndis_getstate_80211(sc) device_printf(sc->ndis_dev, "get power mode failed: %d\n", rval); if (arg == NDIS_80211_POWERMODE_CAM) - ic->ic_flags &= ~IEEE80211_F_PMGTON; + vap->iv_flags &= ~IEEE80211_F_PMGTON; else - ic->ic_flags |= IEEE80211_F_PMGTON; + vap->iv_flags |= IEEE80211_F_PMGTON; } /* Get TX power */ @@ -2776,7 +2778,7 @@ ndis_getstate_80211(sc) device_printf (sc->ndis_dev, "get authmode status failed: %d\n", rval); else { - ic->ic_flags &= ~IEEE80211_F_WPA; + vap->iv_flags &= ~IEEE80211_F_WPA; switch(arg) { case NDIS_80211_AUTHMODE_OPEN: ni->ni_authmode = IEEE80211_AUTH_OPEN; @@ -2791,12 +2793,12 @@ ndis_getstate_80211(sc) case NDIS_80211_AUTHMODE_WPAPSK: case NDIS_80211_AUTHMODE_WPANONE: ni->ni_authmode = IEEE80211_AUTH_WPA; - ic->ic_flags |= IEEE80211_F_WPA1; + vap->iv_flags |= IEEE80211_F_WPA1; break; case NDIS_80211_AUTHMODE_WPA2: case NDIS_80211_AUTHMODE_WPA2PSK: ni->ni_authmode = IEEE80211_AUTH_WPA; - ic->ic_flags |= IEEE80211_F_WPA2; + vap->iv_flags |= IEEE80211_F_WPA2; break; default: ni->ni_authmode = IEEE80211_AUTH_NONE; @@ -2812,9 +2814,9 @@ ndis_getstate_80211(sc) "get wep status failed: %d\n", rval); if (arg == NDIS_80211_WEPSTAT_ENABLED) - ic->ic_flags |= IEEE80211_F_PRIVACY|IEEE80211_F_DROPUNENC; + vap->iv_flags |= IEEE80211_F_PRIVACY|IEEE80211_F_DROPUNENC; else - ic->ic_flags &= ~(IEEE80211_F_PRIVACY|IEEE80211_F_DROPUNENC); + vap->iv_flags &= ~(IEEE80211_F_PRIVACY|IEEE80211_F_DROPUNENC); return; } Modified: user/gnn/fasttrap/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- user/gnn/fasttrap/sys/fs/nfsclient/nfs_clbio.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/sys/fs/nfsclient/nfs_clbio.c Thu Jun 18 19:41:04 2009 (r194455) @@ -198,7 +198,7 @@ ncl_getpages(struct vop_getpages_args *a if ((object = vp->v_object) == NULL) { ncl_printf("nfs_getpages: called with non-merged cache vnode??\n"); - return VM_PAGER_ERROR; + return (VM_PAGER_ERROR); } if (newnfs_directio_enable && !newnfs_directio_allow_mmap) { @@ -206,7 +206,7 @@ ncl_getpages(struct vop_getpages_args *a if ((np->n_flag & NNONCACHE) && (vp->v_type == VREG)) { mtx_unlock(&np->n_mtx); ncl_printf("nfs_getpages: called on non-cacheable vnode??\n"); - return VM_PAGER_ERROR; + return (VM_PAGER_ERROR); } else mtx_unlock(&np->n_mtx); } @@ -227,23 +227,18 @@ ncl_getpages(struct vop_getpages_args *a * allow the pager to zero-out the blanks. Partially valid pages * can only occur at the file EOF. */ - - { - vm_page_t m = pages[ap->a_reqpage]; - - VM_OBJECT_LOCK(object); - if (m->valid != 0) { - vm_page_lock_queues(); - for (i = 0; i < npages; ++i) { - if (i != ap->a_reqpage) - vm_page_free(pages[i]); - } - vm_page_unlock_queues(); - VM_OBJECT_UNLOCK(object); - return(0); + VM_OBJECT_LOCK(object); + if (pages[ap->a_reqpage]->valid != 0) { + vm_page_lock_queues(); + for (i = 0; i < npages; ++i) { + if (i != ap->a_reqpage) + vm_page_free(pages[i]); } + vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); + return (0); } + VM_OBJECT_UNLOCK(object); /* * We use only the kva address for the buffer, but this is extremely @@ -281,7 +276,7 @@ ncl_getpages(struct vop_getpages_args *a } vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); - return VM_PAGER_ERROR; + return (VM_PAGER_ERROR); } /* @@ -347,7 +342,7 @@ ncl_getpages(struct vop_getpages_args *a } vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); - return 0; + return (0); } /* Modified: user/gnn/fasttrap/sys/fs/nfsclient/nfs_clkrpc.c ============================================================================== --- user/gnn/fasttrap/sys/fs/nfsclient/nfs_clkrpc.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/sys/fs/nfsclient/nfs_clkrpc.c Thu Jun 18 19:41:04 2009 (r194455) @@ -194,6 +194,7 @@ nfscbd_addsock(struct file *fp) fp->f_data = NULL; svc_reg(xprt, NFS_CALLBCKPROG, NFSV4_CBVERS, nfscb_program, NULL); + SVC_RELEASE(xprt); } return (0); Modified: user/gnn/fasttrap/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- user/gnn/fasttrap/sys/fs/nfsserver/nfs_nfsdkrpc.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/sys/fs/nfsserver/nfs_nfsdkrpc.c Thu Jun 18 19:41:04 2009 (r194455) @@ -372,6 +372,7 @@ nfsrvd_addsock(struct file *fp) if (nfs_maxvers >= NFS_VER4) svc_reg(xprt, NFS_PROG, NFS_VER4, nfssvc_program, NULL); + SVC_RELEASE(xprt); } return (0); Modified: user/gnn/fasttrap/sys/geom/label/g_label_gpt.c ============================================================================== --- user/gnn/fasttrap/sys/geom/label/g_label_gpt.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/sys/geom/label/g_label_gpt.c Thu Jun 18 19:41:04 2009 (r194455) @@ -41,16 +41,16 @@ __FBSDID("$FreeBSD$"); #define PART_CLASS_NAME "PART" #define SCHEME_NAME "GPT" -#define G_LABEL_GPT_VOLUME_DIR "gpt" -#define G_LABEL_GPT_ID_DIR "gptid" +#define G_LABEL_GPT_VOLUME_DIR "gpt" +#define G_LABEL_GPT_ID_DIR "gptid" -/* also defined in geom/part/g_part_gpt.c */ +/* XXX: Also defined in geom/part/g_part_gpt.c */ struct g_part_gpt_entry { struct g_part_entry base; struct gpt_ent ent; }; -/* shamelessly stolen from g_part_gpt.c */ +/* XXX: Shamelessly stolen from g_part_gpt.c */ static void sbuf_nprintf_utf16(struct sbuf *sb, uint16_t *str, size_t len) { @@ -109,7 +109,7 @@ g_label_gpt_taste(struct g_consumer *cp, tp = (struct g_part_table *)pp->geom->softc; label[0] = '\0'; - /* We taste only partitions from GPART */ + /* We taste only partitions handled by GPART */ if (strncmp(pp->geom->class->name, PART_CLASS_NAME, sizeof(PART_CLASS_NAME))) return; /* and only GPT */ @@ -119,11 +119,11 @@ g_label_gpt_taste(struct g_consumer *cp, part_gpt_entry = (struct g_part_gpt_entry *)pp->private; /* - * create sbuf with biggest possible size - * we need max. 4 bytes for every 2-byte utf16 char + * Create sbuf with biggest possible size. + * We need max. 4 bytes for every 2-byte utf16 char. */ lbl = sbuf_new(NULL, NULL, sizeof(part_gpt_entry->ent.ent_name) << 1, SBUF_FIXEDLEN); - /* size ist the number of characters, not bytes */ + /* Size is the number of characters, not bytes */ sbuf_nprintf_utf16(lbl, part_gpt_entry->ent.ent_name, sizeof(part_gpt_entry->ent.ent_name) >> 1); sbuf_finish(lbl); strlcpy(label, sbuf_data(lbl), size); @@ -142,7 +142,7 @@ g_label_gpt_uuid_taste(struct g_consumer tp = (struct g_part_table *)pp->geom->softc; label[0] = '\0'; - /* we taste only partitions from GPART */ + /* We taste only partitions handled by GPART */ if (strncmp(pp->geom->class->name, PART_CLASS_NAME, sizeof(PART_CLASS_NAME))) return; /* and only GPT */ Modified: user/gnn/fasttrap/sys/nfsclient/nfs_bio.c ============================================================================== --- user/gnn/fasttrap/sys/nfsclient/nfs_bio.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/sys/nfsclient/nfs_bio.c Thu Jun 18 19:41:04 2009 (r194455) @@ -101,7 +101,7 @@ nfs_getpages(struct vop_getpages_args *a if ((object = vp->v_object) == NULL) { nfs_printf("nfs_getpages: called with non-merged cache vnode??\n"); - return VM_PAGER_ERROR; + return (VM_PAGER_ERROR); } if (nfs_directio_enable && !nfs_directio_allow_mmap) { @@ -109,7 +109,7 @@ nfs_getpages(struct vop_getpages_args *a if ((np->n_flag & NNONCACHE) && (vp->v_type == VREG)) { mtx_unlock(&np->n_mtx); nfs_printf("nfs_getpages: called on non-cacheable vnode??\n"); - return VM_PAGER_ERROR; + return (VM_PAGER_ERROR); } else mtx_unlock(&np->n_mtx); } @@ -130,23 +130,18 @@ nfs_getpages(struct vop_getpages_args *a * allow the pager to zero-out the blanks. Partially valid pages * can only occur at the file EOF. */ - - { - vm_page_t m = pages[ap->a_reqpage]; - - VM_OBJECT_LOCK(object); - if (m->valid != 0) { - vm_page_lock_queues(); - for (i = 0; i < npages; ++i) { - if (i != ap->a_reqpage) - vm_page_free(pages[i]); - } - vm_page_unlock_queues(); - VM_OBJECT_UNLOCK(object); - return(0); + VM_OBJECT_LOCK(object); + if (pages[ap->a_reqpage]->valid != 0) { + vm_page_lock_queues(); + for (i = 0; i < npages; ++i) { + if (i != ap->a_reqpage) + vm_page_free(pages[i]); } + vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); + return (0); } + VM_OBJECT_UNLOCK(object); /* * We use only the kva address for the buffer, but this is extremely @@ -184,7 +179,7 @@ nfs_getpages(struct vop_getpages_args *a } vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); - return VM_PAGER_ERROR; + return (VM_PAGER_ERROR); } /* @@ -250,7 +245,7 @@ nfs_getpages(struct vop_getpages_args *a } vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); - return 0; + return (0); } /* Modified: user/gnn/fasttrap/sys/nfsserver/nfs_srvkrpc.c ============================================================================== --- user/gnn/fasttrap/sys/nfsserver/nfs_srvkrpc.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/sys/nfsserver/nfs_srvkrpc.c Thu Jun 18 19:41:04 2009 (r194455) @@ -467,6 +467,7 @@ nfssvc_addsock(struct file *fp, struct t fp->f_data = NULL; svc_reg(xprt, NFS_PROG, NFS_VER2, nfssvc_program, NULL); svc_reg(xprt, NFS_PROG, NFS_VER3, nfssvc_program, NULL); + SVC_RELEASE(xprt); } return (0); Modified: user/gnn/fasttrap/sys/nlm/nlm_prot_impl.c ============================================================================== --- user/gnn/fasttrap/sys/nlm/nlm_prot_impl.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/sys/nlm/nlm_prot_impl.c Thu Jun 18 19:41:04 2009 (r194455) @@ -1389,7 +1389,7 @@ nlm_register_services(SVCPOOL *pool, int return (EINVAL); } - xprts = malloc(addr_count * sizeof(SVCXPRT *), M_NLM, M_WAITOK); + xprts = malloc(addr_count * sizeof(SVCXPRT *), M_NLM, M_WAITOK|M_ZERO); for (i = 0; i < version_count; i++) { for (j = 0; j < addr_count; j++) { /* @@ -1447,6 +1447,10 @@ nlm_register_services(SVCPOOL *pool, int } error = 0; out: + for (j = 0; j < addr_count; j++) { + if (xprts[j]) + SVC_RELEASE(xprts[j]); + } free(xprts, M_NLM); return (error); } Modified: user/gnn/fasttrap/sys/rpc/svc.c ============================================================================== --- user/gnn/fasttrap/sys/rpc/svc.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/sys/rpc/svc.c Thu Jun 18 19:41:04 2009 (r194455) @@ -276,6 +276,7 @@ xprt_register(SVCXPRT *xprt) { SVCPOOL *pool = xprt->xp_pool; + SVC_ACQUIRE(xprt); mtx_lock(&pool->sp_lock); xprt->xp_registered = TRUE; xprt->xp_active = FALSE; Modified: user/gnn/fasttrap/sys/rpc/svc_generic.c ============================================================================== --- user/gnn/fasttrap/sys/rpc/svc_generic.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/sys/rpc/svc_generic.c Thu Jun 18 19:41:04 2009 (r194455) @@ -120,8 +120,10 @@ svc_create( /* It was not found. Now create a new one */ xprt = svc_tp_create(pool, dispatch, prognum, versnum, NULL, nconf); - if (xprt) + if (xprt) { num++; + SVC_RELEASE(xprt); + } } } __rpc_endconf(handle); @@ -179,6 +181,7 @@ svc_tp_create( (unsigned)prognum, (unsigned)versnum, nconf->nc_netid); xprt_unregister(xprt); + SVC_RELEASE(xprt); return (NULL); } return (xprt); Modified: user/gnn/fasttrap/sys/rpc/svc_vc.c ============================================================================== --- user/gnn/fasttrap/sys/rpc/svc_vc.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/sys/rpc/svc_vc.c Thu Jun 18 19:41:04 2009 (r194455) @@ -324,6 +324,7 @@ svc_vc_rendezvous_recv(SVCXPRT *xprt, st struct socket *so = NULL; struct sockaddr *sa = NULL; int error; + SVCXPRT *new_xprt; /* * The socket upcall calls xprt_active() which will eventually @@ -383,10 +384,14 @@ svc_vc_rendezvous_recv(SVCXPRT *xprt, st /* * svc_vc_create_conn will call xprt_register - we don't need - * to do anything with the new connection. + * to do anything with the new connection except derefence it. */ - if (!svc_vc_create_conn(xprt->xp_pool, so, sa)) + new_xprt = svc_vc_create_conn(xprt->xp_pool, so, sa); + if (!new_xprt) { soclose(so); + } else { + SVC_RELEASE(new_xprt); + } free(sa, M_SONAME); Modified: user/gnn/fasttrap/sys/vm/uma_core.c ============================================================================== --- user/gnn/fasttrap/sys/vm/uma_core.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/sys/vm/uma_core.c Thu Jun 18 19:41:04 2009 (r194455) @@ -1061,8 +1061,10 @@ page_free(void *mem, int size, u_int8_t if (flags & UMA_SLAB_KMEM) map = kmem_map; + else if (flags & UMA_SLAB_KERNEL) + map = kernel_map; else - panic("UMA: page_free used with invalid flags %d\n", flags); + panic("UMA: page_free used with invalid flags %d", flags); kmem_free(map, (vm_offset_t)mem, size); } @@ -1352,7 +1354,7 @@ keg_ctor(void *mem, int size, void *udat printf("zone %s ipers %d rsize %d size %d\n", zone->uz_name, keg->uk_ipers, keg->uk_rsize, keg->uk_size); - panic("UMA slab won't fit.\n"); + panic("UMA slab won't fit."); } } Modified: user/gnn/fasttrap/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- user/gnn/fasttrap/tools/tools/nanobsd/nanobsd.sh Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/tools/tools/nanobsd/nanobsd.sh Thu Jun 18 19:41:04 2009 (r194455) @@ -51,7 +51,6 @@ NANO_PACKAGE_LIST="*" # Object tree directory # default is subdir of /usr/obj -# XXX: MAKEOBJDIRPREFIX handling... ? #NANO_OBJ="" # The directory to put the final images @@ -147,21 +146,19 @@ NANO_ARCH=i386 clean_build ( ) ( pprint 2 "Clean and create object directory (${MAKEOBJDIRPREFIX})" - if rm -rf ${MAKEOBJDIRPREFIX} > /dev/null 2>&1 ; then - true - else + if ! rm -rf ${MAKEOBJDIRPREFIX} > /dev/null 2>&1 ; then chflags -R noschg ${MAKEOBJDIRPREFIX} - rm -rf ${MAKEOBJDIRPREFIX} + rm -r ${MAKEOBJDIRPREFIX} fi mkdir -p ${MAKEOBJDIRPREFIX} printenv > ${MAKEOBJDIRPREFIX}/_.env ) make_conf_build ( ) ( - pprint 2 "Construct build make.conf ($NANO_MAKE_CONF)" + pprint 2 "Construct build make.conf ($NANO_MAKE_CONF_BUILD)" - echo "${CONF_WORLD}" > ${NANO_MAKE_CONF} - echo "${CONF_BUILD}" >> ${NANO_MAKE_CONF} + echo "${CONF_WORLD}" > ${NANO_MAKE_CONF_BUILD} + echo "${CONF_BUILD}" >> ${NANO_MAKE_CONF_BUILD} ) build_world ( ) ( @@ -170,7 +167,7 @@ build_world ( ) ( cd ${NANO_SRC} env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} \ - __MAKE_CONF=${NANO_MAKE_CONF} buildworld \ + __MAKE_CONF=${NANO_MAKE_CONF_BUILD} buildworld \ > ${MAKEOBJDIRPREFIX}/_.bw 2>&1 ) @@ -188,62 +185,70 @@ build_kernel ( ) ( unset TARGET_CPUTYPE unset TARGET_BIG_ENDIAN env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} buildkernel \ - __MAKE_CONF=${NANO_MAKE_CONF} KERNCONF=`basename ${NANO_KERNEL}` \ + __MAKE_CONF=${NANO_MAKE_CONF_BUILD} KERNCONF=`basename ${NANO_KERNEL}` \ > ${MAKEOBJDIRPREFIX}/_.bk 2>&1 ) ) clean_world ( ) ( - pprint 2 "Clean and create world directory (${NANO_WORLDDIR})" - if rm -rf ${NANO_WORLDDIR}/ > /dev/null 2>&1 ; then - true + if [ "${NANO_OBJ}" != "${MAKEOBJDIRPREFIX}" ]; then + pprint 2 "Clean and create object directory (${NANO_OBJ})" + if ! rm -rf ${NANO_OBJ} > /dev/null 2>&1 ; then + chflags -R noschg ${NANO_OBJ} + rm -r ${NANO_OBJ} + fi + mkdir -p ${NANO_OBJ} ${NANO_WORLDDIR} + printenv > ${NANO_OBJ}/_.env else - chflags -R noschg ${NANO_WORLDDIR}/ - rm -rf ${NANO_WORLDDIR}/ + pprint 2 "Clean and create world directory (${NANO_WORLDDIR})" + if ! rm -rf ${NANO_WORLDDIR}/ > /dev/null 2>&1 ; then + chflags -R noschg ${NANO_WORLDDIR} + rm -rf ${NANO_WORLDDIR} + fi + mkdir -p ${NANO_WORLDDIR} fi - mkdir -p ${NANO_WORLDDIR}/ ) make_conf_install ( ) ( - pprint 2 "Construct install make.conf ($NANO_MAKE_CONF)" + pprint 2 "Construct install make.conf ($NANO_MAKE_CONF_INSTALL)" - echo "${CONF_WORLD}" > ${NANO_MAKE_CONF} - echo "${CONF_INSTALL}" >> ${NANO_MAKE_CONF} + echo "${CONF_WORLD}" > ${NANO_MAKE_CONF_INSTALL} + echo "${CONF_INSTALL}" >> ${NANO_MAKE_CONF_INSTALL} ) install_world ( ) ( pprint 2 "installworld" - pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.iw" + pprint 3 "log: ${NANO_OBJ}/_.iw" cd ${NANO_SRC} env TARGET_ARCH=${NANO_ARCH} \ - ${NANO_PMAKE} __MAKE_CONF=${NANO_MAKE_CONF} installworld \ + ${NANO_PMAKE} __MAKE_CONF=${NANO_MAKE_CONF_INSTALL} installworld \ DESTDIR=${NANO_WORLDDIR} \ - > ${MAKEOBJDIRPREFIX}/_.iw 2>&1 + > ${NANO_OBJ}/_.iw 2>&1 chflags -R noschg ${NANO_WORLDDIR} ) install_etc ( ) ( pprint 2 "install /etc" - pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.etc" + pprint 3 "log: ${NANO_OBJ}/_.etc" cd ${NANO_SRC} env TARGET_ARCH=${NANO_ARCH} \ - ${NANO_PMAKE} __MAKE_CONF=${NANO_MAKE_CONF} distribution \ + ${NANO_PMAKE} __MAKE_CONF=${NANO_MAKE_CONF_INSTALL} distribution \ DESTDIR=${NANO_WORLDDIR} \ - > ${MAKEOBJDIRPREFIX}/_.etc 2>&1 + > ${NANO_OBJ}/_.etc 2>&1 ) install_kernel ( ) ( pprint 2 "install kernel" - pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.ik" + pprint 3 "log: ${NANO_OBJ}/_.ik" cd ${NANO_SRC} env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} installkernel \ DESTDIR=${NANO_WORLDDIR} \ - __MAKE_CONF=${NANO_MAKE_CONF} KERNCONF=`basename ${NANO_KERNEL}` \ - > ${MAKEOBJDIRPREFIX}/_.ik 2>&1 + __MAKE_CONF=${NANO_MAKE_CONF_INSTALL} KERNCONF=`basename ${NANO_KERNEL}` \ + > ${NANO_OBJ}/_.ik 2>&1 ) run_customize() ( @@ -252,9 +257,9 @@ run_customize() ( for c in $NANO_CUSTOMIZE do pprint 2 "customize \"$c\"" - pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.cust.$c" + pprint 3 "log: ${NANO_OBJ}/_.cust.$c" pprint 4 "`type $c`" - ( $c ) > ${MAKEOBJDIRPREFIX}/_.cust.$c 2>&1 + ( $c ) > ${NANO_OBJ}/_.cust.$c 2>&1 done ) @@ -264,15 +269,15 @@ run_late_customize() ( for c in $NANO_LATE_CUSTOMIZE do pprint 2 "late customize \"$c\"" - pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.late_cust.$c" + pprint 3 "log: ${NANO_OBJ}/_.late_cust.$c" pprint 4 "`type $c`" - ( $c ) > ${MAKEOBJDIRPREFIX}/_.late_cust.$c 2>&1 + ( $c ) > ${NANO_OBJ}/_.late_cust.$c 2>&1 done ) setup_nanobsd ( ) ( pprint 2 "configure nanobsd setup" - pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.dl" + pprint 3 "log: ${NANO_OBJ}/_.dl" ( cd ${NANO_WORLDDIR} @@ -312,7 +317,7 @@ setup_nanobsd ( ) ( rm tmp || true ln -s var/tmp tmp - ) > ${MAKEOBJDIRPREFIX}/_.dl 2>&1 + ) > ${NANO_OBJ}/_.dl 2>&1 ) setup_nanobsd_etc ( ) ( @@ -348,7 +353,7 @@ prune_usr() ( create_i386_diskimage ( ) ( pprint 2 "build diskimage" - pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.di" + pprint 3 "log: ${NANO_OBJ}/_.di" ( echo $NANO_MEDIASIZE $NANO_IMAGES \ @@ -417,10 +422,10 @@ create_i386_diskimage ( ) ( # for booting the image from a USB device to work. print "a 1" } - ' > ${MAKEOBJDIRPREFIX}/_.fdisk + ' > ${NANO_OBJ}/_.fdisk IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} - MNT=${MAKEOBJDIRPREFIX}/_.mnt + MNT=${NANO_OBJ}/_.mnt mkdir -p ${MNT} if [ "${NANO_MD_BACKING}" = "swap" ] ; then @@ -436,7 +441,7 @@ create_i386_diskimage ( ) ( trap "df -i ${MNT} ; umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT - fdisk -i -f ${MAKEOBJDIRPREFIX}/_.fdisk ${MD} + fdisk -i -f ${NANO_OBJ}/_.fdisk ${MD} fdisk ${MD} # XXX: params # XXX: pick up cached boot* files, they may not be in image anymore. @@ -452,8 +457,8 @@ create_i386_diskimage ( ) ( ( cd ${NANO_WORLDDIR} && find . -print | cpio -dump ${MNT} ) df -i ${MNT} echo "Generating mtree..." - ( cd ${MNT} && mtree -c ) > ${MAKEOBJDIRPREFIX}/_.mtree - ( cd ${MNT} && du -k ) > ${MAKEOBJDIRPREFIX}/_.du + ( cd ${MNT} && mtree -c ) > ${NANO_OBJ}/_.mtree + ( cd ${MNT} && du -k ) > ${NANO_OBJ}/_.du umount ${MNT} if [ $NANO_IMAGES -gt 1 -a $NANO_INIT_IMG2 -gt 0 ] ; then @@ -466,7 +471,6 @@ create_i386_diskimage ( ) ( sed -i "" "s/${NANO_DRIVE}s1/${NANO_DRIVE}s2/g" $f done umount ${MNT} - fi # Create Config slice @@ -480,21 +484,21 @@ create_i386_diskimage ( ) ( fi if [ "${NANO_MD_BACKING}" = "swap" ] ; then - echo "Writing out _.disk.full..." + echo "Writing out ${NANO_IMGNAME}..." dd if=/dev/${MD} of=${IMG} bs=64k fi echo "Writing out _.disk.image..." dd if=/dev/${MD}s1 of=${NANO_DISKIMGDIR}/_.disk.image bs=64k mdconfig -d -u $MD - ) > ${MAKEOBJDIRPREFIX}/_.di 2>&1 + ) > ${NANO_OBJ}/_.di 2>&1 ) last_orders () ( # Redefine this function with any last orders you may have # after the build completed, for instance to copy the finished # image to a more convenient place: - # cp ${MAKEOBJDIRPREFIX}/_.disk.image /home/ftp/pub/nanobsd.disk + # cp ${NANO_DISKIMGDIR}/_.disk.image /home/ftp/pub/nanobsd.disk ) ####################################################################### @@ -751,19 +755,13 @@ fi ####################################################################### # Setup and Export Internal variables # -if [ "x${NANO_OBJ}" = "x" ] ; then - MAKEOBJDIRPREFIX=/usr/obj/nanobsd.${NANO_NAME}/ - NANO_OBJ=${MAKEOBJDIRPREFIX} -else - MAKEOBJDIRPREFIX=${NANO_OBJ} -fi - -if [ "x${NANO_DISKIMGDIR}" = "x" ] ; then - NANO_DISKIMGDIR=${MAKEOBJDIRPREFIX} -fi - -NANO_WORLDDIR=${MAKEOBJDIRPREFIX}/_.w -NANO_MAKE_CONF=${MAKEOBJDIRPREFIX}/make.conf +test -n "${NANO_OBJ}" || NANO_OBJ=/usr/obj/nanobsd.${NANO_NAME}/ +test -n "${MAKEOBJDIRPREFIX}" || MAKEOBJDIRPREFIX=${NANO_OBJ} +test -n "${NANO_DISKIMGDIR}" || NANO_DISKIMGDIR=${NANO_OBJ} + +NANO_WORLDDIR=${NANO_OBJ}/_.w +NANO_MAKE_CONF_BUILD=${MAKEOBJDIRPREFIX}/make.conf.build +NANO_MAKE_CONF_INSTALL=${NANO_OBJ}/make.conf.install if [ -d ${NANO_TOOLS} ] ; then true @@ -791,7 +789,8 @@ export NANO_DRIVE export NANO_HEADS export NANO_IMAGES export NANO_IMGNAME -export NANO_MAKE_CONF +export NANO_MAKE_CONF_BUILD +export NANO_MAKE_CONF_INSTALL export NANO_MEDIASIZE export NANO_NAME export NANO_NEWFS @@ -840,7 +839,6 @@ prune_usr run_late_customize if $do_image ; then create_${NANO_ARCH}_diskimage - echo "# Created NanoBSD disk image: ${MAKEOBJDIRPREFIX}/${NANO_IMGNAME}" else pprint 2 "Skipping image build (as instructed)" fi Modified: user/gnn/fasttrap/usr.bin/ncal/ncal.c ============================================================================== --- user/gnn/fasttrap/usr.bin/ncal/ncal.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/usr.bin/ncal/ncal.c Thu Jun 18 19:41:04 2009 (r194455) @@ -844,7 +844,7 @@ mkweekdays(struct weekdays *wds) for (i = 0; i != 7; i++) { tm.tm_wday = (i+1) % 7; wcsftime(buf, sizeof(buf), L"%a", &tm); - for (len = wcslen(buf); len > 0; --len) { + for (len = 2; len > 0; --len) { if ((width = wcswidth(buf, len)) <= 2) break; } @@ -852,7 +852,7 @@ mkweekdays(struct weekdays *wds) if (width == 1) wds->names[i][0] = L' '; wcsncat(wds->names[i], buf, len); - wcsncat(wds->names[i], L" ", 3 - wcswidth(wds->names[i], 2)); + wcsncat(wds->names[i], L" ", 1); } } Modified: user/gnn/fasttrap/usr.sbin/mountd/mountd.c ============================================================================== --- user/gnn/fasttrap/usr.sbin/mountd/mountd.c Thu Jun 18 17:59:04 2009 (r194454) +++ user/gnn/fasttrap/usr.sbin/mountd/mountd.c Thu Jun 18 19:41:04 2009 (r194455) @@ -568,13 +568,6 @@ create_service(struct netconfig *nconf) continue; } } - if (si.si_socktype == SOCK_DGRAM && - setsockopt(fd, IPPROTO_IP, IP_RECVDSTADDR, &one, - sizeof one) < 0) { - syslog(LOG_ERR, - "can't disable v4-in-v6 on IPv6 socket"); - exit(1); - } break; case AF_INET6: if (inet_pton(AF_INET6, hosts[nhostsbak], From owner-svn-src-user@FreeBSD.ORG Thu Jun 18 19:45:22 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C819D1065679; Thu, 18 Jun 2009 19:45:22 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B52C88FC25; Thu, 18 Jun 2009 19:45:22 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5IJjMDK020960; Thu, 18 Jun 2009 19:45:22 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5IJjMM2020958; Thu, 18 Jun 2009 19:45:22 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200906181945.n5IJjMM2020958@svn.freebsd.org> From: "George V. Neville-Neil" Date: Thu, 18 Jun 2009 19:45:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194456 - user/gnn/fasttrap/sys/cddl/dev/fasttrap X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2009 19:45:23 -0000 Author: gnn Date: Thu Jun 18 19:45:22 2009 New Revision: 194456 URL: http://svn.freebsd.org/changeset/base/194456 Log: Import vendor version of fasttrap.c for modification. Added: user/gnn/fasttrap/sys/cddl/dev/fasttrap/ user/gnn/fasttrap/sys/cddl/dev/fasttrap/fasttrap.c - copied unchanged from r194454, vendor-sys/opensolaris/dist/uts/common/dtrace/fasttrap.c Copied: user/gnn/fasttrap/sys/cddl/dev/fasttrap/fasttrap.c (from r194454, vendor-sys/opensolaris/dist/uts/common/dtrace/fasttrap.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/gnn/fasttrap/sys/cddl/dev/fasttrap/fasttrap.c Thu Jun 18 19:45:22 2009 (r194456, copy of r194454, vendor-sys/opensolaris/dist/uts/common/dtrace/fasttrap.c) @@ -0,0 +1,2383 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * User-Land Trap-Based Tracing + * ---------------------------- + * + * The fasttrap provider allows DTrace consumers to instrument any user-level + * instruction to gather data; this includes probes with semantic + * signifigance like entry and return as well as simple offsets into the + * function. While the specific techniques used are very ISA specific, the + * methodology is generalizable to any architecture. + * + * + * The General Methodology + * ----------------------- + * + * With the primary goal of tracing every user-land instruction and the + * limitation that we can't trust user space so don't want to rely on much + * information there, we begin by replacing the instructions we want to trace + * with trap instructions. Each instruction we overwrite is saved into a hash + * table keyed by process ID and pc address. When we enter the kernel due to + * this trap instruction, we need the effects of the replaced instruction to + * appear to have occurred before we proceed with the user thread's + * execution. + * + * Each user level thread is represented by a ulwp_t structure which is + * always easily accessible through a register. The most basic way to produce + * the effects of the instruction we replaced is to copy that instruction out + * to a bit of scratch space reserved in the user thread's ulwp_t structure + * (a sort of kernel-private thread local storage), set the PC to that + * scratch space and single step. When we reenter the kernel after single + * stepping the instruction we must then adjust the PC to point to what would + * normally be the next instruction. Of course, special care must be taken + * for branches and jumps, but these represent such a small fraction of any + * instruction set that writing the code to emulate these in the kernel is + * not too difficult. + * + * Return probes may require several tracepoints to trace every return site, + * and, conversely, each tracepoint may activate several probes (the entry + * and offset 0 probes, for example). To solve this muliplexing problem, + * tracepoints contain lists of probes to activate and probes contain lists + * of tracepoints to enable. If a probe is activated, it adds its ID to + * existing tracepoints or creates new ones as necessary. + * + * Most probes are activated _before_ the instruction is executed, but return + * probes are activated _after_ the effects of the last instruction of the + * function are visible. Return probes must be fired _after_ we have + * single-stepped the instruction whereas all other probes are fired + * beforehand. + * + * + * Lock Ordering + * ------------- + * + * The lock ordering below -- both internally and with respect to the DTrace + * framework -- is a little tricky and bears some explanation. Each provider + * has a lock (ftp_mtx) that protects its members including reference counts + * for enabled probes (ftp_rcount), consumers actively creating probes + * (ftp_ccount) and USDT consumers (ftp_mcount); all three prevent a provider + * from being freed. A provider is looked up by taking the bucket lock for the + * provider hash table, and is returned with its lock held. The provider lock + * may be taken in functions invoked by the DTrace framework, but may not be + * held while calling functions in the DTrace framework. + * + * To ensure consistency over multiple calls to the DTrace framework, the + * creation lock (ftp_cmtx) should be held. Naturally, the creation lock may + * not be taken when holding the provider lock as that would create a cyclic + * lock ordering. In situations where one would naturally take the provider + * lock and then the creation lock, we instead up a reference count to prevent + * the provider from disappearing, drop the provider lock, and acquire the + * creation lock. + * + * Briefly: + * bucket lock before provider lock + * DTrace before provider lock + * creation lock before DTrace + * never hold the provider lock and creation lock simultaneously + */ + +static dev_info_t *fasttrap_devi; +static dtrace_meta_provider_id_t fasttrap_meta_id; + +static timeout_id_t fasttrap_timeout; +static kmutex_t fasttrap_cleanup_mtx; +static uint_t fasttrap_cleanup_work; + +/* + * Generation count on modifications to the global tracepoint lookup table. + */ +static volatile uint64_t fasttrap_mod_gen; + +/* + * When the fasttrap provider is loaded, fasttrap_max is set to either + * FASTTRAP_MAX_DEFAULT or the value for fasttrap-max-probes in the + * fasttrap.conf file. Each time a probe is created, fasttrap_total is + * incremented by the number of tracepoints that may be associated with that + * probe; fasttrap_total is capped at fasttrap_max. + */ +#define FASTTRAP_MAX_DEFAULT 250000 +static uint32_t fasttrap_max; +static uint32_t fasttrap_total; + + +#define FASTTRAP_TPOINTS_DEFAULT_SIZE 0x4000 +#define FASTTRAP_PROVIDERS_DEFAULT_SIZE 0x100 +#define FASTTRAP_PROCS_DEFAULT_SIZE 0x100 + +#define FASTTRAP_PID_NAME "pid" + +fasttrap_hash_t fasttrap_tpoints; +static fasttrap_hash_t fasttrap_provs; +static fasttrap_hash_t fasttrap_procs; + +static uint64_t fasttrap_pid_count; /* pid ref count */ +static kmutex_t fasttrap_count_mtx; /* lock on ref count */ + +#define FASTTRAP_ENABLE_FAIL 1 +#define FASTTRAP_ENABLE_PARTIAL 2 + +static int fasttrap_tracepoint_enable(proc_t *, fasttrap_probe_t *, uint_t); +static void fasttrap_tracepoint_disable(proc_t *, fasttrap_probe_t *, uint_t); + +static fasttrap_provider_t *fasttrap_provider_lookup(pid_t, const char *, + const dtrace_pattr_t *); +static void fasttrap_provider_retire(pid_t, const char *, int); +static void fasttrap_provider_free(fasttrap_provider_t *); + +static fasttrap_proc_t *fasttrap_proc_lookup(pid_t); +static void fasttrap_proc_release(fasttrap_proc_t *); + +#define FASTTRAP_PROVS_INDEX(pid, name) \ + ((fasttrap_hash_str(name) + (pid)) & fasttrap_provs.fth_mask) + +#define FASTTRAP_PROCS_INDEX(pid) ((pid) & fasttrap_procs.fth_mask) + +static int +fasttrap_highbit(ulong_t i) +{ + int h = 1; + + if (i == 0) + return (0); +#ifdef _LP64 + if (i & 0xffffffff00000000ul) { + h += 32; i >>= 32; + } +#endif + if (i & 0xffff0000) { + h += 16; i >>= 16; + } + if (i & 0xff00) { + h += 8; i >>= 8; + } + if (i & 0xf0) { + h += 4; i >>= 4; + } + if (i & 0xc) { + h += 2; i >>= 2; + } + if (i & 0x2) { + h += 1; + } + return (h); +} + +static uint_t +fasttrap_hash_str(const char *p) +{ + unsigned int g; + uint_t hval = 0; + + while (*p) { + hval = (hval << 4) + *p++; + if ((g = (hval & 0xf0000000)) != 0) + hval ^= g >> 24; + hval &= ~g; + } + return (hval); +} + +void +fasttrap_sigtrap(proc_t *p, kthread_t *t, uintptr_t pc) +{ + sigqueue_t *sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP); + + sqp->sq_info.si_signo = SIGTRAP; + sqp->sq_info.si_code = TRAP_DTRACE; + sqp->sq_info.si_addr = (caddr_t)pc; + + mutex_enter(&p->p_lock); + sigaddqa(p, t, sqp); + mutex_exit(&p->p_lock); + + if (t != NULL) + aston(t); +} + +/* + * This function ensures that no threads are actively using the memory + * associated with probes that were formerly live. + */ +static void +fasttrap_mod_barrier(uint64_t gen) +{ + int i; + + if (gen < fasttrap_mod_gen) + return; + + fasttrap_mod_gen++; + + for (i = 0; i < NCPU; i++) { + mutex_enter(&cpu_core[i].cpuc_pid_lock); + mutex_exit(&cpu_core[i].cpuc_pid_lock); + } +} + +/* + * This is the timeout's callback for cleaning up the providers and their + * probes. + */ +/*ARGSUSED*/ +static void +fasttrap_pid_cleanup_cb(void *data) +{ + fasttrap_provider_t **fpp, *fp; + fasttrap_bucket_t *bucket; + dtrace_provider_id_t provid; + int i, later; + + static volatile int in = 0; + ASSERT(in == 0); + in = 1; + + mutex_enter(&fasttrap_cleanup_mtx); + while (fasttrap_cleanup_work) { + fasttrap_cleanup_work = 0; + mutex_exit(&fasttrap_cleanup_mtx); + + later = 0; + + /* + * Iterate over all the providers trying to remove the marked + * ones. If a provider is marked but not retired, we just + * have to take a crack at removing it -- it's no big deal if + * we can't. + */ + for (i = 0; i < fasttrap_provs.fth_nent; i++) { + bucket = &fasttrap_provs.fth_table[i]; + mutex_enter(&bucket->ftb_mtx); + fpp = (fasttrap_provider_t **)&bucket->ftb_data; + + while ((fp = *fpp) != NULL) { + if (!fp->ftp_marked) { + fpp = &fp->ftp_next; + continue; + } + + mutex_enter(&fp->ftp_mtx); + + /* + * If this provider has consumers actively + * creating probes (ftp_ccount) or is a USDT + * provider (ftp_mcount), we can't unregister + * or even condense. + */ + if (fp->ftp_ccount != 0 || + fp->ftp_mcount != 0) { + mutex_exit(&fp->ftp_mtx); + fp->ftp_marked = 0; + continue; + } + + if (!fp->ftp_retired || fp->ftp_rcount != 0) + fp->ftp_marked = 0; + + mutex_exit(&fp->ftp_mtx); + + /* + * If we successfully unregister this + * provider we can remove it from the hash + * chain and free the memory. If our attempt + * to unregister fails and this is a retired + * provider, increment our flag to try again + * pretty soon. If we've consumed more than + * half of our total permitted number of + * probes call dtrace_condense() to try to + * clean out the unenabled probes. + */ + provid = fp->ftp_provid; + if (dtrace_unregister(provid) != 0) { + if (fasttrap_total > fasttrap_max / 2) + (void) dtrace_condense(provid); + later += fp->ftp_marked; + fpp = &fp->ftp_next; + } else { + *fpp = fp->ftp_next; + fasttrap_provider_free(fp); + } + } + mutex_exit(&bucket->ftb_mtx); + } + + mutex_enter(&fasttrap_cleanup_mtx); + } + + ASSERT(fasttrap_timeout != 0); + + /* + * If we were unable to remove a retired provider, try again after + * a second. This situation can occur in certain circumstances where + * providers cannot be unregistered even though they have no probes + * enabled because of an execution of dtrace -l or something similar. + * If the timeout has been disabled (set to 1 because we're trying + * to detach), we set fasttrap_cleanup_work to ensure that we'll + * get a chance to do that work if and when the timeout is reenabled + * (if detach fails). + */ + if (later > 0 && fasttrap_timeout != (timeout_id_t)1) + fasttrap_timeout = timeout(&fasttrap_pid_cleanup_cb, NULL, hz); + else if (later > 0) + fasttrap_cleanup_work = 1; + else + fasttrap_timeout = 0; + + mutex_exit(&fasttrap_cleanup_mtx); + in = 0; +} + +/* + * Activates the asynchronous cleanup mechanism. + */ +static void +fasttrap_pid_cleanup(void) +{ + mutex_enter(&fasttrap_cleanup_mtx); + fasttrap_cleanup_work = 1; + if (fasttrap_timeout == 0) + fasttrap_timeout = timeout(&fasttrap_pid_cleanup_cb, NULL, 1); + mutex_exit(&fasttrap_cleanup_mtx); +} + +/* + * This is called from cfork() via dtrace_fasttrap_fork(). The child + * process's address space is (roughly) a copy of the parent process's so + * we have to remove all the instrumentation we had previously enabled in the + * parent. + */ +static void +fasttrap_fork(proc_t *p, proc_t *cp) +{ + pid_t ppid = p->p_pid; + int i; + + ASSERT(curproc == p); + ASSERT(p->p_proc_flag & P_PR_LOCK); + ASSERT(p->p_dtrace_count > 0); + ASSERT(cp->p_dtrace_count == 0); + + /* + * This would be simpler and faster if we maintained per-process + * hash tables of enabled tracepoints. It could, however, potentially + * slow down execution of a tracepoint since we'd need to go + * through two levels of indirection. In the future, we should + * consider either maintaining per-process ancillary lists of + * enabled tracepoints or hanging a pointer to a per-process hash + * table of enabled tracepoints off the proc structure. + */ + + /* + * We don't have to worry about the child process disappearing + * because we're in fork(). + */ + mutex_enter(&cp->p_lock); + sprlock_proc(cp); + mutex_exit(&cp->p_lock); + + /* + * Iterate over every tracepoint looking for ones that belong to the + * parent process, and remove each from the child process. + */ + for (i = 0; i < fasttrap_tpoints.fth_nent; i++) { + fasttrap_tracepoint_t *tp; + fasttrap_bucket_t *bucket = &fasttrap_tpoints.fth_table[i]; + + mutex_enter(&bucket->ftb_mtx); + for (tp = bucket->ftb_data; tp != NULL; tp = tp->ftt_next) { + if (tp->ftt_pid == ppid && + tp->ftt_proc->ftpc_acount != 0) { + int ret = fasttrap_tracepoint_remove(cp, tp); + ASSERT(ret == 0); + + /* + * The count of active providers can only be + * decremented (i.e. to zero) during exec, + * exit, and removal of a meta provider so it + * should be impossible to drop the count + * mid-fork. + */ + ASSERT(tp->ftt_proc->ftpc_acount != 0); + } + } + mutex_exit(&bucket->ftb_mtx); + } + + mutex_enter(&cp->p_lock); + sprunlock(cp); +} + +/* + * This is called from proc_exit() or from exec_common() if p_dtrace_probes + * is set on the proc structure to indicate that there is a pid provider + * associated with this process. + */ +static void +fasttrap_exec_exit(proc_t *p) +{ + ASSERT(p == curproc); + ASSERT(MUTEX_HELD(&p->p_lock)); + + mutex_exit(&p->p_lock); + + /* + * We clean up the pid provider for this process here; user-land + * static probes are handled by the meta-provider remove entry point. + */ + fasttrap_provider_retire(p->p_pid, FASTTRAP_PID_NAME, 0); + + mutex_enter(&p->p_lock); +} + + +/*ARGSUSED*/ +static void +fasttrap_pid_provide(void *arg, const dtrace_probedesc_t *desc) +{ + /* + * There are no "default" pid probes. + */ +} + +static int +fasttrap_tracepoint_enable(proc_t *p, fasttrap_probe_t *probe, uint_t index) +{ + fasttrap_tracepoint_t *tp, *new_tp = NULL; + fasttrap_bucket_t *bucket; + fasttrap_id_t *id; + pid_t pid; + uintptr_t pc; + + ASSERT(index < probe->ftp_ntps); + + pid = probe->ftp_pid; + pc = probe->ftp_tps[index].fit_tp->ftt_pc; + id = &probe->ftp_tps[index].fit_id; + + ASSERT(probe->ftp_tps[index].fit_tp->ftt_pid == pid); + + ASSERT(!(p->p_flag & SVFORK)); + + /* + * Before we make any modifications, make sure we've imposed a barrier + * on the generation in which this probe was last modified. + */ + fasttrap_mod_barrier(probe->ftp_gen); + + bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)]; + + /* + * If the tracepoint has already been enabled, just add our id to the + * list of interested probes. This may be our second time through + * this path in which case we'll have constructed the tracepoint we'd + * like to install. If we can't find a match, and have an allocated + * tracepoint ready to go, enable that one now. + * + * A tracepoint whose process is defunct is also considered defunct. + */ +again: + mutex_enter(&bucket->ftb_mtx); + for (tp = bucket->ftb_data; tp != NULL; tp = tp->ftt_next) { + /* + * Note that it's safe to access the active count on the + * associated proc structure because we know that at least one + * provider (this one) will still be around throughout this + * operation. + */ + if (tp->ftt_pid != pid || tp->ftt_pc != pc || + tp->ftt_proc->ftpc_acount == 0) + continue; + + /* + * Now that we've found a matching tracepoint, it would be + * a decent idea to confirm that the tracepoint is still + * enabled and the trap instruction hasn't been overwritten. + * Since this is a little hairy, we'll punt for now. + */ + + /* + * This can't be the first interested probe. We don't have + * to worry about another thread being in the midst of + * deleting this tracepoint (which would be the only valid + * reason for a tracepoint to have no interested probes) + * since we're holding P_PR_LOCK for this process. + */ + ASSERT(tp->ftt_ids != NULL || tp->ftt_retids != NULL); + + switch (id->fti_ptype) { + case DTFTP_ENTRY: + case DTFTP_OFFSETS: + case DTFTP_IS_ENABLED: + id->fti_next = tp->ftt_ids; + membar_producer(); + tp->ftt_ids = id; + membar_producer(); + break; + + case DTFTP_RETURN: + case DTFTP_POST_OFFSETS: + id->fti_next = tp->ftt_retids; + membar_producer(); + tp->ftt_retids = id; + membar_producer(); + break; + + default: + ASSERT(0); + } + + mutex_exit(&bucket->ftb_mtx); + + if (new_tp != NULL) { + new_tp->ftt_ids = NULL; + new_tp->ftt_retids = NULL; + } + + return (0); + } + + /* + * If we have a good tracepoint ready to go, install it now while + * we have the lock held and no one can screw with us. + */ + if (new_tp != NULL) { + int rc = 0; + + new_tp->ftt_next = bucket->ftb_data; + membar_producer(); + bucket->ftb_data = new_tp; + membar_producer(); + mutex_exit(&bucket->ftb_mtx); + + /* + * Activate the tracepoint in the ISA-specific manner. + * If this fails, we need to report the failure, but + * indicate that this tracepoint must still be disabled + * by calling fasttrap_tracepoint_disable(). + */ + if (fasttrap_tracepoint_install(p, new_tp) != 0) + rc = FASTTRAP_ENABLE_PARTIAL; + + /* + * Increment the count of the number of tracepoints active in + * the victim process. + */ + ASSERT(p->p_proc_flag & P_PR_LOCK); + p->p_dtrace_count++; + + return (rc); + } + + mutex_exit(&bucket->ftb_mtx); + + /* + * Initialize the tracepoint that's been preallocated with the probe. + */ + new_tp = probe->ftp_tps[index].fit_tp; + + ASSERT(new_tp->ftt_pid == pid); + ASSERT(new_tp->ftt_pc == pc); + ASSERT(new_tp->ftt_proc == probe->ftp_prov->ftp_proc); + ASSERT(new_tp->ftt_ids == NULL); + ASSERT(new_tp->ftt_retids == NULL); + + switch (id->fti_ptype) { + case DTFTP_ENTRY: + case DTFTP_OFFSETS: + case DTFTP_IS_ENABLED: + id->fti_next = NULL; + new_tp->ftt_ids = id; + break; + + case DTFTP_RETURN: + case DTFTP_POST_OFFSETS: + id->fti_next = NULL; + new_tp->ftt_retids = id; + break; + + default: + ASSERT(0); + } + + /* + * If the ISA-dependent initialization goes to plan, go back to the + * beginning and try to install this freshly made tracepoint. + */ + if (fasttrap_tracepoint_init(p, new_tp, pc, id->fti_ptype) == 0) + goto again; + + new_tp->ftt_ids = NULL; + new_tp->ftt_retids = NULL; + + return (FASTTRAP_ENABLE_FAIL); +} + +static void +fasttrap_tracepoint_disable(proc_t *p, fasttrap_probe_t *probe, uint_t index) +{ + fasttrap_bucket_t *bucket; + fasttrap_provider_t *provider = probe->ftp_prov; + fasttrap_tracepoint_t **pp, *tp; + fasttrap_id_t *id, **idp; + pid_t pid; + uintptr_t pc; + + ASSERT(index < probe->ftp_ntps); + + pid = probe->ftp_pid; + pc = probe->ftp_tps[index].fit_tp->ftt_pc; + id = &probe->ftp_tps[index].fit_id; + + ASSERT(probe->ftp_tps[index].fit_tp->ftt_pid == pid); + + /* + * Find the tracepoint and make sure that our id is one of the + * ones registered with it. + */ + bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)]; + mutex_enter(&bucket->ftb_mtx); + for (tp = bucket->ftb_data; tp != NULL; tp = tp->ftt_next) { + if (tp->ftt_pid == pid && tp->ftt_pc == pc && + tp->ftt_proc == provider->ftp_proc) + break; + } + + /* + * If we somehow lost this tracepoint, we're in a world of hurt. + */ + ASSERT(tp != NULL); + + switch (id->fti_ptype) { + case DTFTP_ENTRY: + case DTFTP_OFFSETS: + case DTFTP_IS_ENABLED: + ASSERT(tp->ftt_ids != NULL); + idp = &tp->ftt_ids; + break; + + case DTFTP_RETURN: + case DTFTP_POST_OFFSETS: + ASSERT(tp->ftt_retids != NULL); + idp = &tp->ftt_retids; + break; + + default: + ASSERT(0); + } + + while ((*idp)->fti_probe != probe) { + idp = &(*idp)->fti_next; + ASSERT(*idp != NULL); + } + + id = *idp; + *idp = id->fti_next; + membar_producer(); + + ASSERT(id->fti_probe == probe); + + /* + * If there are other registered enablings of this tracepoint, we're + * all done, but if this was the last probe assocated with this + * this tracepoint, we need to remove and free it. + */ + if (tp->ftt_ids != NULL || tp->ftt_retids != NULL) { + + /* + * If the current probe's tracepoint is in use, swap it + * for an unused tracepoint. + */ + if (tp == probe->ftp_tps[index].fit_tp) { + fasttrap_probe_t *tmp_probe; + fasttrap_tracepoint_t **tmp_tp; + uint_t tmp_index; + + if (tp->ftt_ids != NULL) { + tmp_probe = tp->ftt_ids->fti_probe; + /* LINTED - alignment */ + tmp_index = FASTTRAP_ID_INDEX(tp->ftt_ids); + tmp_tp = &tmp_probe->ftp_tps[tmp_index].fit_tp; + } else { + tmp_probe = tp->ftt_retids->fti_probe; + /* LINTED - alignment */ + tmp_index = FASTTRAP_ID_INDEX(tp->ftt_retids); + tmp_tp = &tmp_probe->ftp_tps[tmp_index].fit_tp; + } + + ASSERT(*tmp_tp != NULL); + ASSERT(*tmp_tp != probe->ftp_tps[index].fit_tp); + ASSERT((*tmp_tp)->ftt_ids == NULL); + ASSERT((*tmp_tp)->ftt_retids == NULL); + + probe->ftp_tps[index].fit_tp = *tmp_tp; + *tmp_tp = tp; + } + + mutex_exit(&bucket->ftb_mtx); + + /* + * Tag the modified probe with the generation in which it was + * changed. + */ + probe->ftp_gen = fasttrap_mod_gen; + return; + } + + mutex_exit(&bucket->ftb_mtx); + + /* + * We can't safely remove the tracepoint from the set of active + * tracepoints until we've actually removed the fasttrap instruction + * from the process's text. We can, however, operate on this + * tracepoint secure in the knowledge that no other thread is going to + * be looking at it since we hold P_PR_LOCK on the process if it's + * live or we hold the provider lock on the process if it's dead and + * gone. + */ + + /* + * We only need to remove the actual instruction if we're looking + * at an existing process + */ + if (p != NULL) { + /* + * If we fail to restore the instruction we need to kill + * this process since it's in a completely unrecoverable + * state. + */ + if (fasttrap_tracepoint_remove(p, tp) != 0) + fasttrap_sigtrap(p, NULL, pc); + + /* + * Decrement the count of the number of tracepoints active + * in the victim process. + */ + ASSERT(p->p_proc_flag & P_PR_LOCK); + p->p_dtrace_count--; + } + + /* + * Remove the probe from the hash table of active tracepoints. + */ + mutex_enter(&bucket->ftb_mtx); + pp = (fasttrap_tracepoint_t **)&bucket->ftb_data; + ASSERT(*pp != NULL); + while (*pp != tp) { + pp = &(*pp)->ftt_next; + ASSERT(*pp != NULL); + } + + *pp = tp->ftt_next; + membar_producer(); + + mutex_exit(&bucket->ftb_mtx); + + /* + * Tag the modified probe with the generation in which it was changed. + */ + probe->ftp_gen = fasttrap_mod_gen; +} + +static void +fasttrap_enable_callbacks(void) +{ + /* + * We don't have to play the rw lock game here because we're + * providing something rather than taking something away -- + * we can be sure that no threads have tried to follow this + * function pointer yet. + */ + mutex_enter(&fasttrap_count_mtx); + if (fasttrap_pid_count == 0) { + ASSERT(dtrace_pid_probe_ptr == NULL); + ASSERT(dtrace_return_probe_ptr == NULL); + dtrace_pid_probe_ptr = &fasttrap_pid_probe; + dtrace_return_probe_ptr = &fasttrap_return_probe; + } + ASSERT(dtrace_pid_probe_ptr == &fasttrap_pid_probe); + ASSERT(dtrace_return_probe_ptr == &fasttrap_return_probe); + fasttrap_pid_count++; + mutex_exit(&fasttrap_count_mtx); +} + +static void +fasttrap_disable_callbacks(void) +{ + ASSERT(MUTEX_HELD(&cpu_lock)); + + mutex_enter(&fasttrap_count_mtx); + ASSERT(fasttrap_pid_count > 0); + fasttrap_pid_count--; + if (fasttrap_pid_count == 0) { + cpu_t *cur, *cpu = CPU; + + for (cur = cpu->cpu_next_onln; cur != cpu; + cur = cur->cpu_next_onln) { + rw_enter(&cur->cpu_ft_lock, RW_WRITER); + } + + dtrace_pid_probe_ptr = NULL; + dtrace_return_probe_ptr = NULL; + + for (cur = cpu->cpu_next_onln; cur != cpu; + cur = cur->cpu_next_onln) { + rw_exit(&cur->cpu_ft_lock); + } + } + mutex_exit(&fasttrap_count_mtx); +} + +/*ARGSUSED*/ +static void +fasttrap_pid_enable(void *arg, dtrace_id_t id, void *parg) +{ + fasttrap_probe_t *probe = parg; + proc_t *p; + int i, rc; + + ASSERT(probe != NULL); + ASSERT(!probe->ftp_enabled); + ASSERT(id == probe->ftp_id); + ASSERT(MUTEX_HELD(&cpu_lock)); + + /* + * Increment the count of enabled probes on this probe's provider; + * the provider can't go away while the probe still exists. We + * must increment this even if we aren't able to properly enable + * this probe. + */ + mutex_enter(&probe->ftp_prov->ftp_mtx); + probe->ftp_prov->ftp_rcount++; + mutex_exit(&probe->ftp_prov->ftp_mtx); + + /* + * If this probe's provider is retired (meaning it was valid in a + * previously exec'ed incarnation of this address space), bail out. The + * provider can't go away while we're in this code path. + */ + if (probe->ftp_prov->ftp_retired) + return; + + /* + * If we can't find the process, it may be that we're in the context of + * a fork in which the traced process is being born and we're copying + * USDT probes. Otherwise, the process is gone so bail. + */ + if ((p = sprlock(probe->ftp_pid)) == NULL) { + if ((curproc->p_flag & SFORKING) == 0) + return; + + mutex_enter(&pidlock); + p = prfind(probe->ftp_pid); + + /* + * Confirm that curproc is indeed forking the process in which + * we're trying to enable probes. + */ + ASSERT(p != NULL); + ASSERT(p->p_parent == curproc); + ASSERT(p->p_stat == SIDL); + + mutex_enter(&p->p_lock); + mutex_exit(&pidlock); + + sprlock_proc(p); + } + + ASSERT(!(p->p_flag & SVFORK)); + mutex_exit(&p->p_lock); + + /* + * We have to enable the trap entry point before any user threads have + * the chance to execute the trap instruction we're about to place + * in their process's text. + */ + fasttrap_enable_callbacks(); + + /* + * Enable all the tracepoints and add this probe's id to each + * tracepoint's list of active probes. + */ + for (i = 0; i < probe->ftp_ntps; i++) { + if ((rc = fasttrap_tracepoint_enable(p, probe, i)) != 0) { + /* + * If enabling the tracepoint failed completely, + * we don't have to disable it; if the failure + * was only partial we must disable it. + */ + if (rc == FASTTRAP_ENABLE_FAIL) + i--; + else + ASSERT(rc == FASTTRAP_ENABLE_PARTIAL); + + /* + * Back up and pull out all the tracepoints we've + * created so far for this probe. + */ + while (i >= 0) { + fasttrap_tracepoint_disable(p, probe, i); + i--; + } + + mutex_enter(&p->p_lock); + sprunlock(p); + + /* + * Since we're not actually enabling this probe, + * drop our reference on the trap table entry. + */ + fasttrap_disable_callbacks(); + return; + } + } + + mutex_enter(&p->p_lock); + sprunlock(p); + + probe->ftp_enabled = 1; +} + +/*ARGSUSED*/ +static void +fasttrap_pid_disable(void *arg, dtrace_id_t id, void *parg) +{ + fasttrap_probe_t *probe = parg; + fasttrap_provider_t *provider = probe->ftp_prov; + proc_t *p; + int i, whack = 0; + + ASSERT(id == probe->ftp_id); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Jun 18 19:58:05 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80AF7106564A; Thu, 18 Jun 2009 19:58:05 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DF708FC15; Thu, 18 Jun 2009 19:58:05 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5IJw5qW021307; Thu, 18 Jun 2009 19:58:05 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5IJw5EX021306; Thu, 18 Jun 2009 19:58:05 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200906181958.n5IJw5EX021306@svn.freebsd.org> From: "George V. Neville-Neil" Date: Thu, 18 Jun 2009 19:58:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194458 - in user/gnn/fasttrap/sys/cddl/contrib/opensolaris: . uts/common/sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2009 19:58:05 -0000 Author: gnn Date: Thu Jun 18 19:58:05 2009 New Revision: 194458 URL: http://svn.freebsd.org/changeset/base/194458 Log: IFC grab the newly imported fasttrap_impl header file. Added: user/gnn/fasttrap/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h - copied unchanged from r194457, vendor-sys/opensolaris/dist/uts/common/sys/fasttrap_impl.h Modified: user/gnn/fasttrap/sys/cddl/contrib/opensolaris/ (props changed) Copied: user/gnn/fasttrap/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h (from r194457, vendor-sys/opensolaris/dist/uts/common/sys/fasttrap_impl.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/gnn/fasttrap/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h Thu Jun 18 19:58:05 2009 (r194458, copy of r194457, vendor-sys/opensolaris/dist/uts/common/sys/fasttrap_impl.h) @@ -0,0 +1,192 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _FASTTRAP_IMPL_H +#define _FASTTRAP_IMPL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Fasttrap Providers, Probes and Tracepoints + * + * Each Solaris process can have multiple providers -- the pid provider as + * well as any number of user-level statically defined tracing (USDT) + * providers. Those providers are each represented by a fasttrap_provider_t. + * All providers for a given process have a pointer to a shared + * fasttrap_proc_t. The fasttrap_proc_t has two states: active or defunct. + * When the count of active providers goes to zero it becomes defunct; a + * provider drops its active count when it is removed individually or as part + * of a mass removal when a process exits or performs an exec. + * + * Each probe is represented by a fasttrap_probe_t which has a pointer to + * its associated provider as well as a list of fasttrap_id_tp_t structures + * which are tuples combining a fasttrap_id_t and a fasttrap_tracepoint_t. + * A fasttrap_tracepoint_t represents the actual point of instrumentation + * and it contains two lists of fasttrap_id_t structures (to be fired pre- + * and post-instruction emulation) that identify the probes attached to the + * tracepoint. Tracepoints also have a pointer to the fasttrap_proc_t for the + * process they trace which is used when looking up a tracepoint both when a + * probe fires and when enabling and disabling probes. + * + * It's important to note that probes are preallocated with the necessary + * number of tracepoints, but that tracepoints can be shared by probes and + * swapped between probes. If a probe's preallocated tracepoint is enabled + * (and, therefore, the associated probe is enabled), and that probe is + * then disabled, ownership of that tracepoint may be exchanged for an + * unused tracepoint belonging to another probe that was attached to the + * enabled tracepoint. + */ + +typedef struct fasttrap_proc { + pid_t ftpc_pid; /* process ID for this proc */ + uint64_t ftpc_acount; /* count of active providers */ + uint64_t ftpc_rcount; /* count of extant providers */ + kmutex_t ftpc_mtx; /* lock on all but acount */ + struct fasttrap_proc *ftpc_next; /* next proc in hash chain */ +} fasttrap_proc_t; + +typedef struct fasttrap_provider { + pid_t ftp_pid; /* process ID for this prov */ + char ftp_name[DTRACE_PROVNAMELEN]; /* prov name (w/o the pid) */ + dtrace_provider_id_t ftp_provid; /* DTrace provider handle */ + uint_t ftp_marked; /* mark for possible removal */ + uint_t ftp_retired; /* mark when retired */ + kmutex_t ftp_mtx; /* provider lock */ + kmutex_t ftp_cmtx; /* lock on creating probes */ + uint64_t ftp_rcount; /* enabled probes ref count */ + uint64_t ftp_ccount; /* consumers creating probes */ + uint64_t ftp_mcount; /* meta provider count */ + fasttrap_proc_t *ftp_proc; /* shared proc for all provs */ + struct fasttrap_provider *ftp_next; /* next prov in hash chain */ +} fasttrap_provider_t; + +typedef struct fasttrap_id fasttrap_id_t; +typedef struct fasttrap_probe fasttrap_probe_t; +typedef struct fasttrap_tracepoint fasttrap_tracepoint_t; + +struct fasttrap_id { + fasttrap_probe_t *fti_probe; /* referrring probe */ + fasttrap_id_t *fti_next; /* enabled probe list on tp */ + fasttrap_probe_type_t fti_ptype; /* probe type */ +}; + +typedef struct fasttrap_id_tp { + fasttrap_id_t fit_id; + fasttrap_tracepoint_t *fit_tp; +} fasttrap_id_tp_t; + +struct fasttrap_probe { + dtrace_id_t ftp_id; /* DTrace probe identifier */ + pid_t ftp_pid; /* pid for this probe */ + fasttrap_provider_t *ftp_prov; /* this probe's provider */ + uintptr_t ftp_faddr; /* associated function's addr */ + size_t ftp_fsize; /* associated function's size */ + uint64_t ftp_gen; /* modification generation */ + uint64_t ftp_ntps; /* number of tracepoints */ + uint8_t *ftp_argmap; /* native to translated args */ + uint8_t ftp_nargs; /* translated argument count */ + uint8_t ftp_enabled; /* is this probe enabled */ + char *ftp_xtypes; /* translated types index */ + char *ftp_ntypes; /* native types index */ + fasttrap_id_tp_t ftp_tps[1]; /* flexible array */ +}; + +#define FASTTRAP_ID_INDEX(id) \ +((fasttrap_id_tp_t *)(((char *)(id) - offsetof(fasttrap_id_tp_t, fit_id))) - \ +&(id)->fti_probe->ftp_tps[0]) + +struct fasttrap_tracepoint { + fasttrap_proc_t *ftt_proc; /* associated process struct */ + uintptr_t ftt_pc; /* address of tracepoint */ + pid_t ftt_pid; /* pid of tracepoint */ + fasttrap_machtp_t ftt_mtp; /* ISA-specific portion */ + fasttrap_id_t *ftt_ids; /* NULL-terminated list */ + fasttrap_id_t *ftt_retids; /* NULL-terminated list */ + fasttrap_tracepoint_t *ftt_next; /* link in global hash */ +}; + +typedef struct fasttrap_bucket { + kmutex_t ftb_mtx; /* bucket lock */ + void *ftb_data; /* data payload */ + + uint8_t ftb_pad[64 - sizeof (kmutex_t) - sizeof (void *)]; +} fasttrap_bucket_t; + +typedef struct fasttrap_hash { + ulong_t fth_nent; /* power-of-2 num. of entries */ + ulong_t fth_mask; /* fth_nent - 1 */ + fasttrap_bucket_t *fth_table; /* array of buckets */ +} fasttrap_hash_t; + +/* + * If at some future point these assembly functions become observable by + * DTrace, then these defines should become separate functions so that the + * fasttrap provider doesn't trigger probes during internal operations. + */ +#define fasttrap_copyout copyout +#define fasttrap_fuword32 fuword32 +#define fasttrap_suword32 suword32 + +#define fasttrap_fulword fulword +#define fasttrap_sulword sulword + +extern void fasttrap_sigtrap(proc_t *, kthread_t *, uintptr_t); + +extern dtrace_id_t fasttrap_probe_id; +extern fasttrap_hash_t fasttrap_tpoints; + +#define FASTTRAP_TPOINTS_INDEX(pid, pc) \ + (((pc) / sizeof (fasttrap_instr_t) + (pid)) & fasttrap_tpoints.fth_mask) + +/* + * Must be implemented by fasttrap_isa.c + */ +extern int fasttrap_tracepoint_init(proc_t *, fasttrap_tracepoint_t *, + uintptr_t, fasttrap_probe_type_t); +extern int fasttrap_tracepoint_install(proc_t *, fasttrap_tracepoint_t *); +extern int fasttrap_tracepoint_remove(proc_t *, fasttrap_tracepoint_t *); + +extern int fasttrap_pid_probe(struct regs *); +extern int fasttrap_return_probe(struct regs *); + +extern uint64_t fasttrap_pid_getarg(void *, dtrace_id_t, void *, int, int); +extern uint64_t fasttrap_usdt_getarg(void *, dtrace_id_t, void *, int, int); + +#ifdef __cplusplus +} +#endif + +#endif /* _FASTTRAP_IMPL_H */ From owner-svn-src-user@FreeBSD.ORG Thu Jun 18 22:17:25 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA6791065672; Thu, 18 Jun 2009 22:17:25 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A8FC68FC13; Thu, 18 Jun 2009 22:17:25 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5IMHPRB023791; Thu, 18 Jun 2009 22:17:25 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5IMHPJu023788; Thu, 18 Jun 2009 22:17:25 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906182217.n5IMHPJu023788@svn.freebsd.org> From: Kip Macy Date: Thu, 18 Jun 2009 22:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194464 - in user/kmacy/releng_7_2_xen/sys/i386: include/xen xen X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2009 22:17:26 -0000 Author: kmacy Date: Thu Jun 18 22:17:25 2009 New Revision: 194464 URL: http://svn.freebsd.org/changeset/base/194464 Log: make gdtset visible for UP Modified: user/kmacy/releng_7_2_xen/sys/i386/include/xen/xen-os.h user/kmacy/releng_7_2_xen/sys/i386/xen/locore.s Modified: user/kmacy/releng_7_2_xen/sys/i386/include/xen/xen-os.h ============================================================================== --- user/kmacy/releng_7_2_xen/sys/i386/include/xen/xen-os.h Thu Jun 18 21:24:23 2009 (r194463) +++ user/kmacy/releng_7_2_xen/sys/i386/include/xen/xen-os.h Thu Jun 18 22:17:25 2009 (r194464) @@ -34,10 +34,10 @@ void force_evtchn_callback(void); #include #endif +extern int gdtset; #ifdef SMP #include /* XXX for pcpu.h */ #include /* XXX for PCPU_GET */ -extern int gdtset; static inline int smp_processor_id(void) { Modified: user/kmacy/releng_7_2_xen/sys/i386/xen/locore.s ============================================================================== --- user/kmacy/releng_7_2_xen/sys/i386/xen/locore.s Thu Jun 18 21:24:23 2009 (r194463) +++ user/kmacy/releng_7_2_xen/sys/i386/xen/locore.s Thu Jun 18 22:17:25 2009 (r194464) @@ -148,9 +148,7 @@ IdlePDPT: .long 0 /* phys addr of kerne .globl KPTphys #endif KPTphys: .long 0 /* phys addr of kernel page tables */ -#ifdef SMP .globl gdtset -#endif gdtset: .long 0 /* GDT is valid */ .globl proc0kstack From owner-svn-src-user@FreeBSD.ORG Thu Jun 18 22:33:03 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BD5B106567A; Thu, 18 Jun 2009 22:33:03 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A3208FC15; Thu, 18 Jun 2009 22:33:03 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5IMX3iB023949; Thu, 18 Jun 2009 22:33:03 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5IMX3ke023947; Thu, 18 Jun 2009 22:33:03 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906182233.n5IMX3ke023947@svn.freebsd.org> From: Kip Macy Date: Thu, 18 Jun 2009 22:33:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194465 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2009 22:33:03 -0000 Author: kmacy Date: Thu Jun 18 22:33:03 2009 New Revision: 194465 URL: http://svn.freebsd.org/changeset/base/194465 Log: don't return side effect of assignment Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 18 22:17:25 2009 (r194464) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 18 22:33:03 2009 (r194465) @@ -1301,7 +1301,7 @@ write_wr_hdr_sgl(unsigned int ndesc, str if (__predict_true(ndesc == 1)) { set_wr_hdr(wrp, htonl(F_WR_SOP | F_WR_EOP | V_WR_DATATYPE(1) | V_WR_SGLSFLT(flits)) | wr_hi, - wrp->wrh_lo = htonl(V_WR_LEN(flits + sgl_flits) | + htonl(V_WR_LEN(flits + sgl_flits) | V_WR_GEN(txqs->gen)) | wr_lo); /* XXX gen? */ wr_gen2(txd, txqs->gen); From owner-svn-src-user@FreeBSD.ORG Thu Jun 18 22:41:43 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96008106564A; Thu, 18 Jun 2009 22:41:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 852398FC1E; Thu, 18 Jun 2009 22:41:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5IMfhfa024099; Thu, 18 Jun 2009 22:41:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5IMfh1L024097; Thu, 18 Jun 2009 22:41:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906182241.n5IMfh1L024097@svn.freebsd.org> From: Kip Macy Date: Thu, 18 Jun 2009 22:41:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194466 - user/kmacy/releng_7_2_fcs/lib/libstand X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2009 22:41:43 -0000 Author: kmacy Date: Thu Jun 18 22:41:43 2009 New Revision: 194466 URL: http://svn.freebsd.org/changeset/base/194466 Log: increase number of file descriptors for the loader Modified: user/kmacy/releng_7_2_fcs/lib/libstand/ (props changed) user/kmacy/releng_7_2_fcs/lib/libstand/stand.h Modified: user/kmacy/releng_7_2_fcs/lib/libstand/stand.h ============================================================================== --- user/kmacy/releng_7_2_fcs/lib/libstand/stand.h Thu Jun 18 22:33:03 2009 (r194465) +++ user/kmacy/releng_7_2_fcs/lib/libstand/stand.h Thu Jun 18 22:41:43 2009 (r194466) @@ -167,7 +167,7 @@ struct open_file { #define SOPEN_RASIZE 512 }; -#define SOPEN_MAX 8 +#define SOPEN_MAX 64 extern struct open_file files[]; /* f_flags values */ From owner-svn-src-user@FreeBSD.ORG Thu Jun 18 23:16:32 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 140BE106564A; Thu, 18 Jun 2009 23:16:32 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0261F8FC12; Thu, 18 Jun 2009 23:16:32 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5INGVoZ024864; Thu, 18 Jun 2009 23:16:31 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5INGVAi024859; Thu, 18 Jun 2009 23:16:31 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906182316.n5INGVAi024859@svn.freebsd.org> From: Kip Macy Date: Thu, 18 Jun 2009 23:16:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194467 - in user/kmacy/releng_7_2_fcs/sys: kern sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2009 23:16:32 -0000 Author: kmacy Date: Thu Jun 18 23:16:31 2009 New Revision: 194467 URL: http://svn.freebsd.org/changeset/base/194467 Log: use shared lockmgr locks for range-locked file systems Modified: user/kmacy/releng_7_2_fcs/sys/kern/vfs_syscalls.c user/kmacy/releng_7_2_fcs/sys/kern/vfs_vnops.c user/kmacy/releng_7_2_fcs/sys/kern/vnode_if.src user/kmacy/releng_7_2_fcs/sys/sys/mount.h Modified: user/kmacy/releng_7_2_fcs/sys/kern/vfs_syscalls.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/vfs_syscalls.c Thu Jun 18 22:41:43 2009 (r194466) +++ user/kmacy/releng_7_2_fcs/sys/kern/vfs_syscalls.c Thu Jun 18 23:16:31 2009 (r194467) @@ -3273,7 +3273,7 @@ fsync(td, uap) struct mount *mp; struct file *fp; int vfslocked; - int error; + int error, lock_flags; AUDIT_ARG(fd, uap->fd); if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) @@ -3282,7 +3282,13 @@ fsync(td, uap) vfslocked = VFS_LOCK_GIANT(vp->v_mount); if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) goto drop; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); + if (MNT_SHARED_WRITES(mp) || + ((mp == NULL) && MNT_SHARED_WRITES(vp->v_mount))) { + lock_flags = LK_SHARED; + } else { + lock_flags = LK_EXCLUSIVE; + } + vn_lock(vp, lock_flags | LK_RETRY, td); AUDIT_ARG(vnode, vp, ARG_VNODE1); if (vp->v_object != NULL) { VM_OBJECT_LOCK(vp->v_object); Modified: user/kmacy/releng_7_2_fcs/sys/kern/vfs_vnops.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/vfs_vnops.c Thu Jun 18 22:41:43 2009 (r194466) +++ user/kmacy/releng_7_2_fcs/sys/kern/vfs_vnops.c Thu Jun 18 23:16:31 2009 (r194467) @@ -351,7 +351,7 @@ vn_rdwr(rw, vp, base, len, offset, segfl struct iovec aiov; struct mount *mp; struct ucred *cred; - int error; + int error, lock_flags; VFS_ASSERT_GIANT(vp->v_mount); @@ -362,10 +362,14 @@ vn_rdwr(rw, vp, base, len, offset, segfl (error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) return (error); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); - } else - vn_lock(vp, LK_SHARED | LK_RETRY, td); - + if (MNT_SHARED_WRITES(mp) || + ((mp == NULL) && MNT_SHARED_WRITES(vp->v_mount))) { + lock_flags = LK_SHARED; + } else { + lock_flags = LK_EXCLUSIVE; + } + vn_lock(vp, lock_flags | LK_RETRY, td); + } } ASSERT_VOP_LOCKED(vp, "IO_NODELOCKED with no vp lock held"); auio.uio_iov = &aiov; @@ -469,6 +473,7 @@ vn_rdwr_inchunks(rw, vp, base, len, offs return (error); } + /* * File table vnode read routine. */ @@ -549,7 +554,7 @@ vn_write(fp, uio, active_cred, flags, td { struct vnode *vp; struct mount *mp; - int error, ioflag; + int error, ioflag, lock_flags; int vfslocked; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", @@ -573,7 +578,15 @@ vn_write(fp, uio, active_cred, flags, td (error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) goto unlock; VOP_LEASE(vp, td, fp->f_cred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); + if ((MNT_SHARED_WRITES(mp) || + ((mp == NULL) && MNT_SHARED_WRITES(vp->v_mount))) && + (flags & FOF_OFFSET) != 0) { + lock_flags = LK_SHARED; + } else { + lock_flags = LK_EXCLUSIVE; + } + + vn_lock(vp, lock_flags | LK_RETRY, td); if ((flags & FOF_OFFSET) == 0) uio->uio_offset = fp->f_offset; ioflag |= sequential_heuristic(uio, fp); Modified: user/kmacy/releng_7_2_fcs/sys/kern/vnode_if.src ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/vnode_if.src Thu Jun 18 22:41:43 2009 (r194466) +++ user/kmacy/releng_7_2_fcs/sys/kern/vnode_if.src Thu Jun 18 23:16:31 2009 (r194467) @@ -185,7 +185,7 @@ vop_read { }; -%% write vp E E E +%% write vp L L L %! write pre VOP_WRITE_PRE %! write post VOP_WRITE_POST @@ -245,7 +245,7 @@ vop_revoke { }; -%% fsync vp E E E +%% fsync vp L L L vop_fsync { IN struct vnode *vp; Modified: user/kmacy/releng_7_2_fcs/sys/sys/mount.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/sys/mount.h Thu Jun 18 22:41:43 2009 (r194466) +++ user/kmacy/releng_7_2_fcs/sys/sys/mount.h Thu Jun 18 23:16:31 2009 (r194467) @@ -328,6 +328,7 @@ void __mnt_vnode_markerfree(str #define MNTK_SOFTDEP 0x00000004 /* async disabled by softdep */ #define MNTK_NOINSMNTQ 0x00000008 /* insmntque is not allowed */ #define MNTK_REFEXPIRE 0x00000020 /* refcount expiring is happening */ +#define MNTK_SHARED_WRITES 0x00000080 /* Allow shared locking for writes */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ #define MNTK_SUSPEND 0x08000000 /* request write suspension */ @@ -337,6 +338,9 @@ void __mnt_vnode_markerfree(str #define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */ #define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */ +#define MNT_SHARED_WRITES(mp) (((mp) != NULL) && \ + ((mp)->mnt_kern_flag & MNTK_SHARED_WRITES)) + /* * Sysctl CTL_VFS definitions. * From owner-svn-src-user@FreeBSD.ORG Fri Jun 19 04:25:44 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F674106566C; Fri, 19 Jun 2009 04:25:44 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C4618FC1D; Fri, 19 Jun 2009 04:25:44 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5J4Pikm030879; Fri, 19 Jun 2009 04:25:44 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5J4Piuq030877; Fri, 19 Jun 2009 04:25:44 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906190425.n5J4Piuq030877@svn.freebsd.org> From: Kip Macy Date: Fri, 19 Jun 2009 04:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194468 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2009 04:25:45 -0000 Author: kmacy Date: Fri Jun 19 04:25:44 2009 New Revision: 194468 URL: http://svn.freebsd.org/changeset/base/194468 Log: use shared lockmgr Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jun 18 23:16:31 2009 (r194467) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Jun 19 04:25:44 2009 (r194468) @@ -588,6 +588,7 @@ zfs_domount(vfs_t *vfsp, char *osname) vfsp->mnt_flag |= MNT_LOCAL; vfsp->mnt_kern_flag |= MNTK_MPSAFE; vfsp->mnt_kern_flag |= MNTK_LOOKUP_SHARED; + vfsp->mnt_kern_flag |= MNTK_SHARED_WRITES; if (error = dsl_prop_get_integer(osname, "readonly", &readonly, NULL)) goto out; From owner-svn-src-user@FreeBSD.ORG Fri Jun 19 05:14:46 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42A6C1065672; Fri, 19 Jun 2009 05:14:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 310488FC1C; Fri, 19 Jun 2009 05:14:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5J5EkP7031940; Fri, 19 Jun 2009 05:14:46 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5J5EkIN031938; Fri, 19 Jun 2009 05:14:46 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906190514.n5J5EkIN031938@svn.freebsd.org> From: Kip Macy Date: Fri, 19 Jun 2009 05:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194471 - in user/kmacy/releng_7_2_fcs/usr.sbin: . pppd pppstats X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2009 05:14:46 -0000 Author: kmacy Date: Fri Jun 19 05:14:45 2009 New Revision: 194471 URL: http://svn.freebsd.org/changeset/base/194471 Log: remove stale ppp references Deleted: user/kmacy/releng_7_2_fcs/usr.sbin/pppd/ user/kmacy/releng_7_2_fcs/usr.sbin/pppstats/ Modified: user/kmacy/releng_7_2_fcs/usr.sbin/Makefile Modified: user/kmacy/releng_7_2_fcs/usr.sbin/Makefile ============================================================================== --- user/kmacy/releng_7_2_fcs/usr.sbin/Makefile Fri Jun 19 05:00:17 2009 (r194470) +++ user/kmacy/releng_7_2_fcs/usr.sbin/Makefile Fri Jun 19 05:14:45 2009 (r194471) @@ -129,8 +129,6 @@ SUBDIR= ${_ac} \ powerd \ ${_ppp} \ ${_pppctl} \ - ${_pppd} \ - ${_pppstats} \ ${_praliases} \ ${_praudit} \ procctl \ From owner-svn-src-user@FreeBSD.ORG Fri Jun 19 05:15:19 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85F541065690; Fri, 19 Jun 2009 05:15:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59DA98FC0C; Fri, 19 Jun 2009 05:15:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5J5FJVe031995; Fri, 19 Jun 2009 05:15:19 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5J5FJKA031994; Fri, 19 Jun 2009 05:15:19 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906190515.n5J5FJKA031994@svn.freebsd.org> From: Kip Macy Date: Fri, 19 Jun 2009 05:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194472 - user/kmacy/releng_7_2_fcs/sys/cddl/compat/opensolaris/rpc X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2009 05:15:20 -0000 Author: kmacy Date: Fri Jun 19 05:15:19 2009 New Revision: 194472 URL: http://svn.freebsd.org/changeset/base/194472 Log: remove redundant xdr header Deleted: user/kmacy/releng_7_2_fcs/sys/cddl/compat/opensolaris/rpc/xdr.h From owner-svn-src-user@FreeBSD.ORG Fri Jun 19 05:18:44 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C6A1106566C; Fri, 19 Jun 2009 05:18:44 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5AFAE8FC08; Fri, 19 Jun 2009 05:18:44 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5J5IiML032083; Fri, 19 Jun 2009 05:18:44 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5J5Iil0032081; Fri, 19 Jun 2009 05:18:44 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906190518.n5J5Iil0032081@svn.freebsd.org> From: Kip Macy Date: Fri, 19 Jun 2009 05:18:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194473 - user/kmacy/releng_7_2_fcs/sys/boot/i386/loader X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2009 05:18:44 -0000 Author: kmacy Date: Fri Jun 19 05:18:43 2009 New Revision: 194473 URL: http://svn.freebsd.org/changeset/base/194473 Log: define LIBZFS in the non MK_ZFS case Modified: user/kmacy/releng_7_2_fcs/sys/boot/i386/loader/Makefile Modified: user/kmacy/releng_7_2_fcs/sys/boot/i386/loader/Makefile ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/boot/i386/loader/Makefile Fri Jun 19 05:15:19 2009 (r194472) +++ user/kmacy/releng_7_2_fcs/sys/boot/i386/loader/Makefile Fri Jun 19 05:18:43 2009 (r194473) @@ -19,6 +19,8 @@ LIBFIREWIRE= ${.OBJDIR}/../libfirewire/l .if ${MK_ZFS} != "no" CFLAGS+= -DLOADER_ZFS_SUPPORT LIBZFS= ${.OBJDIR}/../../zfs/libzfsboot.a +.else +LIBZFS= .endif # Enable PXE TFTP or NFS support, not both. From owner-svn-src-user@FreeBSD.ORG Fri Jun 19 19:59:43 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8C371065670; Fri, 19 Jun 2009 19:59:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7DF88FC19; Fri, 19 Jun 2009 19:59:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5JJxhw0053833; Fri, 19 Jun 2009 19:59:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5JJxhoc053831; Fri, 19 Jun 2009 19:59:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906191959.n5JJxhoc053831@svn.freebsd.org> From: Kip Macy Date: Fri, 19 Jun 2009 19:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194509 - user/kmacy/releng_7_2_fcs/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2009 19:59:44 -0000 Author: kmacy Date: Fri Jun 19 19:59:43 2009 New Revision: 194509 URL: http://svn.freebsd.org/changeset/base/194509 Log: add flag for per-packet multipath routing Modified: user/kmacy/releng_7_2_fcs/sys/net/route.h Modified: user/kmacy/releng_7_2_fcs/sys/net/route.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/route.h Fri Jun 19 19:28:21 2009 (r194508) +++ user/kmacy/releng_7_2_fcs/sys/net/route.h Fri Jun 19 19:59:43 2009 (r194509) @@ -192,7 +192,7 @@ struct ortentry { /* 0x20000 unused, was RTF_WASCLONED */ #define RTF_PROTO3 0x40000 /* protocol specific routing flag */ -/* 0x80000 unused */ +#define RTF_PPACKET 0x80000 /* per-packet load balancing */ #define RTF_PINNED 0x100000 /* future use */ #define RTF_LOCAL 0x200000 /* route represents a local address */ #define RTF_BROADCAST 0x400000 /* route represents a bcast address */ From owner-svn-src-user@FreeBSD.ORG Fri Jun 19 20:05:10 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 642C2106564A; Fri, 19 Jun 2009 20:05:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3759F8FC21; Fri, 19 Jun 2009 20:05:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5JK5A9f053991; Fri, 19 Jun 2009 20:05:10 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5JK5AuT053988; Fri, 19 Jun 2009 20:05:10 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906192005.n5JK5AuT053988@svn.freebsd.org> From: Kip Macy Date: Fri, 19 Jun 2009 20:05:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194510 - user/kmacy/releng_7_2_fcs/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2009 20:05:10 -0000 Author: kmacy Date: Fri Jun 19 20:05:09 2009 New Revision: 194510 URL: http://svn.freebsd.org/changeset/base/194510 Log: add per-packet support to rtalloc_mpath_fib Modified: user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.c user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.h Modified: user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.c Fri Jun 19 19:59:43 2009 (r194509) +++ user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.c Fri Jun 19 20:05:09 2009 (r194510) @@ -258,8 +258,11 @@ different: return 0; } -void -rtalloc_mpath_fib(struct route *ro, uint32_t hash, u_int fibnum) +#define RT_MP_NORMAL 0 +#define RT_MP_LIST 1 + +static void +rtalloc_mpath_fib_(struct route *ro, uint32_t hash, u_int fibnum, int type) { struct radix_node *rn0, *rn; u_int32_t n; @@ -277,15 +280,19 @@ rtalloc_mpath_fib(struct route *ro, uint /* if the route does not exist or it is not multipath, don't care */ if (ro->ro_rt == NULL) return; - if (rn_mpath_next((struct radix_node *)ro->ro_rt) == NULL) { + if (rn_mpath_next((struct radix_node *)ro->ro_rt) == NULL || + ((type == RT_MP_LIST) && (ro->ro_rt->rt_flags & RTF_PPACKET))) { RT_UNLOCK(ro->ro_rt); return; } - + /* beyond here, we use rn as the master copy */ rn0 = rn = (struct radix_node *)ro->ro_rt; n = rn_mpath_count(rn0); + if (ro->ro_rt->rt_flags & RTF_PPACKET) + hash = arc4random(); + /* gw selection by Modulo-N Hash (RFC2991) XXX need improvement? */ hash += hashjitter; hash %= n; @@ -317,6 +324,21 @@ rtalloc_mpath_fib(struct route *ro, uint RT_UNLOCK(ro->ro_rt); } +void +rtalloc_mpath_fib_list(struct route *ro, uint32_t hash, u_int fibnum) +{ + + rtalloc_mpath_fib_(ro, hash, fibnum, RT_MP_LIST); +} + + +void +rtalloc_mpath_fib(struct route *ro, uint32_t hash, u_int fibnum) +{ + + rtalloc_mpath_fib_(ro, hash, fibnum, RT_MP_NORMAL); +} + extern int in6_inithead(void **head, int off); extern int in_inithead(void **head, int off); Modified: user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.h Fri Jun 19 19:59:43 2009 (r194509) +++ user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.h Fri Jun 19 20:05:09 2009 (r194510) @@ -51,6 +51,7 @@ struct rtentry *rt_mpath_matchgate(struc int rt_mpath_conflict(struct radix_node_head *, struct rtentry *, struct sockaddr *); void rtalloc_mpath_fib(struct route *, u_int32_t, u_int); +void rtalloc_mpath_fib_list(struct route *ro, uint32_t hash, u_int fibnum); #define rtalloc_mpath(_route, _hash) rtalloc_mpath_fib((_route), (_hash), 0) struct radix_node *rn_mpath_lookup(void *, void *, struct radix_node_head *); From owner-svn-src-user@FreeBSD.ORG Fri Jun 19 20:05:34 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7557210656C2; Fri, 19 Jun 2009 20:05:34 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63ED18FC0A; Fri, 19 Jun 2009 20:05:34 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5JK5Y9T054038; Fri, 19 Jun 2009 20:05:34 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5JK5Y4J054035; Fri, 19 Jun 2009 20:05:34 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906192005.n5JK5Y4J054035@svn.freebsd.org> From: Kip Macy Date: Fri, 19 Jun 2009 20:05:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194511 - user/kmacy/releng_7_2_fcs/sbin/route X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2009 20:05:34 -0000 Author: kmacy Date: Fri Jun 19 20:05:34 2009 New Revision: 194511 URL: http://svn.freebsd.org/changeset/base/194511 Log: add per-packet support to route command Modified: user/kmacy/releng_7_2_fcs/sbin/route/keywords user/kmacy/releng_7_2_fcs/sbin/route/route.c Modified: user/kmacy/releng_7_2_fcs/sbin/route/keywords ============================================================================== --- user/kmacy/releng_7_2_fcs/sbin/route/keywords Fri Jun 19 20:05:09 2009 (r194510) +++ user/kmacy/releng_7_2_fcs/sbin/route/keywords Fri Jun 19 20:05:34 2009 (r194511) @@ -34,7 +34,9 @@ net netmask nostatic nostick +noppacket osi +ppacket prefixlen proto1 proto2 Modified: user/kmacy/releng_7_2_fcs/sbin/route/route.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sbin/route/route.c Fri Jun 19 20:05:09 2009 (r194510) +++ user/kmacy/releng_7_2_fcs/sbin/route/route.c Fri Jun 19 20:05:34 2009 (r194511) @@ -644,6 +644,12 @@ newroute(argc, argv) case K_NOSTICK: flags &= ~RTF_STICKY; break; + case K_PPACKET: + flags |= RTF_PPACKET; + break; + case K_NOPPACKET: + flags &= ~RTF_PPACKET; + break; case K_IFA: if (!--argc) usage((char *)NULL); @@ -1310,7 +1316,7 @@ char metricnames[] = char routeflags[] = "\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE" "\012XRESOLVE\013LLINFO\014STATIC\015BLACKHOLE" -"\017PROTO2\020PROTO1\021PRCLONING\022WASCLONED\023PROTO3" +"\017PROTO2\020PROTO1\021PRCLONING\022WASCLONED\023PROTO3\024PPACKET" "\025PINNED\026LOCAL\027BROADCAST\030MULTICAST\035STICKY"; char ifnetflags[] = "\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6b6\7RUNNING\010NOARP"