svn commit: r239206 - head/lib/libthr/thread
Author: davidxu Date: Sun Aug 12 00:56:56 2012 New Revision: 239206 URL: http://svn.freebsd.org/changeset/base/239206 Log: Do defered mutex wakeup once. Modified: head/lib/libthr/thread/thr_cond.c Modified: head/lib/libthr/thread/thr_cond.c == --- head/lib/libthr/thread/thr_cond.c Sun Aug 12 00:46:15 2012 (r239205) +++ head/lib/libthr/thread/thr_cond.c Sun Aug 12 00:56:56 2012 (r239206) @@ -239,6 +239,7 @@ cond_wait_user(struct pthread_cond *cvp, _thr_clear_wake(curthread); _sleepq_unlock(cvp); if (defered) { + defered = 0; if ((mp->m_lock.m_owner & UMUTEX_CONTESTED) == 0) (void)_umtx_op_err(&mp->m_lock, UMTX_OP_MUTEX_WAKE2, mp->m_lock.m_flags, 0, 0); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239205 - head/sys/dev/ath
Author: adrian Date: Sun Aug 12 00:46:15 2012 New Revision: 239205 URL: http://svn.freebsd.org/changeset/base/239205 Log: Revert the ath_tx_draintxq() method, and instead teach it the minimum necessary to "do" EDMA. It was just using the TX completion status for logging information about the descriptor completion. Since with EDMA we don't know this without checking the TX completion FIFO, we can't provide this information. So don't. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_misc.h head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_ath_tx.h head/sys/dev/ath/if_ath_tx_edma.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c == --- head/sys/dev/ath/if_ath.c Sun Aug 12 00:37:29 2012(r239204) +++ head/sys/dev/ath/if_ath.c Sun Aug 12 00:46:15 2012(r239205) @@ -3987,7 +3987,7 @@ ath_tx_freebuf(struct ath_softc *sc, str } void -ath_legacy_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq) +ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq) { #ifdef ATH_DEBUG struct ath_hal *ah = sc->sc_ah; @@ -4013,6 +4013,17 @@ ath_legacy_tx_draintxq(struct ath_softc bf = TAILQ_FIRST(&txq->axq_q); if (bf == NULL) { txq->axq_link = NULL; + /* +* There's currently no flag that indicates +* a buffer is on the FIFO. So until that +* occurs, just clear the FIFO counter here. +* +* Yes, this means that if something in parallel +* is pushing things onto this TXQ and pushing +* _that_ into the hardware, things will get +* very fruity very quickly. +*/ + txq->axq_fifo_depth = 0; ATH_TXQ_UNLOCK(txq); break; } @@ -4022,10 +4033,20 @@ ath_legacy_tx_draintxq(struct ath_softc #ifdef ATH_DEBUG if (sc->sc_debug & ATH_DEBUG_RESET) { struct ieee80211com *ic = sc->sc_ifp->if_l2com; + int status = 0; - ath_printtxbuf(sc, bf, txq->axq_qnum, ix, - ath_hal_txprocdesc(ah, bf->bf_lastds, + /* +* EDMA operation has a TX completion FIFO +* separate from the TX descriptor, so this +* method of checking the "completion" status +* is wrong. +*/ + if (! sc->sc_isedma) { + status = (ath_hal_txprocdesc(ah, + bf->bf_lastds, &bf->bf_status.ds_txstat) == HAL_OK); + } + ath_printtxbuf(sc, bf, txq->axq_qnum, ix, status); ieee80211_dump_pkt(ic, mtod(bf->bf_m, const uint8_t *), bf->bf_m->m_len, 0, -1); } Modified: head/sys/dev/ath/if_ath_misc.h == --- head/sys/dev/ath/if_ath_misc.h Sun Aug 12 00:37:29 2012 (r239204) +++ head/sys/dev/ath/if_ath_misc.h Sun Aug 12 00:46:15 2012 (r239205) @@ -97,7 +97,8 @@ externvoid ath_descdma_cleanup(struct a extern void ath_legacy_attach_comp_func(struct ath_softc *sc); -extern void ath_legacy_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq); +extern void ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq); + extern void ath_legacy_tx_drain(struct ath_softc *sc, ATH_RESET_TYPE reset_type); Modified: head/sys/dev/ath/if_ath_tx.c == --- head/sys/dev/ath/if_ath_tx.cSun Aug 12 00:37:29 2012 (r239204) +++ head/sys/dev/ath/if_ath_tx.cSun Aug 12 00:46:15 2012 (r239205) @@ -4572,6 +4572,5 @@ ath_xmit_setup_legacy(struct ath_softc * sc->sc_tx.xmit_dma_restart = ath_legacy_tx_dma_restart; sc->sc_tx.xmit_handoff = ath_legacy_xmit_handoff; - sc->sc_tx.xmit_drainq = ath_legacy_tx_draintxq; sc->sc_tx.xmit_drain = ath_legacy_tx_drain; } Modified: head/sys/dev/ath/if_ath_tx.h == --- head/sys/dev/ath/if_ath_tx.hSun Aug 12 00:37:29 2012 (r239204) +++ head/sys/dev/ath/if_ath_tx.hSun Aug 12 00:46:15 2012 (r239205) @@ -134,9 +134,6 @@ extern void ath_addba_response_timeout(s (_sc)->sc_tx.xmit_dma_restart((_sc), (_txq)) #defineath_tx_handoff(_sc, _txq, _bf) \ (_sc)->sc_tx.xmit_handoff((_sc),
svn commit: r239204 - head/sys/dev/ath
Author: adrian Date: Sun Aug 12 00:37:29 2012 New Revision: 239204 URL: http://svn.freebsd.org/changeset/base/239204 Log: Break out ath_draintxq() into a method and un-methodize ath_tx_processq(). Now that I understand what's going on with this, I've realised that it's going to be quite difficult to implement a processq method in the EDMA case. Because there's a separate TX status FIFO, I can't just run processq() on each EDMA TXQ to see what's finished. i have to actually run the TX status queue and handle individual TXQs. So: * unmethodize ath_tx_processq(); * leave ath_tx_draintxq() as a method, as it only uses the completion status for debugging rather than actively completing the frames (ie, all frames here are failed); * Methodize ath_draintxq(). The EDMA ath_draintxq() will have to take care of running the TX completion FIFO before (potentially) freeing frames in the queue. The only two places where ath_tx_draintxq() (on a single TXQ) are used: * ath_draintxq(); and * the CABQ handling in the beacon setup code - it drains the CABQ before populating the CABQ with frames for a new beacon (when doing multi-VAP operation.) So it's quite possible that once I methodize the CABQ and beacon handling, I can just drop ath_tx_draintxq() in its entirety. Finally, it's also quite possible that I can remove ath_tx_draintxq() in the future and just "teach" it to not check the status when doing EDMA. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_misc.h head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_ath_tx.h head/sys/dev/ath/if_ath_tx_edma.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c == --- head/sys/dev/ath/if_ath.c Sun Aug 12 00:25:35 2012(r239203) +++ head/sys/dev/ath/if_ath.c Sun Aug 12 00:37:29 2012(r239204) @@ -168,12 +168,13 @@ static struct ath_txq *ath_txq_setup(str static int ath_tx_setup(struct ath_softc *, int, int); static voidath_tx_cleanupq(struct ath_softc *, struct ath_txq *); static voidath_tx_cleanup(struct ath_softc *); +static int ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq, + int dosched); static voidath_tx_proc_q0(void *, int); static voidath_tx_proc_q0123(void *, int); static voidath_tx_proc(void *, int); static voidath_txq_sched_tasklet(void *, int); static int ath_chan_set(struct ath_softc *, struct ieee80211_channel *); -static voidath_draintxq(struct ath_softc *, ATH_RESET_TYPE reset_type); static voidath_chan_change(struct ath_softc *, struct ieee80211_channel *); static voidath_scan_start(struct ieee80211com *); static voidath_scan_end(struct ieee80211com *); @@ -3585,8 +3586,8 @@ ath_tx_update_busy(struct ath_softc *sc) * Kick the packet scheduler if needed. This can occur from this * particular task. */ -int -ath_legacy_tx_processq(struct ath_softc *sc, struct ath_txq *txq, int dosched) +static int +ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq, int dosched) { struct ath_hal *ah = sc->sc_ah; struct ath_buf *bf; @@ -4093,8 +4094,8 @@ ath_stoptxdma(struct ath_softc *sc) /* * Drain the transmit queues and reclaim resources. */ -static void -ath_draintxq(struct ath_softc *sc, ATH_RESET_TYPE reset_type) +void +ath_legacy_tx_drain(struct ath_softc *sc, ATH_RESET_TYPE reset_type) { #ifdef ATH_DEBUG struct ath_hal *ah = sc->sc_ah; Modified: head/sys/dev/ath/if_ath_misc.h == --- head/sys/dev/ath/if_ath_misc.h Sun Aug 12 00:25:35 2012 (r239203) +++ head/sys/dev/ath/if_ath_misc.h Sun Aug 12 00:37:29 2012 (r239204) @@ -96,9 +96,10 @@ extern void ath_descdma_cleanup(struct a struct ath_descdma *dd, ath_bufhead *head); extern void ath_legacy_attach_comp_func(struct ath_softc *sc); + extern void ath_legacy_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq); -extern int ath_legacy_tx_processq(struct ath_softc *sc, struct ath_txq *txq, - int dosched); +extern void ath_legacy_tx_drain(struct ath_softc *sc, + ATH_RESET_TYPE reset_type); /* * This is only here so that the RX proc function can call it. Modified: head/sys/dev/ath/if_ath_tx.c == --- head/sys/dev/ath/if_ath_tx.cSun Aug 12 00:25:35 2012 (r239203) +++ head/sys/dev/ath/if_ath_tx.cSun Aug 12 00:37:29 2012 (r239204) @@ -4571,6 +4571,7 @@ ath_xmit_setup_legacy(struct ath_softc * sc->sc_tx.xmit_dma_restart = ath_legacy_tx_dma_restart; sc->sc_tx.xmit_handoff = ath_legacy_xmit_handoff; - sc->sc_tx.xmit_processq = ath_legacy_tx_processq; + sc->sc_tx.xmit_drainq = ath_legacy_tx_draintxq; +
svn commit: r239202 - head/sys/kern
Author: davidxu Date: Sat Aug 11 23:48:39 2012 New Revision: 239202 URL: http://svn.freebsd.org/changeset/base/239202 Log: Some style fixes inspired by @bde. Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c == --- head/sys/kern/kern_umtx.c Sat Aug 11 23:26:19 2012(r239201) +++ head/sys/kern/kern_umtx.c Sat Aug 11 23:48:39 2012(r239202) @@ -587,7 +587,7 @@ abs_timeout_init2(struct abs_timeout *ti &umtxtime->_timeout); } -static void +static inline void abs_timeout_update(struct abs_timeout *timo) { kern_clock_gettime(curthread, timo->clockid, &timo->cur); @@ -598,10 +598,10 @@ abs_timeout_gethz(struct abs_timeout *ti { struct timespec tts; + if (timespeccmp(&timo->end, &timo->cur, <=)) + return (-1); tts = timo->end; timespecsub(&tts, &timo->cur); - if (tts.tv_sec < 0 || (tts.tv_sec == 0 && tts.tv_nsec == 0)) - return (-1); return (tstohz(&tts)); } @@ -610,29 +610,29 @@ abs_timeout_gethz(struct abs_timeout *ti * thread was removed from umtx queue. */ static inline int -umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *timo) +umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *abstime) { struct umtxq_chain *uc; - int error; - int pulse; + int error, timo; uc = umtxq_getchain(&uq->uq_key); UMTXQ_LOCKED_ASSERT(uc); for (;;) { if (!(uq->uq_flags & UQF_UMTXQ)) return (0); - if (timo != NULL) { - pulse = abs_timeout_gethz(timo); - if (pulse < 0) + if (abstime != NULL) { + timo = abs_timeout_gethz(abstime); + if (timo < 0) return (ETIMEDOUT); } else - pulse = 0; - error = msleep(uq, &uc->uc_lock, PCATCH|PDROP, wmesg, pulse); + timo = 0; + error = msleep(uq, &uc->uc_lock, PCATCH | PDROP, wmesg, timo); if (error != EWOULDBLOCK) { umtxq_lock(&uq->uq_key); break; } - abs_timeout_update(timo); + if (abstime != NULL) + abs_timeout_update(abstime); umtxq_lock(&uq->uq_key); } return (error); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239201 - head/sys/dev/ath
Author: adrian Date: Sat Aug 11 23:26:19 2012 New Revision: 239201 URL: http://svn.freebsd.org/changeset/base/239201 Log: Extend the beacon code slightly to support AP mode beaconing for the EDMA HAL hardware. * The EDMA HAL code assumes the nexttbtt and intval values are in TU/8 units, rather than TU. For now, just "hack" around that here, at least until I code up something to translate it in the HAL. * Setup some different TXQ flags for EDMA hardware. * The EDMA HAL doesn't support setting the first rate series via ath_hal_setuptxdesc() - instead, a call to ath_hal_set11nratescenario() is always required. So for now, just do an 11n rate series setup for EDMA beacon frames. This allows my AR9380 to successfully transmit beacon frames. However, CABQ TX and all normal data frame TX and TX completion is still not functional and will require some more significant code churn to make work. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_beacon.c head/sys/dev/ath/if_ath_beacon.h Modified: head/sys/dev/ath/if_ath.c == --- head/sys/dev/ath/if_ath.c Sat Aug 11 23:17:02 2012(r239200) +++ head/sys/dev/ath/if_ath.c Sat Aug 11 23:26:19 2012(r239201) @@ -443,7 +443,7 @@ ath_attach(u_int16_t devid, struct ath_s * * XXX PS-Poll */ - sc->sc_bhalq = ath_beaconq_setup(ah); + sc->sc_bhalq = ath_beaconq_setup(sc); if (sc->sc_bhalq == (u_int) -1) { if_printf(ifp, "unable to setup a beacon xmit queue!\n"); error = EIO; Modified: head/sys/dev/ath/if_ath_beacon.c == --- head/sys/dev/ath/if_ath_beacon.cSat Aug 11 23:17:02 2012 (r239200) +++ head/sys/dev/ath/if_ath_beacon.cSat Aug 11 23:26:19 2012 (r239201) @@ -108,8 +108,9 @@ __FBSDID("$FreeBSD$"); * Setup a h/w transmit queue for beacons. */ int -ath_beaconq_setup(struct ath_hal *ah) +ath_beaconq_setup(struct ath_softc *sc) { + struct ath_hal *ah = sc->sc_ah; HAL_TXQ_INFO qi; memset(&qi, 0, sizeof(qi)); @@ -118,6 +119,10 @@ ath_beaconq_setup(struct ath_hal *ah) qi.tqi_cwmax = HAL_TXQ_USEDEFAULT; /* NB: for dynamic turbo, don't enable any other interrupts */ qi.tqi_qflags = HAL_TXQ_TXDESCINT_ENABLE; + if (sc->sc_isedma) + qi.tqi_qflags |= HAL_TXQ_TXOKINT_ENABLE | + HAL_TXQ_TXERRINT_ENABLE; + return ath_hal_setuptxqueue(ah, HAL_TX_QUEUE_BEACON, &qi); } @@ -268,6 +273,7 @@ ath_beacon_setup(struct ath_softc *sc, s u_int8_t rix, rate; HAL_DMA_ADDR bufAddrList[4]; uint32_t segLenList[4]; + HAL_11N_RATE_SERIES rc[4]; DPRINTF(sc, ATH_DEBUG_BEACON_PROC, "%s: m %p len %u\n", __func__, m, m->m_len); @@ -324,6 +330,26 @@ ath_beacon_setup(struct ath_softc *sc, s , 0 /* rts/cts rate */ , 0 /* rts/cts duration */ ); + + /* +* The EDMA HAL currently assumes that _all_ rate control +* settings are done in ath_hal_set11nratescenario(), rather +* than in ath_hal_setuptxdesc(). +*/ + if (sc->sc_isedma) { + memset(&rc, 0, sizeof(rc)); + + rc[0].ChSel = sc->sc_txchainmask; + rc[0].Tries = 1; + rc[0].Rate = rt->info[rix].rateCode; + rc[0].RateIndex = rix; + rc[0].tx_power_cap = 0x3f; + rc[0].PktDuration = + ath_hal_computetxtime(ah, rt, roundup(m->m_len, 4), + rix, 0); + ath_hal_set11nratescenario(ah, ds, 0, 0, rc, 4, flags); + } + /* NB: beacon's BufLen must be a multiple of 4 bytes */ segLenList[0] = roundup(m->m_len, 4); segLenList[1] = segLenList[2] = segLenList[3] = 0; @@ -458,12 +484,15 @@ ath_beacon_proc(void *arg, int pending) * This should never fail since we check above that no frames * are still pending on the queue. */ - if (!ath_hal_stoptxdma(ah, sc->sc_bhalq)) { - DPRINTF(sc, ATH_DEBUG_ANY, - "%s: beacon queue %u did not stop?\n", - __func__, sc->sc_bhalq); + if (! sc->sc_isedma) { + if (!ath_hal_stoptxdma(ah, sc->sc_bhalq)) { + DPRINTF(sc, ATH_DEBUG_ANY, + "%s: beacon queue %u did not stop?\n", + __func__, sc->sc_bhalq); + } } /* NB: cabq traffic should already be queued and primed */ + ath_hal_puttxbuf(ah, sc->sc_bhalq, bfad
svn commit: r239200 - head/lib/libthr/thread
Author: davidxu Date: Sat Aug 11 23:17:02 2012 New Revision: 239200 URL: http://svn.freebsd.org/changeset/base/239200 Log: MFp4: Further decreases unexpected context switches by defering mutex wakeup until internal sleep queue lock is released. Modified: head/lib/libthr/thread/thr_cond.c head/lib/libthr/thread/thr_kern.c head/lib/libthr/thread/thr_mutex.c head/lib/libthr/thread/thr_private.h head/lib/libthr/thread/thr_umtx.h Modified: head/lib/libthr/thread/thr_cond.c == --- head/lib/libthr/thread/thr_cond.c Sat Aug 11 22:39:27 2012 (r239199) +++ head/lib/libthr/thread/thr_cond.c Sat Aug 11 23:17:02 2012 (r239200) @@ -217,6 +217,7 @@ cond_wait_user(struct pthread_cond *cvp, struct sleepqueue *sq; int recurse; int error; + int defered; if (curthread->wchan != NULL) PANIC("thread was already on queue."); @@ -230,13 +231,23 @@ cond_wait_user(struct pthread_cond *cvp, * us to check it without locking in pthread_cond_signal(). */ cvp->__has_user_waiters = 1; - curthread->will_sleep = 1; - (void)_mutex_cv_unlock(mp, &recurse); + defered = 0; + (void)_mutex_cv_unlock(mp, &recurse, &defered); curthread->mutex_obj = mp; _sleepq_add(cvp, curthread); for(;;) { _thr_clear_wake(curthread); _sleepq_unlock(cvp); + if (defered) { + if ((mp->m_lock.m_owner & UMUTEX_CONTESTED) == 0) + (void)_umtx_op_err(&mp->m_lock, UMTX_OP_MUTEX_WAKE2, +mp->m_lock.m_flags, 0, 0); + } + if (curthread->nwaiter_defer > 0) { + _thr_wake_all(curthread->defer_waiters, + curthread->nwaiter_defer); + curthread->nwaiter_defer = 0; + } if (cancel) { _thr_cancel_enter2(curthread, 0); Modified: head/lib/libthr/thread/thr_kern.c == --- head/lib/libthr/thread/thr_kern.c Sat Aug 11 22:39:27 2012 (r239199) +++ head/lib/libthr/thread/thr_kern.c Sat Aug 11 23:17:02 2012 (r239200) @@ -199,13 +199,6 @@ _thr_sleep(struct pthread *curthread, in const struct timespec *abstime) { - curthread->will_sleep = 0; - if (curthread->nwaiter_defer > 0) { - _thr_wake_all(curthread->defer_waiters, - curthread->nwaiter_defer); - curthread->nwaiter_defer = 0; - } - if (curthread->wake_addr->value != 0) return (0); Modified: head/lib/libthr/thread/thr_mutex.c == --- head/lib/libthr/thread/thr_mutex.c Sat Aug 11 22:39:27 2012 (r239199) +++ head/lib/libthr/thread/thr_mutex.c Sat Aug 11 23:17:02 2012 (r239200) @@ -92,7 +92,7 @@ int __pthread_mutex_setyieldloops_np(pth static int mutex_self_trylock(pthread_mutex_t); static int mutex_self_lock(pthread_mutex_t, const struct timespec *abstime); -static int mutex_unlock_common(struct pthread_mutex *, int); +static int mutex_unlock_common(struct pthread_mutex *, int, int *); static int mutex_lock_sleep(struct pthread *, pthread_mutex_t, const struct timespec *); @@ -461,7 +461,7 @@ _pthread_mutex_unlock(pthread_mutex_t *m struct pthread_mutex *mp; mp = *mutex; - return (mutex_unlock_common(mp, 0)); + return (mutex_unlock_common(mp, 0, NULL)); } int @@ -476,7 +476,7 @@ _mutex_cv_lock(struct pthread_mutex *m, } int -_mutex_cv_unlock(struct pthread_mutex *m, int *count) +_mutex_cv_unlock(struct pthread_mutex *m, int *count, int *defer) { /* @@ -484,7 +484,7 @@ _mutex_cv_unlock(struct pthread_mutex *m */ *count = m->m_count; m->m_count = 0; - (void)mutex_unlock_common(m, 1); + (void)mutex_unlock_common(m, 1, defer); return (0); } @@ -629,7 +629,7 @@ mutex_self_lock(struct pthread_mutex *m, } static int -mutex_unlock_common(struct pthread_mutex *m, int cv) +mutex_unlock_common(struct pthread_mutex *m, int cv, int *mtx_defer) { struct pthread *curthread = _get_curthread(); uint32_t id; @@ -657,12 +657,12 @@ mutex_unlock_common(struct pthread_mutex defered = 1; m->m_flags &= ~PMUTEX_FLAG_DEFERED; } else - defered = 0; + defered = 0; DEQUEUE_MUTEX(curthread, m); - _thr_umutex_unlock(&m->m_lock, id); + _thr_umutex_unlock2(&m->m_lock, id, mtx_defer);
svn commit: r239199 - head/sys/dev/ath
Author: adrian Date: Sat Aug 11 22:39:27 2012 New Revision: 239199 URL: http://svn.freebsd.org/changeset/base/239199 Log: Add the AR9380 HAL to the TX descriptor debugging, in order to dump all of the descriptor contents. Modified: head/sys/dev/ath/if_ath_debug.c Modified: head/sys/dev/ath/if_ath_debug.c == --- head/sys/dev/ath/if_ath_debug.c Sat Aug 11 22:25:28 2012 (r239198) +++ head/sys/dev/ath/if_ath_debug.c Sat Aug 11 22:39:27 2012 (r239199) @@ -158,7 +158,8 @@ ath_printtxbuf(struct ath_softc *sc, con ds->ds_ctl0, ds->ds_ctl1, ds->ds_hw[0], ds->ds_hw[1], ds->ds_hw[2], ds->ds_hw[3]); - if (ah->ah_magic == 0x20065416) { + if (ah->ah_magic == 0x20065416 || + ah->ah_magic == 0x19741014) { printf("%08x %08x %08x %08x %08x %08x %08x %08x\n", ds->ds_hw[4], ds->ds_hw[5], ds->ds_hw[6], ds->ds_hw[7], ds->ds_hw[8], ds->ds_hw[9], ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239198 - head/sys/dev/ath
Author: adrian Date: Sat Aug 11 22:25:28 2012 New Revision: 239198 URL: http://svn.freebsd.org/changeset/base/239198 Log: Add the AR9300 HAL ID in to the 11n check routine. I was having TX hang issues, which I root caused to having the legacy ath_hal_setupxtxdesc() called, rather than the 11n rate scenario setup code. This meant that rate control information wasn't being put into frames, causing the MAC to stall/hang. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c == --- head/sys/dev/ath/if_ath_tx.cSat Aug 11 22:20:28 2012 (r239197) +++ head/sys/dev/ath/if_ath_tx.cSat Aug 11 22:25:28 2012 (r239198) @@ -120,7 +120,8 @@ static int ath_tx_action_frame_override_ static inline int ath_tx_is_11n(struct ath_softc *sc) { - return (sc->sc_ah->ah_magic == 0x20065416); + return ((sc->sc_ah->ah_magic == 0x20065416) || + (sc->sc_ah->ah_magic == 0x19741014)); } /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239197 - head/sys/dev/ath
Author: adrian Date: Sat Aug 11 22:20:28 2012 New Revision: 239197 URL: http://svn.freebsd.org/changeset/base/239197 Log: Begin fleshing out the TX FIFO support. * Add ATH_TXQ_FIRST() for easy tasting of what's on the list; * Add an "axq_fifo_depth" for easy tracking of how deep the current FIFO is; * Flesh out the handoff (mcast, hw) functions; * Begin fleshing out a TX ISR proc, which tastes the TX status FIFO. The legacy hardware stuffs the TX completion at the end of the final frame descriptor (or final sub-frame when doing aggregate.) So it's feasible to do a per-TXQ drain and process, as the needed info is right there. For EDMA hardware, there's a separate TX completion FIFO. So the TX process routine needs to read the single FIFO and then process the frames in each hardware queue. This makes it difficult to do a per-queue process, as you'll end up with frames in the TX completion FIFO for a different TXQ to the one you've passed to ath_tx_draintxq() or ath_tx_processq(). Testing: I've tested the TX queue and TX completion code in hostap mode on an AR9380. Beacon frames successfully transmit and the completion routine is called. Occasional data frames end up in TXQ 1 and are also successfully completed. However, this requires some changes to the beacon code path as: * The AR9380 beacon configuration API is now in TU/8, rather than TU; * The AR9380 TX API requires the rate control is setup using a call to setup11nratescenario, rather than having the try0 series setup (rate/tries for the first series); so the beacon won't go out. I'll follow this up with commits to the beacon code. Modified: head/sys/dev/ath/if_ath_tx_edma.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath_tx_edma.c == --- head/sys/dev/ath/if_ath_tx_edma.c Sat Aug 11 20:24:39 2012 (r239196) +++ head/sys/dev/ath/if_ath_tx_edma.c Sat Aug 11 22:20:28 2012 (r239197) @@ -132,7 +132,7 @@ MALLOC_DECLARE(M_ATHDEV); /* * Re-initialise the DMA FIFO with the current contents of - * said FIFO. + * said TXQ. * * This should only be called as part of the chip reset path, as it * assumes the FIFO is currently empty. @@ -152,6 +152,90 @@ ath_edma_dma_restart(struct ath_softc *s } /* + * Hand off this frame to a hardware queue. + * + * Things are a bit hairy in the EDMA world. The TX FIFO is only + * 8 entries deep, so we need to keep track of exactly what we've + * pushed into the FIFO and what's just sitting in the TX queue, + * waiting to go out. + * + * So this is split into two halves - frames get appended to the + * TXQ; then a scheduler is called to push some frames into the + * actual TX FIFO. + */ +static void +ath_edma_xmit_handoff_hw(struct ath_softc *sc, struct ath_txq *txq, +struct ath_buf *bf) +{ + struct ath_hal *ah = sc->sc_ah; + + ATH_TXQ_LOCK_ASSERT(txq); + + KASSERT((bf->bf_flags & ATH_BUF_BUSY) == 0, + ("%s: busy status 0x%x", __func__, bf->bf_flags)); + + /* +* XXX TODO: write a hard-coded check to ensure that +* the queue id in the TX descriptor matches txq->axq_qnum. +*/ + + /* Update aggr stats */ + if (bf->bf_state.bfs_aggr) + txq->axq_aggr_depth++; + + /* Push and update frame stats */ + ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); + + /* Only schedule to the FIFO if there's space */ + if (txq->axq_fifo_depth < HAL_TXFIFO_DEPTH) { + ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); + ath_hal_txstart(ah, txq->axq_qnum); + } +} + +/* + * Hand off this frame to a multicast software queue. + * + * Unlike legacy DMA, this doesn't chain together frames via the + * link pointer. Instead, they're just added to the queue. + * When it comes time to populate the CABQ, these frames should + * be individually pushed into the FIFO as appropriate. + * + * Yes, this does mean that I'll eventually have to flesh out some + * replacement code to handle populating the CABQ, rather than + * what's done in ath_beacon_generate(). It'll have to push each + * frame from the HW CABQ to the FIFO rather than just appending + * it to the existing TXQ and kicking off DMA. + */ +static void +ath_edma_xmit_handoff_mcast(struct ath_softc *sc, struct ath_txq *txq, +struct ath_buf *bf) +{ + + ATH_TXQ_LOCK_ASSERT(txq); + KASSERT((bf->bf_flags & ATH_BUF_BUSY) == 0, + ("%s: busy status 0x%x", __func__, bf->bf_flags)); + + /* +* XXX this is mostly duplicated in ath_tx_handoff_mcast(). +*/ + if (ATH_TXQ_FIRST(txq) != NULL) { + struct ath_buf *bf_last = ATH_TXQ_LAST(txq, axq_q_s); + struct ieee80211_frame *wh; + + /* mark previous frame */ + wh = mtod(bf_last->bf_m, struct ieee80211_frame *); +
svn commit: r239196 - head/sys/kern
Author: mav Date: Sat Aug 11 20:24:39 2012 New Revision: 239196 URL: http://svn.freebsd.org/changeset/base/239196 Log: Some more minor tunings inspired by bde@. Modified: head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_4bsd.c == --- head/sys/kern/sched_4bsd.c Sat Aug 11 15:47:22 2012(r239195) +++ head/sys/kern/sched_4bsd.c Sat Aug 11 20:24:39 2012(r239196) @@ -193,12 +193,13 @@ sysctl_kern_quantum(SYSCTL_HANDLER_ARGS) period = 100 / realstathz; new_val = period * sched_slice; error = sysctl_handle_int(oidp, &new_val, 0, req); -if (error != 0 || req->newptr == NULL) + if (error != 0 || req->newptr == NULL) return (error); if (new_val <= 0) return (EINVAL); - sched_slice = max(1, (new_val + period / 2) / period); - hogticks = max(1, 2 * hz * sched_slice / realstathz); + sched_slice = imax(1, (new_val + period / 2) / period); + hogticks = imax(1, (2 * hz * sched_slice + realstathz / 2) / + realstathz); return (0); } @@ -208,9 +209,9 @@ SYSCTL_STRING(_kern_sched, OID_AUTO, nam "Scheduler name"); SYSCTL_PROC(_kern_sched, OID_AUTO, quantum, CTLTYPE_INT | CTLFLAG_RW, NULL, 0, sysctl_kern_quantum, "I", -"Length of time granted to timeshare threads in microseconds"); +"Quantum for timeshare threads in microseconds"); SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, -"Length of time granted to timeshare threads in stathz ticks"); +"Quantum for timeshare threads in stathz ticks"); #ifdef SMP /* Enable forwarding of wakeups to all other cpus */ static SYSCTL_NODE(_kern_sched, OID_AUTO, ipiwakeup, CTLFLAG_RD, NULL, @@ -665,7 +666,8 @@ sched_initticks(void *dummy) realstathz = stathz ? stathz : hz; sched_slice = realstathz / 10; /* ~100ms */ - hogticks = max(1, 2 * hz * sched_slice / realstathz); + hogticks = imax(1, (2 * hz * sched_slice + realstathz / 2) / + realstathz); } /* External interfaces start here */ @@ -704,7 +706,7 @@ sched_rr_interval(void) { /* Convert sched_slice from stathz to hz. */ - return (max(1, (sched_slice * hz + realstathz / 2) / realstathz)); + return (imax(1, (sched_slice * hz + realstathz / 2) / realstathz)); } /* Modified: head/sys/kern/sched_ule.c == --- head/sys/kern/sched_ule.c Sat Aug 11 15:47:22 2012(r239195) +++ head/sys/kern/sched_ule.c Sat Aug 11 20:24:39 2012(r239196) @@ -1383,7 +1383,8 @@ sched_initticks(void *dummy) realstathz = stathz ? stathz : hz; sched_slice = realstathz / 10; /* ~100ms */ - hogticks = max(1, 2 * hz * sched_slice / realstathz); + hogticks = imax(1, (2 * hz * sched_slice + realstathz / 2) / + realstathz); /* * tickincr is shifted out by 10 to avoid rounding errors due to @@ -1406,7 +1407,7 @@ sched_initticks(void *dummy) affinity = SCHED_AFFINITY_DEFAULT; #endif if (sched_idlespinthresh < 0) - sched_idlespinthresh = max(16, 2 * hz / realstathz); + sched_idlespinthresh = imax(16, 2 * hz / realstathz); } @@ -1595,7 +1596,7 @@ sched_rr_interval(void) { /* Convert sched_slice from stathz to hz. */ - return (max(1, (sched_slice * hz + realstathz / 2) / realstathz)); + return (imax(1, (sched_slice * hz + realstathz / 2) / realstathz)); } /* @@ -2790,12 +2791,13 @@ sysctl_kern_quantum(SYSCTL_HANDLER_ARGS) period = 100 / realstathz; new_val = period * sched_slice; error = sysctl_handle_int(oidp, &new_val, 0, req); -if (error != 0 || req->newptr == NULL) + if (error != 0 || req->newptr == NULL) return (error); if (new_val <= 0) return (EINVAL); - sched_slice = max(1, (new_val + period / 2) / period); - hogticks = max(1, 2 * hz * sched_slice / realstathz); + sched_slice = imax(1, (new_val + period / 2) / period); + hogticks = imax(1, (2 * hz * sched_slice + realstathz / 2) / + realstathz); return (0); } @@ -2804,19 +2806,21 @@ SYSCTL_STRING(_kern_sched, OID_AUTO, nam "Scheduler name"); SYSCTL_PROC(_kern_sched, OID_AUTO, quantum, CTLTYPE_INT | CTLFLAG_RW, NULL, 0, sysctl_kern_quantum, "I", -"Length of time granted to timeshare threads in microseconds"); +"Quantum for timeshare threads in microseconds"); SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, -"Length of time granted to timeshare threads in stathz ticks"); +"Quantum for timeshare threads in stathz ticks"); SYSCTL_INT(_kern_sched, OID_AUTO, interact, CTLFLAG_RW, &sched_interact, 0, - "Interactivity score threshold"); -SYSCTL_
svn commit: r239195 - head/lib/msun/src
Author: dim Date: Sat Aug 11 15:47:22 2012 New Revision: 239195 URL: http://svn.freebsd.org/changeset/base/239195 Log: Add __always_inline to __ieee754_rem_pio2() and __ieee754_rem_pio2f(), since some older versions of gcc refuse to inline these otherwise. Requested by: bde MFC after:1 week Modified: head/lib/msun/src/e_rem_pio2.c head/lib/msun/src/e_rem_pio2f.c Modified: head/lib/msun/src/e_rem_pio2.c == --- head/lib/msun/src/e_rem_pio2.c Sat Aug 11 15:08:19 2012 (r239194) +++ head/lib/msun/src/e_rem_pio2.c Sat Aug 11 15:47:22 2012 (r239195) @@ -49,7 +49,7 @@ pio2_3 = 2.02226624871116645580e-21, / pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ #ifdef INLINE_REM_PIO2 -static __inline +static __inline __always_inline #endif int __ieee754_rem_pio2(double x, double *y) Modified: head/lib/msun/src/e_rem_pio2f.c == --- head/lib/msun/src/e_rem_pio2f.c Sat Aug 11 15:08:19 2012 (r239194) +++ head/lib/msun/src/e_rem_pio2f.c Sat Aug 11 15:47:22 2012 (r239195) @@ -41,7 +41,7 @@ pio2_1 = 1.57079631090164184570e+00, / pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */ #ifdef INLINE_REM_PIO2F -static __inline +static __inline __always_inline #endif int __ieee754_rem_pio2f(float x, double *y) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r239066 - head/sys/boot/i386/libi386
On 2012-08-05 16:37, Andrey V. Elsukov wrote:> Author: ae Date: Sun Aug 5 14:37:48 2012 New Revision: 239066 URL: http://svn.freebsd.org/changeset/base/239066 Log: Add offset field to the i386_devdesc structure to be compatible with disk_devdesc structure. Update biosdisk driver to the new disk API. Modified: head/sys/boot/i386/libi386/Makefile head/sys/boot/i386/libi386/biosdisk.c head/sys/boot/i386/libi386/devicename.c head/sys/boot/i386/libi386/libi386.h Though I still don't understand how, this breaks loader(8) for me. When I build a loader from this revision, I get the following at boot: /boot/config: -D -S115200 FreeBSD/x86 boot Default: 0:da(0,a)/boot/loader boot: 0:da(0,a)/boot/loader.testConsoles: internal video/keyboard serial port BIOS drive A: is disk0 BIOS drive C: is disk1 BIOS 638kB/1046464kB available memory FreeBSD/x86 bootstrap loader, Revision 1.1 (d...@vm-dvs-dimtest1.home.andric.com, Sat Aug 11 17:14:02 CEST 2012) can't load 'kernel' Type '?' for a list of commands, 'help' for more detailed help. OK ls open '/' failed: no such file or directory OK lsdev cd devices: disk devices: disk0: BIOS drive A: disk1: BIOS drive C: disk1a: FreeBSD UFS disk1b: FreeBSD swap pxe devices: OK reboot Rebooting... Building a loader from r239065 works just fine: /boot/config: -D -S115200 FreeBSD/x86 boot Default: 0:da(0,a)/boot/loader boot: Consoles: internal video/keyboard serial port BIOS drive A: is disk0 BIOS drive C: is disk1 BIOS 638kB/1046464kB available memory FreeBSD/x86 bootstrap loader, Revision 1.1 (d...@vm-dvs-dimtest1.home.andric.com, Sun Aug 5 01:20:40 CEST 2012) Loading /boot/defaults/loader.conf /boot/kernel/kernel text=0xc02345 data=0x108378+0x21bad0 syms=[0x4+0xd7610+0x4+0x19e1a8] /boot/kernel/pty.ko text=0x920 data=0x1c8 syms=[0x4+0x3b0+0x4+0x350] /boot/kernel/vmmemctl.ko text=0x1cac data=0xfc+0xe4 syms=[0x4+0x5a0+0x4+0x557] \ Hit [Enter] to boot immediately, or any other key for command prompt. Type '?' for a list of commands, 'help' for more detailed help. OK lsdev cd devices: disk devices: disk0: BIOS drive A: disk1: BIOS drive C: disk1a: FFS disk1b: swap pxe devices: OK ls / d .snap d dev d etc d cdrom d dist d bin d boot d lib d libexec d media d mnt d proc d rescue d root d sbin d tmp d usr d var d home d share entropy l sys .cshrc boot.config l compat COPYRIGHT .profile .sujournal OK boot [...booting normally...] This is all in a VMware guest, with 'dangerously dedicated' disks, e.g. /dev/da0a is root, /dev/da0b is swap. Any idea where I should start looking? :) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r239193 - head/lib/libc/gen
On Sat, Aug 11, 2012 at 8:07 AM, Ed Schouten wrote: > On Windows, AUX is the auxiliary device, usually pointing to COM1. > Therefore it is forbidden to create a file named aux.c. To make it a bit > easier for Windows users to check out our source code, rename this file > to auxv.c. I have a long list of similar Windows problems which was probably originally compiled in the FreeBSD 4-FreeBSD 5 days. This prompted me to look again on HEAD, and I'm very happy to report that the vast majority of issues have been dealt with. The only one remaining is a pair of man pages whose names differ only by case (which works out really poorly on a case-insensitive fs): src/share/man/man9/vfs_mount.9 src/share/man/man9/VFS_MOUNT.9 (of course, new ones could have easily cropped up in the meantime). ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239194 - head/sys/kern
Author: mav Date: Sat Aug 11 15:08:19 2012 New Revision: 239194 URL: http://svn.freebsd.org/changeset/base/239194 Log: Allow idle threads to steal second threads from other cores on systems with 8 or more cores to improve utilization. None of my tests on 2xXeon (2x6x2) system shown any slowdown from mentioned "excess thrashing". Same time in pbzip2 test with number of threads more then number of CPUs I see up to 10% speedup with SMT disabled and up 5% with SMT enabled. Thinking about trashing I was trying to limit that stealing within same last level cache, but got only worse results. Present code any way prefers to steal threads from topologically closer cores. Sponsored by: iXsystems, Inc. Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c == --- head/sys/kern/sched_ule.c Sat Aug 11 12:07:24 2012(r239193) +++ head/sys/kern/sched_ule.c Sat Aug 11 15:08:19 2012(r239194) @@ -1403,12 +1403,6 @@ sched_initticks(void *dummy) * what realstathz is. */ balance_interval = realstathz; - /* -* Set steal thresh to roughly log2(mp_ncpu) but no greater than 4. -* This prevents excess thrashing on large machines and excess idle -* on smaller machines. -*/ - steal_thresh = min(fls(mp_ncpus) - 1, 3); affinity = SCHED_AFFINITY_DEFAULT; #endif if (sched_idlespinthresh < 0) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r239193 - head/lib/libc/gen
On Sat, 2012-08-11 at 09:30 -0500, Bryan Drewery wrote: > On 8/11/2012 7:07 AM, Ed Schouten wrote: > > Author: ed > > Date: Sat Aug 11 12:07:24 2012 > > New Revision: 239193 > > URL: http://svn.freebsd.org/changeset/base/239193 > > > > Log: > > Rename aux.c to auxv.c. > > > > On Windows, AUX is the auxiliary device, usually pointing to COM1. > > Therefore it is forbidden to create a file named aux.c. To make it a bit > > easier for Windows users to check out our source code, rename this file > > to auxv.c. > > FWIW, here's the entire list [1] to try to avoid: > > CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, > COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9 > > [1] http://msdn.microsoft.com/en-us/library/aa365247.aspx > > If we're worrying about such things (which I'm agnostic about), filenames ending in a dot are apparently also not allowed. When I turn a fresh checkout of -current into a mercurial repo I get these warnings: warning: filename contains 'aux', which is reserved on Windows: 'share/examples/libusb20/aux.c' warning: filename contains 'aux', which is reserved on Windows: 'share/examples/libusb20/aux.h' warning: filename ends with '.', which is not allowed on Windows: 'tools/test/sort/bigtest/q-1.024.003.' -- Ian ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r239193 - head/lib/libc/gen
On 8/11/2012 7:07 AM, Ed Schouten wrote: > Author: ed > Date: Sat Aug 11 12:07:24 2012 > New Revision: 239193 > URL: http://svn.freebsd.org/changeset/base/239193 > > Log: > Rename aux.c to auxv.c. > > On Windows, AUX is the auxiliary device, usually pointing to COM1. > Therefore it is forbidden to create a file named aux.c. To make it a bit > easier for Windows users to check out our source code, rename this file > to auxv.c. FWIW, here's the entire list [1] to try to avoid: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9 [1] http://msdn.microsoft.com/en-us/library/aa365247.aspx -- Regards, Bryan Drewery bdrewery@freenode/EFNet ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239193 - head/lib/libc/gen
Author: ed Date: Sat Aug 11 12:07:24 2012 New Revision: 239193 URL: http://svn.freebsd.org/changeset/base/239193 Log: Rename aux.c to auxv.c. On Windows, AUX is the auxiliary device, usually pointing to COM1. Therefore it is forbidden to create a file named aux.c. To make it a bit easier for Windows users to check out our source code, rename this file to auxv.c. MFC after:1 month Discussed with: kib Suggested by: Eric van Gyzen Added: head/lib/libc/gen/auxv.c - copied unchanged from r239192, head/lib/libc/gen/aux.c Deleted: head/lib/libc/gen/aux.c Modified: head/lib/libc/gen/Makefile.inc Modified: head/lib/libc/gen/Makefile.inc == --- head/lib/libc/gen/Makefile.inc Sat Aug 11 11:13:48 2012 (r239192) +++ head/lib/libc/gen/Makefile.inc Sat Aug 11 12:07:24 2012 (r239193) @@ -7,7 +7,7 @@ SRCS+= __getosreldate.c __xuname.c \ _once_stub.c _pthread_stubs.c _rand48.c _spinlock_stub.c \ _thread_init.c \ - alarm.c arc4random.c assert.c aux.c basename.c check_utility_compat.c \ + alarm.c arc4random.c assert.c auxv.c basename.c check_utility_compat.c \ clock.c closedir.c confstr.c \ crypt.c ctermid.c daemon.c devname.c dirfd.c dirname.c disklabel.c \ dlfcn.c drand48.c elf_utils.c erand48.c err.c errlst.c errno.c \ Copied: head/lib/libc/gen/auxv.c (from r239192, head/lib/libc/gen/aux.c) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/gen/auxv.cSat Aug 11 12:07:24 2012(r239193, copy of r239192, head/lib/libc/gen/aux.c) @@ -0,0 +1,186 @@ +/*- + * Copyright 2010, 2012 Konstantin Belousov . + * 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 ``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 "namespace.h" +#include +#include +#include +#include +#include +#include "un-namespace.h" +#include "libc_private.h" + +extern char **environ; +extern int _DYNAMIC; +#pragma weak _DYNAMIC + +void *__elf_aux_vector; +static pthread_once_t aux_vector_once = PTHREAD_ONCE_INIT; + +static void +init_aux_vector_once(void) +{ + Elf_Addr *sp; + + sp = (Elf_Addr *)environ; + while (*sp++ != 0) + ; + __elf_aux_vector = (Elf_Auxinfo *)sp; +} + +void +__init_elf_aux_vector(void) +{ + + if (&_DYNAMIC != NULL) + return; + _once(&aux_vector_once, init_aux_vector_once); +} + +static pthread_once_t aux_once = PTHREAD_ONCE_INIT; +static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; +static char *canary, *pagesizes; +static void *timekeep; + +static void +init_aux(void) +{ + Elf_Auxinfo *aux; + + for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) { + switch (aux->a_type) { + case AT_CANARY: + canary = (char *)(aux->a_un.a_ptr); + break; + + case AT_CANARYLEN: + canary_len = aux->a_un.a_val; + break; + + case AT_PAGESIZES: + pagesizes = (char *)(aux->a_un.a_ptr); + break; + + case AT_PAGESIZESLEN: + pagesizes_len = aux->a_un.a_val; + break; + + case AT_PAGESZ: + pagesize = aux->a_un.a_val; + break; + + case AT_OSRELDATE: + osreldate = aux->a_un.a_val; + break; + + case AT_NCPUS: + ncpus = aux->a_un.a_val; +
svn commit: r239192 - head/lib/msun/src
Author: dim Date: Sat Aug 11 11:13:48 2012 New Revision: 239192 URL: http://svn.freebsd.org/changeset/base/239192 Log: Change a few extern inline functions in libm to static inline, since they need to refer to static constants, which C99 does not allow for extern inline functions. While here, change a comment in e_rem_pio2f.c to mention the correct number of bits. Reviewed by: bde MFC after:1 week Modified: head/lib/msun/src/e_rem_pio2.c head/lib/msun/src/e_rem_pio2f.c head/lib/msun/src/k_cosf.c head/lib/msun/src/k_sinf.c head/lib/msun/src/k_tanf.c head/lib/msun/src/math_private.h Modified: head/lib/msun/src/e_rem_pio2.c == --- head/lib/msun/src/e_rem_pio2.c Sat Aug 11 05:58:56 2012 (r239191) +++ head/lib/msun/src/e_rem_pio2.c Sat Aug 11 11:13:48 2012 (r239192) @@ -48,10 +48,10 @@ pio2_2t = 2.02226624879595063154e-21, / pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E00 */ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ -#ifndef INLINE_REM_PIO2 -extern +#ifdef INLINE_REM_PIO2 +static __inline #endif -__inline int +int __ieee754_rem_pio2(double x, double *y) { double z,w,t,r,fn; Modified: head/lib/msun/src/e_rem_pio2f.c == --- head/lib/msun/src/e_rem_pio2f.c Sat Aug 11 05:58:56 2012 (r239191) +++ head/lib/msun/src/e_rem_pio2f.c Sat Aug 11 11:13:48 2012 (r239192) @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); /* * invpio2: 53 bits of 2/pi - * pio2_1: first 33 bit of pi/2 + * pio2_1: first 25 bits of pi/2 * pio2_1t: pi/2 - pio2_1 */ @@ -40,10 +40,10 @@ invpio2 = 6.36619772367581382433e-01, / pio2_1 = 1.57079631090164184570e+00, /* 0x3FF921FB, 0x5000 */ pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */ -#ifndef INLINE_REM_PIO2F -extern +#ifdef INLINE_REM_PIO2F +static __inline #endif -__inline int +int __ieee754_rem_pio2f(float x, double *y) { double w,r,fn; Modified: head/lib/msun/src/k_cosf.c == --- head/lib/msun/src/k_cosf.c Sat Aug 11 05:58:56 2012(r239191) +++ head/lib/msun/src/k_cosf.c Sat Aug 11 11:13:48 2012(r239192) @@ -30,10 +30,10 @@ C1 = 0x13e1053a42.0p-57, /* 0.041 C2 = -0x16c087e80f1e27.0p-62, /* -0.00138867637746099294692 */ C3 = 0x199342e0ee5069.0p-68; /* 0.243904487962774090654 */ -#ifndef INLINE_KERNEL_COSDF -extern +#ifdef INLINE_KERNEL_COSDF +static __inline #endif -__inline float +float __kernel_cosdf(double x) { double r, w, z; Modified: head/lib/msun/src/k_sinf.c == --- head/lib/msun/src/k_sinf.c Sat Aug 11 05:58:56 2012(r239191) +++ head/lib/msun/src/k_sinf.c Sat Aug 11 11:13:48 2012(r239192) @@ -29,10 +29,10 @@ S2 = 0x10896efbb2.0p-59, /* 0.0083 S3 = -0x1a00f9e2cae774.0p-65, /* -0.000198393348360966317347 */ S4 = 0x16cd878c3b46a7.0p-71; /* 0.027183114939898219064 */ -#ifndef INLINE_KERNEL_SINDF -extern +#ifdef INLINE_KERNEL_SINDF +static __inline #endif -__inline float +float __kernel_sindf(double x) { double r, s, w, z; Modified: head/lib/msun/src/k_tanf.c == --- head/lib/msun/src/k_tanf.c Sat Aug 11 05:58:56 2012(r239191) +++ head/lib/msun/src/k_tanf.c Sat Aug 11 11:13:48 2012(r239192) @@ -32,10 +32,10 @@ T[] = { 0x1362b9bf971bcd.0p-59, /* 0.00946564784943673166728 */ }; -#ifndef INLINE_KERNEL_TANDF -extern +#ifdef INLINE_KERNEL_TANDF +static __inline #endif -__inline float +float __kernel_tandf(double x, int iy) { double z,r,w,s,t,u; Modified: head/lib/msun/src/math_private.h == --- head/lib/msun/src/math_private.hSat Aug 11 05:58:56 2012 (r239191) +++ head/lib/msun/src/math_private.hSat Aug 11 11:13:48 2012 (r239192) @@ -431,10 +431,9 @@ irintl(long double x) int__kernel_rem_pio2(double*,double*,int,int,int); /* double precision kernel functions */ -#ifdef INLINE_REM_PIO2 -__inline -#endif +#ifndef INLINE_REM_PIO2 int__ieee754_rem_pio2(double,double*); +#endif double __kernel_sin(double,double,int); double __kernel_cos(double,double); double __kernel_tan(double,double,int); @@ -444,22 +443,18 @@ double complex __ldexp_cexp(double compl #endif /* float precision kernel functions */ -#ifdef INLINE_REM_PIO2F -__inline -#endif +#ifndef INLINE_REM_PIO2F int__ieee754_rem_pio2f(float,double*); -#ifdef INLINE_KERNEL_SINDF -__inline #endif +#ifndef INLINE_KERNEL_SINDF float __kernel_sindf(double); -#ifdef INLINE_KERNEL_COSDF -__inline #endif +#ifndef INL
Re: svn commit: r239187 - head/sys/kern
On Sat, 11 Aug 2012, Bruce Evans wrote: On Sat, 11 Aug 2012, David Xu wrote: ... for (;;) { if (!(uq->uq_flags & UQF_UMTXQ)) return (0); - error = msleep(uq, &uc->uc_lock, PCATCH, wmesg, - timo == NULL ? 0 : abs_timeout_gethz(timo)); - if (error != EWOULDBLOCK) - break; - umtxq_unlock(&uq->uq_key); - if (abs_timeout_update(timo)) { - error = ETIMEDOUT; ... This follows the null pointer in abs_timeout_update() if timo == NULL. timo == NULL has caused msleep to be called with a timeout of 0 ticks (infinity), so EWOULDBLOCK should not normally be returned in this case. However, I think it is always returned after the INT_MAX ticks since a timeout of infinity is not really infinite, but just INT_MAX, and there is no further magic for this value, so EWOULDBLOCK is returned as usual if the timeout expires. Oops, 0 really does mean infinity for msleep(), so there is no problem unless it somehow returns EWOULDBLOCK. ... + abs_timeout_update(timo); This still follows the null pointer, as above. Still no problem. Bruce ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r239187 - head/sys/kern
On Sat, 11 Aug 2012, David Xu wrote: Log: tvtohz will print out an error message if a negative value is given to it, avoid this problem by detecting timeout earlier. Reported by: pho It's interesting that anyone noticed that. In my version, the printf under DIAGNOSTIC (with prettyprinting of negative times) is simplified to an unconditional panic (with no prettyprinting). The panic never occurred here (but I don't have POSIX timers). However, I think I would go the other way and remove the diagnostic and return 1 (tick). In nanosleep(), I objected to returning an error for negative sleep times, and this is similar. A negative time is just the result of subtracting times with the one that is normally largest being smallest for some reason. Unless this must not happen for technical reasons, it is easiest to let it happen and silently handle the problem at the lowest level. For sleep intervals, negative ones should be silently converted to 0. However, there is the technical reason that 0 means infinity in the callout API, so negative sleep intervals would have to be converted to 1 tick, and this is not as good. Modified: head/sys/kern/kern_umtx.c == --- head/sys/kern/kern_umtx.c Fri Aug 10 21:11:00 2012(r239186) +++ head/sys/kern/kern_umtx.c Sat Aug 11 00:06:56 2012(r239187) ... @@ -601,6 +600,8 @@ abs_timeout_gethz(struct abs_timeout *ti tts = timo->end; timespecsub(&tts, &timo->cur); + if (tts.tv_sec < 0 || (tts.tv_sec == 0 && tts.tv_nsec == 0)) + return (-1); return (tstohz(&tts)); } Style bug: home made comparison of timespecs. This should be written as: % + if (timespeccmp(&timo->end, &timo->cur, whatever)) % + return (-1); % tts = timo->end; % timespecsub(&tts, &timo->cur); % return (tstohz(&tts)); (except it shouldn't be written as a function at all -- see below). @@ -613,22 +614,25 @@ umtxq_sleep(struct umtx_q *uq, const cha { struct umtxq_chain *uc; int error; + int pulse; Style bug: int declarations not on the same line. uc = umtxq_getchain(&uq->uq_key); UMTXQ_LOCKED_ASSERT(uc); for (;;) { if (!(uq->uq_flags & UQF_UMTXQ)) return (0); - error = msleep(uq, &uc->uc_lock, PCATCH, wmesg, - timo == NULL ? 0 : abs_timeout_gethz(timo)); - if (error != EWOULDBLOCK) - break; - umtxq_unlock(&uq->uq_key); - if (abs_timeout_update(timo)) { - error = ETIMEDOUT; I see that is part of the spec to return immediately with error ETIMEDOUT if the timeout expired. So we must check for both negative and zero timeouts. The clean way to do this is to let them reach msleep() and make it return EWOULDBLOCK immediately for them. Such timeouts can only be the result of bugs or races, so they shouldn't be optimized for with up-front checks before all calls to msleep(). Races turn negative timeouts into 1-2 tick ones anyway (this happens when the up-front check is done a few nsec before the timeout expires; then the check passes, but the timeout has expired before the sleep begins). This follows the null pointer in abs_timeout_update() if timo == NULL. timo == NULL has caused msleep to be called with a timeout of 0 ticks (infinity), so EWOULDBLOCK should not normally be returned in this case. However, I think it is always returned after the INT_MAX ticks since a timeout of infinity is not really infinite, but just INT_MAX, and there is no further magic for this value, so EWOULDBLOCK is returned as usual if the timeout expires. + if (timo != NULL) { + pulse = abs_timeout_gethz(timo); + if (pulse < 0) + return (ETIMEDOUT); + } else + pulse = 0; + error = msleep(uq, &uc->uc_lock, PCATCH|PDROP, wmesg, pulse); Style bug: missing spaces around binary operator '|'. Style bug: poor variable name 'pulse'. The good name 'timo' is taken, and it is already confusing to use it for a point instead of for the timeout in ticks. (The good name 'timeout' rotted much more to 'callout' in the main timeout API.) Why is the lock dropped for just calling kern_clock_gettime()? + if (error != EWOULDBLOCK) { umtxq_lock(&uq->uq_key); break; } + abs_timeout_update(timo); This still follows the null pointer, as above. abs_timeout_update() is only called once, and now is just kern_clock_gettime(). Manually inlining it would make its locking requirements clearer. abs_timeout_gethz() is only called once. This was convenient for using it in an expression. But now this is just an obfuscation related to 'pulse'