From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 00:02:53 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 2D9611065670; Sun, 7 Jun 2009 00:02:53 +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 0BB498FC19; Sun, 7 Jun 2009 00:02:53 +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 n5702qqX075270; Sun, 7 Jun 2009 00:02:52 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5702qP7075266; Sun, 7 Jun 2009 00:02:52 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070002.n5702qP7075266@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 00:02: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: r193598 - in user/kmacy/releng_7_2_fcs/sys/dev/cxgb: . 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: Sun, 07 Jun 2009 00:02:53 -0000 Author: kmacy Date: Sun Jun 7 00:02:52 2009 New Revision: 193598 URL: http://svn.freebsd.org/changeset/base/193598 Log: - minimize the number of descriptors that are used by a delayed transmit / watchdog - add once per second watchdog Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Sat Jun 6 22:20:41 2009 (r193597) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Sun Jun 7 00:02:52 2009 (r193598) @@ -243,6 +243,7 @@ struct sge_txq { struct buf_ring *txq_mr; struct ifaltq *txq_ifq; struct callout txq_timer; + struct callout txq_watchdog; uint32_t txq_drops; uint32_t txq_skipped; uint32_t txq_coalesced; @@ -267,6 +268,7 @@ enum { #define QS_EXITING 0x1 #define QS_RUNNING 0x2 #define QS_BOUND 0x4 +#define QS_FLUSHING 0x8 struct sge_qset { struct sge_rspq rspq; @@ -562,9 +564,8 @@ static inline int offload_running(adapte return isset(&adapter->open_device_map, OFFLOAD_DEVMAP_BIT); } +void cxgb_tx_watchdog(void *arg); int cxgb_transmit(struct ifnet *ifp, struct mbuf *m); void cxgb_qflush(struct ifnet *ifp); -int process_responses(adapter_t *adap, struct sge_qset *qs, int budget); void cxgb_start(struct ifnet *ifp); -void refill_fl_service(adapter_t *adap, struct sge_fl *fl); #endif Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Sat Jun 6 22:20:41 2009 (r193597) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Sun Jun 7 00:02:52 2009 (r193598) @@ -1936,7 +1936,7 @@ cxgb_init_locked(struct port_info *p) { struct ifnet *ifp; adapter_t *sc = p->adapter; - int err; + int i, err; PORT_LOCK_ASSERT_OWNED(p); ifp = p->ifp; @@ -1972,11 +1972,18 @@ cxgb_init_locked(struct port_info *p) device_printf(sc->dev, "enabling interrupts on port=%d\n", p->port_id); t3_port_intr_enable(sc, p->port_id); - callout_reset(&sc->cxgb_tick_ch, CXGB_TICKS(sc), cxgb_tick, sc); t3_sge_reset_adapter(sc); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + callout_reset(&sc->cxgb_tick_ch, CXGB_TICKS(sc), cxgb_tick, sc); + for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { + struct sge_qset *qs = &sc->sge.qs[i]; + struct sge_txq *txq = &qs->txq[TXQ_ETH]; + + callout_reset_on(&txq->txq_watchdog, hz, cxgb_tx_watchdog, + qs, txq->txq_watchdog.c_cpu); + } } static void 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 Sat Jun 6 22:20:41 2009 (r193597) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 00:02:52 2009 (r193598) @@ -704,12 +704,6 @@ __refill_fl_lt(adapter_t *adap, struct s refill_fl(adap, fl, min(max, fl->size - fl->credits)); } -void -refill_fl_service(adapter_t *adap, struct sge_fl *fl) -{ - __refill_fl_lt(adap, fl, 512); -} - /** * recycle_rx_buf - recycle a receive buffer * @adapter: the adapter @@ -1327,7 +1321,7 @@ t3_encap(struct sge_qset *qs, struct mbu return (err); } KASSERT(m0->m_pkthdr.len, ("empty packet nsegs=%d", nsegs)); - txsd->m = m0; + txsd->m = m0; if (m0->m_nextpkt != NULL) { struct cpl_tx_pkt_batch *cpl_batch = (struct cpl_tx_pkt_batch *)txd; @@ -1491,13 +1485,33 @@ t3_encap(struct sge_qset *qs, struct mbu return (0); } +void +cxgb_tx_watchdog(void *arg) +{ + struct sge_qset *qs = arg; + struct sge_txq *txq = &qs->txq[TXQ_ETH]; + + if (TXQ_TRYLOCK(qs)) { + qs->qs_flags |= QS_FLUSHING; + cxgb_start_locked(qs); + qs->qs_flags &= ~QS_FLUSHING; + TXQ_UNLOCK(qs); + } + if (qs->port->ifp->if_drv_flags & IFF_DRV_RUNNING) + callout_reset_on(&txq->txq_watchdog, hz, cxgb_tx_watchdog, + qs, txq->txq_watchdog.c_cpu); +} + + static void cxgb_tx_timeout(void *arg) { struct sge_qset *qs = arg; if (TXQ_TRYLOCK(qs)) { + qs->qs_flags |= QS_FLUSHING; cxgb_start_locked(qs); + qs->qs_flags &= ~QS_FLUSHING; TXQ_UNLOCK(qs); } } @@ -1564,6 +1578,10 @@ cxgb_start_locked(struct sge_qset *qs) avail = txq->size - txq->in_use - 4; txmax = min(TX_START_MAX_DESC, avail); + /* in case all packets use more than one mbuf */ + if (qs->qs_flags & QS_FLUSHING) + txmax = min(txmax, 7); + TXQ_LOCK_ASSERT(qs); while ((txq->in_use - in_use_init < txmax) && (!TXQ_RING_EMPTY(qs)) && @@ -1620,7 +1638,8 @@ cxgb_transmit_locked(struct ifnet *ifp, * - there are no packets enqueued already * - there is space in hardware transmit queue */ - if (sc->tunq_coalesce == 0 && pi->link_config.link_ok && + if (sc->tunq_coalesce == 0 && + pi->link_config.link_ok && TXQ_RING_EMPTY(qs) && avail > 4) { if (t3_encap(qs, &m)) { if (m != NULL && @@ -2501,7 +2520,9 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i } ifq_attach(q->txq[i].txq_ifq, pi->ifp); callout_init(&q->txq[i].txq_timer, 1); + callout_init(&q->txq[i].txq_watchdog, 1); q->txq[i].txq_timer.c_cpu = id % mp_ncpus; + q->txq[i].txq_watchdog.c_cpu = id % mp_ncpus; } init_qset_cntxt(q, id); q->idx = id; @@ -2888,7 +2909,7 @@ check_ring_db(adapter_t *adap, struct sg * on this queue. If the system is under memory shortage use a fairly * long delay to help recovery. */ -int +static int process_responses(adapter_t *adap, struct sge_qset *qs, int budget) { struct sge_rspq *rspq = &qs->rspq; Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Sat Jun 6 22:20:41 2009 (r193597) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Sun Jun 7 00:02:52 2009 (r193598) @@ -73,9 +73,9 @@ m_freem_list(struct mbuf *m) while (m != NULL) { #ifdef INVARIANTS - if ((m == (struct mbuf *)0xDEADCODE) || + if ((m == (struct mbuf *)0xDEADC0DE) || m == (struct mbuf *)0xdeadc0dedeadc0de) - panic("freed mbuf %d in mbuf list", i); + panic("%s freed mbuf %d in mbuf list", __FUNCTION__, i); i++; #endif n = m->m_nextpkt; From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 00:27:45 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 DA5901065674; Sun, 7 Jun 2009 00:27:45 +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 C8F7D8FC0A; Sun, 7 Jun 2009 00:27:45 +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 n570Rj7F076345; Sun, 7 Jun 2009 00:27:45 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n570RjcP076344; Sun, 7 Jun 2009 00:27:45 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070027.n570RjcP076344@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 00:27:45 +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: r193599 - 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: Sun, 07 Jun 2009 00:27:46 -0000 Author: kmacy Date: Sun Jun 7 00:27:45 2009 New Revision: 193599 URL: http://svn.freebsd.org/changeset/base/193599 Log: don't free mbuf if it is part of a chain 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 Sun Jun 7 00:02:52 2009 (r193598) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 00:27:45 2009 (r193599) @@ -266,6 +266,56 @@ set_wr_hdr(struct work_request_hdr *wrp, } #endif +struct coalesce_info { + int count; + int nbytes; +}; + +static int +coalesce_check(struct mbuf *m, void *arg) +{ + struct coalesce_info *ci = arg; + int *count = &ci->count; + int *nbytes = &ci->nbytes; + + if ((*nbytes + m->m_len <= 10500) && (*count < 7) && + (m->m_next == NULL)){ + *count += 1; + *nbytes += m->m_len; + return (1); + } + return (0); +} + +static struct mbuf * +cxgb_dequeue(struct sge_qset *qs) +{ + struct mbuf *m, *m_head, *m_tail; + struct coalesce_info ci; + + if (qs->port->adapter->tunq_coalesce) { + m = TXQ_RING_DEQUEUE(qs); + if (m != NULL && m->m_nextpkt != NULL) + panic("dequeued regular packet with nextpkt set!"); + } + + m_head = m_tail = NULL; + ci.count = ci.nbytes = 0; + do { + m = TXQ_RING_DEQUEUE_COND(qs, coalesce_check, &ci); + if (m_head == NULL) { + m_tail = m_head = m; + } else if (m != NULL) { + m_tail->m_nextpkt = m; + m_tail = m; + m->m_nextpkt = NULL; + } + } while (m != NULL); + if (ci.count > 7) + panic("trying to coalesce %d packets in to one WR", ci.count); + return (m_head); +} + /** * reclaim_completed_tx - reclaims completed Tx descriptors * @adapter: the adapter @@ -1502,7 +1552,6 @@ cxgb_tx_watchdog(void *arg) qs, txq->txq_watchdog.c_cpu); } - static void cxgb_tx_timeout(void *arg) { @@ -1516,56 +1565,6 @@ cxgb_tx_timeout(void *arg) } } -struct coalesce_info { - int count; - int nbytes; -}; - -static int -coalesce_check(struct mbuf *m, void *arg) -{ - struct coalesce_info *ci = arg; - int *count = &ci->count; - int *nbytes = &ci->nbytes; - - if ((*nbytes + m->m_len <= 10500) && (*count < 7) && - (m->m_next == NULL)){ - *count += 1; - *nbytes += m->m_len; - return (1); - } - return (0); -} - -static struct mbuf * -cxgb_dequeue(struct sge_qset *qs) -{ - struct mbuf *m, *m_head, *m_tail; - struct coalesce_info ci; - - if (qs->port->adapter->tunq_coalesce) { - m = TXQ_RING_DEQUEUE(qs); - if (m != NULL && m->m_nextpkt != NULL) - panic("dequeued regular packet with nextpkt set!"); - } - - m_head = m_tail = NULL; - ci.count = ci.nbytes = 0; - do { - m = TXQ_RING_DEQUEUE_COND(qs, coalesce_check, &ci); - if (m_head == NULL) { - m_tail = m_head = m; - } else if (m != NULL) { - m_tail->m_nextpkt = m; - m_tail = m; - m->m_nextpkt = NULL; - } - } while (m != NULL); - if (ci.count > 7) - panic("trying to coalesce %d packets in to one WR", ci.count); - return (m_head); -} - static void cxgb_start_locked(struct sge_qset *qs) { @@ -1596,7 +1595,7 @@ cxgb_start_locked(struct sge_qset *qs) * Encapsulation can modify our pointer, and or make it * NULL on failure. In that event, we can't requeue. */ - if (t3_encap(qs, &m_head)) + if (t3_encap(qs, &m_head) || m_head == NULL) break; /* Send a copy of the frame to the BPF listener */ @@ -1605,7 +1604,8 @@ cxgb_start_locked(struct sge_qset *qs) /* * We sent via PIO, no longer need a copy */ - if (m_head->m_pkthdr.len <= PIO_LEN) + if (m->head->m_nextpkt == NULL && + m_head->m_pkthdr.len <= PIO_LEN) m_freem(m_head); m_head = NULL; From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 00:47:29 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 372CC106566B; Sun, 7 Jun 2009 00:47:29 +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 E3EBF8FC13; Sun, 7 Jun 2009 00:47:28 +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 n570lSB0076723; Sun, 7 Jun 2009 00:47:28 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n570lSXQ076721; Sun, 7 Jun 2009 00:47:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070047.n570lSXQ076721@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 00:47:28 +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: r193600 - 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: Sun, 07 Jun 2009 00:47:29 -0000 Author: kmacy Date: Sun Jun 7 00:47:28 2009 New Revision: 193600 URL: http://svn.freebsd.org/changeset/base/193600 Log: drain callouts on detach Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Sun Jun 7 00:27:45 2009 (r193599) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Sun Jun 7 00:47:28 2009 (r193600) @@ -1033,10 +1033,15 @@ cxgb_port_detach(device_t dev) cxgb_stop_locked(p); PORT_UNLOCK(p); + for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { + struct sge_qset *qs = &sc->sge.qs[i]; + struct sge_txq *txq = &qs->txq[TXQ_ETH]; + + callout_drain(&txq->txq_watchdog); + callout_drain(&txq->txq_timer); + } ether_ifdetach(p->ifp); - printf("waiting for callout to stop ..."); DELAY(1000000); - printf("done\n"); /* * the lock may be acquired in ifdetach */ 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 Sun Jun 7 00:27:45 2009 (r193599) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 00:47:28 2009 (r193600) @@ -1604,7 +1604,7 @@ cxgb_start_locked(struct sge_qset *qs) /* * We sent via PIO, no longer need a copy */ - if (m->head->m_nextpkt == NULL && + if (m_head->m_nextpkt == NULL && m_head->m_pkthdr.len <= PIO_LEN) m_freem(m_head); From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 00:52:02 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 9E731106566C; Sun, 7 Jun 2009 00:52:02 +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 8D30E8FC14; Sun, 7 Jun 2009 00:52:02 +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 n570q2ht076840; Sun, 7 Jun 2009 00:52:02 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n570q260076839; Sun, 7 Jun 2009 00:52:02 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070052.n570q260076839@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 00:52:02 +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: r193601 - 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: Sun, 07 Jun 2009 00:52:02 -0000 Author: kmacy Date: Sun Jun 7 00:52:02 2009 New Revision: 193601 URL: http://svn.freebsd.org/changeset/base/193601 Log: add missed variable declarations Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Sun Jun 7 00:47:28 2009 (r193600) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Sun Jun 7 00:52:02 2009 (r193601) @@ -1025,6 +1025,7 @@ static int cxgb_port_detach(device_t dev) { struct port_info *p; + int i; p = device_get_softc(dev); @@ -1034,6 +1035,7 @@ cxgb_port_detach(device_t dev) PORT_UNLOCK(p); for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { + struct adapter *sc = p->adapter; struct sge_qset *qs = &sc->sge.qs[i]; struct sge_txq *txq = &qs->txq[TXQ_ETH]; From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 01:02:33 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 A81611065674; Sun, 7 Jun 2009 01:02:33 +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 96C308FC14; Sun, 7 Jun 2009 01:02:33 +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 n5712XYg077091; Sun, 7 Jun 2009 01:02:33 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5712XF3077090; Sun, 7 Jun 2009 01:02:33 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070102.n5712XF3077090@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 01:02:33 +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: r193602 - 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: Sun, 07 Jun 2009 01:02:33 -0000 Author: kmacy Date: Sun Jun 7 01:02:33 2009 New Revision: 193602 URL: http://svn.freebsd.org/changeset/base/193602 Log: always enqueue a timeout if the ring is not empty 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 Sun Jun 7 00:52:02 2009 (r193601) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 01:02:33 2009 (r193602) @@ -1612,7 +1612,9 @@ cxgb_start_locked(struct sge_qset *qs) /* Set timeout in case hardware has problems transmitting. */ pi->watchdog_timer = CXGB_TX_TIMEOUT; } - + if (!TXQ_RING_EMPTY(qs) && callout_pending(&txq->txq_timer) == 0) + callout_reset_on(&txq->txq_timer, 1, cxgb_tx_timeout, + qs, txq->txq_timer.c_cpu); if (m_head != NULL) m_freem(m_head); } @@ -1669,8 +1671,7 @@ cxgb_transmit_locked(struct ifnet *ifp, if (!TXQ_RING_EMPTY(qs) && pi->link_config.link_ok && (!sc->tunq_coalesce || (drbr_inuse(ifp, br) >= 7))) cxgb_start_locked(qs); - else if (!TXQ_RING_EMPTY(qs) && sc->tunq_coalesce && - callout_pending(&txq->txq_timer) == 0) + else if (!TXQ_RING_EMPTY(qs) && callout_pending(&txq->txq_timer) == 0) callout_reset_on(&txq->txq_timer, 1, cxgb_tx_timeout, qs, txq->txq_timer.c_cpu); return (0); From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 01:21:18 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 6DB66106566B; Sun, 7 Jun 2009 01:21:18 +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 5C3428FC08; Sun, 7 Jun 2009 01:21:18 +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 n571LIaX077514; Sun, 7 Jun 2009 01:21:18 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n571LImO077513; Sun, 7 Jun 2009 01:21:18 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070121.n571LImO077513@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 01:21:18 +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: r193604 - 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: Sun, 07 Jun 2009 01:21:18 -0000 Author: kmacy Date: Sun Jun 7 01:21:17 2009 New Revision: 193604 URL: http://svn.freebsd.org/changeset/base/193604 Log: - don't reduce txmax for callouts - set reclaim_min to zero for first pass 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 Sun Jun 7 01:06:56 2009 (r193603) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 01:21:17 2009 (r193604) @@ -1577,9 +1577,9 @@ cxgb_start_locked(struct sge_qset *qs) avail = txq->size - txq->in_use - 4; txmax = min(TX_START_MAX_DESC, avail); - /* in case all packets use more than one mbuf */ + /* free all completed requests */ if (qs->qs_flags & QS_FLUSHING) - txmax = min(txmax, 7); + reclaim_completed_tx(qs, 0, TXQ_ETH); TXQ_LOCK_ASSERT(qs); while ((txq->in_use - in_use_init < txmax) && From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 01:36: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 E6B561065670; Sun, 7 Jun 2009 01:36: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 D53038FC0A; Sun, 7 Jun 2009 01:36: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 n571aRK0077843; Sun, 7 Jun 2009 01:36:27 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n571aRkv077841; Sun, 7 Jun 2009 01:36:27 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070136.n571aRkv077841@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 01:36: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: r193605 - 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: Sun, 07 Jun 2009 01:36:28 -0000 Author: kmacy Date: Sun Jun 7 01:36:27 2009 New Revision: 193605 URL: http://svn.freebsd.org/changeset/base/193605 Log: track coalesced packets Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Sun Jun 7 01:21:17 2009 (r193604) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Sun Jun 7 01:36:27 2009 (r193605) @@ -244,9 +244,9 @@ struct sge_txq { struct ifaltq *txq_ifq; struct callout txq_timer; struct callout txq_watchdog; + uint64_t txq_coalesced; uint32_t txq_drops; uint32_t txq_skipped; - uint32_t txq_coalesced; uint32_t txq_enqueued; uint32_t txq_dump_start; uint32_t txq_dump_count; 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 Sun Jun 7 01:21:17 2009 (r193604) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 01:36:27 2009 (r193605) @@ -1379,6 +1379,7 @@ t3_encap(struct sge_qset *qs, struct mbu if (nsegs > 7) panic("trying to coalesce %d packets in to one WR", nsegs); + txq->txq_coalesced += nsegs wrp = (struct work_request_hdr *)txd; flits = nsegs*2 + 1; txq_prod(txq, 1, &txqs); @@ -3607,7 +3608,7 @@ t3_add_configured_sysctls(adapter_t *sc) SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "skipped", CTLFLAG_RD, &txq->txq_skipped, 0, "#tunneled packet descriptors skipped"); - SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "coalesced", + SYSCTL_ADD_QUAD(ctx, txqpoidlist, OID_AUTO, "coalesced", CTLFLAG_RD, &txq->txq_coalesced, 0, "#tunneled packets coalesced"); SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "enqueued", From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 01:38:14 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 EA8F7106566B; Sun, 7 Jun 2009 01:38:14 +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 D93978FC13; Sun, 7 Jun 2009 01:38:14 +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 n571cEtj077911; Sun, 7 Jun 2009 01:38:14 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n571cEAd077910; Sun, 7 Jun 2009 01:38:14 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070138.n571cEAd077910@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 01:38:14 +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: r193606 - 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: Sun, 07 Jun 2009 01:38:15 -0000 Author: kmacy Date: Sun Jun 7 01:38:14 2009 New Revision: 193606 URL: http://svn.freebsd.org/changeset/base/193606 Log: QUAD takes 7 arguments 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 Sun Jun 7 01:36:27 2009 (r193605) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 01:38:14 2009 (r193606) @@ -1379,7 +1379,7 @@ t3_encap(struct sge_qset *qs, struct mbu if (nsegs > 7) panic("trying to coalesce %d packets in to one WR", nsegs); - txq->txq_coalesced += nsegs + txq->txq_coalesced += nsegs; wrp = (struct work_request_hdr *)txd; flits = nsegs*2 + 1; txq_prod(txq, 1, &txqs); @@ -3610,7 +3610,7 @@ t3_add_configured_sysctls(adapter_t *sc) 0, "#tunneled packet descriptors skipped"); SYSCTL_ADD_QUAD(ctx, txqpoidlist, OID_AUTO, "coalesced", CTLFLAG_RD, &txq->txq_coalesced, - 0, "#tunneled packets coalesced"); + "#tunneled packets coalesced"); SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "enqueued", CTLFLAG_RD, &txq->txq_enqueued, 0, "#tunneled packets enqueued to hardware"); From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 03:51:53 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 61DDA1065672; Sun, 7 Jun 2009 03:51:53 +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 7DC3E8FC19; Sun, 7 Jun 2009 03:51: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 n573pqmN080657; Sun, 7 Jun 2009 03:51:52 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n573pqhG080656; Sun, 7 Jun 2009 03:51:52 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070351.n573pqhG080656@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 03:51: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: r193607 - 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: Sun, 07 Jun 2009 03:51:53 -0000 Author: kmacy Date: Sun Jun 7 03:51:52 2009 New Revision: 193607 URL: http://svn.freebsd.org/changeset/base/193607 Log: - simplify t3_encap by only calliing txq_prod at the start - change the unacked overflow to 8 down from 32 like the linux driver 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 Sun Jun 7 01:38:14 2009 (r193606) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 03:51:52 2009 (r193607) @@ -1055,8 +1055,8 @@ txq_prod(struct sge_txq *txq, unsigned i */ txqs->gen = txq->gen; txq->unacked += ndesc; - txqs->compl = (txq->unacked & 32) << (S_WR_COMPL - 5); - txq->unacked &= 31; + txqs->compl = (txq->unacked & 8) << (S_WR_COMPL - 3); + txq->unacked &= 7; txqs->pidx = txq->pidx; txq->pidx += ndesc; #ifdef INVARIANTS @@ -1090,7 +1090,7 @@ calc_tx_descs(const struct mbuf *m, int { unsigned int flits; - if (m->m_pkthdr.len <= WR_LEN - sizeof(struct cpl_tx_pkt)) + if (m->m_pkthdr.len <= PIO_LEN) return 1; flits = sgl_len(nsegs) + 2; @@ -1365,11 +1365,17 @@ t3_encap(struct sge_qset *qs, struct mbu #endif if (m0->m_nextpkt != NULL) { busdma_map_sg_vec(m0, segs, &nsegs); - } else if ((err = busdma_map_sg_collapse(&m0, segs, &nsegs))) { - if (cxgb_debug) - printf("failed ... err=%d\n", err); - return (err); - } + ndesc = 1; + } else { + if ((err = busdma_map_sg_collapse(&m0, segs, &nsegs))) { + if (cxgb_debug) + printf("failed ... err=%d\n", err); + return (err); + } + ndesc = calc_tx_descs(m0, nsegs); + } + txq_prod(txq, ndesc, &txqs); + KASSERT(m0->m_pkthdr.len, ("empty packet nsegs=%d", nsegs)); txsd->m = m0; @@ -1382,7 +1388,6 @@ t3_encap(struct sge_qset *qs, struct mbu txq->txq_coalesced += nsegs; wrp = (struct work_request_hdr *)txd; flits = nsegs*2 + 1; - txq_prod(txq, 1, &txqs); for (fidx = 1, i = 0; i < nsegs; i++, fidx += 2) { struct cpl_tx_pkt_batch_entry *cbe = &cpl_batch->pkt_entry[i]; @@ -1472,7 +1477,6 @@ t3_encap(struct sge_qset *qs, struct mbu DPRINTF("**5592 Fix** mbuf=%p,len=%d,tso_segsz=%d,csum_flags=%#x,flags=%#x", m0, mlen, m0->m_pkthdr.tso_segsz, m0->m_pkthdr.csum_flags, m0->m_flags); txsd->m = NULL; - txq_prod(txq, 1, &txqs); m_copydata(m0, 0, mlen, (caddr_t)&txd->flit[3]); flits = (mlen + 7) / 8 + 3; wr_hi = htonl(V_WR_BCNTLFLT(mlen & 7) | @@ -1501,7 +1505,6 @@ t3_encap(struct sge_qset *qs, struct mbu if (mlen <= PIO_LEN) { txsd->m = NULL; - txq_prod(txq, 1, &txqs); m_copydata(m0, 0, mlen, (caddr_t)&txd->flit[2]); flits = (mlen + 7) / 8 + 2; @@ -1518,15 +1521,12 @@ t3_encap(struct sge_qset *qs, struct mbu flits = 2; } wrp = (struct work_request_hdr *)txd; - - ndesc = calc_tx_descs(m0, nsegs); - sgp = (ndesc == 1) ? (struct sg_ent *)&txd->flit[flits] : sgl; make_sgl(sgp, segs, nsegs); sgl_flits = sgl_len(nsegs); - txq_prod(txq, ndesc, &txqs); + KASSERT(ndesc <= 4, ("ndesc too large %d", ndesc)); wr_hi = htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | txqs.compl); wr_lo = htonl(V_WR_TID(txq->token)); write_wr_hdr_sgl(ndesc, txd, &txqs, txq, sgl, flits, From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 04:39: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 017CF106564A; Sun, 7 Jun 2009 04:39: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 E46E38FC15; Sun, 7 Jun 2009 04:39: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 n574dw8Z081633; Sun, 7 Jun 2009 04:39:58 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n574dwNh081632; Sun, 7 Jun 2009 04:39:58 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070439.n574dwNh081632@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 04:39: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: r193608 - 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: Sun, 07 Jun 2009 04:39:59 -0000 Author: kmacy Date: Sun Jun 7 04:39:58 2009 New Revision: 193608 URL: http://svn.freebsd.org/changeset/base/193608 Log: - revert to previous compl setting - fix multi-WR send 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 Sun Jun 7 03:51:52 2009 (r193607) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 04:39:58 2009 (r193608) @@ -1055,8 +1055,8 @@ txq_prod(struct sge_txq *txq, unsigned i */ txqs->gen = txq->gen; txq->unacked += ndesc; - txqs->compl = (txq->unacked & 8) << (S_WR_COMPL - 3); - txq->unacked &= 7; + txqs->compl = (txq->unacked & 32) << (S_WR_COMPL - 5); + txq->unacked &= 31; txqs->pidx = txq->pidx; txq->pidx += ndesc; #ifdef INVARIANTS @@ -1304,7 +1304,9 @@ write_wr_hdr_sgl(unsigned int ndesc, str wr_gen2(txd, txqs->gen); flits = 1; } - set_wr_hdr(wrp, wrp->wrh_hi |= htonl(F_WR_EOP), + wrp->wrh_hi |= htonl(F_WR_EOP); + + set_wr_hdr(wrp, wrp->wrh_hi, htonl(V_WR_LEN(WR_FLITS) | V_WR_GEN(ogen)) | wr_lo); wr_gen2((struct tx_desc *)wp, ogen); } @@ -1372,6 +1374,7 @@ t3_encap(struct sge_qset *qs, struct mbu printf("failed ... err=%d\n", err); return (err); } + mlen = m0->m_pkthdr.len; ndesc = calc_tx_descs(m0, nsegs); } txq_prod(txq, ndesc, &txqs); @@ -1427,7 +1430,6 @@ t3_encap(struct sge_qset *qs, struct mbu GET_VTAG(cntrl, m0); cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT_LSO); hdr->cntrl = htonl(cntrl); - mlen = m0->m_pkthdr.len; hdr->len = htonl(mlen | 0x80000000); DPRINTF("tso buf len=%d\n", mlen); @@ -1500,7 +1502,6 @@ t3_encap(struct sge_qset *qs, struct mbu if (__predict_false(!(m0->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)))) cntrl |= F_TXPKT_L4CSUM_DIS; cpl->cntrl = htonl(cntrl); - mlen = m0->m_pkthdr.len; cpl->len = htonl(mlen | 0x80000000); if (mlen <= PIO_LEN) { From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 04:58:35 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 2DE431065673; Sun, 7 Jun 2009 04:58:35 +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 1D03E8FC1B; Sun, 7 Jun 2009 04:58:35 +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 n574wZBk082087; Sun, 7 Jun 2009 04:58:35 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n574wYFW082086; Sun, 7 Jun 2009 04:58:34 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070458.n574wYFW082086@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 04:58: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: r193611 - 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: Sun, 07 Jun 2009 04:58:35 -0000 Author: kmacy Date: Sun Jun 7 04:58:34 2009 New Revision: 193611 URL: http://svn.freebsd.org/changeset/base/193611 Log: update wr_lo on first WR in a multi-WR send 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 Sun Jun 7 04:49:23 2009 (r193610) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 04:58:34 2009 (r193611) @@ -1289,7 +1289,7 @@ write_wr_hdr_sgl(unsigned int ndesc, str txd = txq->desc; txsd = txq->sdesc; } - + /* * when the head of the mbuf chain * is freed all clusters will be freed @@ -1305,9 +1305,8 @@ write_wr_hdr_sgl(unsigned int ndesc, str flits = 1; } wrp->wrh_hi |= htonl(F_WR_EOP); - - set_wr_hdr(wrp, wrp->wrh_hi, - htonl(V_WR_LEN(WR_FLITS) | V_WR_GEN(ogen)) | wr_lo); + wmb(); + wp->wrh_lo = htonl(V_WR_LEN(WR_FLITS) | V_WR_GEN(ogen)) | wr_lo; wr_gen2((struct tx_desc *)wp, ogen); } } @@ -1368,6 +1367,7 @@ t3_encap(struct sge_qset *qs, struct mbu if (m0->m_nextpkt != NULL) { busdma_map_sg_vec(m0, segs, &nsegs); ndesc = 1; + mlen = 0; } else { if ((err = busdma_map_sg_collapse(&m0, segs, &nsegs))) { if (cxgb_debug) From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 06:46:29 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 70B57106566B; Sun, 7 Jun 2009 06:46:29 +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 55A008FC08; Sun, 7 Jun 2009 06:46:29 +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 n576kTF9084878; Sun, 7 Jun 2009 06:46:29 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n576kTpv084877; Sun, 7 Jun 2009 06:46:29 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070646.n576kTpv084877@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 06:46:29 +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: r193623 - 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: Sun, 07 Jun 2009 06:46:29 -0000 Author: kmacy Date: Sun Jun 7 06:46:27 2009 New Revision: 193623 URL: http://svn.freebsd.org/changeset/base/193623 Log: - simplify get_packet - simplify cxgb_dequeue 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 Sun Jun 7 06:28:55 2009 (r193622) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 06:46:27 2009 (r193623) @@ -293,11 +293,8 @@ cxgb_dequeue(struct sge_qset *qs) struct mbuf *m, *m_head, *m_tail; struct coalesce_info ci; - if (qs->port->adapter->tunq_coalesce) { - m = TXQ_RING_DEQUEUE(qs); - if (m != NULL && m->m_nextpkt != NULL) - panic("dequeued regular packet with nextpkt set!"); - } + if (qs->port->adapter->tunq_coalesce == 0) + return TXQ_RING_DEQUEUE(qs); m_head = m_tail = NULL; ci.count = ci.nbytes = 0; @@ -308,7 +305,6 @@ cxgb_dequeue(struct sge_qset *qs) } else if (m != NULL) { m_tail->m_nextpkt = m; m_tail = m; - m->m_nextpkt = NULL; } } while (m != NULL); if (ci.count > 7) @@ -919,7 +915,8 @@ sge_timer_cb(void *arg) (FW_TUNNEL_SGEEC_START + pi->first_qset)); } } - if (sc->open_device_map != 0) + if (((sc->flags & USING_MSIX) == 0 || sc->params.nports > 2) && + sc->open_device_map != 0) callout_reset(&sc->sge_timer_ch, TX_RECLAIM_PERIOD, sge_timer_cb, sc); } @@ -990,6 +987,7 @@ sge_timer_reclaim(void *arg, int ncount) KASSERT((sc->flags & USING_MSIX) == 0, ("can't call timer reclaim for msi-x")); + for (i = 0; i < nqsets; i++) { qs = &sc->sge.qs[pi->first_qset + i]; @@ -1702,7 +1700,6 @@ cxgb_transmit(struct ifnet *ifp, struct TXQ_UNLOCK(qs); } else error = drbr_enqueue(ifp, qs->txq[TXQ_ETH].txq_mr, m); - return (error); } void @@ -2808,19 +2805,21 @@ get_packet(adapter_t *adap, unsigned int } else { m_cljset(m, cl, fl->type); m->m_flags = flags; - m->m_next = m->m_nextpkt = NULL; } m->m_len = len; } switch(sopeop) { case RSPQ_SOP_EOP: - DBG(DBG_RX, ("get_packet: SOP-EOP m %p\n", m)); + ret = 1; + /* FALLTHROUGH */ + case RSPQ_SOP: mh->mh_head = mh->mh_tail = m; m->m_pkthdr.len = len; - ret = 1; break; + case RSPQ_EOP: + ret = 1; + /* FALLTHROUGH */ case RSPQ_NSOP_NEOP: - DBG(DBG_RX, ("get_packet: NO_SOP-NO_EOP m %p\n", m)); if (mh->mh_tail == NULL) { log(LOG_ERR, "discarding intermediate descriptor entry\n"); m_freem(m); @@ -2829,20 +2828,6 @@ get_packet(adapter_t *adap, unsigned int mh->mh_tail->m_next = m; mh->mh_tail = m; mh->mh_head->m_pkthdr.len += len; - ret = 0; - break; - case RSPQ_SOP: - DBG(DBG_RX, ("get_packet: SOP m %p\n", m)); - m->m_pkthdr.len = len; - mh->mh_head = mh->mh_tail = m; - ret = 0; - break; - case RSPQ_EOP: - DBG(DBG_RX, ("get_packet: EOP m %p\n", m)); - mh->mh_head->m_pkthdr.len += len; - mh->mh_tail->m_next = m; - mh->mh_tail = m; - ret = 1; break; } if (cxgb_debug) @@ -2955,9 +2940,6 @@ process_responses(adapter_t *adap, struc } else { m = m_gethdr(M_DONTWAIT, MT_DATA); } - - /* XXX m is lost here if rspq->rspq_mbuf is not NULL */ - if (m == NULL) goto no_mem; From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 07:01: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 B2CDF106566B; Sun, 7 Jun 2009 07:01: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 522318FC14; Sun, 7 Jun 2009 07:01: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 n5771Mss085265; Sun, 7 Jun 2009 07:01:22 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5771L99085264; Sun, 7 Jun 2009 07:01:21 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906070701.n5771L99085264@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 07:01: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: r193624 - 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: Sun, 07 Jun 2009 07:01:23 -0000 Author: kmacy Date: Sun Jun 7 07:01:21 2009 New Revision: 193624 URL: http://svn.freebsd.org/changeset/base/193624 Log: - we should always be able to return at least one packet from dequeue_cond - use check_pkt_coalesce to return coalescing state 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 Sun Jun 7 06:46:27 2009 (r193623) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 07:01:21 2009 (r193624) @@ -220,7 +220,7 @@ static void sge_timer_reclaim(void *arg, static void sge_txq_reclaim_handler(void *arg, int ncount); static void cxgb_start_locked(struct sge_qset *qs); -static __inline void +static __inline uint64_t check_pkt_coalesce(struct sge_qset *qs) { struct adapter *sc; @@ -233,7 +233,7 @@ check_pkt_coalesce(struct sge_qset *qs) if (cxgb_pcpu_tx_coalesce_force && (*fill == 0)) { *fill = 1; - return; + return (1); } /* * if the hardware transmit queue is more than 3/4 full @@ -243,6 +243,8 @@ check_pkt_coalesce(struct sge_qset *qs) *fill = 0; else if (*fill == 0 && (txq->in_use >= (txq->size - (txq->size>>2)))) *fill = 1; + + return (sc->tunq_coalesce); } #ifdef __LP64__ @@ -278,8 +280,8 @@ coalesce_check(struct mbuf *m, void *arg int *count = &ci->count; int *nbytes = &ci->nbytes; - if ((*nbytes + m->m_len <= 10500) && (*count < 7) && - (m->m_next == NULL)){ + if ((*nbytes == 0) || ((*nbytes + m->m_len <= 10500) && + (*count < 7) && (m->m_next == NULL))) { *count += 1; *nbytes += m->m_len; return (1); @@ -293,7 +295,8 @@ cxgb_dequeue(struct sge_qset *qs) struct mbuf *m, *m_head, *m_tail; struct coalesce_info ci; - if (qs->port->adapter->tunq_coalesce == 0) + + if (check_pkt_coalesce(qs) == 0) return TXQ_RING_DEQUEUE(qs); m_head = m_tail = NULL; @@ -1587,7 +1590,6 @@ cxgb_start_locked(struct sge_qset *qs) (ifp->if_drv_flags & IFF_DRV_RUNNING) && pi->link_config.link_ok) { reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); - check_pkt_coalesce(qs); if ((m_head = cxgb_dequeue(qs)) == NULL) break; @@ -1631,7 +1633,6 @@ cxgb_transmit_locked(struct ifnet *ifp, avail = txq->size - txq->in_use; TXQ_LOCK_ASSERT(qs); reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); - check_pkt_coalesce(qs); /* * We can only do a direct transmit if the following are true: @@ -1640,7 +1641,7 @@ cxgb_transmit_locked(struct ifnet *ifp, * - there are no packets enqueued already * - there is space in hardware transmit queue */ - if (sc->tunq_coalesce == 0 && + if (check_pkt_coalesce(qs) == 0 && pi->link_config.link_ok && TXQ_RING_EMPTY(qs) && avail > 4) { if (t3_encap(qs, &m)) { From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 21:11:23 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 2176F1065677; Sun, 7 Jun 2009 21:11:23 +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 0FFD28FC14; Sun, 7 Jun 2009 21:11:23 +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 n57LBMsp005632; Sun, 7 Jun 2009 21:11:22 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n57LBMgu005631; Sun, 7 Jun 2009 21:11:22 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906072111.n57LBMgu005631@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 21:11: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: r193651 - 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: Sun, 07 Jun 2009 21:11:23 -0000 Author: kmacy Date: Sun Jun 7 21:11:22 2009 New Revision: 193651 URL: http://svn.freebsd.org/changeset/base/193651 Log: don't persistently change tunq_coalesce if coalesce forcing is enabled 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 Sun Jun 7 20:51:31 2009 (r193650) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 21:11:22 2009 (r193651) @@ -227,14 +227,12 @@ check_pkt_coalesce(struct sge_qset *qs) struct sge_txq *txq; uint8_t *fill; - txq = &qs->txq[TXQ_ETH]; + if (__predict_false(cxgb_pcpu_tx_coalesce_force)) + return (1); + txq = &qs->txq[TXQ_ETH]; sc = qs->port->adapter; fill = &sc->tunq_fill[qs->idx]; - if (cxgb_pcpu_tx_coalesce_force && (*fill == 0)) { - *fill = 1; - return (1); - } /* * if the hardware transmit queue is more than 3/4 full * we mark it as coalescing @@ -1586,7 +1584,7 @@ cxgb_start_locked(struct sge_qset *qs) TXQ_LOCK_ASSERT(qs); while ((txq->in_use - in_use_init < txmax) && - (!TXQ_RING_EMPTY(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>>4), TXQ_ETH); @@ -1670,9 +1668,9 @@ cxgb_transmit_locked(struct ifnet *ifp, return (error); if (!TXQ_RING_EMPTY(qs) && pi->link_config.link_ok && - (!sc->tunq_coalesce || (drbr_inuse(ifp, br) >= 7))) + (!check_pkt_coalesce(qs) || (drbr_inuse(ifp, br) >= 7))) cxgb_start_locked(qs); - else if (!TXQ_RING_EMPTY(qs) && callout_pending(&txq->txq_timer) == 0) + else if (!TXQ_RING_EMPTY(qs) && !callout_pending(&txq->txq_timer)) callout_reset_on(&txq->txq_timer, 1, cxgb_tx_timeout, qs, txq->txq_timer.c_cpu); return (0); From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 21:50:42 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 7EC591065706; Sun, 7 Jun 2009 21:50:42 +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 6AE618FC0C; Sun, 7 Jun 2009 21:50:42 +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 n57LogSA006499; Sun, 7 Jun 2009 21:50:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n57Logdq006495; Sun, 7 Jun 2009 21:50:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906072150.n57Logdq006495@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 21:50:42 +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: r193654 - in user/kmacy/releng_7_2_fcs/usr.sbin: . pmcannotate 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, 07 Jun 2009 21:50:43 -0000 Author: kmacy Date: Sun Jun 7 21:50:42 2009 New Revision: 193654 URL: http://svn.freebsd.org/changeset/base/193654 Log: MFC pmcannotate Added: user/kmacy/releng_7_2_fcs/usr.sbin/pmcannotate/ user/kmacy/releng_7_2_fcs/usr.sbin/pmcannotate/Makefile user/kmacy/releng_7_2_fcs/usr.sbin/pmcannotate/pmcannotate.8 user/kmacy/releng_7_2_fcs/usr.sbin/pmcannotate/pmcannotate.c 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 Sun Jun 7 21:32:01 2009 (r193653) +++ user/kmacy/releng_7_2_fcs/usr.sbin/Makefile Sun Jun 7 21:50:42 2009 (r193654) @@ -121,6 +121,7 @@ SUBDIR= ${_ac} \ pciconf \ periodic \ ${_pkg_install} \ + ${_pmcannotate} \ ${_pmccontrol} \ ${_pmcstat} \ ${_pnpinfo} \ @@ -345,6 +346,7 @@ _pkg_install= pkg_install # XXX MK_TOOLCHAIN? .if ${MK_PMC} != "no" +_pmcannotate= pmcannotate _pmccontrol= pmccontrol _pmcstat= pmcstat .endif Added: user/kmacy/releng_7_2_fcs/usr.sbin/pmcannotate/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_fcs/usr.sbin/pmcannotate/Makefile Sun Jun 7 21:50:42 2009 (r193654) @@ -0,0 +1,12 @@ +# +# $FreeBSD$ +# + +PROG= pmcannotate +MAN= pmcannotate.8 + +WARNS?= 6 + +SRCS= pmcannotate.c + +.include Added: user/kmacy/releng_7_2_fcs/usr.sbin/pmcannotate/pmcannotate.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_fcs/usr.sbin/pmcannotate/pmcannotate.8 Sun Jun 7 21:50:42 2009 (r193654) @@ -0,0 +1,108 @@ +.\" Copyright (c) 2008 Nokia Corporation +.\" All rights reserved. +.\" +.\" This software was developed by Attilio Rao for the IPSO project under +.\" contract to Nokia Corporation. +.\" +.\" 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. +.\" 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 authors ``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 authors 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$ +.\" +.Dd November 20, 2008 +.Os +.Dt PMCANNOTATE 8 +.Sh NAME +.Nm pmcannotate +.Nd "sources printout with inlined profiling" +.Sh SYNOPSIS +.Nm +.Op Fl a +.Op Fl h +.Op Fl k Ar pathname +.Op Fl l Ar level +.Ar pmcout.out binaryobj +.Sh DESCRIPTION +The +.Nm +utility can produce both C sources or assembly sources of a program with +a line-by-line based profiling. +The profiling informations are retrieved through a +.Xr pmcstat 8 +raw output while the program operations are retrieved through the +.Xr objdump 1 +tool. +.Pp +When calling +.Nm +the raw output is passed through the +.Ar pmcout.out +argument, while the program is passed through the +.Ar binaryobj +argument. +.Pp +As long as +.Nm +relies on +.Xr objdump 1 +and +.Xr pmcstat 8 +to work, it will fail if one of them is not available. +.Sh OPTIONS +The following options are available: +.Bl -tag -width indent +.It Fl a +Shows the program profiling inlined in the assembly code only. +No C informations involving C sources are provided. +.It Fl h +Prints out informations about the usage of the tool. +.It Fl l Ar level +Changes the lower bound (expressed in percentage) for traced functions +that will be printed out in the report. +The default value is 0.5%. +.It Fl k Ar kerneldir +Set the pathname of the kernel directory to argument +.Ar kerneldir . +This directory specifies where +.Nm +should look for the kernel and its modules. +The default is +.Pa /boot/kernel . +.Sh LIMITATIONS +As long as +.Nm +relies on the +.Xr objdump 1 +utility to retrieve the C code, the program needs to be compiled with +debugging options. +Sometimes, in particular with heavy optimization levels, the +.Xr objdump 1 +utility embeds the code of inlining functions directly in the callers, +making an output difficult to read. +The x86 version reports the sampling from pmcstat collecting the following +instruction in regard of the interrupted one. +This means that the samples may be attributed to the line below the one +of interest. +.Sh SEE ALSO +.Xr objdump 1 , +.Xr pmcstat 8 +.Sh AUTHORS +.An Attilio Rao Aq attilio@FreeBSD.org Added: user/kmacy/releng_7_2_fcs/usr.sbin/pmcannotate/pmcannotate.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_fcs/usr.sbin/pmcannotate/pmcannotate.c Sun Jun 7 21:50:42 2009 (r193654) @@ -0,0 +1,804 @@ +/*- + * Copyright (c) 2008 Nokia Corporation + * All rights reserved. + * + * This software was developed by Attilio Rao for the IPSO project under + * contract to Nokia Corporation. + * + * 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 unmodified, this list of conditions, and the following + * disclaimer. + * 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 ``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 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. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include + +#include + +#define FNBUFF 161 +#define LNBUFF 161 + +#define TMPPATH "/tmp/pmcannotate.XXXXXX" + +#define FATAL(ptr, x ...) do { \ + fqueue_deleteall(); \ + general_deleteall(); \ + if ((ptr) != NULL) \ + perror(ptr); \ + fprintf(stderr, ##x); \ + remove(tbfl); \ + remove(tofl); \ + exit(EXIT_FAILURE); \ +} while (0) + +#define PERCSAMP(x) ((x) * 100 / totalsamples) + +struct entry { + TAILQ_ENTRY(entry) en_iter; + char *en_name; + uintptr_t en_pc; + uintptr_t en_ostart; + uintptr_t en_oend; + u_int en_nsamples; +}; + +struct aggent { + TAILQ_ENTRY(aggent) ag_fiter; + long ag_offset; + uintptr_t ag_ostart; + uintptr_t ag_oend; + char *ag_name; + u_int ag_nsamples; +}; + +static struct aggent *agg_create(const char *name, u_int nsamples, + uintptr_t start, uintptr_t end); +static void agg_destroy(struct aggent *agg) __unused; +static void asmparse(FILE *fp); +static int cparse(FILE *fp); +static void entry_acqref(struct entry *entry); +static struct entry *entry_create(const char *name, uintptr_t pc, + uintptr_t start, uintptr_t end); +static void entry_destroy(struct entry *entry) __unused; +static void fqueue_compact(float th); +static void fqueue_deleteall(void); +static struct aggent *fqueue_findent_by_name(const char *name); +static int fqueue_getall(const char *bin, char *temp, int asmf); +static int fqueue_insertent(struct entry *entry); +static int fqueue_insertgen(void); +static void general_deleteall(void); +static struct entry *general_findent(uintptr_t pc); +static void general_insertent(struct entry *entry); +static void general_printasm(FILE *fp, struct aggent *agg); +static int general_printc(FILE *fp, struct aggent *agg); +static int printblock(FILE *fp, struct aggent *agg); +static void usage(const char *progname) __dead2; + +static TAILQ_HEAD(, entry) mainlst = TAILQ_HEAD_INITIALIZER(mainlst); +static TAILQ_HEAD(, aggent) fqueue = TAILQ_HEAD_INITIALIZER(fqueue); + +/* + * Use a float value in order to automatically promote operations + * to return a float value rather than use casts. + */ +static float totalsamples; + +/* + * Identifies a string cointaining objdump's assembly printout. + */ +static inline int +isasminline(const char *str) +{ + void *ptr; + int nbytes; + + if (isxdigit(str[1]) == 0) + return (0); + if (sscanf(str, " %p%n", &ptr, &nbytes) != 1) + return (0); + if (str[nbytes] != ':' || isspace(str[nbytes + 1]) == 0) + return (0); + return (1); +} + +/* + * Identifies a string containing objdump's assembly printout + * for a new function. + */ +static inline int +newfunction(const char *str) +{ + char fname[FNBUFF]; + void *ptr; + int nbytes; + + if (isspace(str[0])) + return (0); + if (sscanf(str, "%p <%[^>:]>:%n", &ptr, fname, &nbytes) != 2) + return (0); + return (nbytes); +} + +/* + * Create a new first-level aggregation object for a specified + * function. + */ +static struct aggent * +agg_create(const char *name, u_int nsamples, uintptr_t start, uintptr_t end) +{ + struct aggent *agg; + + agg = calloc(1, sizeof(struct aggent)); + if (agg == NULL) + return (NULL); + agg->ag_name = strdup(name); + if (agg->ag_name == NULL) { + free(agg); + return (NULL); + } + agg->ag_nsamples = nsamples; + agg->ag_ostart = start; + agg->ag_oend = end; + return (agg); +} + +/* + * Destroy a first-level aggregation object for a specified + * function. + */ +static void +agg_destroy(struct aggent *agg) +{ + + free(agg->ag_name); + free(agg); +} + +/* + * Analyze the "objdump -d" output, locate functions and start + * printing out the assembly functions content. + * We do not use newfunction() because we actually need the + * function name in available form, but the heurstic used is + * the same. + */ +static void +asmparse(FILE *fp) +{ + char buffer[LNBUFF], fname[FNBUFF]; + struct aggent *agg; + void *ptr; + + while (fgets(buffer, LNBUFF, fp) != NULL) { + if (isspace(buffer[0])) + continue; + if (sscanf(buffer, "%p <%[^>:]>:", &ptr, fname) != 2) + continue; + agg = fqueue_findent_by_name(fname); + if (agg == NULL) + continue; + agg->ag_offset = ftell(fp); + } + + TAILQ_FOREACH(agg, &fqueue, ag_fiter) { + if (fseek(fp, agg->ag_offset, SEEK_SET) == -1) + return; + printf("Profile trace for function: %s() [%.2f%%]\n", + agg->ag_name, PERCSAMP(agg->ag_nsamples)); + general_printasm(fp, agg); + printf("\n"); + } +} + +/* + * Analyze the "objdump -S" output, locate functions and start + * printing out the C functions content. + * We do not use newfunction() because we actually need the + * function name in available form, but the heurstic used is + * the same. + * In order to maintain the printout sorted, on the first pass it + * simply stores the file offsets in order to fastly moved later + * (when the file is hot-cached also) when the real printout will + * happen. + */ +static int +cparse(FILE *fp) +{ + char buffer[LNBUFF], fname[FNBUFF]; + struct aggent *agg; + void *ptr; + + while (fgets(buffer, LNBUFF, fp) != NULL) { + if (isspace(buffer[0])) + continue; + if (sscanf(buffer, "%p <%[^>:]>:", &ptr, fname) != 2) + continue; + agg = fqueue_findent_by_name(fname); + if (agg == NULL) + continue; + agg->ag_offset = ftell(fp); + } + + TAILQ_FOREACH(agg, &fqueue, ag_fiter) { + if (fseek(fp, agg->ag_offset, SEEK_SET) == -1) + return (-1); + printf("Profile trace for function: %s() [%.2f%%]\n", + agg->ag_name, PERCSAMP(agg->ag_nsamples)); + if (general_printc(fp, agg) == -1) + return (-1); + printf("\n"); + } + return (0); +} + +/* + * Bump the number of samples for any raw entry. + */ +static void +entry_acqref(struct entry *entry) +{ + + entry->en_nsamples++; +} + +/* + * Create a new raw entry object for a specified function. + */ +static struct entry * +entry_create(const char *name, uintptr_t pc, uintptr_t start, uintptr_t end) +{ + struct entry *obj; + + obj = calloc(1, sizeof(struct entry)); + if (obj == NULL) + return (NULL); + obj->en_name = strdup(name); + if (obj->en_name == NULL) { + free(obj); + return (NULL); + } + obj->en_pc = pc; + obj->en_ostart = start; + obj->en_oend = end; + obj->en_nsamples = 1; + return (obj); +} + +/* + * Destroy a raw entry object for a specified function. + */ +static void +entry_destroy(struct entry *entry) +{ + + free(entry->en_name); + free(entry); +} + +/* + * Specify a lower bound in percentage and drop from the + * first-level aggregation queue all the objects with a + * smaller impact. + */ +static void +fqueue_compact(float th) +{ + u_int thi; + struct aggent *agg, *tmpagg; + + if (totalsamples == 0) + return; + + /* Revert the percentage calculation. */ + thi = th * totalsamples / 100; + TAILQ_FOREACH_SAFE(agg, &fqueue, ag_fiter, tmpagg) + if (agg->ag_nsamples < thi) + TAILQ_REMOVE(&fqueue, agg, ag_fiter); +} + +/* + * Flush the first-level aggregates queue. + */ +static void +fqueue_deleteall() +{ + struct aggent *agg; + + while (TAILQ_EMPTY(&fqueue) == 0) { + agg = TAILQ_FIRST(&fqueue); + TAILQ_REMOVE(&fqueue, agg, ag_fiter); + } +} + +/* + * Insert a raw entry into the aggregations queue. + * If the respective first-level aggregation object + * does not exist create it and maintain it sorted + * in respect of the number of samples. + */ +static int +fqueue_insertent(struct entry *entry) +{ + struct aggent *obj, *tmp; + int found; + + found = 0; + TAILQ_FOREACH(obj, &fqueue, ag_fiter) + if (!strcmp(obj->ag_name, entry->en_name)) { + found = 1; + obj->ag_nsamples += entry->en_nsamples; + break; + } + + /* + * If the firt-level aggregation object alredy exist, + * just aggregate the samples and, if needed, resort + * it. + */ + if (found) { + TAILQ_REMOVE(&fqueue, obj, ag_fiter); + found = 0; + TAILQ_FOREACH(tmp, &fqueue, ag_fiter) + if (obj->ag_nsamples > tmp->ag_nsamples) { + found = 1; + break; + } + if (found) + TAILQ_INSERT_BEFORE(tmp, obj, ag_fiter); + else + TAILQ_INSERT_TAIL(&fqueue, obj, ag_fiter); + return (0); + } + + /* + * If the first-level aggregation object does not + * exist, create it and put in the sorted queue. + * If this is the first object, we need to set the + * head of the queue. + */ + obj = agg_create(entry->en_name, entry->en_nsamples, entry->en_ostart, + entry->en_oend); + if (obj == NULL) + return (-1); + if (TAILQ_EMPTY(&fqueue) != 0) { + TAILQ_INSERT_HEAD(&fqueue, obj, ag_fiter); + return (0); + } + TAILQ_FOREACH(tmp, &fqueue, ag_fiter) + if (obj->ag_nsamples > tmp->ag_nsamples) { + found = 1; + break; + } + if (found) + TAILQ_INSERT_BEFORE(tmp, obj, ag_fiter); + else + TAILQ_INSERT_TAIL(&fqueue, obj, ag_fiter); + return (0); +} + +/* + * Lookup a first-level aggregation object by name. + */ +static struct aggent * +fqueue_findent_by_name(const char *name) +{ + struct aggent *obj; + + TAILQ_FOREACH(obj, &fqueue, ag_fiter) + if (!strcmp(obj->ag_name, name)) + return (obj); + return (NULL); +} + +/* + * Return the number of object in the first-level aggregations queue. + */ +static int +fqueue_getall(const char *bin, char *temp, int asmf) +{ + char tmpf[MAXPATHLEN * 2 + 50]; + struct aggent *agg; + uintptr_t start, end; + + if (mkstemp(temp) == -1) + return (-1); + TAILQ_FOREACH(agg, &fqueue, ag_fiter) { + bzero(tmpf, sizeof(tmpf)); + start = agg->ag_ostart; + end = agg->ag_oend; + + /* + * Fix-up the end address in order to show it in the objdump's + * trace. + */ + end++; + if (asmf) + snprintf(tmpf, sizeof(tmpf), + "objdump --start-address=%p " + "--stop-address=%p -d %s >> %s", (void *)start, + (void *)end, bin, temp); + else + snprintf(tmpf, sizeof(tmpf), + "objdump --start-address=%p " + "--stop-address=%p -S %s >> %s", (void *)start, + (void *)end, bin, temp); + if (system(tmpf) != 0) + return (-1); + } + return (0); +} + +/* + * Insert all the raw entries present in the general queue + * into the first-level aggregations queue. + */ +static int +fqueue_insertgen(void) +{ + struct entry *obj; + + TAILQ_FOREACH(obj, &mainlst, en_iter) + if (fqueue_insertent(obj) == -1) + return (-1); + return (0); +} + +/* + * Flush the raw entries general queue. + */ +static void +general_deleteall() +{ + struct entry *obj; + + while (TAILQ_EMPTY(&mainlst) == 0) { + obj = TAILQ_FIRST(&mainlst); + TAILQ_REMOVE(&mainlst, obj, en_iter); + } +} + +/* + * Lookup a raw entry by the PC. + */ +static struct entry * +general_findent(uintptr_t pc) +{ + struct entry *obj; + + TAILQ_FOREACH(obj, &mainlst, en_iter) + if (obj->en_pc == pc) + return (obj); + return (NULL); +} + +/* + * Insert a new raw entry in the general queue. + */ +static void +general_insertent(struct entry *entry) +{ + + TAILQ_INSERT_TAIL(&mainlst, entry, en_iter); +} + +/* + * Printout the body of an "objdump -d" assembly function. + * It does simply stops when a new function is encountered, + * bringing back the file position in order to not mess up + * subsequent analysis. + * C lines and others not recognized are simply skipped. + */ +static void +general_printasm(FILE *fp, struct aggent *agg) +{ + char buffer[LNBUFF]; + struct entry *obj; + int nbytes; + void *ptr; + + while (fgets(buffer, LNBUFF, fp) != NULL) { + if ((nbytes = newfunction(buffer)) != 0) { + fseek(fp, nbytes * -1, SEEK_CUR); + break; + } + if (!isasminline(buffer)) + continue; + if (sscanf(buffer, " %p:", &ptr) != 1) + continue; + obj = general_findent((uintptr_t)ptr); + if (obj == NULL) + printf("\t| %s", buffer); + else + printf("%.2f%%\t| %s", + (float)obj->en_nsamples * 100 / agg->ag_nsamples, + buffer); + } +} + +/* + * Printout the body of an "objdump -S" function. + * It does simply stops when a new function is encountered, + * bringing back the file position in order to not mess up + * subsequent analysis. + * It expect from the starting to the end to find, always, valid blocks + * (see below for an explanation of the "block" concept). + */ +static int +general_printc(FILE *fp, struct aggent *agg) +{ + char buffer[LNBUFF]; + + while (fgets(buffer, LNBUFF, fp) != NULL) { + fseek(fp, strlen(buffer) * -1, SEEK_CUR); + if (newfunction(buffer) != 0) + break; + if (printblock(fp, agg) == -1) + return (-1); + } + return (0); +} + +/* + * Printout a single block inside an "objdump -S" function. + * The block is composed of a first part in C and subsequent translation + * in assembly. + * This code also operates a second-level aggregation packing together + * samples relative to PCs into a (lower bottom) block with their + * C (higher half) counterpart. + */ +static int +printblock(FILE *fp, struct aggent *agg) +{ + char buffer[LNBUFF]; + long lstart; + struct entry *obj; + u_int tnsamples; + int done, nbytes, sentinel; + void *ptr; + + /* + * We expect the first thing of the block is C code, so simply give + * up if asm line is found. + */ + lstart = ftell(fp); + sentinel = 0; + for (;;) { + if (fgets(buffer, LNBUFF, fp) == NULL) + return (0); + if (isasminline(buffer) != 0) + break; + sentinel = 1; + nbytes = newfunction(buffer); + if (nbytes != 0) { + if (fseek(fp, nbytes * -1, SEEK_CUR) == -1) + return (-1); + return (0); + } + } + + /* + * If the sentinel is not set, it means it did not match any + * "high half" for this code so simply give up. + * Operates the second-level aggregation. + */ + tnsamples = 0; + do { + if (sentinel == 0) + return (-1); + if (sscanf(buffer, " %p:", &ptr) != 1) + return (-1); + obj = general_findent((uintptr_t)ptr); + if (obj != NULL) + tnsamples += obj->en_nsamples; + } while (fgets(buffer, LNBUFF, fp) != NULL && isasminline(buffer) != 0); + + /* Rewind to the start of the block in order to start the printout. */ + if (fseek(fp, lstart, SEEK_SET) == -1) + return (-1); + + /* Again the high half of the block rappresenting the C part. */ + done = 0; + while (fgets(buffer, LNBUFF, fp) != NULL && isasminline(buffer) == 0) { + if (tnsamples == 0 || done != 0) + printf("\t| %s", buffer); + else { + done = 1; + printf("%.2f%%\t| %s", + (float)tnsamples * 100 / agg->ag_nsamples, buffer); + } + } + + /* + * Again the low half of the block rappresenting the asm + * translation part. + */ + for (;;) { + if (fgets(buffer, LNBUFF, fp) == NULL) + return (0); + if (isasminline(buffer) == 0) + break; + nbytes = newfunction(buffer); + if (nbytes != 0) { + if (fseek(fp, nbytes * -1, SEEK_CUR) == -1) + return (-1); + return (0); + } + } + if (fseek(fp, strlen(buffer) * -1, SEEK_CUR) == -1) + return (-1); + return (0); +} + +/* + * Helper printout functions. + */ +static void +usage(const char *progname) +{ + + fprintf(stderr, + "usage: %s [-a] [-h] [-k kfile] [-l lb] pmcraw.out binary\n", + progname); + exit(EXIT_SUCCESS); +} + +int +main(int argc, char *argv[]) +{ + char buffer[LNBUFF], fname[FNBUFF], tbfl[] = TMPPATH, tofl[] = TMPPATH; + char tmpf[MAXPATHLEN * 2 + 50]; + float limit; + char *bin, *exec, *kfile, *ofile; + struct entry *obj; + FILE *gfp, *bfp; + void *ptr, *hstart, *hend; + uintptr_t tmppc, ostart, oend; + int cget, asmsrc; + + exec = argv[0]; + ofile = NULL; + bin = NULL; + kfile = NULL; + asmsrc = 0; + limit = 0.5; + while ((cget = getopt(argc, argv, "ahl:k:")) != -1) + switch(cget) { + case 'a': + asmsrc = 1; + break; + case 'k': + kfile = optarg; + break; + case 'l': + limit = (float)atof(optarg); + break; + case 'h': + case '?': + default: + usage(exec); + } + argc -= optind; + argv += optind; + if (argc != 2) + usage(exec); + ofile = argv[0]; + bin = argv[1]; + + if (access(bin, R_OK | F_OK) == -1) + FATAL(exec, "%s: Impossible to locate the binary file\n", + exec); + if (access(ofile, R_OK | F_OK) == -1) + FATAL(exec, "%s: Impossible to locate the pmcstat file\n", + exec); + if (kfile != NULL && access(kfile, R_OK | F_OK) == -1) + FATAL(exec, "%s: Impossible to locate the kernel file\n", + exec); + + bzero(tmpf, sizeof(tmpf)); + if (mkstemp(tofl) == -1) + FATAL(exec, "%s: Impossible to create the tmp file\n", + exec); + if (kfile != NULL) + snprintf(tmpf, sizeof(tmpf), "pmcstat -k %s -R %s -m %s", + kfile, ofile, tofl); + else + snprintf(tmpf, sizeof(tmpf), "pmcstat -R %s -m %s", ofile, + tofl); + if (system(tmpf) != 0) + FATAL(exec, "%s: Impossible to create the tmp file\n", + exec); + + gfp = fopen(tofl, "r"); + if (gfp == NULL) + FATAL(exec, "%s: Impossible to open the map file\n", + exec); + + /* + * Make the collection of raw entries from a pmcstat mapped file. + * The heuristic here wants strings in the form: + * "addr funcname startfaddr endfaddr". + */ + while (fgets(buffer, LNBUFF, gfp) != NULL) { + if (isspace(buffer[0])) + continue; + if (sscanf(buffer, "%p %s %p %p\n", &ptr, fname, + &hstart, &hend) != 4) + FATAL(NULL, + "%s: Invalid scan of function in the map file\n", + exec); + ostart = (uintptr_t)hstart; + oend = (uintptr_t)hend; + tmppc = (uintptr_t)ptr; + totalsamples++; + obj = general_findent(tmppc); + if (obj != NULL) { + entry_acqref(obj); + continue; + } + obj = entry_create(fname, tmppc, ostart, oend); + if (obj == NULL) + FATAL(exec, + "%s: Impossible to create a new object\n", exec); + general_insertent(obj); + } + if (fclose(gfp) == EOF) + FATAL(exec, "%s: Impossible to close the filedesc\n", + exec); + if (remove(tofl) == -1) + FATAL(exec, "%s: Impossible to remove the tmpfile\n", + exec); + + /* + * Remove the loose end objects and feed the first-level aggregation + * queue. + */ + if (fqueue_insertgen() == -1) + FATAL(exec, "%s: Impossible to generate an analysis\n", + exec); + fqueue_compact(limit); + if (fqueue_getall(bin, tbfl, asmsrc) == -1) + FATAL(exec, "%s: Impossible to create the tmp file\n", + exec); + + bfp = fopen(tbfl, "r"); + if (bfp == NULL) + FATAL(exec, "%s: Impossible to open the binary file\n", + exec); + + if (asmsrc != 0) + asmparse(bfp); + else if (cparse(bfp) == -1) + FATAL(NULL, "%s: Invalid format for the C file\n", exec); + if (fclose(bfp) == EOF) + FATAL(exec, "%s: Impossible to close the filedesc\n", + exec); + if (remove(tbfl) == -1) + FATAL(exec, "%s: Impossible to remove the tmpfile\n", + exec); + return (0); +} From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 22:50:17 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 3952F106564A; Sun, 7 Jun 2009 22:50:17 +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 279BC8FC12; Sun, 7 Jun 2009 22:50:17 +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 n57MoHU0007867; Sun, 7 Jun 2009 22:50:17 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n57MoGho007865; Sun, 7 Jun 2009 22:50:16 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906072250.n57MoGho007865@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 22:50: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: r193659 - in user/kmacy/releng_7_2_fcs/sys/dev/cxgb: . 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: Sun, 07 Jun 2009 22:50:17 -0000 Author: kmacy Date: Sun Jun 7 22:50:16 2009 New Revision: 193659 URL: http://svn.freebsd.org/changeset/base/193659 Log: small cleanups Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h 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 Sun Jun 7 22:06:15 2009 (r193658) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 22:50:16 2009 (r193659) @@ -1623,7 +1623,6 @@ static int cxgb_transmit_locked(struct ifnet *ifp, struct sge_qset *qs, struct mbuf *m) { struct port_info *pi = qs->port; - struct adapter *sc = pi->adapter; struct sge_txq *txq = &qs->txq[TXQ_ETH]; struct buf_ring *br = txq->txq_mr; int error, avail; Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Sun Jun 7 22:06:15 2009 (r193658) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Sun Jun 7 22:50:16 2009 (r193659) @@ -67,17 +67,8 @@ static __inline void m_freem_list(struct mbuf *m) { struct mbuf *n; -#ifdef INVARIANTS - int i = 0; -#endif while (m != NULL) { -#ifdef INVARIANTS - if ((m == (struct mbuf *)0xDEADC0DE) || - m == (struct mbuf *)0xdeadc0dedeadc0de) - panic("%s freed mbuf %d in mbuf list", __FUNCTION__, i); - i++; -#endif n = m->m_nextpkt; if (n != NULL) prefetch(n); From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 22:50: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 15EC71065676; Sun, 7 Jun 2009 22:50: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 DE85B8FC1C; Sun, 7 Jun 2009 22:50:45 +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 n57Mojuo007914; Sun, 7 Jun 2009 22:50:45 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n57Mojee007913; Sun, 7 Jun 2009 22:50:45 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906072250.n57Mojee007913@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 22:50:45 +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: r193660 - 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, 07 Jun 2009 22:50:46 -0000 Author: kmacy Date: Sun Jun 7 22:50:45 2009 New Revision: 193660 URL: http://svn.freebsd.org/changeset/base/193660 Log: keep stats per-cpu Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Sun Jun 7 22:50:16 2009 (r193659) +++ user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Sun Jun 7 22:50:45 2009 (r193660) @@ -148,7 +148,8 @@ struct flowtable { uint32_t ft_allocated; uint32_t ft_misses; uint64_t ft_hits; - + uint64_t ft_lookups; + uint32_t ft_udp_idle; uint32_t ft_fin_wait_idle; uint32_t ft_syn_idle; @@ -164,13 +165,13 @@ struct flowtable { bitstr_t *ft_masks[MAXCPU]; bitstr_t *ft_tmpmask; struct flowtable *ft_next; -}; +} __aligned(128); static struct proc *flowcleanerproc; -static struct flowtable *flow_list_head; -static uint32_t hashjitter; -static uma_zone_t ipv4_zone; -static uma_zone_t ipv6_zone; +static struct flowtable *flow_list_head __aligned(128); +static uma_zone_t ipv4_zone __aligned(128); +static uma_zone_t ipv6_zone __aligned(128); +static uint32_t hashjitter __aligned(128); static struct cv flowclean_cv; static struct mtx flowclean_lock; @@ -606,7 +607,7 @@ flowtable_lookup(struct flowtable *ft, s if (hash == 0 || (key[0] == 0 && (ft->ft_flags & FL_HASH_PORTS))) return (ENOENT); - flowtable_lookups++; + ft->ft_lookups++; FL_ENTRY_LOCK(ft, hash); if ((fle = FL_ENTRY(ft, hash)) == NULL) { FL_ENTRY_UNLOCK(ft, hash); @@ -621,7 +622,7 @@ keycheck: && (proto == fle->f_proto) && (rt->rt_flags & RTF_UP) && (rt->rt_ifp != NULL)) { - flowtable_hits++; + ft->ft_hits++; fle->f_uptime = time_uptime; fle->f_flags |= flags; ro->ro_rt = rt; @@ -635,7 +636,7 @@ keycheck: FL_ENTRY_UNLOCK(ft, hash); uncached: - flowtable_misses++; + ft->ft_misses++; /* * This bit of code ends up locking the * same route 3 times (just like ip_output + ether_output) From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 22:52: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 1D6C81065670; Sun, 7 Jun 2009 22:52:20 +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 E56D18FC14; Sun, 7 Jun 2009 22:52: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 n57MqJYL007981; Sun, 7 Jun 2009 22:52:19 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n57MqJVD007977; Sun, 7 Jun 2009 22:52:19 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906072252.n57MqJVD007977@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 22:52: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: r193661 - in user/kmacy/releng_7_2_fcs/sys: amd64/conf conf netinet 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: Sun, 07 Jun 2009 22:52:20 -0000 Author: kmacy Date: Sun Jun 7 22:52:19 2009 New Revision: 193661 URL: http://svn.freebsd.org/changeset/base/193661 Log: - add pcpu ipid as performance hack Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC user/kmacy/releng_7_2_fcs/sys/conf/options user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c user/kmacy/releng_7_2_fcs/sys/sys/pcpu.h Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC Sun Jun 7 22:50:45 2009 (r193660) +++ user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC Sun Jun 7 22:52:19 2009 (r193661) @@ -30,6 +30,7 @@ makeoptions MODULES_OVERRIDE="geom zfs c makeoptions OPENSOLARIS options OPENSOLARIS options ZFS +options NO_SLOW_STATS options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption Modified: user/kmacy/releng_7_2_fcs/sys/conf/options ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/conf/options Sun Jun 7 22:50:45 2009 (r193660) +++ user/kmacy/releng_7_2_fcs/sys/conf/options Sun Jun 7 22:52:19 2009 (r193661) @@ -781,3 +781,8 @@ INTR_FILTER opt_global.h # Virtualize the network stack VIMAGE opt_global.h VIMAGE_GLOBALS opt_global.h + + +# remove slow stats keeping +NO_SLOW_STATS opt_global.h + Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Sun Jun 7 22:50:45 2009 (r193660) +++ user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Sun Jun 7 22:52:19 2009 (r193661) @@ -190,8 +190,13 @@ ip_output(struct mbuf *m, struct mbuf *o if ((flags & (IP_FORWARDING|IP_RAWOUTPUT)) == 0) { ip->ip_v = IPVERSION; ip->ip_hl = hlen >> 2; +#ifndef NO_SLOW_STATS ip->ip_id = ip_newid(); V_ipstat.ips_localout++; +#else + ip->ip_id = PCPU_GET(ipid); + PCPU_INC(ipid, 1); +#endif } else { hlen = ip->ip_hl << 2; } Modified: user/kmacy/releng_7_2_fcs/sys/sys/pcpu.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/sys/pcpu.h Sun Jun 7 22:50:45 2009 (r193660) +++ user/kmacy/releng_7_2_fcs/sys/sys/pcpu.h Sun Jun 7 22:52:19 2009 (r193661) @@ -72,6 +72,8 @@ struct pcpu { uint64_t pc_switchtime; int pc_switchticks; u_int pc_cpuid; /* This cpu number */ + u_short pc_ipid; + u_short pc_short_pad; cpumask_t pc_cpumask; /* This cpu mask */ cpumask_t pc_other_cpus; /* Mask of all other cpus */ SLIST_ENTRY(pcpu) pc_allcpu; From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 22:55: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 EB005106566C; Sun, 7 Jun 2009 22:55: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 D99708FC08; Sun, 7 Jun 2009 22:55:48 +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 n57MtmXu008170; Sun, 7 Jun 2009 22:55:48 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n57Mtm3H008169; Sun, 7 Jun 2009 22:55:48 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906072255.n57Mtm3H008169@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 22:55:48 +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: r193663 - 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: Sun, 07 Jun 2009 22:55:49 -0000 Author: kmacy Date: Sun Jun 7 22:55:48 2009 New Revision: 193663 URL: http://svn.freebsd.org/changeset/base/193663 Log: PCPU_INC only takes 1 argument Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Sun Jun 7 22:52:48 2009 (r193662) +++ user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Sun Jun 7 22:55:48 2009 (r193663) @@ -195,7 +195,7 @@ ip_output(struct mbuf *m, struct mbuf *o V_ipstat.ips_localout++; #else ip->ip_id = PCPU_GET(ipid); - PCPU_INC(ipid, 1); + PCPU_INC(ipid); #endif } else { hlen = ip->ip_hl << 2; From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 23:46:29 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 E5D821065672; Sun, 7 Jun 2009 23:46:29 +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 D48D58FC0A; Sun, 7 Jun 2009 23:46:29 +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 n57NkTkO009485; Sun, 7 Jun 2009 23:46:29 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n57NkTNF009483; Sun, 7 Jun 2009 23:46:29 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906072346.n57NkTNF009483@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 23:46:29 +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: r193668 - 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: Sun, 07 Jun 2009 23:46:30 -0000 Author: kmacy Date: Sun Jun 7 23:46:29 2009 New Revision: 193668 URL: http://svn.freebsd.org/changeset/base/193668 Log: track packets per-txq rather than globally Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Sun Jun 7 23:38:16 2009 (r193667) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Sun Jun 7 23:46:29 2009 (r193668) @@ -250,7 +250,9 @@ struct sge_txq { uint32_t txq_enqueued; uint32_t txq_dump_start; uint32_t txq_dump_count; - unsigned long txq_frees; + uint64_t txq_direct_packets; + uint64_t txq_direct_bytes; + uint64_t txq_frees; struct sg_ent txq_sgl[TX_MAX_SEGS / 2 + 1]; }; 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 Sun Jun 7 23:38:16 2009 (r193667) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sun Jun 7 23:46:29 2009 (r193668) @@ -1648,9 +1648,10 @@ cxgb_transmit_locked(struct ifnet *ifp, } else { /* * We've bypassed the buf ring so we need to update - * ifp directly + * the stats directly */ - drbr_stats_update(ifp, m->m_pkthdr.len, m->m_flags); + txq->txq_direct_packets++; + txq->txq_direct_bytes += m->m_pkthdr.len; /* ** Send a copy of the frame to the BPF ** listener and set the watchdog on. From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 23:47: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 1ED6A1065675; Sun, 7 Jun 2009 23:47: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 0E0958FC0C; Sun, 7 Jun 2009 23:47: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 n57Nl6KY009535; Sun, 7 Jun 2009 23:47:06 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n57Nl6kB009534; Sun, 7 Jun 2009 23:47:06 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906072347.n57Nl6kB009534@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 23:47:06 +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: r193669 - 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, 07 Jun 2009 23:47:07 -0000 Author: kmacy Date: Sun Jun 7 23:47:06 2009 New Revision: 193669 URL: http://svn.freebsd.org/changeset/base/193669 Log: pre-fetch collision entries Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Sun Jun 7 23:46:29 2009 (r193668) +++ user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Sun Jun 7 23:47:06 2009 (r193669) @@ -177,6 +177,20 @@ static struct cv flowclean_cv; static struct mtx flowclean_lock; static uint64_t flowclean_cycles; +#if defined(__i386__) || defined(__amd64__) +static __inline +void prefetch(void *x) +{ + __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); +} +#else +static __inline +void prefetch(void *x) +{ + ; +} +#endif + /* * TODO: * - Make flowtable stats per-cpu, aggregated at sysctl call time, @@ -613,7 +627,10 @@ flowtable_lookup(struct flowtable *ft, s FL_ENTRY_UNLOCK(ft, hash); goto uncached; } -keycheck: +keycheck: + if (fle->f_next != NULL) + prefetch(fle->f_next); + rt = __DEVOLATILE(struct rtentry *, fle->f_rt); lle = __DEVOLATILE(struct llentry *, fle->f_lle); if ((rt != NULL) From owner-svn-src-user@FreeBSD.ORG Sun Jun 7 23:49:17 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 277441065672; Sun, 7 Jun 2009 23:49:17 +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 160478FC08; Sun, 7 Jun 2009 23:49:17 +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 n57NnFox009607; Sun, 7 Jun 2009 23:49:15 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n57NnF8c009605; Sun, 7 Jun 2009 23:49:15 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906072349.n57NnF8c009605@svn.freebsd.org> From: Kip Macy Date: Sun, 7 Jun 2009 23:49:15 +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: r193670 - in user/kmacy/releng_7_2_fcs/sys: net 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: Sun, 07 Jun 2009 23:49:17 -0000 Author: kmacy Date: Sun Jun 7 23:49:15 2009 New Revision: 193670 URL: http://svn.freebsd.org/changeset/base/193670 Log: track bytes and buffers enqueued in buf_ring Modified: user/kmacy/releng_7_2_fcs/sys/net/if_var.h user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.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 7 23:47:06 2009 (r193669) +++ user/kmacy/releng_7_2_fcs/sys/net/if_var.h Sun Jun 7 23:49:15 2009 (r193670) @@ -559,8 +559,9 @@ do { \ static __inline void drbr_stats_update(struct ifnet *ifp, int len, int mflags) { - +#ifndef NO_SLOW_STATS ifp->if_obytes += len; +#endif if (mflags & M_MCAST) ifp->if_omcasts++; } @@ -578,13 +579,12 @@ drbr_enqueue(struct ifnet *ifp, struct b return (error); } #endif - if ((error = buf_ring_enqueue(br, m)) == ENOBUFS) { + if ((error = buf_ring_enqueue(br, m, m->m_pkthdr.len)) == ENOBUFS) { br->br_drops++; - _IF_DROP(&ifp->if_snd); m_freem(m); } else drbr_stats_update(ifp, len, mflags); - + return (error); } Modified: user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h Sun Jun 7 23:47:06 2009 (r193669) +++ user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h Sun Jun 7 23:49:15 2009 (r193670) @@ -49,10 +49,12 @@ struct buf_ring { int br_prod_size; int br_prod_mask; uint64_t br_drops; + uint64_t br_prod_bufs; + uint64_t br_prod_bytes; /* * Pad out to next L2 cache line */ - uint64_t _pad0[13]; + uint64_t _pad0[11]; volatile uint32_t br_cons_head; volatile uint32_t br_cons_tail; @@ -74,7 +76,7 @@ struct buf_ring { * */ static __inline int -buf_ring_enqueue(struct buf_ring *br, void *buf) +buf_ring_enqueue(struct buf_ring *br, void *buf, int nbytes) { uint32_t prod_head, prod_next; uint32_t cons_tail; @@ -116,6 +118,8 @@ buf_ring_enqueue(struct buf_ring *br, vo */ while (br->br_prod_tail != prod_head) cpu_spinwait(); + br->br_prod_bufs++; + br->br_prod_bytes += nbytes; br->br_prod_tail = prod_next; critical_exit(); return (0); From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 01:26:23 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 C400B106566C; Mon, 8 Jun 2009 01:26:23 +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 B33118FC12; Mon, 8 Jun 2009 01:26:23 +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 n581QNEm011478; Mon, 8 Jun 2009 01:26:23 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n581QN7T011477; Mon, 8 Jun 2009 01:26:23 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080126.n581QN7T011477@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 01:26:23 +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: r193671 - user/kmacy/releng_7_2_fcs/lib/libpmc 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, 08 Jun 2009 01:26:24 -0000 Author: kmacy Date: Mon Jun 8 01:26:23 2009 New Revision: 193671 URL: http://svn.freebsd.org/changeset/base/193671 Log: fix large buffer handling Modified: user/kmacy/releng_7_2_fcs/lib/libpmc/pmclog.c Modified: user/kmacy/releng_7_2_fcs/lib/libpmc/pmclog.c ============================================================================== --- user/kmacy/releng_7_2_fcs/lib/libpmc/pmclog.c Sun Jun 7 23:49:15 2009 (r193670) +++ user/kmacy/releng_7_2_fcs/lib/libpmc/pmclog.c Mon Jun 8 01:26:23 2009 (r193671) @@ -483,6 +483,7 @@ pmclog_read(void *cookie, struct pmclog_ /* Retrieve one event from the byte stream. */ + ps->ps_len; retval = pmclog_get_event(ps, &ps->ps_data, &ps->ps_len, ev); /* From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 01:28: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 116E51065670; Mon, 8 Jun 2009 01:28: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 006918FC18; Mon, 8 Jun 2009 01:28: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 n581Sb7I011550; Mon, 8 Jun 2009 01:28:37 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n581SbfU011549; Mon, 8 Jun 2009 01:28:37 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080128.n581SbfU011549@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 01:28:37 +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: r193672 - user/kmacy/releng_7_2_fcs/lib/libpmc 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, 08 Jun 2009 01:28:38 -0000 Author: kmacy Date: Mon Jun 8 01:28:37 2009 New Revision: 193672 URL: http://svn.freebsd.org/changeset/base/193672 Log: wooops Modified: user/kmacy/releng_7_2_fcs/lib/libpmc/pmclog.c Modified: user/kmacy/releng_7_2_fcs/lib/libpmc/pmclog.c ============================================================================== --- user/kmacy/releng_7_2_fcs/lib/libpmc/pmclog.c Mon Jun 8 01:26:23 2009 (r193671) +++ user/kmacy/releng_7_2_fcs/lib/libpmc/pmclog.c Mon Jun 8 01:28:37 2009 (r193672) @@ -483,7 +483,7 @@ pmclog_read(void *cookie, struct pmclog_ /* Retrieve one event from the byte stream. */ - ps->ps_len; + ps->ps_len = 0; retval = pmclog_get_event(ps, &ps->ps_data, &ps->ps_len, ev); /* From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 03:40:39 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 F33FE1065672; Mon, 8 Jun 2009 03:40: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 E22168FC15; Mon, 8 Jun 2009 03:40: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 n583ec6B014669; Mon, 8 Jun 2009 03:40:38 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n583ecmJ014668; Mon, 8 Jun 2009 03:40:38 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080340.n583ecmJ014668@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 03:40: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: r193678 - user/kmacy/releng_7_2_fcs/lib/libpmc 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, 08 Jun 2009 03:40:39 -0000 Author: kmacy Date: Mon Jun 8 03:40:38 2009 New Revision: 193678 URL: http://svn.freebsd.org/changeset/base/193678 Log: pilot error Modified: user/kmacy/releng_7_2_fcs/lib/libpmc/pmclog.c Modified: user/kmacy/releng_7_2_fcs/lib/libpmc/pmclog.c ============================================================================== --- user/kmacy/releng_7_2_fcs/lib/libpmc/pmclog.c Mon Jun 8 03:39:15 2009 (r193677) +++ user/kmacy/releng_7_2_fcs/lib/libpmc/pmclog.c Mon Jun 8 03:40:38 2009 (r193678) @@ -483,7 +483,6 @@ pmclog_read(void *cookie, struct pmclog_ /* Retrieve one event from the byte stream. */ - ps->ps_len = 0; retval = pmclog_get_event(ps, &ps->ps_data, &ps->ps_len, ev); /* From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 03:41: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 83B20106566B; Mon, 8 Jun 2009 03:41: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 685F48FC15; Mon, 8 Jun 2009 03:41: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 n583fc0x014725; Mon, 8 Jun 2009 03:41:38 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n583fcJf014724; Mon, 8 Jun 2009 03:41:38 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080341.n583fcJf014724@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 03:41: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: r193679 - 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: Mon, 08 Jun 2009 03:41:38 -0000 Author: kmacy Date: Mon Jun 8 03:41:38 2009 New Revision: 193679 URL: http://svn.freebsd.org/changeset/base/193679 Log: - remove more global variable touching - hash ports when setting flowid Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Mon Jun 8 03:40:38 2009 (r193678) +++ user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Mon Jun 8 03:41:38 2009 (r193679) @@ -147,6 +147,8 @@ struct flowtable { uint32_t ft_collisions; uint32_t ft_allocated; uint32_t ft_misses; + uint64_t ft_free_checks; + uint64_t ft_frees; uint64_t ft_hits; uint64_t ft_lookups; @@ -356,7 +358,8 @@ ipv4_flow_lookup_hash_internal(struct mb key[2] = sin->sin_addr.s_addr; - if ((*flags & FL_HASH_PORTS) == 0) + if ((*flags & FL_HASH_PORTS) == 0 && + (m == NULL || (m->m_flags & M_FLOWID))) goto skipports; proto = ip->ip_p; @@ -390,7 +393,14 @@ ipv4_flow_lookup_hash_internal(struct mb } *protop = proto; - + if (m != NULL && (m->m_flags & M_FLOWID) == 0) { + ((uint16_t *)key)[0] = sport; + ((uint16_t *)key)[1] = dport; + m->m_flags |= M_FLOWID; + m->m_pkthdr.flowid = jenkins_hashword(key, 3, + hashjitter + proto); + } + /* * If this is a transmit route cache then * hash all flows to a given destination to @@ -404,11 +414,6 @@ ipv4_flow_lookup_hash_internal(struct mb skipports: hash = jenkins_hashword(key, 3, hashjitter + proto); - if (m != NULL && (m->m_flags & M_FLOWID) == 0) { - m->m_flags |= M_FLOWID; - m->m_pkthdr.flowid = hash; - } - return (hash); noop: *protop = proto; @@ -488,7 +493,6 @@ flowtable_set_hashkey(struct flentry *fl nwords = 3; hashkey = ((struct flentry_v6 *)fle)->fl_flow.ipf_key; } - for (i = 0; i < nwords; i++) hashkey[i] = key[i]; } @@ -507,7 +511,7 @@ flowtable_insert(struct flowtable *ft, u if (newfle == NULL) return (ENOMEM); - newfle->f_flags |= (flags & FL_IPV6); + prefetch(newfle); FL_ENTRY_LOCK(ft, hash); mask = flowtable_mask(ft); @@ -521,7 +525,7 @@ flowtable_insert(struct flowtable *ft, u } depth = 0; - flowtable_collisions++; + ft->ft_collisions++; /* * find end of list and make sure that we were not * preempted by another thread handling this flow @@ -551,6 +555,7 @@ flowtable_insert(struct flowtable *ft, u flowtable_max_depth = depth; fletail->f_next = newfle; fle = newfle; + newfle->f_flags |= (flags & FL_IPV6); skip: flowtable_set_hashkey(fle, key); @@ -852,7 +857,7 @@ flowtable_free_stale(struct flowtable *f flehead = flowtable_entry(ft, curbit); fle = fleprev = *flehead; - flowtable_free_checks++; + ft->ft_free_checks++; #ifdef DIAGNOSTIC if (fle == NULL && curbit > 0) { log(LOG_ALERT, @@ -903,7 +908,7 @@ flowtable_free_stale(struct flowtable *f while ((fle = flefreehead) != NULL) { flefreehead = fle->f_next; count++; - flowtable_frees++; + ft->ft_frees++; fle_free(fle); } if (bootverbose && count) From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 04:08: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 220F91065670; Mon, 8 Jun 2009 04:08: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 10BC68FC1A; Mon, 8 Jun 2009 04:08: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 n5848I0l015256; Mon, 8 Jun 2009 04:08:18 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5848Ivv015255; Mon, 8 Jun 2009 04:08:18 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080408.n5848Ivv015255@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 04:08:18 +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: r193680 - 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: Mon, 08 Jun 2009 04:08:19 -0000 Author: kmacy Date: Mon Jun 8 04:08:18 2009 New Revision: 193680 URL: http://svn.freebsd.org/changeset/base/193680 Log: - remove gratuitous ntohl - remove redundant conditional Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Mon Jun 8 03:41:38 2009 (r193679) +++ user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Mon Jun 8 04:08:18 2009 (r193680) @@ -337,6 +337,7 @@ ipv4_flow_lookup_hash_internal(struct mb struct ip *ip = NULL; uint8_t proto = 0; int iphlen; + int needflowid; uint32_t hash; struct sockaddr_in *sin; struct tcphdr *th; @@ -358,8 +359,8 @@ ipv4_flow_lookup_hash_internal(struct mb key[2] = sin->sin_addr.s_addr; - if ((*flags & FL_HASH_PORTS) == 0 && - (m == NULL || (m->m_flags & M_FLOWID))) + needflowid = (m != NULL && (m->m_flags & M_FLOWID) == 0); + if ((*flags & FL_HASH_PORTS) == 0 && needflowid) goto skipports; proto = ip->ip_p; @@ -369,8 +370,8 @@ ipv4_flow_lookup_hash_internal(struct mb switch (proto) { case IPPROTO_TCP: th = (struct tcphdr *)((caddr_t)ip + iphlen); - sport = ntohs(th->th_sport); - dport = ntohs(th->th_dport); + sport = th->th_sport; + dport = th->th_dport; *flags |= th->th_flags; if (*flags & TH_RST) *flags |= FL_STALE; @@ -393,7 +394,7 @@ ipv4_flow_lookup_hash_internal(struct mb } *protop = proto; - if (m != NULL && (m->m_flags & M_FLOWID) == 0) { + if (needflowid) { ((uint16_t *)key)[0] = sport; ((uint16_t *)key)[1] = dport; m->m_flags |= M_FLOWID; From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 04:09:13 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 7521D106566C; Mon, 8 Jun 2009 04:09:13 +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 63BD28FC14; Mon, 8 Jun 2009 04:09:13 +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 n5849Dgq015313; Mon, 8 Jun 2009 04:09:13 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5849DgS015311; Mon, 8 Jun 2009 04:09:13 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080409.n5849DgS015311@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 04:09:13 +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: r193681 - 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, 08 Jun 2009 04:09:13 -0000 Author: kmacy Date: Mon Jun 8 04:09:13 2009 New Revision: 193681 URL: http://svn.freebsd.org/changeset/base/193681 Log: give all udp packets a flowid Modified: user/kmacy/releng_7_2_fcs/sys/netinet/in_pcb.c user/kmacy/releng_7_2_fcs/sys/netinet/udp_usrreq.c Modified: user/kmacy/releng_7_2_fcs/sys/netinet/in_pcb.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/in_pcb.c Mon Jun 8 04:08:18 2009 (r193680) +++ user/kmacy/releng_7_2_fcs/sys/netinet/in_pcb.c Mon Jun 8 04:09:13 2009 (r193681) @@ -196,7 +196,8 @@ in_pcballoc(struct socket *so, struct in #endif struct inpcb *inp; int error; - + static int flowid = 1; + INP_INFO_WLOCK_ASSERT(pcbinfo); error = 0; inp = uma_zalloc(pcbinfo->ipi_zone, M_NOWAIT); @@ -207,6 +208,7 @@ in_pcballoc(struct socket *so, struct in inp->inp_socket = so; inp->inp_cred = crhold(so->so_cred); inp->inp_inc.inc_fibnum = so->so_fibnum; + inp->inp_flowid = flowid++; #ifdef MAC error = mac_inpcb_init(inp, M_NOWAIT); if (error != 0) Modified: user/kmacy/releng_7_2_fcs/sys/netinet/udp_usrreq.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/udp_usrreq.c Mon Jun 8 04:08:18 2009 (r193680) +++ user/kmacy/releng_7_2_fcs/sys/netinet/udp_usrreq.c Mon Jun 8 04:09:13 2009 (r193681) @@ -1116,7 +1116,11 @@ udp_output(struct inpcb *inp, struct mbu INP_INFO_WUNLOCK(&V_udbinfo); else if (unlock_udbinfo == 1) INP_INFO_RUNLOCK(&V_udbinfo); - error = ip_output(m, inp->inp_options, NULL, ipflags, + if (inp->inp_flowid != 0) { + m->m_pkthdr.flowid = inp->inp_flowid; + m->m_flags |= M_FLOWID; + } + error = ip_output(m, inp->inp_options, NULL, ipflags, inp->inp_moptions, inp); if (unlock_udbinfo == 2) INP_WUNLOCK(inp); From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 04:34: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 A265B106564A; Mon, 8 Jun 2009 04:34: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 908668FC0A; Mon, 8 Jun 2009 04:34: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 n584Ypn9015873; Mon, 8 Jun 2009 04:34:51 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n584YpqK015872; Mon, 8 Jun 2009 04:34:51 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080434.n584YpqK015872@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 04:34: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: r193682 - 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: Mon, 08 Jun 2009 04:34:51 -0000 Author: kmacy Date: Mon Jun 8 04:34:51 2009 New Revision: 193682 URL: http://svn.freebsd.org/changeset/base/193682 Log: make flowtable stats per-cpu Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Mon Jun 8 04:09:13 2009 (r193681) +++ user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Mon Jun 8 04:34:51 2009 (r193682) @@ -140,10 +140,7 @@ union flentryp { struct flentry **pcpu[MAXCPU]; }; -struct flowtable { - int ft_size; - int ft_lock_count; - uint32_t ft_flags; +struct flowtable_stats { uint32_t ft_collisions; uint32_t ft_allocated; uint32_t ft_misses; @@ -151,6 +148,15 @@ struct flowtable { uint64_t ft_frees; uint64_t ft_hits; uint64_t ft_lookups; +} __aligned(128); + + + +struct flowtable { + struct flowtable_stats ft_stats[MAXCPU]; + int ft_size; + int ft_lock_count; + uint32_t ft_flags; uint32_t ft_udp_idle; uint32_t ft_fin_wait_idle; @@ -503,6 +509,7 @@ flowtable_insert(struct flowtable *ft, u uint8_t proto, struct route *ro, uint16_t flags) { struct flentry *fle, *fletail, *newfle, **flep; + struct flowtable_stats *fs = &ft->ft_stats[curcpu]; int depth; uma_zone_t flezone; bitstr_t *mask; @@ -513,7 +520,6 @@ flowtable_insert(struct flowtable *ft, u return (ENOMEM); prefetch(newfle); - FL_ENTRY_LOCK(ft, hash); mask = flowtable_mask(ft); flep = flowtable_entry(ft, hash); @@ -526,7 +532,7 @@ flowtable_insert(struct flowtable *ft, u } depth = 0; - ft->ft_collisions++; + fs->ft_collisions++; /* * find end of list and make sure that we were not * preempted by another thread handling this flow @@ -600,7 +606,8 @@ flowtable_lookup(struct flowtable *ft, s int error = 0, fib = 0; struct rtentry *rt; struct llentry *lle; - + struct flowtable_stats *fs = &ft->ft_stats[curcpu]; + flags = ft->ft_flags; ro->ro_rt = NULL; ro->ro_lle = NULL; @@ -627,7 +634,7 @@ flowtable_lookup(struct flowtable *ft, s if (hash == 0 || (key[0] == 0 && (ft->ft_flags & FL_HASH_PORTS))) return (ENOENT); - ft->ft_lookups++; + fs->ft_lookups++; FL_ENTRY_LOCK(ft, hash); if ((fle = FL_ENTRY(ft, hash)) == NULL) { FL_ENTRY_UNLOCK(ft, hash); @@ -645,7 +652,7 @@ keycheck: && (proto == fle->f_proto) && (rt->rt_flags & RTF_UP) && (rt->rt_ifp != NULL)) { - ft->ft_hits++; + fs->ft_hits++; fle->f_uptime = time_uptime; fle->f_flags |= flags; ro->ro_rt = rt; @@ -659,7 +666,7 @@ keycheck: FL_ENTRY_UNLOCK(ft, hash); uncached: - ft->ft_misses++; + fs->ft_misses++; /* * This bit of code ends up locking the * same route 3 times (just like ip_output + ether_output) @@ -836,6 +843,7 @@ flowtable_free_stale(struct flowtable *f struct flentry *fle, **flehead, *fleprev; struct flentry *flefreehead, *flefreetail, *fletmp; bitstr_t *mask, *tmpmask; + struct flowtable_stats *fs = &ft->ft_stats[curcpu]; flefreehead = flefreetail = NULL; mask = flowtable_mask(ft); @@ -858,7 +866,7 @@ flowtable_free_stale(struct flowtable *f flehead = flowtable_entry(ft, curbit); fle = fleprev = *flehead; - ft->ft_free_checks++; + fs->ft_free_checks++; #ifdef DIAGNOSTIC if (fle == NULL && curbit > 0) { log(LOG_ALERT, @@ -909,7 +917,7 @@ flowtable_free_stale(struct flowtable *f while ((fle = flefreehead) != NULL) { flefreehead = fle->f_next; count++; - ft->ft_frees++; + fs->ft_frees++; fle_free(fle); } if (bootverbose && count) From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 04:52:08 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 156EA106564A; Mon, 8 Jun 2009 04:52:08 +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 03B8A8FC14; Mon, 8 Jun 2009 04:52:08 +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 n584q7Sw016276; Mon, 8 Jun 2009 04:52:07 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n584q7em016275; Mon, 8 Jun 2009 04:52:07 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080452.n584q7em016275@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 04:52: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: r193684 - 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: Mon, 08 Jun 2009 04:52:08 -0000 Author: kmacy Date: Mon Jun 8 04:52:07 2009 New Revision: 193684 URL: http://svn.freebsd.org/changeset/base/193684 Log: don't do gratuitous NULLing Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Mon Jun 8 04:39:47 2009 (r193683) +++ user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Mon Jun 8 04:52:07 2009 (r193684) @@ -609,8 +609,6 @@ flowtable_lookup(struct flowtable *ft, s struct flowtable_stats *fs = &ft->ft_stats[curcpu]; flags = ft->ft_flags; - ro->ro_rt = NULL; - ro->ro_lle = NULL; /* * The internal hash lookup is the only IPv4 specific bit @@ -699,7 +697,6 @@ uncached: if (lle == NULL) { RTFREE(rt); - ro->ro_rt = NULL; return (ENOENT); } error = flowtable_insert(ft, hash, key, proto, @@ -708,8 +705,6 @@ uncached: if (error) { RTFREE(rt); LLE_FREE(lle); - ro->ro_rt = NULL; - ro->ro_lle = NULL; } } From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 04:53:28 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 7D183106564A; Mon, 8 Jun 2009 04:53:28 +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 6B83F8FC14; Mon, 8 Jun 2009 04:53:28 +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 n584rSeR016334; Mon, 8 Jun 2009 04:53:28 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n584rSHP016333; Mon, 8 Jun 2009 04:53:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080453.n584rSHP016333@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 04:53:28 +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: r193685 - 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, 08 Jun 2009 04:53:28 -0000 Author: kmacy Date: Mon Jun 8 04:53:28 2009 New Revision: 193685 URL: http://svn.freebsd.org/changeset/base/193685 Log: use cached ifp if available Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Mon Jun 8 04:52:07 2009 (r193684) +++ user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Mon Jun 8 04:53:28 2009 (r193685) @@ -163,11 +163,11 @@ ip_output(struct mbuf *m, struct mbuf *o m->m_flags |= M_FLOWID; } } - if ((ro == &iproute) && (ro->ro_rt == NULL) && (ro->ro_lle == NULL)) { - if (flowtable_lookup(ip_ft, m, ro) == 0) - nortfree = 1; + if (ro == &iproute && + flowtable_lookup(ip_ft, m, ro) == 0) { + nortfree = 1; + ifp = ro->ro_rt->rt_ifp; } - if (opt) { len = 0; m = ip_insertoptions(m, opt, &len); @@ -175,7 +175,9 @@ ip_output(struct mbuf *m, struct mbuf *o hlen = len; } ip = mtod(m, struct ip *); - + if (nortfree) + ip->ip_ttl = 1; + /* * Fill in IP header. If we are not allowing fragmentation, * then the ip_id field is meaningless, but we don't set it @@ -245,7 +247,7 @@ again: ifp = ia->ia_ifp; ip->ip_ttl = 1; isbroadcast = 1; - } else if (flags & IP_ROUTETOIF) { + } else if (ifp == NULL && (flags & IP_ROUTETOIF)) { if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL && (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == NULL) { V_ipstat.ips_noroute++; From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 05:00:33 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 49D4A106564A; Mon, 8 Jun 2009 05:00:33 +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 37EE78FC17; Mon, 8 Jun 2009 05:00:33 +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 n5850Xk7016527; Mon, 8 Jun 2009 05:00:33 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5850XAn016526; Mon, 8 Jun 2009 05:00:33 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080500.n5850XAn016526@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 05:00:33 +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: r193686 - 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, 08 Jun 2009 05:00:33 -0000 Author: kmacy Date: Mon Jun 8 05:00:32 2009 New Revision: 193686 URL: http://svn.freebsd.org/changeset/base/193686 Log: cleanup caching of ifp Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Mon Jun 8 04:53:28 2009 (r193685) +++ user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Mon Jun 8 05:00:32 2009 (r193686) @@ -166,7 +166,6 @@ ip_output(struct mbuf *m, struct mbuf *o if (ro == &iproute && flowtable_lookup(ip_ft, m, ro) == 0) { nortfree = 1; - ifp = ro->ro_rt->rt_ifp; } if (opt) { len = 0; @@ -175,8 +174,6 @@ ip_output(struct mbuf *m, struct mbuf *o hlen = len; } ip = mtod(m, struct ip *); - if (nortfree) - ip->ip_ttl = 1; /* * Fill in IP header. If we are not allowing fragmentation, @@ -247,14 +244,18 @@ again: ifp = ia->ia_ifp; ip->ip_ttl = 1; isbroadcast = 1; - } else if (ifp == NULL && (flags & IP_ROUTETOIF)) { - if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL && + } else if (flags & IP_ROUTETOIF) { + if (nortfree == 0 && + (ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL && (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == NULL) { V_ipstat.ips_noroute++; error = ENETUNREACH; goto bad; } - ifp = ia->ia_ifp; + if (nortfree) + ifp = ro->ro_rt->rt_ifp; + else + ifp = ia->ia_ifp; ip->ip_ttl = 1; isbroadcast = in_broadcast(dst->sin_addr, ifp); } else if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) && From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 06:11:36 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 9D39410656FC; Mon, 8 Jun 2009 06:11:36 +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 8B7DB8FC12; Mon, 8 Jun 2009 06:11:36 +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 n586Bagv017957; Mon, 8 Jun 2009 06:11:36 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n586BadM017956; Mon, 8 Jun 2009 06:11:36 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080611.n586BadM017956@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 06:11:36 +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: r193689 - 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, 08 Jun 2009 06:11:37 -0000 Author: kmacy Date: Mon Jun 8 06:11:36 2009 New Revision: 193689 URL: http://svn.freebsd.org/changeset/base/193689 Log: reduce opportunity for false sharing in port_info Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Mon Jun 8 05:33:08 2009 (r193688) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Mon Jun 8 06:11:36 2009 (r193689) @@ -97,11 +97,11 @@ struct port_info { struct cmac mac; struct link_config link_config; struct ifmedia media; - struct mtx lock; - uint8_t port_id; - uint8_t tx_chan; - uint8_t txpkt_intf; - uint8_t first_qset; + struct mtx lock __aligned(128); + uint32_t port_id __aligned(128); + uint32_t tx_chan; + uint32_t txpkt_intf; + uint32_t first_qset; uint32_t nqsets; int link_fault; int watchdog_timer; @@ -115,7 +115,7 @@ struct port_info { #define PORT_NAME_LEN 32 char lockbuf[PORT_LOCK_NAME_LEN]; char namebuf[PORT_NAME_LEN]; -}; +} __aligned(128); enum { /* adapter flags */ FULL_INIT_DONE = (1 << 0), From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 06:12:47 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 90CDE1065673; Mon, 8 Jun 2009 06:12:47 +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 7F67E8FC17; Mon, 8 Jun 2009 06:12: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 n586ClXX018011; Mon, 8 Jun 2009 06:12:47 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n586Clq6018010; Mon, 8 Jun 2009 06:12:47 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080612.n586Clq6018010@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 06: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: r193690 - user/kmacy/releng_7_2_fcs/sys/vm 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, 08 Jun 2009 06:12:47 -0000 Author: kmacy Date: Mon Jun 8 06:12:47 2009 New Revision: 193690 URL: http://svn.freebsd.org/changeset/base/193690 Log: avoid false sharing by aligning sections Modified: user/kmacy/releng_7_2_fcs/sys/vm/uma_int.h Modified: user/kmacy/releng_7_2_fcs/sys/vm/uma_int.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/uma_int.h Mon Jun 8 06:11:36 2009 (r193689) +++ user/kmacy/releng_7_2_fcs/sys/vm/uma_int.h Mon Jun 8 06:12:47 2009 (r193690) @@ -177,7 +177,7 @@ struct uma_cache { uma_bucket_t uc_allocbucket; /* Bucket to allocate from */ u_int64_t uc_allocs; /* Count of allocations */ u_int64_t uc_frees; /* Count of frees */ -}; +} __aligned(128); typedef struct uma_cache * uma_cache_t; @@ -280,11 +280,12 @@ struct uma_zone { uma_dtor uz_dtor; /* Destructor */ uma_init uz_init; /* Initializer for each item */ uma_fini uz_fini; /* Discards memory */ + /* separate uz_flags from stats keeping */ + u_int32_t uz_flags;/* Flags inherited from kegs */ - u_int64_t uz_allocs; /* Total number of allocations */ + u_int64_t uz_allocs __aligned(128); /* Total number of allocations */ u_int64_t uz_frees; /* Total number of frees */ u_int64_t uz_fails; /* Total number of alloc failures */ - u_int32_t uz_flags; /* Flags inherited from kegs */ u_int32_t uz_size; /* Size inherited from kegs */ uint16_t uz_fills; /* Outstanding bucket fills */ uint16_t uz_count; /* Highest value ub_ptr can have */ @@ -293,7 +294,7 @@ struct uma_zone { * This HAS to be the last item because we adjust the zone size * based on NCPU and then allocate the space for the zones. */ - struct uma_cache uz_cpu[1]; /* Per cpu caches */ + struct uma_cache uz_cpu[1] __aligned(128); /* Per cpu caches */ }; /* From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 06:13: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 B8B931065670; Mon, 8 Jun 2009 06:13: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 8CC2B8FC08; Mon, 8 Jun 2009 06:13: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 n586DY0k018064; Mon, 8 Jun 2009 06:13:34 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n586DYDo018062; Mon, 8 Jun 2009 06:13:34 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080613.n586DYDo018062@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 06:13: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: r193691 - 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, 08 Jun 2009 06:13:35 -0000 Author: kmacy Date: Mon Jun 8 06:13:34 2009 New Revision: 193691 URL: http://svn.freebsd.org/changeset/base/193691 Log: conditionally comment out global stats counters Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c user/kmacy/releng_7_2_fcs/sys/netinet/udp_usrreq.c Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Mon Jun 8 06:12:47 2009 (r193690) +++ user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Mon Jun 8 06:13:34 2009 (r193691) @@ -289,7 +289,9 @@ again: } ia = ifatoia(ro->ro_rt->rt_ifa); ifp = ro->ro_rt->rt_ifp; +#ifndef NO_SLOW_STATS ro->ro_rt->rt_rmx.rmx_pksent++; +#endif if (ro->ro_rt->rt_flags & RTF_GATEWAY) dst = (struct sockaddr_in *)ro->ro_rt->rt_gateway; if (ro->ro_rt->rt_flags & RTF_HOST) @@ -612,12 +614,14 @@ passout: * once instead of for every generated packet. */ if (!(flags & IP_FORWARDING) && ia) { +#ifndef NO_SLOW_STATS if (m->m_pkthdr.csum_flags & CSUM_TSO) ia->ia_ifa.if_opackets += m->m_pkthdr.len / m->m_pkthdr.tso_segsz; else ia->ia_ifa.if_opackets++; ia->ia_ifa.if_obytes += m->m_pkthdr.len; +#endif } #ifdef MBUF_STRESS_TEST if (mbuf_frag_size && m->m_pkthdr.len > mbuf_frag_size) Modified: user/kmacy/releng_7_2_fcs/sys/netinet/udp_usrreq.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/udp_usrreq.c Mon Jun 8 06:12:47 2009 (r193690) +++ user/kmacy/releng_7_2_fcs/sys/netinet/udp_usrreq.c Mon Jun 8 06:13:34 2009 (r193691) @@ -1110,8 +1110,9 @@ udp_output(struct inpcb *inp, struct mbu ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; ((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */ ((struct ip *)ui)->ip_tos = inp->inp_ip_tos; /* XXX */ +#ifndef NO_SLOW_STATS V_udpstat.udps_opackets++; - +#endif if (unlock_udbinfo == 2) INP_INFO_WUNLOCK(&V_udbinfo); else if (unlock_udbinfo == 1) From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 07:42: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 A9881106564A; Mon, 8 Jun 2009 07:42:20 +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 7D5EE8FC08; Mon, 8 Jun 2009 07:42:20 +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 n587gK2j019884; Mon, 8 Jun 2009 07:42:20 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n587gKDk019881; Mon, 8 Jun 2009 07:42:20 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080742.n587gKDk019881@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 07:42:20 +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: r193692 - in user/kmacy/releng_7_2_fcs/sys: amd64/include dev/cxgb dev/mxge 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, 08 Jun 2009 07:42:20 -0000 Author: kmacy Date: Mon Jun 8 07:42:19 2009 New Revision: 193692 URL: http://svn.freebsd.org/changeset/base/193692 Log: move prefetch in to machine/cpufunc.h for amd64 Modified: user/kmacy/releng_7_2_fcs/sys/amd64/include/cpufunc.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h user/kmacy/releng_7_2_fcs/sys/dev/mxge/if_mxge.c Modified: user/kmacy/releng_7_2_fcs/sys/amd64/include/cpufunc.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/include/cpufunc.h Mon Jun 8 06:13:34 2009 (r193691) +++ user/kmacy/releng_7_2_fcs/sys/amd64/include/cpufunc.h Mon Jun 8 07:42:19 2009 (r193692) @@ -343,6 +343,12 @@ ia32_pause(void) __asm __volatile("pause"); } +static __inline +void prefetch(void *x) +{ + __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); +} + static __inline u_long read_rflags(void) { Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Mon Jun 8 06:13:34 2009 (r193691) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Mon Jun 8 07:42:19 2009 (r193692) @@ -184,16 +184,10 @@ struct t3_mbuf_hdr { */ -#if defined(__i386__) || defined(__amd64__) +#if defined(__i386__) #define smp_mb() mb() #define L1_CACHE_BYTES 128 -static __inline -void prefetch(void *x) -{ - __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); -} - extern void kdb_backtrace(void); #define WARN_ON(condition) do { \ Modified: user/kmacy/releng_7_2_fcs/sys/dev/mxge/if_mxge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/mxge/if_mxge.c Mon Jun 8 06:13:34 2009 (r193691) +++ user/kmacy/releng_7_2_fcs/sys/dev/mxge/if_mxge.c Mon Jun 8 07:42:19 2009 (r193692) @@ -146,13 +146,13 @@ static int mxge_close(mxge_softc_t *sc); static int mxge_open(mxge_softc_t *sc); static void mxge_tick(void *arg); -#if defined(__i386__) || defined(__amd64__) +#if defined(__i386__) static __inline void prefetch(void *x) { __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); } -#else +#elif !defined(__amd64__) #define prefetch(x) #endif From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 07:44:29 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 280AD106566B; Mon, 8 Jun 2009 07:44:29 +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 16BF58FC17; Mon, 8 Jun 2009 07:44:29 +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 n587iSx0019977; Mon, 8 Jun 2009 07:44:28 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n587iSVQ019974; Mon, 8 Jun 2009 07:44:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080744.n587iSVQ019974@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 07:44:28 +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: r193693 - in user/kmacy/releng_7_2_fcs/sys: net 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: Mon, 08 Jun 2009 07:44:29 -0000 Author: kmacy Date: Mon Jun 8 07:44:28 2009 New Revision: 193693 URL: http://svn.freebsd.org/changeset/base/193693 Log: - add prefetch to single consumer dequeue - remove critical section - protected by client lock - remove gratuitous memory barrier from buf_ring_peek Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c user/kmacy/releng_7_2_fcs/sys/net/if_var.h user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Mon Jun 8 07:42:19 2009 (r193692) +++ user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Mon Jun 8 07:44:28 2009 (r193693) @@ -185,20 +185,6 @@ static struct cv flowclean_cv; static struct mtx flowclean_lock; static uint64_t flowclean_cycles; -#if defined(__i386__) || defined(__amd64__) -static __inline -void prefetch(void *x) -{ - __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); -} -#else -static __inline -void prefetch(void *x) -{ - ; -} -#endif - /* * TODO: * - Make flowtable stats per-cpu, aggregated at sysctl call time, Modified: user/kmacy/releng_7_2_fcs/sys/net/if_var.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/if_var.h Mon Jun 8 07:42:19 2009 (r193692) +++ user/kmacy/releng_7_2_fcs/sys/net/if_var.h Mon Jun 8 07:44:28 2009 (r193693) @@ -561,9 +561,9 @@ drbr_stats_update(struct ifnet *ifp, int { #ifndef NO_SLOW_STATS ifp->if_obytes += len; -#endif if (mflags & M_MCAST) ifp->if_omcasts++; +#endif } static __inline int Modified: user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h Mon Jun 8 07:42:19 2009 (r193692) +++ user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h Mon Jun 8 07:44:28 2009 (r193693) @@ -181,24 +181,27 @@ buf_ring_dequeue_mc(struct buf_ring *br) static __inline void * buf_ring_dequeue_sc(struct buf_ring *br) { - uint32_t cons_head, cons_next; + uint32_t cons_head, cons_next, cons_next_next; uint32_t prod_tail; void *buf; - critical_enter(); cons_head = br->br_cons_head; prod_tail = br->br_prod_tail; cons_next = (cons_head + 1) & br->br_cons_mask; - - if (cons_head == prod_tail) { - critical_exit(); + cons_next_next = (cons_head + 2) & br->br_cons_mask; + + if (cons_head == prod_tail) return (NULL); + + if (cons_next != prod_tail) { + prefetch(br->br_ring[cons_next]); + if (cons_next_next != prod_tail) + prefetch(br->br_ring[cons_next_next]); } - br->br_cons_head = cons_next; buf = br->br_ring[cons_head]; - + #ifdef DEBUG_BUFRING br->br_ring[cons_head] = NULL; if (!mtx_owned(br->br_lock)) @@ -208,7 +211,6 @@ buf_ring_dequeue_sc(struct buf_ring *br) br->br_cons_tail, cons_head); #endif br->br_cons_tail = cons_next; - critical_exit(); return (buf); } @@ -225,7 +227,12 @@ buf_ring_peek(struct buf_ring *br) if ((br->br_lock != NULL) && !mtx_owned(br->br_lock)) panic("lock not held on single consumer dequeue"); #endif - wmb(); + /* + * I believe it is safe to not have a memory barrier + * here because we control cons and tail is worst case + * a lagging indicator so we worst case we might + * return NULL immediately after a buffer has been enqueued + */ if (br->br_cons_head == br->br_prod_tail) return (NULL); From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 08:16: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 17C201065670; Mon, 8 Jun 2009 08:16: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 06AD28FC08; Mon, 8 Jun 2009 08:16: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 n588Ggs8020686; Mon, 8 Jun 2009 08:16:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n588GgMV020685; Mon, 8 Jun 2009 08:16:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080816.n588GgMV020685@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 08:16:42 +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: r193695 - user/kmacy/releng_7_2_fcs/sys/kern 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, 08 Jun 2009 08:16:43 -0000 Author: kmacy Date: Mon Jun 8 08:16:42 2009 New Revision: 193695 URL: http://svn.freebsd.org/changeset/base/193695 Log: reduce coherence overhead of lock profiling when not in use Modified: user/kmacy/releng_7_2_fcs/sys/kern/subr_lock.c Modified: user/kmacy/releng_7_2_fcs/sys/kern/subr_lock.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/subr_lock.c Mon Jun 8 08:10:52 2009 (r193694) +++ user/kmacy/releng_7_2_fcs/sys/kern/subr_lock.c Mon Jun 8 08:16:42 2009 (r193695) @@ -184,12 +184,12 @@ struct lock_prof_type { struct lock_prof_cpu { struct lock_prof_type lpc_types[2]; /* One for spin one for other. */ -}; +} __aligned(128); struct lock_prof_cpu *lp_cpu[MAXCPU]; -volatile int lock_prof_enable = 0; -static volatile int lock_prof_resetting; +volatile int lock_prof_enable __aligned(64); +static volatile int lock_prof_resetting __aligned(64); /* SWAG: sbuf size = avg stat. line size * number of locks */ #define LPROF_SBUF_SIZE 256 * 400 @@ -233,6 +233,7 @@ lock_prof_init(void *arg) { int cpu; + lock_prof_enable = 1; for (cpu = 0; cpu <= mp_maxid; cpu++) { lp_cpu[cpu] = malloc(sizeof(*lp_cpu[cpu]), M_DEVBUF, M_WAITOK | M_ZERO); From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 08:26:13 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 9F8E4106566B; Mon, 8 Jun 2009 08:26:13 +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 8E8D08FC15; Mon, 8 Jun 2009 08:26:13 +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 n588QDqI020903; Mon, 8 Jun 2009 08:26:13 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n588QDo5020901; Mon, 8 Jun 2009 08:26:13 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080826.n588QDo5020901@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 08:26:13 +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: r193696 - 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, 08 Jun 2009 08:26:13 -0000 Author: kmacy Date: Mon Jun 8 08:26:13 2009 New Revision: 193696 URL: http://svn.freebsd.org/changeset/base/193696 Log: remove unused watchdog_timer field Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Mon Jun 8 08:16:42 2009 (r193695) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Mon Jun 8 08:26:13 2009 (r193696) @@ -104,7 +104,6 @@ struct port_info { uint32_t first_qset; uint32_t nqsets; int link_fault; - int watchdog_timer; uint8_t hw_addr[ETHER_ADDR_LEN]; struct task timer_reclaim_task; 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 8 08:16:42 2009 (r193695) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Mon Jun 8 08:26:13 2009 (r193696) @@ -1609,8 +1609,6 @@ cxgb_start_locked(struct sge_qset *qs) m_freem(m_head); m_head = NULL; - /* Set timeout in case hardware has problems transmitting. */ - pi->watchdog_timer = CXGB_TX_TIMEOUT; } if (!TXQ_RING_EMPTY(qs) && callout_pending(&txq->txq_timer) == 0) callout_reset_on(&txq->txq_timer, 1, cxgb_tx_timeout, From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 09:13:17 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 026341065670; Mon, 8 Jun 2009 09:13:17 +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 E60508FC1A; Mon, 8 Jun 2009 09:13:16 +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 n589DG0K021880; Mon, 8 Jun 2009 09:13:16 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n589DGkA021879; Mon, 8 Jun 2009 09:13:16 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080913.n589DGkA021879@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 09:13: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: r193697 - 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, 08 Jun 2009 09:13:17 -0000 Author: kmacy Date: Mon Jun 8 09:13:16 2009 New Revision: 193697 URL: http://svn.freebsd.org/changeset/base/193697 Log: comment on inefficiency in t3_encap 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 8 08:26:13 2009 (r193696) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Mon Jun 8 09:13:16 2009 (r193697) @@ -1404,6 +1404,11 @@ t3_encap(struct sge_qset *qs, struct mbu cbe->cntrl = htonl(cntrl); cbe->len = htonl(segs[i].ds_len | 0x80000000); cbe->addr = htobe64(segs[i].ds_addr); + /* + * 62% of function time is spent on the following - need to + * calculate the value to be stored in an intermediate + * and then do a direct update + */ txd->flit[fidx] |= htobe64(1 << 24); } From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 09:19: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 6D135106564A; Mon, 8 Jun 2009 09:19: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 5C70D8FC19; Mon, 8 Jun 2009 09:19: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 n589JPEg022029; Mon, 8 Jun 2009 09:19:25 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n589JPGJ022028; Mon, 8 Jun 2009 09:19:25 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080919.n589JPGJ022028@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 09:19: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: r193698 - 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, 08 Jun 2009 09:19:25 -0000 Author: kmacy Date: Mon Jun 8 09:19:25 2009 New Revision: 193698 URL: http://svn.freebsd.org/changeset/base/193698 Log: skip idiv if queue is empty Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Mon Jun 8 09:13:16 2009 (r193697) +++ user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Mon Jun 8 09:19:25 2009 (r193698) @@ -447,12 +447,14 @@ again: * interface in which case packetdrop should be done by queueing. */ #ifdef ALTQ - if ((!ALTQ_IS_ENABLED(&ifp->if_snd)) && + if (ifp->if_snd.ifq_len && + (!ALTQ_IS_ENABLED(&ifp->if_snd)) && ((ifp->if_snd.ifq_len + ip->ip_len / mtu + 1) >= ifp->if_snd.ifq_maxlen)) #else - if ((ifp->if_snd.ifq_len + ip->ip_len / mtu + 1) >= - ifp->if_snd.ifq_maxlen) + if (ifp->if_snd.ifq_len && + ((ifp->if_snd.ifq_len + ip->ip_len / mtu + 1) >= + ifp->if_snd.ifq_maxlen)) #endif /* ALTQ */ { error = ENOBUFS; From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 09:22:57 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 01D65106564A; Mon, 8 Jun 2009 09:22:57 +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 E522B8FC0A; Mon, 8 Jun 2009 09:22: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 n589MuhI022145; Mon, 8 Jun 2009 09:22:56 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n589MuOc022144; Mon, 8 Jun 2009 09:22:56 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080922.n589MuOc022144@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 09:22: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: r193699 - user/kmacy/releng_7_2_fcs/sys/kern 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, 08 Jun 2009 09:22:57 -0000 Author: kmacy Date: Mon Jun 8 09:22:56 2009 New Revision: 193699 URL: http://svn.freebsd.org/changeset/base/193699 Log: try to avoid taking a cache miss on the newly allocated mbuf Modified: user/kmacy/releng_7_2_fcs/sys/kern/uipc_mbuf.c Modified: user/kmacy/releng_7_2_fcs/sys/kern/uipc_mbuf.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/uipc_mbuf.c Mon Jun 8 09:19:25 2009 (r193698) +++ user/kmacy/releng_7_2_fcs/sys/kern/uipc_mbuf.c Mon Jun 8 09:22:56 2009 (r193699) @@ -100,6 +100,7 @@ struct mbuf * m_getm2(struct mbuf *m, int len, int how, short type, int flags) { struct mbuf *mb, *nm = NULL, *mtail = NULL; + int size; KASSERT(len >= 0, ("%s: len is < 0", __func__)); @@ -112,25 +113,30 @@ m_getm2(struct mbuf *m, int len, int how /* Loop and append maximum sized mbufs to the chain tail. */ while (len > 0) { - if (len > MCLBYTES) + if (len > MCLBYTES) { mb = m_getjcl(how, type, (flags & M_PKTHDR), MJUMPAGESIZE); - else if (len >= MINCLSIZE) + size = MJUMPAGESIZE; + } else if (len >= MINCLSIZE) { mb = m_getcl(how, type, (flags & M_PKTHDR)); - else if (flags & M_PKTHDR) + size = MCLBYTES; + } else if (flags & M_PKTHDR) { mb = m_gethdr(how, type); - else + size = MHLEN; + } else { mb = m_get(how, type); - + size = MLEN; + } /* Fail the whole operation if one mbuf can't be allocated. */ if (mb == NULL) { if (nm != NULL) m_freem(nm); return (NULL); } - + prefetch(mb); + /* Book keeping. */ - len -= mb->m_size; + len -= size; if (mtail != NULL) mtail->m_next = mb; else From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 10:05: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 92526106564A; Mon, 8 Jun 2009 10:05:05 +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 81C908FC08; Mon, 8 Jun 2009 10:05:05 +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 n58A5511023055; Mon, 8 Jun 2009 10:05:05 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n58A558j023054; Mon, 8 Jun 2009 10:05:05 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906081005.n58A558j023054@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 10:05: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: r193700 - user/kmacy/releng_7_2_fcs/sys/kern 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, 08 Jun 2009 10:05:05 -0000 Author: kmacy Date: Mon Jun 8 10:05:05 2009 New Revision: 193700 URL: http://svn.freebsd.org/changeset/base/193700 Log: statically intialize lock prof enabling to zero Modified: user/kmacy/releng_7_2_fcs/sys/kern/subr_lock.c Modified: user/kmacy/releng_7_2_fcs/sys/kern/subr_lock.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/subr_lock.c Mon Jun 8 09:22:56 2009 (r193699) +++ user/kmacy/releng_7_2_fcs/sys/kern/subr_lock.c Mon Jun 8 10:05:05 2009 (r193700) @@ -188,7 +188,7 @@ struct lock_prof_cpu { struct lock_prof_cpu *lp_cpu[MAXCPU]; -volatile int lock_prof_enable __aligned(64); +volatile int lock_prof_enable = 0; static volatile int lock_prof_resetting __aligned(64); /* SWAG: sbuf size = avg stat. line size * number of locks */ @@ -233,7 +233,6 @@ lock_prof_init(void *arg) { int cpu; - lock_prof_enable = 1; for (cpu = 0; cpu <= mp_maxid; cpu++) { lp_cpu[cpu] = malloc(sizeof(*lp_cpu[cpu]), M_DEVBUF, M_WAITOK | M_ZERO); From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 12:02:15 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 69453106567A; Mon, 8 Jun 2009 12:02:15 +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 558F18FC1F; Mon, 8 Jun 2009 12:02:15 +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 n58C2FrP028747; Mon, 8 Jun 2009 12:02:15 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n58C2FBR028746; Mon, 8 Jun 2009 12:02:15 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906081202.n58C2FBR028746@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 12:02:15 +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: r193710 - user/kmacy/releng_7_2_fcs/sys/vm 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, 08 Jun 2009 12:02:18 -0000 Author: kmacy Date: Mon Jun 8 12:02:15 2009 New Revision: 193710 URL: http://svn.freebsd.org/changeset/base/193710 Log: align buckets to avoid false sharing Modified: user/kmacy/releng_7_2_fcs/sys/vm/uma_int.h Modified: user/kmacy/releng_7_2_fcs/sys/vm/uma_int.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/uma_int.h Mon Jun 8 11:39:04 2009 (r193709) +++ user/kmacy/releng_7_2_fcs/sys/vm/uma_int.h Mon Jun 8 12:02:15 2009 (r193710) @@ -168,7 +168,7 @@ struct uma_bucket { int16_t ub_cnt; /* Count of free items. */ int16_t ub_entries; /* Max items. */ void *ub_bucket[]; /* actual allocation storage */ -}; +} __aligned(128); typedef struct uma_bucket * uma_bucket_t; From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 12:10:42 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 CC430106566B; Mon, 8 Jun 2009 12:10:42 +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 BB74E8FC0C; Mon, 8 Jun 2009 12:10:42 +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 n58CAgQh028925; Mon, 8 Jun 2009 12:10:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n58CAg7L028924; Mon, 8 Jun 2009 12:10:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906081210.n58CAg7L028924@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 12:10:42 +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: r193711 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb/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: Mon, 08 Jun 2009 12:10:43 -0000 Author: kmacy Date: Mon Jun 8 12:10:42 2009 New Revision: 193711 URL: http://svn.freebsd.org/changeset/base/193711 Log: don't null out nextptr forcing mbuf from shared to exclusive Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Mon Jun 8 12:02:15 2009 (r193710) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Mon Jun 8 12:10:42 2009 (r193711) @@ -72,7 +72,6 @@ m_freem_list(struct mbuf *m) n = m->m_nextpkt; if (n != NULL) prefetch(n); - m->m_nextpkt = NULL; m_freem(m); m = n; } From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 14:35:12 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 2E9801065680; Mon, 8 Jun 2009 14:35:12 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 085C08FC24; Mon, 8 Jun 2009 14:35:12 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 79EB146B2A; Mon, 8 Jun 2009 10:35:08 -0400 (EDT) Date: Mon, 8 Jun 2009 15:35:08 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Kip Macy In-Reply-To: <200906080919.n589JPGJ022028@svn.freebsd.org> Message-ID: References: <200906080919.n589JPGJ022028@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r193698 - 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, 08 Jun 2009 14:35:13 -0000 On Mon, 8 Jun 2009, Kip Macy wrote: > skip idiv if queue is empty A more general optimization might be to check whether ip->ip_len is > mtu before doing the idiv case... Robert N M Watson Computer Laboratory University of Cambridge > > Modified: > user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c > > Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c > ============================================================================== > --- user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Mon Jun 8 09:13:16 2009 (r193697) > +++ user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Mon Jun 8 09:19:25 2009 (r193698) > @@ -447,12 +447,14 @@ again: > * interface in which case packetdrop should be done by queueing. > */ > #ifdef ALTQ > - if ((!ALTQ_IS_ENABLED(&ifp->if_snd)) && > + if (ifp->if_snd.ifq_len && > + (!ALTQ_IS_ENABLED(&ifp->if_snd)) && > ((ifp->if_snd.ifq_len + ip->ip_len / mtu + 1) >= > ifp->if_snd.ifq_maxlen)) > #else > - if ((ifp->if_snd.ifq_len + ip->ip_len / mtu + 1) >= > - ifp->if_snd.ifq_maxlen) > + if (ifp->if_snd.ifq_len && > + ((ifp->if_snd.ifq_len + ip->ip_len / mtu + 1) >= > + ifp->if_snd.ifq_maxlen)) > #endif /* ALTQ */ > { > error = ENOBUFS; > From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 21:42: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 20D1A1065694; Mon, 8 Jun 2009 21:42:16 +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 0441B8FC15; Mon, 8 Jun 2009 21:42:16 +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 n58LgFub044625; Mon, 8 Jun 2009 21:42:15 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n58LgF5q044624; Mon, 8 Jun 2009 21:42:15 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906082142.n58LgF5q044624@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 21:42:15 +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: r193764 - 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, 08 Jun 2009 21:42:16 -0000 Author: kmacy Date: Mon Jun 8 21:42:15 2009 New Revision: 193764 URL: http://svn.freebsd.org/changeset/base/193764 Log: - add hysteresis to coalescing - handle big-endian case in set_wr_hdr - don't do read before write of descriptor in t3_encap 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 8 21:34:12 2009 (r193763) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Mon Jun 8 21:42:15 2009 (r193764) @@ -235,9 +235,11 @@ check_pkt_coalesce(struct sge_qset *qs) /* * if the hardware transmit queue is more than 3/4 full - * we mark it as coalescing + * we mark it as coalescing - we drop back from coalescing + * when we go below 1/4 full, this provides us with some + * degree of hysteresis */ - if (*fill != 0 && (txq->in_use < (txq->size - (txq->size>>2)))) + if (*fill != 0 && (txq->in_use < (txq->size>>2))) *fill = 0; else if (*fill == 0 && (txq->in_use >= (txq->size - (txq->size>>2)))) *fill = 1; @@ -250,9 +252,13 @@ static void set_wr_hdr(struct work_request_hdr *wrp, uint32_t wr_hi, uint32_t wr_lo) { uint64_t wr_hilo; - +#if _BYTE_ORDER == _LITTLE_ENDIAN wr_hilo = wr_hi; - wr_hilo |= (((uint64_t)wr_lo)<<32) ; + wr_hilo |= (((uint64_t)wr_lo)<<32); +#else + wr_hilo = wr_lo; + wr_hilo |= (((uint64_t)wr_hi)<<32); +#endif wrp->wrh_hilo = wr_hilo; } #else @@ -1392,29 +1398,31 @@ t3_encap(struct sge_qset *qs, struct mbu flits = nsegs*2 + 1; for (fidx = 1, i = 0; i < nsegs; i++, fidx += 2) { - struct cpl_tx_pkt_batch_entry *cbe = &cpl_batch->pkt_entry[i]; + struct cpl_tx_pkt_batch_entry *cbe; + uint64_t flit; + uint32_t *hflit = (uint32_t *)&flit; + int cflags = m0->m_pkthdr.csum_flags; cntrl = V_TXPKT_INTF(pi->txpkt_intf); GET_VTAG(cntrl, m0); cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT); - if (__predict_false(!(m0->m_pkthdr.csum_flags & CSUM_IP))) + if (__predict_false(!(cflags & CSUM_IP))) cntrl |= F_TXPKT_IPCSUM_DIS; - if (__predict_false(!(m0->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)))) + if (__predict_false(!(cflags & (CSUM_TCP | CSUM_UDP)))) cntrl |= F_TXPKT_L4CSUM_DIS; - cbe->cntrl = htonl(cntrl); - cbe->len = htonl(segs[i].ds_len | 0x80000000); + + hflit[0] = htonl(cntrl); + hflit[1] = htonl(segs[i].ds_len | 0x80000000); + flit |= htobe64(1 << 24); + cbe = &cpl_batch->pkt_entry[i]; + cbe->cntrl = hflit[0]; + cbe->len = hflit[1]; cbe->addr = htobe64(segs[i].ds_addr); - /* - * 62% of function time is spent on the following - need to - * calculate the value to be stored in an intermediate - * and then do a direct update - */ - txd->flit[fidx] |= htobe64(1 << 24); } - wr_hi = htonl(F_WR_SOP | F_WR_EOP | V_WR_DATATYPE(1) | - V_WR_SGLSFLT(flits)) | htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | txqs.compl); + V_WR_SGLSFLT(flits)) | + htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | txqs.compl); wr_lo = htonl(V_WR_LEN(flits) | V_WR_GEN(txqs.gen)) | htonl(V_WR_TID(txq->token)); set_wr_hdr(wrp, wr_hi, wr_lo); From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 22:02:57 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 B94271065672; Mon, 8 Jun 2009 22:02:57 +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 A7E818FC16; Mon, 8 Jun 2009 22:02:57 +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 n58M2vJq045614; Mon, 8 Jun 2009 22:02:57 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n58M2vXK045613; Mon, 8 Jun 2009 22:02:57 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906082202.n58M2vXK045613@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 22:02:57 +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: r193774 - 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, 08 Jun 2009 22:02:58 -0000 Author: kmacy Date: Mon Jun 8 22:02:57 2009 New Revision: 193774 URL: http://svn.freebsd.org/changeset/base/193774 Log: further reduce coalescing threshold 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 8 22:02:30 2009 (r193773) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Mon Jun 8 22:02:57 2009 (r193774) @@ -234,14 +234,14 @@ check_pkt_coalesce(struct sge_qset *qs) fill = &sc->tunq_fill[qs->idx]; /* - * if the hardware transmit queue is more than 3/4 full + * if the hardware transmit queue is more than 1/2 full * we mark it as coalescing - we drop back from coalescing - * when we go below 1/4 full, this provides us with some + * when we go below 1/8 full, this provides us with some * degree of hysteresis */ - if (*fill != 0 && (txq->in_use < (txq->size>>2))) + if (*fill != 0 && (txq->in_use < (txq->size>>3))) *fill = 0; - else if (*fill == 0 && (txq->in_use >= (txq->size - (txq->size>>2)))) + else if (*fill == 0 && (txq->in_use >= (txq->size - (txq->size>>1)))) *fill = 1; return (sc->tunq_coalesce); From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 22:58:12 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 84DEB106566B; Mon, 8 Jun 2009 22:58:12 +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 7340A8FC16; Mon, 8 Jun 2009 22:58:12 +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 n58MwCDl047024; Mon, 8 Jun 2009 22:58:12 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n58MwCiA047023; Mon, 8 Jun 2009 22:58:12 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906082258.n58MwCiA047023@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 22:58:12 +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: r193777 - 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, 08 Jun 2009 22:58:12 -0000 Author: kmacy Date: Mon Jun 8 22:58:12 2009 New Revision: 193777 URL: http://svn.freebsd.org/changeset/base/193777 Log: try to avoid missing on the tx descriptor 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 8 22:05:47 2009 (r193776) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Mon Jun 8 22:58:12 2009 (r193777) @@ -1355,6 +1355,8 @@ t3_encap(struct sge_qset *qs, struct mbu txd = &txq->desc[txq->pidx]; txsd = &txq->sdesc[txq->pidx]; sgl = txq->txq_sgl; + + prefetch(txd); m0 = *m; DPRINTF("t3_encap port_id=%d qsidx=%d ", pi->port_id, pi->first_qset); From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 23:03: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 0E2D7106566B; Mon, 8 Jun 2009 23:03: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 F0B838FC14; Mon, 8 Jun 2009 23:03:37 +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 n58N3bJa047198; Mon, 8 Jun 2009 23:03:37 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n58N3bOm047197; Mon, 8 Jun 2009 23:03:37 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906082303.n58N3bOm047197@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 23:03:37 +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: r193778 - user/kmacy/releng_7_2_fcs/sys/kern 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, 08 Jun 2009 23:03:38 -0000 Author: kmacy Date: Mon Jun 8 23:03:37 2009 New Revision: 193778 URL: http://svn.freebsd.org/changeset/base/193778 Log: try to avoid false sharing with lock_profile_enable Modified: user/kmacy/releng_7_2_fcs/sys/kern/subr_lock.c Modified: user/kmacy/releng_7_2_fcs/sys/kern/subr_lock.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/subr_lock.c Mon Jun 8 22:58:12 2009 (r193777) +++ user/kmacy/releng_7_2_fcs/sys/kern/subr_lock.c Mon Jun 8 23:03:37 2009 (r193778) @@ -188,14 +188,14 @@ struct lock_prof_cpu { struct lock_prof_cpu *lp_cpu[MAXCPU]; +static int lock_prof_skipspin __aligned(128); volatile int lock_prof_enable = 0; -static volatile int lock_prof_resetting __aligned(64); +static volatile int lock_prof_resetting __aligned(128); /* SWAG: sbuf size = avg stat. line size * number of locks */ #define LPROF_SBUF_SIZE 256 * 400 static int lock_prof_rejected; -static int lock_prof_skipspin; static int lock_prof_skipcount; #ifndef USE_CPU_NANOSECONDS From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 23:36:35 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 B0234106566B; Mon, 8 Jun 2009 23:36:35 +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 9B0138FC17; Mon, 8 Jun 2009 23:36:35 +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 n58NaZrk047904; Mon, 8 Jun 2009 23:36:35 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n58NaZbR047903; Mon, 8 Jun 2009 23:36:35 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906082336.n58NaZbR047903@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 23:36:35 +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: r193780 - 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, 08 Jun 2009 23:36:36 -0000 Author: kmacy Date: Mon Jun 8 23:36:35 2009 New Revision: 193780 URL: http://svn.freebsd.org/changeset/base/193780 Log: don't no-op prefetch on amd64 Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Mon Jun 8 23:24:01 2009 (r193779) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Mon Jun 8 23:36:35 2009 (r193780) @@ -197,8 +197,7 @@ extern void kdb_backtrace(void); } \ } while (0) - -#else /* !i386 && !amd64 */ +#elif !defined(__amd64__) /* !i386 && !amd64 */ #define smp_mb() #define prefetch(x) #define L1_CACHE_BYTES 32 From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 23:36:53 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 0A8C11065740; Mon, 8 Jun 2009 23:36:53 +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 ECE838FC14; Mon, 8 Jun 2009 23:36: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 n58Naqfa047948; Mon, 8 Jun 2009 23:36:52 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n58Naqbo047947; Mon, 8 Jun 2009 23:36:52 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906082336.n58Naqbo047947@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 23:36: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: r193781 - 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, 08 Jun 2009 23:36:53 -0000 Author: kmacy Date: Mon Jun 8 23:36:52 2009 New Revision: 193781 URL: http://svn.freebsd.org/changeset/base/193781 Log: make coalescing more aggressive 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 8 23:36:35 2009 (r193780) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Mon Jun 8 23:36:52 2009 (r193781) @@ -234,14 +234,14 @@ check_pkt_coalesce(struct sge_qset *qs) fill = &sc->tunq_fill[qs->idx]; /* - * if the hardware transmit queue is more than 1/2 full + * if the hardware transmit queue is more than 1/4 full * we mark it as coalescing - we drop back from coalescing - * when we go below 1/8 full, this provides us with some + * when we go below 1/16 full, this provides us with some * degree of hysteresis */ - if (*fill != 0 && (txq->in_use < (txq->size>>3))) + if (*fill != 0 && (txq->in_use < (txq->size>>4))) *fill = 0; - else if (*fill == 0 && (txq->in_use >= (txq->size - (txq->size>>1)))) + else if (*fill == 0 && (txq->in_use >= (txq->size>>2))) *fill = 1; return (sc->tunq_coalesce); From owner-svn-src-user@FreeBSD.ORG Tue Jun 9 01:03:37 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 2664F106564A; Tue, 9 Jun 2009 01:03:37 +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 EE1358FC15; Tue, 9 Jun 2009 01:03:36 +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 n5913arI050605; Tue, 9 Jun 2009 01:03:36 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5913ahC050603; Tue, 9 Jun 2009 01:03:36 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906090103.n5913ahC050603@svn.freebsd.org> From: Kip Macy Date: Tue, 9 Jun 2009 01:03:36 +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: r193791 - 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: Tue, 09 Jun 2009 01:03:37 -0000 Author: kmacy Date: Tue Jun 9 01:03:36 2009 New Revision: 193791 URL: http://svn.freebsd.org/changeset/base/193791 Log: - don't coalesce if we're in the watchdog or tx timeout - don't disable coalescing unless we've drained all buf ring enqueued packets - reduce the maximum number of descriptors per call to start - remove undefined smp_mb macro reference Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Tue Jun 9 00:54:57 2009 (r193790) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Tue Jun 9 01:03:36 2009 (r193791) @@ -170,8 +170,8 @@ struct t3_mbuf_hdr { #define TX_MAX_DESC 4 /* max descriptors per packet */ -#define TX_START_MIN_DESC (TX_MAX_DESC << 2) -#define TX_START_MAX_DESC (TX_MAX_DESC << 3) /* maximum number of descriptors +#define TX_START_MIN_DESC (TX_MAX_DESC << 1) +#define TX_START_MAX_DESC (TX_MAX_DESC << 2) /* maximum number of descriptors * call to start used per */ #define TX_CLEAN_MAX_DESC (TX_MAX_DESC << 4) /* maximum tx descriptors 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 Tue Jun 9 00:54:57 2009 (r193790) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Tue Jun 9 01:03:36 2009 (r193791) @@ -229,6 +229,8 @@ check_pkt_coalesce(struct sge_qset *qs) if (__predict_false(cxgb_pcpu_tx_coalesce_force)) return (1); + if (__predict_false(qs->qs_flags & QS_FLUSHING)) + return (0); txq = &qs->txq[TXQ_ETH]; sc = qs->port->adapter; fill = &sc->tunq_fill[qs->idx]; @@ -236,10 +238,10 @@ check_pkt_coalesce(struct sge_qset *qs) /* * if the hardware transmit queue is more than 1/4 full * we mark it as coalescing - we drop back from coalescing - * when we go below 1/16 full, this provides us with some - * degree of hysteresis + * when we go below 1/8 full and there are no packets enqueued, + * this provides us with some degree of hysteresis */ - if (*fill != 0 && (txq->in_use < (txq->size>>4))) + if (*fill != 0 && (txq->in_use < (txq->size>>3)) && TXQ_EMPTY(qs)) *fill = 0; else if (*fill == 0 && (txq->in_use >= (txq->size>>2))) *fill = 1; @@ -3076,7 +3078,7 @@ process_responses(adapter_t *adap, struc if (sleeping) check_ring_db(adap, qs, sleeping); - smp_mb(); /* commit Tx queue processed updates */ + mb(); /* commit Tx queue processed updates */ if (__predict_false(qs->txq_stopped > 1)) { printf("restarting tx on %p\n", qs); From owner-svn-src-user@FreeBSD.ORG Tue Jun 9 01:07:08 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 513111065677; Tue, 9 Jun 2009 01:07:08 +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 3F1A78FC18; Tue, 9 Jun 2009 01:07:08 +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 n59176p9050711; Tue, 9 Jun 2009 01:07:06 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n59176PT050710; Tue, 9 Jun 2009 01:07:06 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906090107.n59176PT050710@svn.freebsd.org> From: Kip Macy Date: Tue, 9 Jun 2009 01:07:06 +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: r193792 - 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: Tue, 09 Jun 2009 01:07:08 -0000 Author: kmacy Date: Tue Jun 9 01:07:06 2009 New Revision: 193792 URL: http://svn.freebsd.org/changeset/base/193792 Log: fix typo 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 Tue Jun 9 01:03:36 2009 (r193791) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Tue Jun 9 01:07:06 2009 (r193792) @@ -241,7 +241,8 @@ check_pkt_coalesce(struct sge_qset *qs) * when we go below 1/8 full and there are no packets enqueued, * this provides us with some degree of hysteresis */ - if (*fill != 0 && (txq->in_use < (txq->size>>3)) && TXQ_EMPTY(qs)) + if (*fill != 0 && (txq->in_use < (txq->size>>3)) && + TXQ_RING_EMPTY(qs)) *fill = 0; else if (*fill == 0 && (txq->in_use >= (txq->size>>2))) *fill = 1; From owner-svn-src-user@FreeBSD.ORG Tue Jun 9 01:21: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 F03F41065677; Tue, 9 Jun 2009 01:21:49 +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 DE95B8FC0A; Tue, 9 Jun 2009 01:21:49 +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 n591Ln3D051040; Tue, 9 Jun 2009 01:21:49 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n591Ln06051039; Tue, 9 Jun 2009 01:21:49 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906090121.n591Ln06051039@svn.freebsd.org> From: Kip Macy Date: Tue, 9 Jun 2009 01:21:49 +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: r193793 - 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: Tue, 09 Jun 2009 01:21:50 -0000 Author: kmacy Date: Tue Jun 9 01:21:49 2009 New Revision: 193793 URL: http://svn.freebsd.org/changeset/base/193793 Log: don't disable coalesce in watchdog 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 Tue Jun 9 01:07:06 2009 (r193792) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Tue Jun 9 01:21:49 2009 (r193793) @@ -229,8 +229,6 @@ check_pkt_coalesce(struct sge_qset *qs) if (__predict_false(cxgb_pcpu_tx_coalesce_force)) return (1); - if (__predict_false(qs->qs_flags & QS_FLUSHING)) - return (0); txq = &qs->txq[TXQ_ETH]; sc = qs->port->adapter; fill = &sc->tunq_fill[qs->idx]; From owner-svn-src-user@FreeBSD.ORG Tue Jun 9 01:41:45 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 D9E9B1065673; Tue, 9 Jun 2009 01:41:45 +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 C85918FC0A; Tue, 9 Jun 2009 01:41:45 +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 n591fjnt051748; Tue, 9 Jun 2009 01:41:45 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n591fj9B051747; Tue, 9 Jun 2009 01:41:45 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906090141.n591fj9B051747@svn.freebsd.org> From: Kip Macy Date: Tue, 9 Jun 2009 01:41:45 +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: r193794 - 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: Tue, 09 Jun 2009 01:41:46 -0000 Author: kmacy Date: Tue Jun 9 01:41:45 2009 New Revision: 193794 URL: http://svn.freebsd.org/changeset/base/193794 Log: add comment on need for further lookback for coalescing 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 Tue Jun 9 01:21:49 2009 (r193793) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Tue Jun 9 01:41:45 2009 (r193794) @@ -220,6 +220,11 @@ static void sge_timer_reclaim(void *arg, static void sge_txq_reclaim_handler(void *arg, int ncount); static void cxgb_start_locked(struct sge_qset *qs); +/* + * XXX need to cope with bursty scheduling by looking at a wider + * window than we are now for determining the need for coalescing + * + */ static __inline uint64_t check_pkt_coalesce(struct sge_qset *qs) { @@ -236,10 +241,10 @@ check_pkt_coalesce(struct sge_qset *qs) /* * if the hardware transmit queue is more than 1/4 full * we mark it as coalescing - we drop back from coalescing - * when we go below 1/8 full and there are no packets enqueued, + * when we go below 1/16 full and there are no packets enqueued, * this provides us with some degree of hysteresis */ - if (*fill != 0 && (txq->in_use < (txq->size>>3)) && + if (*fill != 0 && (txq->in_use < (txq->size>>4)) && TXQ_RING_EMPTY(qs)) *fill = 0; else if (*fill == 0 && (txq->in_use >= (txq->size>>2))) From owner-svn-src-user@FreeBSD.ORG Tue Jun 9 02:58: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 51C581065674; Tue, 9 Jun 2009 02:58: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 E75E58FC16; Tue, 9 Jun 2009 02:58:57 +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 n592wvtR053384; Tue, 9 Jun 2009 02:58:57 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n592wvnc053381; Tue, 9 Jun 2009 02:58:57 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906090258.n592wvnc053381@svn.freebsd.org> From: Kip Macy Date: Tue, 9 Jun 2009 02:58:57 +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: r193797 - 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: Tue, 09 Jun 2009 02:58:58 -0000 Author: kmacy Date: Tue Jun 9 02:58:57 2009 New Revision: 193797 URL: http://svn.freebsd.org/changeset/base/193797 Log: - restore max descriptors per call to cxgb_start_locked - remove unused defines - don't always clean in tx timeout Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Tue Jun 9 02:27:59 2009 (r193796) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Tue Jun 9 02:58:57 2009 (r193797) @@ -84,8 +84,6 @@ extern int cxgb_debug; #else #define MTX_INIT mtx_init #define MTX_DESTROY mtx_destroy -#define SX_INIT sx_init -#define SX_DESTROY sx_destroy #endif struct port_info { @@ -270,6 +268,7 @@ enum { #define QS_RUNNING 0x2 #define QS_BOUND 0x4 #define QS_FLUSHING 0x8 +#define QS_TIMEOUT 0x10 struct sge_qset { struct sge_rspq rspq; Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Tue Jun 9 02:27:59 2009 (r193796) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Tue Jun 9 02:58:57 2009 (r193797) @@ -170,8 +170,8 @@ struct t3_mbuf_hdr { #define TX_MAX_DESC 4 /* max descriptors per packet */ -#define TX_START_MIN_DESC (TX_MAX_DESC << 1) -#define TX_START_MAX_DESC (TX_MAX_DESC << 2) /* maximum number of descriptors +#define TX_START_MIN_DESC (TX_MAX_DESC << 1) +#define TX_START_MAX_DESC (TX_MAX_DESC << 3) /* maximum number of descriptors * call to start used per */ #define TX_CLEAN_MAX_DESC (TX_MAX_DESC << 4) /* maximum tx descriptors 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 Tue Jun 9 02:27:59 2009 (r193796) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Tue Jun 9 02:58:57 2009 (r193797) @@ -1580,9 +1580,9 @@ cxgb_tx_timeout(void *arg) struct sge_qset *qs = arg; if (TXQ_TRYLOCK(qs)) { - qs->qs_flags |= QS_FLUSHING; + qs->qs_flags |= QS_TIMEOUT; cxgb_start_locked(qs); - qs->qs_flags &= ~QS_FLUSHING; + qs->qs_flags &= ~QS_TIMEOUT; TXQ_UNLOCK(qs); } } From owner-svn-src-user@FreeBSD.ORG Tue Jun 9 03:27:09 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 2F8751065672; Tue, 9 Jun 2009 03:27:09 +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 03E328FC18; Tue, 9 Jun 2009 03:27:09 +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 n593R8XY054187; Tue, 9 Jun 2009 03:27:08 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n593R8un054186; Tue, 9 Jun 2009 03:27:08 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906090327.n593R8un054186@svn.freebsd.org> From: Kip Macy Date: Tue, 9 Jun 2009 03:27:08 +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: r193798 - 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: Tue, 09 Jun 2009 03:27:09 -0000 Author: kmacy Date: Tue Jun 9 03:27:08 2009 New Revision: 193798 URL: http://svn.freebsd.org/changeset/base/193798 Log: reduce coalesce and clean thresholds 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 Tue Jun 9 02:58:57 2009 (r193797) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Tue Jun 9 03:27:08 2009 (r193798) @@ -239,15 +239,15 @@ check_pkt_coalesce(struct sge_qset *qs) fill = &sc->tunq_fill[qs->idx]; /* - * if the hardware transmit queue is more than 1/4 full + * 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/16 full and there are no packets enqueued, + * 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>>4)) && + if (*fill != 0 && (txq->in_use < (txq->size>>5)) && TXQ_RING_EMPTY(qs)) *fill = 0; - else if (*fill == 0 && (txq->in_use >= (txq->size>>2))) + else if (*fill == 0 && (txq->in_use >= (txq->size>>3))) *fill = 1; return (sc->tunq_coalesce); @@ -1599,7 +1599,6 @@ cxgb_start_locked(struct sge_qset *qs) avail = txq->size - txq->in_use - 4; txmax = min(TX_START_MAX_DESC, avail); - /* free all completed requests */ if (qs->qs_flags & QS_FLUSHING) reclaim_completed_tx(qs, 0, TXQ_ETH); @@ -1608,7 +1607,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>>4), TXQ_ETH); + reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>6), TXQ_ETH); if ((m_head = cxgb_dequeue(qs)) == NULL) break; @@ -1648,7 +1647,6 @@ cxgb_transmit_locked(struct ifnet *ifp, avail = txq->size - txq->in_use; TXQ_LOCK_ASSERT(qs); - reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); /* * We can only do a direct transmit if the following are true: @@ -1685,7 +1683,8 @@ 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); 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 9 03:47:35 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 3CD1D106564A; Tue, 9 Jun 2009 03:47:35 +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 114C28FC0A; Tue, 9 Jun 2009 03:47:35 +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 n593lYFH054627; Tue, 9 Jun 2009 03:47:34 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n593lYdE054625; Tue, 9 Jun 2009 03:47:34 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906090347.n593lYdE054625@svn.freebsd.org> From: Kip Macy Date: Tue, 9 Jun 2009 03:47: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: r193800 - 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: Tue, 09 Jun 2009 03:47:35 -0000 Author: kmacy Date: Tue Jun 9 03:47:34 2009 New Revision: 193800 URL: http://svn.freebsd.org/changeset/base/193800 Log: lag disabling coalescing by checking value at last watchodg call Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Tue Jun 9 03:35:42 2009 (r193799) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Tue Jun 9 03:47:34 2009 (r193800) @@ -282,6 +282,7 @@ struct sge_qset { struct port_info *port; int idx; /* qset # */ int qs_flags; + int coalescing; struct cv qs_cv; struct mtx lock; #define QS_NAME_LEN 32 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 Tue Jun 9 03:35:42 2009 (r193799) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Tue Jun 9 03:47:34 2009 (r193800) @@ -245,7 +245,7 @@ check_pkt_coalesce(struct sge_qset *qs) * this provides us with some degree of hysteresis */ if (*fill != 0 && (txq->in_use < (txq->size>>5)) && - TXQ_RING_EMPTY(qs)) + TXQ_RING_EMPTY(qs) && (qs->coalescing == 0)) *fill = 0; else if (*fill == 0 && (txq->in_use >= (txq->size>>3))) *fill = 1; @@ -1563,6 +1563,11 @@ 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)) + qs->coalescing = 0; + else if (qs->coalescing == 0 && (txq->in_use >= (txq->size>>3))) + qs->coalescing = 1; if (TXQ_TRYLOCK(qs)) { qs->qs_flags |= QS_FLUSHING; cxgb_start_locked(qs); @@ -1578,7 +1583,10 @@ static void cxgb_tx_timeout(void *arg) { struct sge_qset *qs = arg; + struct sge_txq *txq = &qs->txq[TXQ_ETH]; + if (qs->coalescing == 0 && (txq->in_use >= (txq->size>>3))) + qs->coalescing = 1; if (TXQ_TRYLOCK(qs)) { qs->qs_flags |= QS_TIMEOUT; cxgb_start_locked(qs); From owner-svn-src-user@FreeBSD.ORG Tue Jun 9 04:03: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 EEFF0106566C; Tue, 9 Jun 2009 04:03:04 +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 DDFB58FC14; Tue, 9 Jun 2009 04:03:04 +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 n59434gs054958; Tue, 9 Jun 2009 04:03:04 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n59434NL054956; Tue, 9 Jun 2009 04:03:04 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906090403.n59434NL054956@svn.freebsd.org> From: Kip Macy Date: Tue, 9 Jun 2009 04:03: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: r193801 - 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: Tue, 09 Jun 2009 04:03:05 -0000 Author: kmacy Date: Tue Jun 9 04:03:04 2009 New Revision: 193801 URL: http://svn.freebsd.org/changeset/base/193801 Log: further limits tweaking Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Tue Jun 9 03:47:34 2009 (r193800) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Tue Jun 9 04:03:04 2009 (r193801) @@ -170,8 +170,7 @@ struct t3_mbuf_hdr { #define TX_MAX_DESC 4 /* max descriptors per packet */ -#define TX_START_MIN_DESC (TX_MAX_DESC << 1) -#define TX_START_MAX_DESC (TX_MAX_DESC << 3) /* maximum number of descriptors +#define TX_START_MAX_DESC (TX_MAX_DESC << 2) /* maximum number of descriptors * call to start used per */ #define TX_CLEAN_MAX_DESC (TX_MAX_DESC << 4) /* maximum tx descriptors 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 Tue Jun 9 03:47:34 2009 (r193800) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Tue Jun 9 04:03:04 2009 (r193801) @@ -1607,7 +1607,7 @@ cxgb_start_locked(struct sge_qset *qs) avail = txq->size - txq->in_use - 4; txmax = min(TX_START_MAX_DESC, avail); - if (qs->qs_flags & QS_FLUSHING) + if (qs->qs_flags & (QS_FLUSHING|QS_TIMEOUT)) reclaim_completed_tx(qs, 0, TXQ_ETH); TXQ_LOCK_ASSERT(qs); @@ -1615,7 +1615,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>>6), TXQ_ETH); + reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>5), TXQ_ETH); if ((m_head = cxgb_dequeue(qs)) == NULL) break; From owner-svn-src-user@FreeBSD.ORG Tue Jun 9 04:39:47 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 B3915106564A; Tue, 9 Jun 2009 04:39:47 +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 A2A7A8FC08; Tue, 9 Jun 2009 04:39: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 n594dl5Q055812; Tue, 9 Jun 2009 04:39:47 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n594dlHi055811; Tue, 9 Jun 2009 04:39:47 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906090439.n594dlHi055811@svn.freebsd.org> From: Kip Macy Date: Tue, 9 Jun 2009 04:39: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: r193805 - 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: Tue, 09 Jun 2009 04:39:48 -0000 Author: kmacy Date: Tue Jun 9 04:39:47 2009 New Revision: 193805 URL: http://svn.freebsd.org/changeset/base/193805 Log: randomize flowid Modified: user/kmacy/releng_7_2_fcs/sys/netinet/in_pcb.c Modified: user/kmacy/releng_7_2_fcs/sys/netinet/in_pcb.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/in_pcb.c Tue Jun 9 04:17:36 2009 (r193804) +++ user/kmacy/releng_7_2_fcs/sys/netinet/in_pcb.c Tue Jun 9 04:39:47 2009 (r193805) @@ -208,7 +208,7 @@ in_pcballoc(struct socket *so, struct in inp->inp_socket = so; inp->inp_cred = crhold(so->so_cred); inp->inp_inc.inc_fibnum = so->so_fibnum; - inp->inp_flowid = flowid++; + inp->inp_flowid = arc4random(); #ifdef MAC error = mac_inpcb_init(inp, M_NOWAIT); if (error != 0) From owner-svn-src-user@FreeBSD.ORG Tue Jun 9 08:13: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 0248E10656B4; Tue, 9 Jun 2009 08:13: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 D90FB8FC0A; Tue, 9 Jun 2009 08:13: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 n598DhPd061545; Tue, 9 Jun 2009 08:13:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n598Dheb061544; Tue, 9 Jun 2009 08:13:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906090813.n598Dheb061544@svn.freebsd.org> From: Kip Macy Date: Tue, 9 Jun 2009 08:13: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: r193816 - user/kmacy/releng_7_2_xen/sys/i386/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, 09 Jun 2009 08:13:44 -0000 Author: kmacy Date: Tue Jun 9 08:13:43 2009 New Revision: 193816 URL: http://svn.freebsd.org/changeset/base/193816 Log: add XEN kernel config Added: user/kmacy/releng_7_2_xen/sys/i386/conf/XEN Added: user/kmacy/releng_7_2_xen/sys/i386/conf/XEN ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_xen/sys/i386/conf/XEN Tue Jun 9 08:13:43 2009 (r193816) @@ -0,0 +1,154 @@ +# +# GENERIC -- Generic kernel configuration file for FreeBSD/i386 +# +# For more information on this file, please read the handbook section on +# Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD: head/sys/i386/conf/XEN 182902 2008-09-10 07:11:08Z kmacy $ + +cpu I686_CPU +ident GENERIC + +# To statically compile in device wiring instead of /boot/device.hints +#hints "GENERIC.hints" # Default places to look for devices. + +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +#makeoptions MODULES_OVERRIDE="" + +options SCHED_ULE # ULE scheduler +options PREEMPTION # Enable kernel thread preemption +#options SCHED_4BSD + +options INET # InterNETworking +options INET6 # IPv6 communications protocols +options SCTP # Stream Control Transmission Protocol +options FFS # Berkeley Fast Filesystem +options SOFTUPDATES # Enable FFS soft updates support +options UFS_ACL # Support for access control lists +options UFS_DIRHASH # Improve performance on big directories +options UFS_GJOURNAL # Enable gjournal-based UFS journaling +options MD_ROOT # MD is a potential root device +options NFSCLIENT # Network Filesystem Client +options NFSSERVER # Network Filesystem Server +options NFSLOCKD # Network Lock Manager +options NFS_ROOT # NFS usable as /, requires NFSCLIENT +options MSDOSFS # MSDOS Filesystem +options CD9660 # ISO 9660 Filesystem +options PROCFS # Process filesystem (requires PSEUDOFS) +options PSEUDOFS # Pseudo-filesystem framework +options GEOM_PART_GPT # GUID Partition Tables. +options GEOM_LABEL # Provides labelization +options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!] +options COMPAT_FREEBSD4 # Compatible with FreeBSD4 +options COMPAT_FREEBSD5 # Compatible with FreeBSD5 +options COMPAT_FREEBSD6 # Compatible with FreeBSD6 +options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI +options KTRACE # ktrace(1) support +options STACK # stack(9) support +options SYSVSHM # SYSV-style shared memory +options SYSVMSG # SYSV-style message queues +options SYSVSEM # SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions +options KBD_INSTALL_CDEV # install a CDEV entry in /dev +options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) +options AUDIT # Security event auditing + +# Debugging for use in -current +options KDB # Enable kernel debugger support. +options DDB # Support DDB. +options GDB # Support remote GDB. +options INVARIANTS # Enable calls of extra sanity checking +options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +options WITNESS # Enable checks to detect deadlocks and cycles +options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed + +options PAE +nooption NATIVE +option XEN +nodevice atpic +nodevice isa +options MCLSHIFT=12 +device genclock +nooption KSE +options CPU_DISABLE_SSE + + +# To make an SMP kernel, the next two lines are needed +options SMP # Symmetric MultiProcessor Kernel +device apic # I/O APIC + +# CPU frequency control +#device cpufreq + +# atkbdc0 controls both the keyboard and the PS/2 mouse +device atkbdc # AT keyboard controller +device atkbd # AT keyboard +device psm # PS/2 mouse + +device kbdmux # keyboard multiplexer + +#device vga # VGA video card driver + +device splash # Splash screen and screen saver support + +# syscons is the default console driver, resembling an SCO console +#device sc + +# Power management support (see NOTES for more options) +#device apm +# Add suspend/resume support for the i8254. +device pmtimer + + +device pci + +# PCCARD (PCMCIA) support +# PCMCIA and cardbus bridge support +#device cbb # cardbus (yenta) bridge +#device pccard # PC Card (16-bit) bus +#device cardbus # CardBus (32-bit) bus + +# Serial (COM) ports +device uart # Generic UART driver + +# Parallel port +device ppc +device ppbus # Parallel port bus (required) +device lpt # Printer +device plip # TCP/IP over parallel +device ppi # Parallel port interface device +#device vpo # Requires scbus and da + +# If you've got a "dumb" serial or parallel PCI card that is +# supported by the puc(4) glue driver, uncomment the following +# line to enable it (connects to sio, uart and/or ppc drivers): +#device puc + +# Pseudo devices. +device loop # Network loopback +device random # Entropy device +device ether # Ethernet support +device tun # Packet tunnel. +device pty # Pseudo-ttys (telnet etc) +device md # Memory "disks" +device gif # IPv6 and IPv4 tunneling +device faith # IPv6-to-IPv4 relaying (translation) +device firmware # firmware assist module + +# The `bpf' device enables the Berkeley Packet Filter. +# Be aware of the administrative consequences of enabling this! +# Note that 'bpf' is required for DHCP. +device bpf # Berkeley packet filter + From owner-svn-src-user@FreeBSD.ORG Wed Jun 10 01:26:26 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 20CA0106564A; Wed, 10 Jun 2009 01:26:26 +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 0FF718FC29; Wed, 10 Jun 2009 01:26:26 +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 n5A1QPqF089860; Wed, 10 Jun 2009 01:26:25 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5A1QP5o089859; Wed, 10 Jun 2009 01:26:25 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906100126.n5A1QP5o089859@svn.freebsd.org> From: Kip Macy Date: Wed, 10 Jun 2009 01:26: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: r193879 - 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: Wed, 10 Jun 2009 01:26:26 -0000 Author: kmacy Date: Wed Jun 10 01:26:25 2009 New Revision: 193879 URL: http://svn.freebsd.org/changeset/base/193879 Log: per Robert Watson's suggestion on 193698 generalize to check that the packet is greater than mtu before doing the fragmentation drop check that requires an integer divide Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Modified: user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Wed Jun 10 01:21:32 2009 (r193878) +++ user/kmacy/releng_7_2_fcs/sys/netinet/ip_output.c Wed Jun 10 01:26:25 2009 (r193879) @@ -447,12 +447,12 @@ again: * interface in which case packetdrop should be done by queueing. */ #ifdef ALTQ - if (ifp->if_snd.ifq_len && + if (ip->ip_len > mtu && (!ALTQ_IS_ENABLED(&ifp->if_snd)) && ((ifp->if_snd.ifq_len + ip->ip_len / mtu + 1) >= ifp->if_snd.ifq_maxlen)) #else - if (ifp->if_snd.ifq_len && + if (ip->ip_len > mtu && ((ifp->if_snd.ifq_len + ip->ip_len / mtu + 1) >= ifp->if_snd.ifq_maxlen)) #endif /* ALTQ */ From owner-svn-src-user@FreeBSD.ORG Thu Jun 11 04:50:12 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 075891065680; Thu, 11 Jun 2009 04:50:12 +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 E8AE98FC19; Thu, 11 Jun 2009 04:50: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 n5B4oBru035680; Thu, 11 Jun 2009 04:50:11 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5B4oBW0035677; Thu, 11 Jun 2009 04:50:11 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906110450.n5B4oBW0035677@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Jun 2009 04:50: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: r193967 - user/kmacy/releng_7_2_fcs/sys/contrib/pf/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: Thu, 11 Jun 2009 04:50:12 -0000 Author: kmacy Date: Thu Jun 11 04:50:11 2009 New Revision: 193967 URL: http://svn.freebsd.org/changeset/base/193967 Log: fix pf compile for post vimage / arpv2 Modified: user/kmacy/releng_7_2_fcs/sys/contrib/pf/net/pf.c user/kmacy/releng_7_2_fcs/sys/contrib/pf/net/pf_if.c user/kmacy/releng_7_2_fcs/sys/contrib/pf/net/pf_ioctl.c Modified: user/kmacy/releng_7_2_fcs/sys/contrib/pf/net/pf.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/contrib/pf/net/pf.c Thu Jun 11 04:43:42 2009 (r193966) +++ user/kmacy/releng_7_2_fcs/sys/contrib/pf/net/pf.c Thu Jun 11 04:50:11 2009 (r193967) @@ -92,6 +92,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #else #include #endif @@ -119,6 +120,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef __FreeBSD__ +#include +#endif #ifndef __FreeBSD__ #include @@ -138,6 +142,7 @@ __FBSDID("$FreeBSD$"); #ifdef __FreeBSD__ #include #include +#include #endif #endif /* INET6 */ @@ -1917,13 +1922,13 @@ pf_send_tcp(const struct pf_rule *r, sa_ h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; #ifdef __FreeBSD__ - h->ip_off = path_mtu_discovery ? IP_DF : 0; + h->ip_off = V_path_mtu_discovery ? IP_DF : 0; h->ip_len = len; #else h->ip_off = htons(ip_mtudisc ? IP_DF : 0); h->ip_len = htons(len); #endif - h->ip_ttl = ttl ? ttl : ip_defttl; + h->ip_ttl = ttl ? ttl : V_ip_defttl; h->ip_sum = 0; if (eh == NULL) { #ifdef __FreeBSD__ @@ -2950,7 +2955,7 @@ pf_socket_lookup(int direction, struct p sport = pd->hdr.tcp->th_sport; dport = pd->hdr.tcp->th_dport; #ifdef __FreeBSD__ - pi = &tcbinfo; + pi = &V_tcbinfo; #else tb = &tcbtable; #endif @@ -2961,7 +2966,7 @@ pf_socket_lookup(int direction, struct p sport = pd->hdr.udp->uh_sport; dport = pd->hdr.udp->uh_dport; #ifdef __FreeBSD__ - pi = &udbinfo; + pi = &V_udbinfo; #else tb = &udbtable; #endif @@ -3093,7 +3098,7 @@ pf_get_mss(struct mbuf *m, int off, u_in int hlen; u_int8_t hdr[60]; u_int8_t *opt, optlen; - u_int16_t mss = tcp_mssdflt; + u_int16_t mss = V_tcp_mssdflt; hlen = th_off << 2; /* hlen <= sizeof(hdr) */ if (hlen <= sizeof(struct tcphdr)) @@ -3138,7 +3143,7 @@ pf_calc_mss(struct pf_addr *addr, sa_fam #endif /* INET6 */ struct rtentry *rt = NULL; int hlen = 0; /* make the compiler happy */ - u_int16_t mss = tcp_mssdflt; + u_int16_t mss = V_tcp_mssdflt; switch (af) { #ifdef INET @@ -3153,7 +3158,7 @@ pf_calc_mss(struct pf_addr *addr, sa_fam #ifdef RTF_PRCLONING rtalloc_ign(&ro, (RTF_CLONING | RTF_PRCLONING)); #else /* !RTF_PRCLONING */ - in_rtalloc_ign(&ro, RTF_CLONING, 0); + in_rtalloc_ign(&ro, 0, 0); #endif #else /* ! __FreeBSD__ */ rtalloc_noclone(&ro, NO_CLONING); @@ -3174,7 +3179,7 @@ pf_calc_mss(struct pf_addr *addr, sa_fam rtalloc_ign((struct route *)&ro6, (RTF_CLONING | RTF_PRCLONING)); #else /* !RTF_PRCLONING */ - rtalloc_ign((struct route *)&ro6, RTF_CLONING); + rtalloc_ign((struct route *)&ro6, 0); #endif #else /* ! __FreeBSD__ */ rtalloc_noclone((struct route *)&ro6, NO_CLONING); @@ -3186,7 +3191,7 @@ pf_calc_mss(struct pf_addr *addr, sa_fam if (rt && rt->rt_ifp) { mss = rt->rt_ifp->if_mtu - hlen - sizeof(struct tcphdr); - mss = max(tcp_mssdflt, mss); + mss = max(V_tcp_mssdflt, mss); RTFREE(rt); } mss = min(mss, offer); @@ -3242,7 +3247,7 @@ pf_test_tcp(struct pf_rule **rm, struct u_short reason; int rewrite = 0; int tag = -1, rtableid = -1; - u_int16_t mss = tcp_mssdflt; + u_int16_t mss = V_tcp_mssdflt; int asd = 0; int match = 0; @@ -5976,9 +5981,9 @@ pf_routable(struct pf_addr *addr, sa_fam #ifdef __FreeBSD__ /* XXX MRT not always INET */ /* stick with table 0 though */ if (af == AF_INET) - in_rtalloc_ign((struct route *)&ro, RTF_CLONING, 0); + in_rtalloc_ign((struct route *)&ro, 0, 0); else - rtalloc_ign((struct route *)&ro, RTF_CLONING); + rtalloc_ign((struct route *)&ro, 0); #else /* ! __FreeBSD__ */ rtalloc_noclone((struct route *)&ro, NO_CLONING); #endif @@ -6058,9 +6063,9 @@ pf_rtlabel_match(struct pf_addr *addr, s rtalloc_ign((struct route *)&ro, (RTF_CLONING|RTF_PRCLONING)); # else /* !RTF_PRCLONING */ if (af == AF_INET) - in_rtalloc_ign((struct route *)&ro, RTF_CLONING, 0); + in_rtalloc_ign((struct route *)&ro, 0, 0); else - rtalloc_ign((struct route *)&ro, RTF_CLONING); + rtalloc_ign((struct route *)&ro, 0); # endif #else /* ! __FreeBSD__ */ rtalloc_noclone((struct route *)&ro, NO_CLONING); @@ -6142,7 +6147,7 @@ pf_route(struct mbuf **m, struct pf_rule if (r->rt == PF_FASTROUTE) { in_rtalloc(ro, 0); if (ro->ro_rt == 0) { - ipstat.ips_noroute++; + V_ipstat.ips_noroute++; goto bad; } @@ -6292,7 +6297,7 @@ pf_route(struct mbuf **m, struct pf_rule * Must be able to put at least 8 bytes per fragment. */ if (ip->ip_off & htons(IP_DF)) { - ipstat.ips_cantfrag++; + V_ipstat.ips_cantfrag++; if (r->rt != PF_DUPTO) { #ifdef __FreeBSD__ /* icmp_error() expects host byte ordering */ @@ -6349,7 +6354,7 @@ pf_route(struct mbuf **m, struct pf_rule } if (error == 0) - ipstat.ips_fragmented++; + V_ipstat.ips_fragmented++; done: if (r->rt != PF_DUPTO) @@ -6622,17 +6627,17 @@ pf_check_proto_cksum(struct mbuf *m, int if (sum) { switch (p) { case IPPROTO_TCP: - tcpstat.tcps_rcvbadsum++; + V_tcpstat.tcps_rcvbadsum++; break; case IPPROTO_UDP: - udpstat.udps_badsum++; + V_udpstat.udps_badsum++; break; case IPPROTO_ICMP: - icmpstat.icps_checksum++; + V_icmpstat.icps_checksum++; break; #ifdef INET6 case IPPROTO_ICMPV6: - icmp6stat.icp6s_checksum++; + V_icmp6stat.icp6s_checksum++; break; #endif /* INET6 */ } Modified: user/kmacy/releng_7_2_fcs/sys/contrib/pf/net/pf_if.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/contrib/pf/net/pf_if.c Thu Jun 11 04:43:42 2009 (r193966) +++ user/kmacy/releng_7_2_fcs/sys/contrib/pf/net/pf_if.c Thu Jun 11 04:50:11 2009 (r193967) @@ -54,9 +54,16 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#ifdef __FreeBSD__ +#include +#endif #include #include +#ifdef __FreeBSD__ +#include +#include +#endif #include #include @@ -109,8 +116,10 @@ void pfi_change_group_event(void * __u void pfi_detach_group_event(void * __unused, struct ifg_group *); void pfi_ifaddr_event(void * __unused, struct ifnet *); +#ifdef VIMAGE_GLOBALS extern struct ifgrouphead ifg_head; #endif +#endif RB_PROTOTYPE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); RB_GENERATE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); @@ -121,6 +130,8 @@ RB_GENERATE(pfi_ifhead, pfi_kif, pfik_tr void pfi_initialize(void) { + INIT_VNET_NET(curvnet); + if (pfi_all != NULL) /* already initialized */ return; @@ -141,9 +152,9 @@ pfi_initialize(void) struct ifnet *ifp; IFNET_RLOCK(); - TAILQ_FOREACH(ifg, &ifg_head, ifg_next) + TAILQ_FOREACH(ifg, &V_ifg_head, ifg_next) pfi_attach_ifgroup(ifg); - TAILQ_FOREACH(ifp, &ifnet, if_link) + TAILQ_FOREACH(ifp, &V_ifnet, if_link) pfi_attach_ifnet(ifp); IFNET_RUNLOCK(); Modified: user/kmacy/releng_7_2_fcs/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/contrib/pf/net/pf_ioctl.c Thu Jun 11 04:43:42 2009 (r193966) +++ user/kmacy/releng_7_2_fcs/sys/contrib/pf/net/pf_ioctl.c Thu Jun 11 04:50:11 2009 (r193967) @@ -36,14 +36,11 @@ */ #ifdef __FreeBSD__ -#include "opt_inet.h" -#include "opt_inet6.h" - #include __FBSDID("$FreeBSD$"); -#endif -#ifdef __FreeBSD__ +#include "opt_inet.h" +#include "opt_inet6.h" #include "opt_bpf.h" #include "opt_pf.h" @@ -86,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #else #include #include @@ -101,6 +99,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef __FreeBSD__ +#include +#endif #include #include @@ -3703,6 +3704,8 @@ static int pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, struct inpcb *inp) { + INIT_VNET_NET(curvnet); + /* * IPv6 is not affected by ip_len/ip_off byte order changes. */ @@ -3713,7 +3716,7 @@ pf_check6_in(void *arg, struct mbuf **m, * order to support scoped addresses. In order to support stateful * filtering we have change this to lo0 as it is the case in IPv4. */ - chk = pf_test6(PF_IN, (*m)->m_flags & M_LOOP ? &loif[0] : ifp, m, + chk = pf_test6(PF_IN, (*m)->m_flags & M_LOOP ? V_loif : ifp, m, NULL, inp); if (chk && *m) { m_freem(*m); From owner-svn-src-user@FreeBSD.ORG Thu Jun 11 05:20:06 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 1D04E106566B; Thu, 11 Jun 2009 05:20:06 +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 E50C98FC14; Thu, 11 Jun 2009 05:20:05 +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 n5B5K5Tk036281; Thu, 11 Jun 2009 05:20:05 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5B5K5xT036280; Thu, 11 Jun 2009 05:20:05 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906110520.n5B5K5xT036280@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Jun 2009 05:20: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: r193968 - user/kmacy/releng_7_2_xen/sys/dev/xen/netfront 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, 11 Jun 2009 05:20:06 -0000 Author: kmacy Date: Thu Jun 11 05:20:05 2009 New Revision: 193968 URL: http://svn.freebsd.org/changeset/base/193968 Log: integrate 19286-192870 Modified: user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c Modified: user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c ============================================================================== --- user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c Thu Jun 11 04:50:11 2009 (r193967) +++ user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c Thu Jun 11 05:20:05 2009 (r193968) @@ -284,6 +284,7 @@ struct netfront_rx_info { static inline void add_id_to_freelist(struct mbuf **list, unsigned short id) { + KASSERT(id != 0, ("add_id_to_freelist: the head item (0) must always be free.")); list[id] = list[0]; list[0] = (void *)(u_long)id; } @@ -292,6 +293,7 @@ static inline unsigned short get_id_from_freelist(struct mbuf **list) { u_int id = (u_int)(u_long)list[0]; + KASSERT(id != 0, ("get_id_from_freelist: the head item (0) must always remain free.")); list[0] = list[id]; return (id); } @@ -658,6 +660,23 @@ xn_free_tx_ring(struct netfront_info *sc #endif } +/* + * Do some brief math on the number of descriptors available to + * determine how many slots are available. + * + * Firstly - wouldn't something with RING_FREE_REQUESTS() be more applicable? + * Secondly - MAX_SKB_FRAGS is a Linux construct which may not apply here. + * Thirdly - it isn't used here anyway; the magic constant '24' is possibly + * wrong? + * The "2" is presumably to ensure there are also enough slots available for + * the ring entries used for "options" (eg, the TSO entry before a packet + * is queued); I'm not sure why its 2 and not 1. Perhaps to make sure there's + * a "free" node in the tx mbuf list (node 0) to represent the freelist? + * + * This only figures out whether any xenbus ring descriptors are available; + * it doesn't at all reflect how many tx mbuf ring descriptors are also + * available. + */ static inline int netfront_tx_slot_available(struct netfront_info *np) { @@ -990,10 +1009,10 @@ xn_txeof(struct netfront_info *np) for (i = np->tx.rsp_cons; i != prod; i++) { id = RING_GET_RESPONSE(&np->tx, i)->id; m = np->xn_cdata.xn_tx_chain[id]; - - ifp->if_opackets++; KASSERT(m != NULL, ("mbuf not found in xn_tx_chain")); M_ASSERTVALID(m); + + ifp->if_opackets++; if (unlikely(gnttab_query_foreign_access( np->grant_tx_ref[id]) != 0)) { printf("network_tx_buf_gc: warning " @@ -1325,6 +1344,12 @@ xn_start_locked(struct ifnet *ifp) if (m_head == NULL) break; + /* + * netfront_tx_slot_available() tries to do some math to + * ensure that there'll be enough xenbus ring slots available + * for the maximum number of packet fragments (and a couple more + * for what I guess are TSO and other ring entry items.) + */ if (!netfront_tx_slot_available(sc)) { IF_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; From owner-svn-src-user@FreeBSD.ORG Thu Jun 11 05:36: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 64AD6106566C; Thu, 11 Jun 2009 05:36:49 +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 51F088FC0A; Thu, 11 Jun 2009 05:36:49 +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 n5B5anUW036660; Thu, 11 Jun 2009 05:36:49 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5B5anYY036659; Thu, 11 Jun 2009 05:36:49 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906110536.n5B5anYY036659@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Jun 2009 05:36:49 +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: r193969 - user/kmacy/releng_7_2_xen/sys/dev/xen/netfront 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, 11 Jun 2009 05:36:49 -0000 Author: kmacy Date: Thu Jun 11 05:36:49 2009 New Revision: 193969 URL: http://svn.freebsd.org/changeset/base/193969 Log: integrate Adrian's changes from head Modified: user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c Modified: user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c ============================================================================== --- user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c Thu Jun 11 05:20:05 2009 (r193968) +++ user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c Thu Jun 11 05:36:49 2009 (r193969) @@ -24,11 +24,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -48,6 +48,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#if __FreeBSD_version >= 700000 +#include +#include +#endif #include #include @@ -64,23 +68,42 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include #include -#include -#include #include #include +#include + #include "xenbus_if.h" +#define XN_CSUM_FEATURES (CSUM_TCP | CSUM_UDP | CSUM_TSO) + #define GRANT_INVALID_REF 0 #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE) #define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE) +#if __FreeBSD_version >= 700000 +/* + * Should the driver do LRO on the RX end + * this can be toggled on the fly, but the + * interface must be reset (down/up) for it + * to take effect. + */ +static int xn_enable_lro = 1; +TUNABLE_INT("hw.xn.enable_lro", &xn_enable_lro); +#else + +#define IFCAP_TSO4 0 +#define CSUM_TSO 0 + +#endif + #ifdef CONFIG_XEN static int MODPARM_rx_copy = 0; module_param_named(rx_copy, MODPARM_rx_copy, bool, 0); @@ -93,6 +116,7 @@ static const int MODPARM_rx_copy = 1; static const int MODPARM_rx_flip = 0; #endif +#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2) #define RX_COPY_THRESHOLD 256 #define net_ratelimit() 0 @@ -153,6 +177,7 @@ static int xennet_get_responses(struct n */ struct xn_chain_data { struct mbuf *xn_tx_chain[NET_TX_RING_SIZE+1]; + int xn_tx_chain_cnt; struct mbuf *xn_rx_chain[NET_RX_RING_SIZE+1]; }; @@ -193,6 +218,9 @@ struct net_device_stats struct netfront_info { struct ifnet *xn_ifp; +#if __FreeBSD_version >= 700000 + struct lro_ctrl xn_lro; +#endif struct net_device_stats stats; u_int tx_full; @@ -325,38 +353,16 @@ xennet_get_rx_ref(struct netfront_info * return ref; } -#ifdef DEBUG - -#endif #define IPRINTK(fmt, args...) \ printf("[XEN] " fmt, ##args) #define WPRINTK(fmt, args...) \ printf("[XEN] " fmt, ##args) +#if 0 #define DPRINTK(fmt, args...) \ printf("[XEN] %s: " fmt, __func__, ##args) - - -static __inline struct mbuf* -makembuf (struct mbuf *buf) -{ - struct mbuf *m = NULL; - - MGETHDR (m, M_DONTWAIT, MT_DATA); - - if (! m) - return 0; - - M_MOVE_PKTHDR(m, buf); - - m_cljget(m, M_DONTWAIT, MJUMPAGESIZE); - m->m_pkthdr.len = buf->m_pkthdr.len; - m->m_len = buf->m_len; - m_copydata(buf, 0, buf->m_pkthdr.len, mtod(m,caddr_t) ); - - m->m_ext.ext_args = (caddr_t *)(uintptr_t)(vtophys(mtod(m,caddr_t)) >> PAGE_SHIFT); - - return m; -} +#else +#define DPRINTK(fmt, args...) +#endif /** * Read the 'mac' node at the given device's node in the store, and parse that @@ -417,6 +423,13 @@ netfront_attach(device_t dev) return err; } +#if __FreeBSD_version >= 700000 + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "enable_lro", CTLTYPE_INT|CTLFLAG_RW, + &xn_enable_lro, 0, "Large Receive Offload"); +#endif + return 0; } @@ -492,17 +505,12 @@ talk_to_backend(device_t dev, struct net message = "writing feature-rx-notify"; goto abort_transaction; } - err = xenbus_printf(xbt, node, "feature-no-csum-offload", "%d", 1); - if (err) { - message = "writing feature-no-csum-offload"; - goto abort_transaction; - } err = xenbus_printf(xbt, node, "feature-sg", "%d", 1); if (err) { message = "writing feature-sg"; goto abort_transaction; } -#ifdef HAVE_TSO +#if __FreeBSD_version >= 700000 err = xenbus_printf(xbt, node, "feature-gso-tcpv4", "%d", 1); if (err) { message = "writing feature-gso-tcpv4"; @@ -572,7 +580,7 @@ setup_device(device_t dev, struct netfro goto fail; error = bind_listening_port_to_irqhandler(xenbus_get_otherend_id(dev), - "xn", xn_intr, info, INTR_TYPE_NET | INTR_MPSAFE, &info->irq); + "xn", xn_intr, info, INTR_TYPE_NET | INTR_MPSAFE, &info->irq); if (error) { xenbus_dev_fatal(dev, error, @@ -590,6 +598,24 @@ setup_device(device_t dev, struct netfro } /** + * If this interface has an ipv4 address, send an arp for it. This + * helps to get the network going again after migrating hosts. + */ +static void +netfront_send_fake_arp(device_t dev, struct netfront_info *info) +{ + struct ifnet *ifp; + struct ifaddr *ifa; + + ifp = info->xn_ifp; + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family == AF_INET) { + arp_ifinit(ifp, ifa); + } + } +} + +/** * Callback received when the backend's state changes. */ static void @@ -614,9 +640,7 @@ netfront_backend_changed(device_t dev, X if (network_connect(sc) != 0) break; xenbus_set_state(dev, XenbusStateConnected); -#ifdef notyet - (void)send_fake_arp(netdev); -#endif + netfront_send_fake_arp(dev, sc); break; case XenbusStateClosing: xenbus_set_state(dev, XenbusStateClosed); @@ -702,6 +726,10 @@ netif_release_tx_bufs(struct netfront_in np->grant_tx_ref[i]); np->grant_tx_ref[i] = GRANT_INVALID_REF; add_id_to_freelist(np->tx_mbufs, i); + np->xn_cdata.xn_tx_chain_cnt--; + if (np->xn_cdata.xn_tx_chain_cnt < 0) { + panic("netif_release_tx_bufs: tx_chain_cnt must be >= 0"); + } m_freem(m); } } @@ -871,6 +899,10 @@ static void xn_rxeof(struct netfront_info *np) { struct ifnet *ifp; +#if __FreeBSD_version >= 700000 + struct lro_ctrl *lro = &np->xn_lro; + struct lro_entry *queued; +#endif struct netfront_rx_info rinfo; struct netif_rx_response *rx = &rinfo.rx; struct netif_extra_info *extras = rinfo.extras; @@ -965,13 +997,35 @@ xn_rxeof(struct netfront_info *np) * Do we really need to drop the rx lock? */ XN_RX_UNLOCK(np); - /* Pass it up. */ +#if __FreeBSD_version >= 700000 + /* Use LRO if possible */ + if ((ifp->if_capenable & IFCAP_LRO) == 0 || + lro->lro_cnt == 0 || tcp_lro_rx(lro, m, 0)) { + /* + * If LRO fails, pass up to the stack + * directly. + */ + (*ifp->if_input)(ifp, m); + } +#else (*ifp->if_input)(ifp, m); +#endif XN_RX_LOCK(np); } np->rx.rsp_cons = i; +#if __FreeBSD_version >= 700000 + /* + * Flush any outstanding LRO work + */ + while (!SLIST_EMPTY(&lro->lro_active)) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, next); + tcp_lro_flush(lro, queued); + } +#endif + #if 0 /* If we get a callback with very few responses, reduce fill target. */ /* NB. Note exponential increase, linear decrease. */ @@ -992,6 +1046,7 @@ xn_txeof(struct netfront_info *np) RING_IDX i, prod; unsigned short id; struct ifnet *ifp; + netif_tx_response_t *txr; struct mbuf *m; XN_TX_LOCK_ASSERT(np); @@ -1007,12 +1062,21 @@ xn_txeof(struct netfront_info *np) rmb(); /* Ensure we see responses up to 'rp'. */ for (i = np->tx.rsp_cons; i != prod; i++) { - id = RING_GET_RESPONSE(&np->tx, i)->id; + txr = RING_GET_RESPONSE(&np->tx, i); + if (txr->status == NETIF_RSP_NULL) + continue; + + id = txr->id; m = np->xn_cdata.xn_tx_chain[id]; KASSERT(m != NULL, ("mbuf not found in xn_tx_chain")); M_ASSERTVALID(m); - ifp->if_opackets++; + /* + * Increment packet count if this is the last + * mbuf of the chain. + */ + if (!m->m_next) + ifp->if_opackets++; if (unlikely(gnttab_query_foreign_access( np->grant_tx_ref[id]) != 0)) { printf("network_tx_buf_gc: warning " @@ -1028,7 +1092,13 @@ xn_txeof(struct netfront_info *np) np->xn_cdata.xn_tx_chain[id] = NULL; add_id_to_freelist(np->xn_cdata.xn_tx_chain, id); - m_freem(m); + np->xn_cdata.xn_tx_chain_cnt--; + if (np->xn_cdata.xn_tx_chain_cnt < 0) { + panic("netif_release_tx_bufs: tx_chain_cnt must be >= 0"); + } + m_free(m); + /* Only mark the queue active if we've freed up at least one slot to try */ + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } np->tx.rsp_cons = prod; @@ -1045,7 +1115,6 @@ xn_txeof(struct netfront_info *np) prod + ((np->tx.sring->req_prod - prod) >> 1) + 1; mb(); - } while (prod != np->tx.sring->rsp_prod); out: @@ -1257,7 +1326,7 @@ xennet_get_responses(struct netfront_inf next: if (m == NULL) break; - + m->m_len = rx->status; m->m_data += rx->offset; m0->m_pkthdr.len += rx->status; @@ -1324,13 +1393,14 @@ xn_start_locked(struct ifnet *ifp) { int otherend_id; unsigned short id; - struct mbuf *m_head, *new_m; + struct mbuf *m_head, *m; struct netfront_info *sc; netif_tx_request_t *tx; + netif_extra_info_t *extra; RING_IDX i; grant_ref_t ref; u_long mfn, tx_bytes; - int notify; + int notify, nfrags; sc = ifp->if_softc; otherend_id = xenbus_get_otherend_id(sc->xbdev); @@ -1355,37 +1425,153 @@ xn_start_locked(struct ifnet *ifp) ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - - id = get_id_from_freelist(sc->xn_cdata.xn_tx_chain); + + /* + * Defragment the mbuf if necessary. + */ + for (m = m_head, nfrags = 0; m; m = m->m_next) + nfrags++; + if (nfrags > MAX_SKB_FRAGS) { + m = m_defrag(m_head, M_DONTWAIT); + if (!m) { + m_freem(m_head); + break; + } + m_head = m; + } + + /* Determine how many fragments now exist */ + for (m = m_head, nfrags = 0; m; m = m->m_next) + nfrags++; + + /* + * Don't attempt to queue this packet if there aren't + * enough free entries in the chain. + * + * There isn't a 1:1 correspondance between the mbuf TX ring + * and the xenbus TX ring. + * xn_txeof() may need to be called to free up some slots. + * + * It is quite possible that this can be later eliminated if + * it turns out that partial * packets can be pushed into + * the ringbuffer, with fragments pushed in when further slots + * free up. + * + * It is also quite possible that the driver will lock up + * if the TX queue fills up with no RX traffic, and + * the mbuf ring is exhausted. The queue may need + * a swift kick to continue. + */ + + /* + * It is not +1 like the allocation because we need to keep + * slot [0] free for the freelist head + */ + if (sc->xn_cdata.xn_tx_chain_cnt + nfrags >= NET_TX_RING_SIZE) { + printf("xn_start_locked: xn_tx_chain_cnt (%d) + nfrags %d >= NET_TX_RING_SIZE (%d); must be full!\n", + (int) sc->xn_cdata.xn_tx_chain_cnt, + (int) nfrags, (int) NET_TX_RING_SIZE); + IF_PREPEND(&ifp->if_snd, m_head); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + + /* + * Make sure there's actually space available in the + * Xen TX ring for this. Overcompensate for the possibility + * of having a TCP offload fragment just in case for now + * (the +1) rather than adding logic to accurately calculate + * the required size. + */ + if (RING_FREE_REQUESTS(&sc->tx) < (nfrags + 1)) { + printf("xn_start_locked: free ring slots (%d) < (nfrags + 1) (%d); must be full!\n", + (int) RING_FREE_REQUESTS(&sc->tx), + (int) (nfrags + 1)); + IF_PREPEND(&ifp->if_snd, m_head); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } /* * Start packing the mbufs in this chain into * the fragment pointers. Stop when we run out * of fragments or hit the end of the mbuf chain. */ - new_m = makembuf(m_head); - tx = RING_GET_REQUEST(&sc->tx, i); - tx->id = id; - ref = gnttab_claim_grant_reference(&sc->gref_tx_head); - KASSERT((short)ref >= 0, ("Negative ref")); - mfn = virt_to_mfn(mtod(new_m, vm_offset_t)); - gnttab_grant_foreign_access_ref(ref, otherend_id, - mfn, GNTMAP_readonly); - tx->gref = sc->grant_tx_ref[id] = ref; - tx->size = new_m->m_pkthdr.len; -#if 0 - tx->flags = (skb->ip_summed == CHECKSUM_HW) ? NETTXF_csum_blank : 0; -#endif - tx->flags = 0; - new_m->m_next = NULL; - new_m->m_nextpkt = NULL; + m = m_head; + extra = NULL; + for (m = m_head; m; m = m->m_next) { + tx = RING_GET_REQUEST(&sc->tx, i); + id = get_id_from_freelist(sc->xn_cdata.xn_tx_chain); + if (id == 0) + panic("xn_start_locked: was allocated the freelist head!\n"); + sc->xn_cdata.xn_tx_chain_cnt++; + if (sc->xn_cdata.xn_tx_chain_cnt >= NET_TX_RING_SIZE+1) + panic("xn_start_locked: tx_chain_cnt must be < NET_TX_RING_SIZE+1\n"); + sc->xn_cdata.xn_tx_chain[id] = m; + tx->id = id; + ref = gnttab_claim_grant_reference(&sc->gref_tx_head); + KASSERT((short)ref >= 0, ("Negative ref")); + mfn = virt_to_mfn(mtod(m, vm_offset_t)); + gnttab_grant_foreign_access_ref(ref, otherend_id, + mfn, GNTMAP_readonly); + tx->gref = sc->grant_tx_ref[id] = ref; + tx->offset = mtod(m, vm_offset_t) & (PAGE_SIZE - 1); + tx->flags = 0; + if (m == m_head) { + /* + * The first fragment has the entire packet + * size, subsequent fragments have just the + * fragment size. The backend works out the + * true size of the first fragment by + * subtracting the sizes of the other + * fragments. + */ + tx->size = m->m_pkthdr.len; - m_freem(m_head); + /* + * The first fragment contains the + * checksum flags and is optionally + * followed by extra data for TSO etc. + */ + if (m->m_pkthdr.csum_flags + & CSUM_DELAY_DATA) { + tx->flags |= (NETTXF_csum_blank + | NETTXF_data_validated); + } +#if __FreeBSD_version >= 700000 + if (m->m_pkthdr.csum_flags & CSUM_TSO) { + struct netif_extra_info *gso = + (struct netif_extra_info *) + RING_GET_REQUEST(&sc->tx, ++i); + + if (extra) + extra->flags |= XEN_NETIF_EXTRA_FLAG_MORE; + else + tx->flags |= NETTXF_extra_info; + + gso->u.gso.size = m->m_pkthdr.tso_segsz; + gso->u.gso.type = + XEN_NETIF_GSO_TYPE_TCPV4; + gso->u.gso.pad = 0; + gso->u.gso.features = 0; + + gso->type = XEN_NETIF_EXTRA_TYPE_GSO; + gso->flags = 0; + extra = gso; + } +#endif + } else { + tx->size = m->m_len; + } + if (m->m_next) { + tx->flags |= NETTXF_more_data; + i++; + } + } - sc->xn_cdata.xn_tx_chain[id] = new_m; - BPF_MTAP(ifp, new_m); + BPF_MTAP(ifp, m_head); - sc->stats.tx_bytes += new_m->m_pkthdr.len; + sc->stats.tx_bytes += m_head->m_pkthdr.len; sc->stats.tx_packets++; } @@ -1471,9 +1657,9 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) xn_ifinit_locked(sc); arp_ifinit(ifp, ifa); - XN_UNLOCK(sc); + XN_UNLOCK(sc); } else { - XN_UNLOCK(sc); + XN_UNLOCK(sc); error = ether_ioctl(ifp, cmd, data); } break; @@ -1527,12 +1713,39 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, break; case SIOCSIFCAP: mask = ifr->ifr_reqcap ^ ifp->if_capenable; - if (mask & IFCAP_HWCSUM) { - if (IFCAP_HWCSUM & ifp->if_capenable) - ifp->if_capenable &= ~IFCAP_HWCSUM; - else - ifp->if_capenable |= IFCAP_HWCSUM; + if (mask & IFCAP_TXCSUM) { + if (IFCAP_TXCSUM & ifp->if_capenable) { + ifp->if_capenable &= ~(IFCAP_TXCSUM|IFCAP_TSO4); + ifp->if_hwassist &= ~(CSUM_TCP | CSUM_UDP + | CSUM_IP | CSUM_TSO); + } else { + ifp->if_capenable |= IFCAP_TXCSUM; + ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP + | CSUM_IP); + } + } + if (mask & IFCAP_RXCSUM) { + ifp->if_capenable ^= IFCAP_RXCSUM; + } +#if __FreeBSD_version >= 700000 + if (mask & IFCAP_TSO4) { + if (IFCAP_TSO4 & ifp->if_capenable) { + ifp->if_capenable &= ~IFCAP_TSO4; + ifp->if_hwassist &= ~CSUM_TSO; + } else if (IFCAP_TXCSUM & ifp->if_capenable) { + ifp->if_capenable |= IFCAP_TSO4; + ifp->if_hwassist |= CSUM_TSO; + } else { + IPRINTK("Xen requires tx checksum offload" + " be enabled to use TSO\n"); + error = EINVAL; + } } + if (mask & IFCAP_LRO) { + ifp->if_capenable ^= IFCAP_LRO; + + } +#endif error = 0; break; case SIOCADDMULTI: @@ -1741,11 +1954,21 @@ create_netdev(device_t dev) ifp->if_mtu = ETHERMTU; ifp->if_snd.ifq_maxlen = NET_TX_RING_SIZE - 1; -#ifdef notyet ifp->if_hwassist = XN_CSUM_FEATURES; ifp->if_capabilities = IFCAP_HWCSUM; +#if __FreeBSD_version >= 700000 + ifp->if_capabilities |= IFCAP_TSO4; + if (xn_enable_lro) { + int err = tcp_lro_init(&np->xn_lro); + if (err) { + device_printf(dev, "LRO initialization failed\n"); + goto exit; + } + np->xn_lro.ifp = ifp; + ifp->if_capabilities |= IFCAP_LRO; + } +#endif ifp->if_capenable = ifp->if_capabilities; -#endif ether_ifattach(ifp, np->mac); callout_init(&np->xn_stat_ch, CALLOUT_MPSAFE); From owner-svn-src-user@FreeBSD.ORG Thu Jun 11 05:42:37 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 19FC8106566B; Thu, 11 Jun 2009 05:42:37 +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 08CC08FC19; Thu, 11 Jun 2009 05:42:37 +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 n5B5gaI8036793; Thu, 11 Jun 2009 05:42:36 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5B5galc036792; Thu, 11 Jun 2009 05:42:36 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906110542.n5B5galc036792@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Jun 2009 05:42:36 +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: r193970 - user/kmacy/releng_7_2_xen/sys/xen/xenbus 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, 11 Jun 2009 05:42:37 -0000 Author: kmacy Date: Thu Jun 11 05:42:36 2009 New Revision: 193970 URL: http://svn.freebsd.org/changeset/base/193970 Log: check message callback for null Modified: user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbus_xs.c Modified: user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbus_xs.c ============================================================================== --- user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbus_xs.c Thu Jun 11 05:36:49 2009 (r193969) +++ user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbus_xs.c Thu Jun 11 05:42:36 2009 (r193970) @@ -769,7 +769,7 @@ xenwatch_thread(void *unused) TAILQ_REMOVE(&watch_events, msg, list); mtx_unlock(&watch_events_lock); - if (msg != NULL) { + if (msg != NULL && msg->u.watch.handle->callback != NULL) { msg->u.watch.handle->callback( msg->u.watch.handle, (const char **)msg->u.watch.vec, From owner-svn-src-user@FreeBSD.ORG Thu Jun 11 05:46: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 E6C08106566B; Thu, 11 Jun 2009 05:46: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 D469E8FC15; Thu, 11 Jun 2009 05:46: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 n5B5kB5K036925; Thu, 11 Jun 2009 05:46:11 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5B5kBOb036923; Thu, 11 Jun 2009 05:46:11 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906110546.n5B5kBOb036923@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Jun 2009 05:46: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: r193971 - in user/kmacy/releng_7_2_xen/sys: conf i386/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, 11 Jun 2009 05:46:12 -0000 Author: kmacy Date: Thu Jun 11 05:46:11 2009 New Revision: 193971 URL: http://svn.freebsd.org/changeset/base/193971 Log: merge RTC from HEAD: Say hello to a very basic, read-only, Xen Hypervisor RTC. The hypervisor doesn't provide a single "TOD" - it instead provides a "start time" and a "running time". These are added together to form the current TOD. The TOD is in UTC. This RTC is only (initially) designed to be read at startup. There's some further poking that needs to happen to pick up hypervisor time changes (ie, by the Dom0 time being adjusted by something). This time adjustment currently can cause "weird stuff" in the DomU clock; I'll begin investigating and repairing that in subsequent commits. Added: user/kmacy/releng_7_2_xen/sys/i386/xen/xen_rtc.c Modified: user/kmacy/releng_7_2_xen/sys/conf/files.i386 Modified: user/kmacy/releng_7_2_xen/sys/conf/files.i386 ============================================================================== --- user/kmacy/releng_7_2_xen/sys/conf/files.i386 Thu Jun 11 05:42:36 2009 (r193970) +++ user/kmacy/releng_7_2_xen/sys/conf/files.i386 Thu Jun 11 05:46:11 2009 (r193971) @@ -329,6 +329,7 @@ i386/isa/atpic.c optional atpic #i386/isa/atpic_vector.s standard i386/isa/clock.c optional native i386/xen/clock.c optional xen +i386/xen/xen_rtc.c optional xen i386/isa/dpms.c optional dpms i386/isa/elcr.c standard i386/isa/elink.c optional ep | ie Added: user/kmacy/releng_7_2_xen/sys/i386/xen/xen_rtc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_xen/sys/i386/xen/xen_rtc.c Thu Jun 11 05:46:11 2009 (r193971) @@ -0,0 +1,191 @@ +/*- + * Copyright (c) 2009 Adrian Chadd + * 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. + * 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$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "clock_if.h" + +/* + * Read the current hypervisor start time (wall clock) from Xen. + */ +static void +xen_fetch_wallclock(struct timespec *ts) +{ + shared_info_t *s = HYPERVISOR_shared_info; + uint32_t ts_version; + + do { + ts_version = s->wc_version; + rmb(); + ts->tv_sec = s->wc_sec; + ts->tv_nsec = s->wc_nsec; + rmb(); + } + while ((s->wc_version & 1) | (ts_version ^ s->wc_version)); +} + +/* + * Read the current hypervisor system uptime value from Xen. + */ +static void +xen_fetch_uptime(struct timespec *ts) +{ + shared_info_t *s = HYPERVISOR_shared_info; + struct vcpu_time_info *src; + struct shadow_time_info dst; + uint32_t pre_version, post_version; + + src = &s->vcpu_info[smp_processor_id()].time; + + spinlock_enter(); + do { + pre_version = dst.version = src->version; + rmb(); + dst.system_timestamp = src->system_time; + rmb(); + post_version = src->version; + } + while ((pre_version & 1) | (pre_version ^ post_version)); + + spinlock_exit(); + + ts->tv_sec = dst.system_timestamp / 1000000000; + ts->tv_nsec = dst.system_timestamp % 1000000000; +} + + +static int +xen_rtc_probe(device_t dev) +{ + device_set_desc(dev, "Xen Hypervisor Clock"); + printf("[XEN] xen_rtc_probe: probing Hypervisor RTC clock\n"); + if (! HYPERVISOR_shared_info) { + device_printf(dev, "No hypervisor shared page found; RTC can not start.\n"); + return (EINVAL); + } + return (0); +} + +static int +xen_rtc_attach(device_t dev) +{ + printf("[XEN] xen_rtc_attach: attaching Hypervisor RTC clock\n"); + clock_register(dev, 1000000); + return(0); +} + +static int +xen_rtc_settime(device_t dev __unused, struct timespec *ts) +{ + device_printf(dev, "[XEN] xen_rtc_settime\n"); + /* + * Don't return EINVAL here; just silently fail if the domain isn't privileged enough + * to set the TOD. + */ + return(0); +} + +/* + * The Xen time structures document the hypervisor start time and the + * uptime-since-hypervisor-start (in nsec.) They need to be combined + * in order to calculate a TOD clock. + */ +static int +xen_rtc_gettime(device_t dev, struct timespec *ts) +{ + struct timespec w_ts, u_ts; + + device_printf(dev, "[XEN] xen_rtc_gettime\n"); + xen_fetch_wallclock(&w_ts); + device_printf(dev, "[XEN] xen_rtc_gettime: wallclock %ld sec; %ld nsec\n", (long int) w_ts.tv_sec, (long int) w_ts.tv_nsec); + xen_fetch_uptime(&u_ts); + device_printf(dev, "[XEN] xen_rtc_gettime: uptime %ld sec; %ld nsec\n", (long int) u_ts.tv_sec, (long int) u_ts.tv_nsec); + + timespecclear(ts); + timespecadd(ts, &w_ts); + timespecadd(ts, &u_ts); + + device_printf(dev, "[XEN] xen_rtc_gettime: TOD %ld sec; %ld nsec\n", (long int) ts->tv_sec, (long int) ts->tv_nsec); + + return(0); +} + +static void +xen_rtc_identify(driver_t *drv, device_t parent) +{ + BUS_ADD_CHILD(parent, 0, "rtc", 0); +} + +static device_method_t xen_rtc_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, xen_rtc_probe), + DEVMETHOD(device_attach, xen_rtc_attach), + DEVMETHOD(device_identify, xen_rtc_identify), + + DEVMETHOD(device_detach, bus_generic_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + + /* clock interface */ + DEVMETHOD(clock_gettime, xen_rtc_gettime), + DEVMETHOD(clock_settime, xen_rtc_settime), + + { 0, 0 } +}; + + +static driver_t xen_rtc_driver = { + "rtc", + xen_rtc_methods, + 0 +}; + +static devclass_t xen_rtc_devclass; + +DRIVER_MODULE(rtc, nexus, xen_rtc_driver, xen_rtc_devclass, 0, 0); From owner-svn-src-user@FreeBSD.ORG Thu Jun 11 05:47:14 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 3134A1065670; Thu, 11 Jun 2009 05:47:14 +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 1E7D08FC0C; Thu, 11 Jun 2009 05:47:14 +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 n5B5lEW3036984; Thu, 11 Jun 2009 05:47:14 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5B5lDX2036980; Thu, 11 Jun 2009 05:47:13 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906110547.n5B5lDX2036980@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Jun 2009 05:47:13 +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: r193972 - in user/kmacy/releng_7_2_xen/sys: conf i386/include/xen i386/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, 11 Jun 2009 05:47:14 -0000 Author: kmacy Date: Thu Jun 11 05:47:13 2009 New Revision: 193972 URL: http://svn.freebsd.org/changeset/base/193972 Log: Migrate the Xen hypervisor clock reading routines into something sharable. Added: user/kmacy/releng_7_2_xen/sys/i386/include/xen/xen_clock_util.h user/kmacy/releng_7_2_xen/sys/i386/xen/xen_clock_util.c Modified: user/kmacy/releng_7_2_xen/sys/conf/files.i386 user/kmacy/releng_7_2_xen/sys/i386/xen/xen_rtc.c Modified: user/kmacy/releng_7_2_xen/sys/conf/files.i386 ============================================================================== --- user/kmacy/releng_7_2_xen/sys/conf/files.i386 Thu Jun 11 05:46:11 2009 (r193971) +++ user/kmacy/releng_7_2_xen/sys/conf/files.i386 Thu Jun 11 05:47:13 2009 (r193972) @@ -329,6 +329,7 @@ i386/isa/atpic.c optional atpic #i386/isa/atpic_vector.s standard i386/isa/clock.c optional native i386/xen/clock.c optional xen +i386/xen/xen_clock_util.c optional xen i386/xen/xen_rtc.c optional xen i386/isa/dpms.c optional dpms i386/isa/elcr.c standard Added: user/kmacy/releng_7_2_xen/sys/i386/include/xen/xen_clock_util.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_xen/sys/i386/include/xen/xen_clock_util.h Thu Jun 11 05:47:13 2009 (r193972) @@ -0,0 +1,38 @@ +/* + * + * Copyright (c) 2009 Adrian Chadd + * 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. + * 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. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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$ + */ + +#ifndef __XEN_CLOCK_UTIL_H__ +#define __XEN_CLOCK_UTIL_H__ + +extern void xen_fetch_wallclock(struct timespec *ts); +extern void xen_fetch_uptime(struct timespec *ts); + +#endif /* __XEN_CLOCK_UTIL_H__ */ Added: user/kmacy/releng_7_2_xen/sys/i386/xen/xen_clock_util.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_xen/sys/i386/xen/xen_clock_util.c Thu Jun 11 05:47:13 2009 (r193972) @@ -0,0 +1,101 @@ +/*- + * Copyright (c) 2009 Adrian Chadd + * 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. + * 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$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* + * Read the current hypervisor start time (wall clock) from Xen. + */ +void +xen_fetch_wallclock(struct timespec *ts) +{ + shared_info_t *s = HYPERVISOR_shared_info; + uint32_t ts_version; + + do { + ts_version = s->wc_version; + rmb(); + ts->tv_sec = s->wc_sec; + ts->tv_nsec = s->wc_nsec; + rmb(); + } + while ((s->wc_version & 1) | (ts_version ^ s->wc_version)); +} + +/* + * Read the current hypervisor system uptime value from Xen. + */ +void +xen_fetch_uptime(struct timespec *ts) +{ + shared_info_t *s = HYPERVISOR_shared_info; + struct vcpu_time_info *src; + struct shadow_time_info dst; + uint32_t pre_version, post_version; + + src = &s->vcpu_info[smp_processor_id()].time; + + spinlock_enter(); + do { + pre_version = dst.version = src->version; + rmb(); + dst.system_timestamp = src->system_time; + rmb(); + post_version = src->version; + } + while ((pre_version & 1) | (pre_version ^ post_version)); + + spinlock_exit(); + + ts->tv_sec = dst.system_timestamp / 1000000000; + ts->tv_nsec = dst.system_timestamp % 1000000000; +} Modified: user/kmacy/releng_7_2_xen/sys/i386/xen/xen_rtc.c ============================================================================== --- user/kmacy/releng_7_2_xen/sys/i386/xen/xen_rtc.c Thu Jun 11 05:46:11 2009 (r193971) +++ user/kmacy/releng_7_2_xen/sys/i386/xen/xen_rtc.c Thu Jun 11 05:47:13 2009 (r193972) @@ -50,56 +50,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include "clock_if.h" - -/* - * Read the current hypervisor start time (wall clock) from Xen. - */ -static void -xen_fetch_wallclock(struct timespec *ts) -{ - shared_info_t *s = HYPERVISOR_shared_info; - uint32_t ts_version; - - do { - ts_version = s->wc_version; - rmb(); - ts->tv_sec = s->wc_sec; - ts->tv_nsec = s->wc_nsec; - rmb(); - } - while ((s->wc_version & 1) | (ts_version ^ s->wc_version)); -} - -/* - * Read the current hypervisor system uptime value from Xen. - */ -static void -xen_fetch_uptime(struct timespec *ts) -{ - shared_info_t *s = HYPERVISOR_shared_info; - struct vcpu_time_info *src; - struct shadow_time_info dst; - uint32_t pre_version, post_version; - - src = &s->vcpu_info[smp_processor_id()].time; - - spinlock_enter(); - do { - pre_version = dst.version = src->version; - rmb(); - dst.system_timestamp = src->system_time; - rmb(); - post_version = src->version; - } - while ((pre_version & 1) | (pre_version ^ post_version)); - - spinlock_exit(); - - ts->tv_sec = dst.system_timestamp / 1000000000; - ts->tv_nsec = dst.system_timestamp % 1000000000; -} +#include +#include "clock_if.h" static int xen_rtc_probe(device_t dev) From owner-svn-src-user@FreeBSD.ORG Thu Jun 11 05:48: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 DB5C6106566C; Thu, 11 Jun 2009 05:48:49 +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 AFC328FC1B; Thu, 11 Jun 2009 05:48:49 +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 n5B5mnsJ037052; Thu, 11 Jun 2009 05:48:49 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5B5mntQ037051; Thu, 11 Jun 2009 05:48:49 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906110548.n5B5mntQ037051@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Jun 2009 05:48:49 +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: r193973 - user/kmacy/releng_7_2_xen/sys/i386/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, 11 Jun 2009 05:48:50 -0000 Author: kmacy Date: Thu Jun 11 05:48:49 2009 New Revision: 193973 URL: http://svn.freebsd.org/changeset/base/193973 Log: Merge 193033 Fix the Xen TOD update when the hypervisor wall clock is nudged. The "wall clock" in the current code is actually the hypervisor start time. The time of day is the "start time" plus the hypervisor "uptime". Large enough bumps in the dom0 clock lead to a hypervisor "bump" which is implemented as a bump in the start time, not the uptime. The clock.c routines were reading in the hypervisor start time and then using this as the TOD. This meant that any hypervisor time bump would cause the FreeBSD DomU to set its TOD to the hypervisor start time, rather than the actual TOD. This fix is a bit hacky and some reshuffling should be done later on to clarify what is going on. I've left the wall clock code alone. (The code which updates shadow_tv and shadow_tv_version.) A new routine adds the uptime to the shadow_tv, which is then used to update the TOD. I've included some debugging so it is obvious when the clock is nudged. Modified: user/kmacy/releng_7_2_xen/sys/i386/xen/clock.c Modified: user/kmacy/releng_7_2_xen/sys/i386/xen/clock.c ============================================================================== --- user/kmacy/releng_7_2_xen/sys/i386/xen/clock.c Thu Jun 11 05:47:13 2009 (r193972) +++ user/kmacy/releng_7_2_xen/sys/i386/xen/clock.c Thu Jun 11 05:48:49 2009 (r193973) @@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we @@ -237,6 +238,15 @@ static void update_wallclock(void) } +static void +add_uptime_to_wallclock(void) +{ + struct timespec ut; + + xen_fetch_uptime(&ut); + timespecadd(&shadow_tv, &ut); +} + /* * Reads a consistent set of time-base values from Xen, into a shadow data * area. Must be called with the xtime_lock held for writing. @@ -332,7 +342,9 @@ clkintr(void *arg) */ if (shadow_tv_version != HYPERVISOR_shared_info->wc_version) { + printf("[XEN] hypervisor wallclock nudged; nudging TOD.\n"); update_wallclock(); + add_uptime_to_wallclock(); tc_setclock(&shadow_tv); } @@ -543,6 +555,7 @@ domu_inittodr(time_t base) struct timespec ts; update_wallclock(); + add_uptime_to_wallclock(); RTC_LOCK; @@ -592,6 +605,7 @@ domu_resettodr(void) op.u.settime.system_time = shadow->system_timestamp; HYPERVISOR_dom0_op(&op); update_wallclock(); + add_uptime_to_wallclock(); } else if (independent_wallclock) { /* notyet */ ; From owner-svn-src-user@FreeBSD.ORG Fri Jun 12 22:39:23 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 6DB9B106564A; Fri, 12 Jun 2009 22:39:23 +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 424C18FC12; Fri, 12 Jun 2009 22:39:23 +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 n5CMdNc7094931; Fri, 12 Jun 2009 22:39:23 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5CMdN1C094930; Fri, 12 Jun 2009 22:39:23 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200906122239.n5CMdN1C094930@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Fri, 12 Jun 2009 22:39:23 +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: r194080 - user/des 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, 12 Jun 2009 22:39:23 -0000 Author: des Date: Fri Jun 12 22:39:22 2009 New Revision: 194080 URL: http://svn.freebsd.org/changeset/base/194080 Log: My very own playpen! Added: user/des/ From owner-svn-src-user@FreeBSD.ORG Fri Jun 12 22:48: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 C65E71065670; Fri, 12 Jun 2009 22:48:10 +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 9B0D58FC15; Fri, 12 Jun 2009 22:48:10 +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 n5CMmAd8095174; Fri, 12 Jun 2009 22:48:10 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5CMmAaZ095173; Fri, 12 Jun 2009 22:48:10 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200906122248.n5CMmAaZ095173@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Fri, 12 Jun 2009 22:48: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: r194081 - user/des 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, 12 Jun 2009 22:48:11 -0000 Author: des Date: Fri Jun 12 22:48:10 2009 New Revision: 194081 URL: http://svn.freebsd.org/changeset/base/194081 Log: Stay at home Added: user/des/Makefile.inc (contents, props changed) Added: user/des/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/Makefile.inc Fri Jun 12 22:48:10 2009 (r194081) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +BINDIR=${HOME}/bin +BINOWN=${USER} +ETCDIR=${HOME}/etc +ETCOWN=${USER} +LIBDIR=${HOME}/lib +LIBOWN=${USER} +MANDIR=${HOME}/man +MANOWN=${USER} +SHAREDIR=${HOME}/share +SHAREOWN=${USER} From owner-svn-src-user@FreeBSD.ORG Fri Jun 12 22:52: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 E8CC0106564A; Fri, 12 Jun 2009 22:52:19 +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 D71428FC14; Fri, 12 Jun 2009 22:52:19 +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 n5CMqJoB095391; Fri, 12 Jun 2009 22:52:19 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5CMqJJq095389; Fri, 12 Jun 2009 22:52:19 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200906122252.n5CMqJJq095389@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Fri, 12 Jun 2009 22:52: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: r194083 - 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: Fri, 12 Jun 2009 22:52:20 -0000 Author: des Date: Fri Jun 12 22:52:19 2009 New Revision: 194083 URL: http://svn.freebsd.org/changeset/base/194083 Log: A very simple shell script that automates merging from head into a stable branch. Simply cd to the target directory and run fmerge with a list of revisions you want merged. It will automatically identify your repository root and the branch and subdirectory where you're standing, and attempt to merge each revision you specified, in order, from head. Added: user/des/fmerge/ user/des/fmerge/Makefile (contents, props changed) user/des/fmerge/fmerge.sh (contents, props changed) Added: user/des/fmerge/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fmerge/Makefile Fri Jun 12 22:52:19 2009 (r194083) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +SCRIPTS = fmerge + +.include "${.CURDIR}/../Makefile.inc" +.include Added: user/des/fmerge/fmerge.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fmerge/fmerge.sh Fri Jun 12 22:52:19 2009 (r194083) @@ -0,0 +1,78 @@ +#!/bin/sh +#- +# 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$ +# + +error() { + echo "$@" 1>&2 + exit 1 +} + +say_and_do() { + echo "$@" + "$@" +} + +eval $(svn info | awk ' +/^URL/ { print "svnurl=" $2 } +/^Repository Root/ { print "svnroot=" $3 } +') +svnpath=${svnurl##${svnroot}/} + +case $svnpath in +stable/[0-9]/*) + subdir=${svnpath##stable/[0-9]/} + branch=${svnpath%%/${subdir}} + ;; +*) + error "I don't know where $svnpath is" + ;; +esac + +[ $# -gt 0 ] || error "You have to give me a revision number" + +for rev ; do + # I wish sh had something approaching a kleene star. + case $rev in + [0-9]*) + rev=-c${rev} + ;; + r[0-9]*) + rev=-c${rev##r} + ;; + [0-9]*-[0-9]*) + reva=${rev%%-[0-9]*} + revb=${rev##[0-9]*-} + rev=-r${reva}-${revb} + ;; + *) + error "I can't figure this revision number out" + ;; + esac + say_and_do svn merge ${rev} ${svnroot}/head/${subdir} . +done From owner-svn-src-user@FreeBSD.ORG Sat Jun 13 23:05:55 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 6F1C6106566B; Sat, 13 Jun 2009 23:05:55 +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 42E2A8FC08; Sat, 13 Jun 2009 23:05:55 +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 n5DN5tqO026925; Sat, 13 Jun 2009 23:05:55 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5DN5tdv026924; Sat, 13 Jun 2009 23:05:55 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906132305.n5DN5tdv026924@svn.freebsd.org> From: Kip Macy Date: Sat, 13 Jun 2009 23:05:55 +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: r194132 - user/kmacy/releng_7_2_xen/sys/dev/xen/netfront 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: Sat, 13 Jun 2009 23:05:55 -0000 Author: kmacy Date: Sat Jun 13 23:05:54 2009 New Revision: 194132 URL: http://svn.freebsd.org/changeset/base/194132 Log: fix WITNESS sleepability warnings Modified: user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c Modified: user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c ============================================================================== --- user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c Sat Jun 13 22:02:55 2009 (r194131) +++ user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c Sat Jun 13 23:05:54 2009 (r194132) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -230,7 +229,7 @@ struct netfront_info { struct mtx tx_lock; struct mtx rx_lock; - struct sx sc_lock; + struct mtx sc_lock; u_int handle; u_int irq; @@ -274,7 +273,7 @@ struct netfront_info { #define XN_LOCK_INIT(_sc, _name) \ mtx_init(&(_sc)->tx_lock, #_name"_tx", "network transmit lock", MTX_DEF); \ mtx_init(&(_sc)->rx_lock, #_name"_rx", "network receive lock", MTX_DEF); \ - sx_init(&(_sc)->sc_lock, #_name"_rx") + mtx_init(&(_sc)->sc_lock, #_name"_sc", "network softc lock", MTX_DEF) #define XN_RX_LOCK(_sc) mtx_lock(&(_sc)->rx_lock) #define XN_RX_UNLOCK(_sc) mtx_unlock(&(_sc)->rx_lock) @@ -282,15 +281,15 @@ struct netfront_info { #define XN_TX_LOCK(_sc) mtx_lock(&(_sc)->tx_lock) #define XN_TX_UNLOCK(_sc) mtx_unlock(&(_sc)->tx_lock) -#define XN_LOCK(_sc) sx_xlock(&(_sc)->sc_lock); -#define XN_UNLOCK(_sc) sx_xunlock(&(_sc)->sc_lock); +#define XN_LOCK(_sc) mtx_lock(&(_sc)->sc_lock); +#define XN_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_lock); -#define XN_LOCK_ASSERT(_sc) sx_assert(&(_sc)->sc_lock, SX_LOCKED); +#define XN_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_lock, MA_OWNED); #define XN_RX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->rx_lock, MA_OWNED); #define XN_TX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->tx_lock, MA_OWNED); #define XN_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->rx_lock); \ mtx_destroy(&(_sc)->tx_lock); \ - sx_destroy(&(_sc)->sc_lock); + mtx_destroy(&(_sc)->sc_lock); struct netfront_rx_info { struct netif_rx_response rx; @@ -1813,7 +1812,6 @@ network_connect(struct netfront_info *np np->copying_receiver = ((MODPARM_rx_copy && feature_rx_copy) || (MODPARM_rx_flip && !feature_rx_flip)); - XN_LOCK(np); /* Recovery procedure: */ error = talk_to_backend(np->xbdev, np); if (error) @@ -1822,6 +1820,7 @@ network_connect(struct netfront_info *np /* Step 1: Reinitialise variables. */ netif_release_tx_bufs(np); + XN_LOCK(np); /* Step 2: Rebuild the RX buffer freelist and the RX ring itself. */ for (requeue_idx = 0, i = 0; i < NET_RX_RING_SIZE; i++) { struct mbuf *m;