Re: svn commit: r239301 - in head/sys: kern nlm sys
On 2012-Aug-15 15:56:21 +, Konstantin Belousov wrote: > Add a sysctl kern.pid_max, which limits the maximum pid the system is > allowed to allocate, and corresponding tunable with the same > name. Note that existing processes with higher pids are left intact. Sorry for not picking this up when you first posted the patch but I think you need to place a lower bound on max_pid to prevent the system being rendered unusable. >Modified: head/sys/kern/kern_fork.c >== >--- head/sys/kern/kern_fork.c Wed Aug 15 15:53:27 2012(r239300) >+++ head/sys/kern/kern_fork.c Wed Aug 15 15:56:21 2012(r239301) >@@ -209,8 +209,8 @@ sysctl_kern_randompid(SYSCTL_HANDLER_ARG > pid = randompid; > error = sysctl_handle_int(oidp, &pid, 0, req); > if (error == 0 && req->newptr != NULL) { >- if (pid < 0 || pid > PID_MAX - 100) /* out of range */ >- pid = PID_MAX - 100; >+ if (pid < 0 || pid > pid_max - 100) /* out of range */ >+ pid = pid_max - 100; Setting max_pid to a value less than 100 will have an undesirable effect here. >+static int >+sysctl_kern_pid_max(SYSCTL_HANDLER_ARGS) >+{ >+ int error, pm; >+ >+ pm = pid_max; >+ error = sysctl_handle_int(oidp, &pm, 0, req); >+ if (error || !req->newptr) >+ return (error); >+ sx_xlock(&proctree_lock); >+ sx_xlock(&allproc_lock); >+ /* Only permit the values less then PID_MAX. */ >+ if (pm > PID_MAX) >+ error = EINVAL; >+ else >+ pid_max = pm; >+ sx_xunlock(&allproc_lock); >+ sx_xunlock(&proctree_lock); >+ return (error); >+} >+SYSCTL_PROC(_kern, OID_AUTO, pid_max, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_TUN | >+CTLFLAG_MPSAFE, 0, 0, sysctl_kern_pid_max, "I", >+"Maximum allowed pid"); I don't see anything in this code that would prevent setting max_pid to an unusably low (as in making the system unusable) or even negative value >+ TUNABLE_INT_FETCH("kern.pid_max", &pid_max); >+ if (pid_max > PID_MAX) >+ pid_max = PID_MAX; > } Likewise, this needs a lower bounds check. -- Peter Jeremy pgpjSBXtQZhiY.pgp Description: PGP signature
svn commit: r239326 - head/sys/dev/sound/pci/hda
Author: mav Date: Thu Aug 16 07:43:15 2012 New Revision: 239326 URL: http://svn.freebsd.org/changeset/base/239326 Log: Fix "speaker" volume control, broken at r230451. Reported and tested by: Slawa Olhovchenkov MFC after:1 month Modified: head/sys/dev/sound/pci/hda/hdaa.c Modified: head/sys/dev/sound/pci/hda/hdaa.c == --- head/sys/dev/sound/pci/hda/hdaa.c Thu Aug 16 06:45:58 2012 (r239325) +++ head/sys/dev/sound/pci/hda/hdaa.c Thu Aug 16 07:43:15 2012 (r239326) @@ -2127,11 +2127,14 @@ hdaa_audio_ctl_dev_volume(struct hdaa_pc w = hdaa_widget_get(devinfo, i); if (w == NULL || w->enable == 0) continue; - if (w->bindas < 0 && pdevinfo->index != 0) - continue; - if (w->bindas != pdevinfo->playas && - w->bindas != pdevinfo->recas) - continue; + if (w->bindas < 0) { + if (pdevinfo->index != 0) + continue; + } else { + if (w->bindas != pdevinfo->playas && + w->bindas != pdevinfo->recas) + continue; + } if (dev == SOUND_MIXER_RECLEV && w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT) { hdaa_audio_ctl_dest_volume(pdevinfo, dev, ___ 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: r239327 - head/sys/vm
Author: des Date: Thu Aug 16 08:29:49 2012 New Revision: 239327 URL: http://svn.freebsd.org/changeset/base/239327 Log: - When running out of swzone, instead of spewing an error message every tick until the situation is resolved (if ever), just print a single message when running out and another when space becomes available. - When adding more swap, warn if the total amount exceeds half the theoretical maximum we can handle. Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cThu Aug 16 07:43:15 2012(r239326) +++ head/sys/vm/swap_pager.cThu Aug 16 08:29:49 2012(r239327) @@ -1804,6 +1804,7 @@ restart: static void swp_pager_meta_build(vm_object_t object, vm_pindex_t pindex, daddr_t swapblk) { + static volatile int exhausted; struct swblock *swap; struct swblock **pswap; int idx; @@ -1847,7 +1848,9 @@ retry: mtx_unlock(&swhash_mtx); VM_OBJECT_UNLOCK(object); if (uma_zone_exhausted(swap_zone)) { - printf("swap zone exhausted, increase kern.maxswzone\n"); + if (atomic_cmpset_rel_int(&exhausted, 0, 1)) + printf("swap zone exhausted, " + "increase kern.maxswzone\n"); vm_pageout_oom(VM_OOM_SWAPZ); pause("swzonex", 10); } else @@ -1856,6 +1859,9 @@ retry: goto retry; } + if (atomic_cmpset_rel_int(&exhausted, 1, 0)) + printf("swap zone ok\n"); + swap->swb_hnext = NULL; swap->swb_object = object; swap->swb_index = pindex & ~(vm_pindex_t)SWAP_META_MASK; @@ -2112,6 +2118,31 @@ done: return (error); } +/* + * Check that the total amount of swap currently configured does not + * exceed half the theoretical maximum. If it does, print a warning + * message and return -1; otherwise, return 0. + */ +static int +swapon_check_swzone(unsigned long npages) +{ + unsigned long maxpages; + + /* absolute maximum we can handle assuming 100% efficiency */ + maxpages = uma_zone_get_max(swap_zone) * SWAP_META_PAGES; + + /* recommend using no more than half that amount */ + if (npages > maxpages / 2) { + printf("warning: total configured swap (%lu pages) " + "exceeds maximum recommended amount (%lu pages).\n", + npages, maxpages); + printf("warning: increase kern.maxswzone " + "or reduce amount of swap.\n"); + return (-1); + } + return (0); +} + static void swaponsomething(struct vnode *vp, void *id, u_long nblks, sw_strategy_t *strategy, sw_close_t *close, dev_t dev) { @@ -2175,6 +2206,7 @@ swaponsomething(struct vnode *vp, void * nswapdev++; swap_pager_avail += nblks; swap_total += (vm_ooffset_t)nblks * PAGE_SIZE; + swapon_check_swzone(swap_total / PAGE_SIZE); swp_sizecheck(); mtx_unlock(&sw_dev_mtx); } ___ 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: r239318 - head/sys/nfs
On Thu, Aug 16, 2012 at 12:51:50AM +, Oleksandr Tymoshenko wrote: > Author: gonzo > Date: Thu Aug 16 00:51:50 2012 > New Revision: 239318 > URL: http://svn.freebsd.org/changeset/base/239318 > > Log: > Merge somewhat modified r230399 from projects/armv6: > > Add timeout to wait for network controllers to appear when netbooting. > > USB ethernet adapter initialization usually is delayed and > they're not available immidiately after autoconfiguration. So we need > to wait a bit before giving up > > Reviewed by:stas@ > > Modified: > head/sys/nfs/bootp_subr.c > > Modified: head/sys/nfs/bootp_subr.c > == > --- head/sys/nfs/bootp_subr.c Wed Aug 15 22:51:01 2012(r239317) > +++ head/sys/nfs/bootp_subr.c Thu Aug 16 00:51:50 2012(r239318) > @@ -82,6 +82,14 @@ __FBSDID("$FreeBSD$"); > #define BOOTP_SETTLE_DELAY 3 > #endif > > +/* > + * Wait 10 seconds for interface appearance > + * USB ethernet adapters might reqquire some time to pop up s/qq/q/ > + */ > +#ifndef BOOTP_IFACE_WAIT_TIMEOUT > +#define BOOTP_IFACE_WAIT_TIMEOUT10 > +#endif > + > /* > * What is the longest we will wait before re-sending a request? > * Note this is also the frequency of "RPC timeout" messages. > @@ -1515,6 +1523,8 @@ bootpc_init(void) > #endif > struct nfsv3_diskless *nd; > struct thread *td; > + int timeout = BOOTP_IFACE_WAIT_TIMEOUT * hz; > + int delay = hz / 10; According to style(9), initialization and declaration shall be separated. > > nd = &nfsv3_diskless; > td = curthread; > @@ -1567,6 +1577,7 @@ bootpc_init(void) > allocifctx(gctx); > #endif > > +retry: > ifctx = STAILQ_FIRST(&gctx->interfaces); > IFNET_RLOCK(); > TAILQ_FOREACH(ifp, &V_ifnet, if_link) { > @@ -1613,6 +1624,11 @@ bootpc_init(void) > > if (STAILQ_EMPTY(&gctx->interfaces) || > STAILQ_FIRST(&gctx->interfaces)->ifp == NULL) { > + if (timeout > 0) { > + pause("bootpc", delay); > + timeout -= delay; > + goto retry; > + } > #ifdef BOOTP_WIRED_TO > panic("%s: Could not find interface specified " > "by BOOTP_WIRED_TO: " pgprRNzxWVMTw.pgp Description: PGP signature
svn commit: r239328 - in head/sys: kern nlm
Author: kib Date: Thu Aug 16 13:01:56 2012 New Revision: 239328 URL: http://svn.freebsd.org/changeset/base/239328 Log: Fix grammar. Submitted by: jh MFC after:1 week Modified: head/sys/kern/init_main.c head/sys/kern/kern_thread.c head/sys/nlm/nlm_advlock.c Modified: head/sys/kern/init_main.c == --- head/sys/kern/init_main.c Thu Aug 16 08:29:49 2012(r239327) +++ head/sys/kern/init_main.c Thu Aug 16 13:01:56 2012(r239328) @@ -476,7 +476,7 @@ proc0_init(void *dummy __unused) knlist_init_mtx(&p->p_klist, &p->p_mtx); STAILQ_INIT(&p->p_ktr); p->p_nice = NZERO; - /* pid_max cannot be greater then PID_MAX */ + /* pid_max cannot be greater than PID_MAX */ td->td_tid = PID_MAX + 1; LIST_INSERT_HEAD(TIDHASH(td->td_tid), td, td_hash); td->td_state = TDS_RUNNING; Modified: head/sys/kern/kern_thread.c == --- head/sys/kern/kern_thread.c Thu Aug 16 08:29:49 2012(r239327) +++ head/sys/kern/kern_thread.c Thu Aug 16 13:01:56 2012(r239328) @@ -271,7 +271,7 @@ threadinit(void) mtx_init(&tid_lock, "TID lock", NULL, MTX_DEF); /* -* pid_max cannot be greater then PID_MAX. +* pid_max cannot be greater than PID_MAX. * leave one number for thread0. */ tid_unrhdr = new_unrhdr(PID_MAX + 2, INT_MAX, &tid_lock); Modified: head/sys/nlm/nlm_advlock.c == --- head/sys/nlm/nlm_advlock.c Thu Aug 16 08:29:49 2012(r239327) +++ head/sys/nlm/nlm_advlock.c Thu Aug 16 13:01:56 2012(r239328) @@ -98,7 +98,7 @@ nlm_client_init(void *dummy) int i; mtx_init(&nlm_svid_lock, "NLM svid lock", NULL, MTX_DEF); - /* pid_max cannot be greater then PID_MAX */ + /* pid_max cannot be greater than PID_MAX */ nlm_svid_allocator = new_unrhdr(PID_MAX + 2, INT_MAX, &nlm_svid_lock); for (i = 0; i < NLM_SVID_HASH_SIZE; i++) LIST_INIT(&nlm_file_svids[i]); ___ 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: r239329 - head/sys/kern
Author: kib Date: Thu Aug 16 13:04:21 2012 New Revision: 239329 URL: http://svn.freebsd.org/changeset/base/239329 Log: As a safety measure, disable lowering pid_max too much. Requested by: Peter Jeremy MFC after:1 week Modified: head/sys/kern/kern_mib.c head/sys/kern/subr_param.c Modified: head/sys/kern/kern_mib.c == --- head/sys/kern/kern_mib.cThu Aug 16 13:01:56 2012(r239328) +++ head/sys/kern/kern_mib.cThu Aug 16 13:04:21 2012(r239329) @@ -510,8 +510,12 @@ sysctl_kern_pid_max(SYSCTL_HANDLER_ARGS) return (error); sx_xlock(&proctree_lock); sx_xlock(&allproc_lock); - /* Only permit the values less then PID_MAX. */ - if (pm > PID_MAX) + + /* +* Only permit the values less then PID_MAX. +* As a safety measure, do not allow to limit the pid_max too much. +*/ + if (pm < 300 || pm > PID_MAX) error = EINVAL; else pid_max = pm; Modified: head/sys/kern/subr_param.c == --- head/sys/kern/subr_param.c Thu Aug 16 13:01:56 2012(r239328) +++ head/sys/kern/subr_param.c Thu Aug 16 13:04:21 2012(r239329) @@ -255,10 +255,13 @@ init_param1(void) /* * Only allow to lower the maximal pid. +* Prevent setting up a non-bootable system if pid_max is too low. */ TUNABLE_INT_FETCH("kern.pid_max", &pid_max); if (pid_max > PID_MAX) pid_max = PID_MAX; + else if (pid_max < 300) + pid_max = 300; } /* ___ 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: r239330 - head/sys/dev/isp
Author: mjacob Date: Thu Aug 16 15:32:16 2012 New Revision: 239330 URL: http://svn.freebsd.org/changeset/base/239330 Log: On lun disable, complete all INOTs and ATIOs with CAM_REQ_ABORTED. Reviewed by: ken (silently), chuck MFC after:3 weeks Modified: head/sys/dev/isp/isp_freebsd.c Modified: head/sys/dev/isp/isp_freebsd.c == --- head/sys/dev/isp/isp_freebsd.c Thu Aug 16 13:04:21 2012 (r239329) +++ head/sys/dev/isp/isp_freebsd.c Thu Aug 16 15:32:16 2012 (r239330) @@ -1154,10 +1154,27 @@ create_lun_state(ispsoftc_t *isp, int bu static ISP_INLINE void destroy_lun_state(ispsoftc_t *isp, tstate_t *tptr) { + union ccb *ccb; struct tslist *lhp; KASSERT((tptr->hold != 0), ("tptr is not held")); KASSERT((tptr->hold == 1), ("tptr still held (%d)", tptr->hold)); + do { + ccb = (union ccb *)SLIST_FIRST(&tptr->atios); + if (ccb) { + SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle); + ccb->ccb_h.status = CAM_REQ_ABORTED; + xpt_done(ccb); + } + } while (ccb); + do { + ccb = (union ccb *)SLIST_FIRST(&tptr->inots); + if (ccb) { + SLIST_REMOVE_HEAD(&tptr->inots, sim_links.sle); + ccb->ccb_h.status = CAM_REQ_ABORTED; + xpt_done(ccb); + } + } while (ccb); ISP_GET_PC_ADDR(isp, cam_sim_bus(xpt_path_sim(tptr->owner)), lun_hash[LUN_HASH_FUNC(xpt_path_lun_id(tptr->owner))], lhp); SLIST_REMOVE(lhp, tptr, tstate, next); ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, tptr->owner, "destroyed tstate\n"); @@ -1472,8 +1489,8 @@ done: } ccb->ccb_h.status = status; if (status == CAM_REQ_CMP) { - xpt_print(ccb->ccb_h.path, "lun now disabled for target mode\n"); destroy_lun_state(isp, tptr); + xpt_print(ccb->ccb_h.path, "lun now disabled for target mode\n"); } else { if (tptr) rls_lun_statep(isp, tptr); ___ 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: r239331 - head/sys/ia64/ia64
Author: jhb Date: Thu Aug 16 17:17:08 2012 New Revision: 239331 URL: http://svn.freebsd.org/changeset/base/239331 Log: Add locking for sscdisk(4) and mark it MPSAFE. Since this driver just makes calls out to the emulator, the locking is fairly simple. A global mutex protects the list of ssc disks, and each ssc disk has a mutex to protect it's bioq. Approved by: marcel Modified: head/sys/ia64/ia64/sscdisk.c Modified: head/sys/ia64/ia64/sscdisk.c == --- head/sys/ia64/ia64/sscdisk.cThu Aug 16 15:32:16 2012 (r239330) +++ head/sys/ia64/ia64/sscdisk.cThu Aug 16 17:17:08 2012 (r239331) @@ -77,13 +77,15 @@ static MALLOC_DEFINE(M_SSC, "ssc_disk", static d_strategy_t sscstrategy; static LIST_HEAD(, ssc_s) ssc_softc_list = LIST_HEAD_INITIALIZER(ssc_softc_list); +static struct mtx ssc_list_lock; +MTX_SYSINIT(ssc_list, &ssc_list_lock, "ssc list", MTX_DEF); struct ssc_s { int unit; LIST_ENTRY(ssc_s) list; struct bio_queue_head bio_queue; struct disk *disk; - struct cdev *dev; + struct mtx lock; int busy; int fd; }; @@ -94,30 +96,27 @@ static void sscstrategy(struct bio *bp) { struct ssc_s *sc; - int s; struct disk_req req; struct disk_stat stat; u_long len, va, off; sc = bp->bio_disk->d_drv1; - s = splbio(); - + mtx_lock(&sc->lock); bioq_disksort(&sc->bio_queue, bp); if (sc->busy) { - splx(s); + mtx_unlock(&sc->lock); return; } - sc->busy++; - - while (1) { + + for (;;) { bp = bioq_takefirst(&sc->bio_queue); - splx(s); if (!bp) break; + mtx_unlock(&sc->lock); va = (u_long) bp->bio_data; len = bp->bio_bcount; off = bp->bio_pblkno << DEV_BSHIFT; @@ -140,10 +139,11 @@ sscstrategy(struct bio *bp) } bp->bio_resid = 0; biodone(bp); - s = splbio(); + mtx_lock(&sc->lock); } sc->busy = 0; + mtx_unlock(&sc->lock); return; } @@ -158,17 +158,24 @@ ssccreate(int unit) if (fd == -1) return (NULL); + sc = malloc(sizeof(*sc), M_SSC, M_WAITOK | M_ZERO); + + mtx_lock(&ssc_list_lock); if (unit == -1) unit = sscunits++; /* Make sure this unit isn't already in action */ LIST_FOREACH(sc, &ssc_softc_list, list) { - if (sc->unit == unit) + if (sc->unit == unit) { + mtx_unlock(&ssc_list_lock); + free(sc, M_SSC); return (NULL); + } } - sc = malloc(sizeof(*sc), M_SSC, M_WAITOK | M_ZERO); LIST_INSERT_HEAD(&ssc_softc_list, sc, list); sc->unit = unit; + mtx_unlock(&ssc_list_lock); bioq_init(&sc->bio_queue); + mtx_init(&sc->lock, "ssc", NULL, MTX_DEF); sc->disk = disk_alloc(); sc->disk->d_drv1 = sc; @@ -180,7 +187,6 @@ ssccreate(int unit) sc->disk->d_sectorsize = DEV_BSIZE; sc->disk->d_strategy = sscstrategy; sc->disk->d_unit = sc->unit; - sc->disk->d_flags = DISKFLAG_NEEDSGIANT; disk_create(sc->disk, DISK_VERSION); sc->fd = fd; if (sc->unit == 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: r239334 - head/sys/netinet
Author: rrs Date: Thu Aug 16 17:55:16 2012 New Revision: 239334 URL: http://svn.freebsd.org/changeset/base/239334 Log: Its never a good idea to double free the same address. MFC after:1 week (after the other commits ahead of this gets MFC'd) Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c == --- head/sys/netinet/in.c Thu Aug 16 17:27:11 2012(r239333) +++ head/sys/netinet/in.c Thu Aug 16 17:55:16 2012(r239334) @@ -573,7 +573,7 @@ in_control(struct socket *so, u_long cmd } TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); - ifa_free(&ia->ia_ifa); /* if_addrhead */ +/* ifa_free(&ia->ia_ifa); - Double free?? */ /* if_addrhead */ IN_IFADDR_WLOCK(); TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); ___ 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: r239335 - head/sys/kern
Author: jhb Date: Thu Aug 16 18:04:33 2012 New Revision: 239335 URL: http://svn.freebsd.org/changeset/base/239335 Log: Remove D_NEEDGIANT from dead_devsw. biofinish() (and thus dead_strategy) does not need Giant. MFC after:1 month Modified: head/sys/kern/kern_conf.c Modified: head/sys/kern/kern_conf.c == --- head/sys/kern/kern_conf.c Thu Aug 16 17:55:16 2012(r239334) +++ head/sys/kern/kern_conf.c Thu Aug 16 18:04:33 2012(r239335) @@ -307,7 +307,6 @@ dead_strategy(struct bio *bp) static struct cdevsw dead_cdevsw = { .d_version =D_VERSION, - .d_flags = D_NEEDGIANT, /* XXX: does dead_strategy need this ? */ .d_open = dead_open, .d_close = dead_close, .d_read = dead_read, ___ 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: r239336 - in head/sys/dev/cxgbe: . common
Author: np Date: Thu Aug 16 18:31:50 2012 New Revision: 239336 URL: http://svn.freebsd.org/changeset/base/239336 Log: Allow for a different handler for each type of firmware message. MFC after:2 weeks Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/t4_msg.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hThu Aug 16 18:04:33 2012 (r239335) +++ head/sys/dev/cxgbe/adapter.hThu Aug 16 18:31:50 2012 (r239336) @@ -510,6 +510,7 @@ struct rss_header; typedef int (*cpl_handler_t)(struct sge_iq *, const struct rss_header *, struct mbuf *); typedef int (*an_handler_t)(struct sge_iq *, const struct rsp_ctrl *); +typedef int (*fw_msg_handler_t)(struct adapter *, const __be64 *); struct adapter { SLIST_ENTRY(adapter) link; @@ -582,7 +583,8 @@ struct adapter { struct callout sfl_callout; an_handler_t an_handler __aligned(CACHE_LINE_SIZE); - cpl_handler_t cpl_handler[256]; + fw_msg_handler_t fw_msg_handler[4]; /* NUM_FW6_TYPES */ + cpl_handler_t cpl_handler[0xef];/* NUM_CPL_CMDS */ }; #define ADAPTER_LOCK(sc) mtx_lock(&(sc)->sc_lock) @@ -741,6 +743,7 @@ void t4_os_link_changed(struct adapter * void t4_iterate(void (*)(struct adapter *, void *), void *); int t4_register_cpl_handler(struct adapter *, int, cpl_handler_t); int t4_register_an_handler(struct adapter *, an_handler_t); +int t4_register_fw_msg_handler(struct adapter *, int, fw_msg_handler_t); /* t4_sge.c */ void t4_sge_modload(void); Modified: head/sys/dev/cxgbe/common/t4_msg.h == --- head/sys/dev/cxgbe/common/t4_msg.h Thu Aug 16 18:04:33 2012 (r239335) +++ head/sys/dev/cxgbe/common/t4_msg.h Thu Aug 16 18:31:50 2012 (r239336) @@ -2281,6 +2281,8 @@ enum { FW6_TYPE_WR_RPL = 1, FW6_TYPE_CQE = 2, FW6_TYPE_OFLD_CONNECTION_WR_RPL = 3, + + NUM_FW6_TYPES }; struct cpl_fw6_msg_ofld_connection_wr_rpl { Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cThu Aug 16 18:04:33 2012 (r239335) +++ head/sys/dev/cxgbe/t4_main.cThu Aug 16 18:31:50 2012 (r239336) @@ -306,6 +306,7 @@ static void cxgbe_vlan_config(void *, st static int cpl_not_handled(struct sge_iq *, const struct rss_header *, struct mbuf *); static int an_not_handled(struct sge_iq *, const struct rsp_ctrl *); +static int fw_msg_not_handled(struct adapter *, const __be64 *); static int t4_sysctls(struct adapter *); static int cxgbe_sysctls(struct port_info *); static int sysctl_int_array(SYSCTL_HANDLER_ARGS); @@ -381,6 +382,10 @@ CTASSERT(offsetof(struct sge_ofld_rxq, i CTASSERT(offsetof(struct sge_ofld_rxq, fl) == offsetof(struct sge_rxq, fl)); #endif +/* No easy way to include t4_msg.h before adapter.h so we check this way */ +CTASSERT(ARRAY_SIZE(((struct adapter *)0)->cpl_handler) == NUM_CPL_CMDS); +CTASSERT(ARRAY_SIZE(((struct adapter *)0)->fw_msg_handler) == NUM_FW6_TYPES); + static int t4_probe(device_t dev) { @@ -458,6 +463,8 @@ t4_attach(device_t dev) sc->an_handler = an_not_handled; for (i = 0; i < ARRAY_SIZE(sc->cpl_handler); i++) sc->cpl_handler[i] = cpl_not_handled; + for (i = 0; i < ARRAY_SIZE(sc->fw_msg_handler); i++) + sc->fw_msg_handler[i] = fw_msg_not_handled; t4_register_cpl_handler(sc, CPL_SET_TCB_RPL, filter_rpl); /* Prepare the adapter for operation */ @@ -2980,7 +2987,7 @@ cpl_not_handled(struct sge_iq *iq, const panic("%s: opcode 0x%02x on iq %p with payload %p", __func__, rss->opcode, iq, m); #else - log(LOG_ERR, "%s: opcode 0x%02x on iq %p with payload %p", + log(LOG_ERR, "%s: opcode 0x%02x on iq %p with payload %p\n", __func__, rss->opcode, iq, m); m_freem(m); #endif @@ -3009,7 +3016,7 @@ an_not_handled(struct sge_iq *iq, const #ifdef INVARIANTS panic("%s: async notification on iq %p (ctrl %p)", __func__, iq, ctrl); #else - log(LOG_ERR, "%s: async notification on iq %p (ctrl %p)", + log(LOG_ERR, "%s: async notification on iq %p (ctrl %p)\n", __func__, iq, ctrl); #endif return (EDOOFUS); @@ -3028,6 +3035,35 @@ t4_register_an_handler(struct adapter *s } static int +fw_msg_not_handled(struct adapter *sc, const __be64 *rpl) +{ + __be64 *r = __DECONST(__be64 *, rpl); + struct cpl_fw6_msg *cpl = member2struct(cpl_fw6_msg, data, r); + +#ifdef INVARIANTS + panic("%s: fw_msg type %d", __func__, cpl->type); +#else + log(LOG_ERR, "%s: fw_msg type %d\n", __func__, cpl->type); +#endif + return (EDOOFUS); +} + +int +t4_re
svn commit: r239337 - head/sys/nfs
Author: gonzo Date: Thu Aug 16 19:22:34 2012 New Revision: 239337 URL: http://svn.freebsd.org/changeset/base/239337 Log: - Typo fix - style(9) fix Spotted by: kib@, Andrey Zonov Modified: head/sys/nfs/bootp_subr.c Modified: head/sys/nfs/bootp_subr.c == --- head/sys/nfs/bootp_subr.c Thu Aug 16 18:31:50 2012(r239336) +++ head/sys/nfs/bootp_subr.c Thu Aug 16 19:22:34 2012(r239337) @@ -84,7 +84,7 @@ __FBSDID("$FreeBSD$"); /* * Wait 10 seconds for interface appearance - * USB ethernet adapters might reqquire some time to pop up + * USB ethernet adapters might require some time to pop up */ #ifndefBOOTP_IFACE_WAIT_TIMEOUT #defineBOOTP_IFACE_WAIT_TIMEOUT10 @@ -1523,8 +1523,11 @@ bootpc_init(void) #endif struct nfsv3_diskless *nd; struct thread *td; - int timeout = BOOTP_IFACE_WAIT_TIMEOUT * hz; - int delay = hz / 10; + int timeout; + int delay; + + timeout = BOOTP_IFACE_WAIT_TIMEOUT * hz; + delay = hz / 10; nd = &nfsv3_diskless; td = curthread; ___ 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: r239334 - head/sys/netinet
On Thursday, August 16, 2012 1:55:17 pm Randall Stewart wrote: > Author: rrs > Date: Thu Aug 16 17:55:16 2012 > New Revision: 239334 > URL: http://svn.freebsd.org/changeset/base/239334 > > Log: > Its never a good idea to double free the same > address. > > MFC after: 1 week (after the other commits ahead of this gets MFC'd) > > Modified: > head/sys/netinet/in.c > > Modified: head/sys/netinet/in.c > == > --- head/sys/netinet/in.c Thu Aug 16 17:27:11 2012(r239333) > +++ head/sys/netinet/in.c Thu Aug 16 17:55:16 2012(r239334) > @@ -573,7 +573,7 @@ in_control(struct socket *so, u_long cmd > } > TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); > IF_ADDR_WUNLOCK(ifp); > - ifa_free(&ia->ia_ifa); /* if_addrhead */ > +/* ifa_free(&ia->ia_ifa); - Double free?? */ /* if_addrhead */ This isn't a double free. This is dropping a reference count. In this case as the comment suggests, it is removing the reference held by the per- interface if_addrhead list that it was just removed from two lines above. Later in the function when ifa_free() is invoked: LIST_REMOVE(ia, ia_hash); IN_IFADDR_WUNLOCK(); ... ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ It is dropping the reference held by the in_ifaddrhead list which the ifa was removed from by the above LIST_REMOVE(). Are you seeing a panic or refcount underflow or some such? -- John Baldwin ___ 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: r239338 - in head/sys/dev/cxgbe: . tom
Author: np Date: Thu Aug 16 20:15:29 2012 New Revision: 239338 URL: http://svn.freebsd.org/changeset/base/239338 Log: Add a routine (t4_set_tcb_field) to update arbitrary parts of a hardware TCB. Filters are programmed by modifying the TCB too (via a different routine) and the reply to any TCB update is delivered via a CPL_SET_TCB_RPL. Figure out whether the reply is for a filter-write or something else and route it appropriately. MFC after:2 weeks Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hThu Aug 16 19:22:34 2012 (r239337) +++ head/sys/dev/cxgbe/adapter.hThu Aug 16 20:15:29 2012 (r239338) @@ -744,6 +744,7 @@ void t4_iterate(void (*)(struct adapter int t4_register_cpl_handler(struct adapter *, int, cpl_handler_t); int t4_register_an_handler(struct adapter *, an_handler_t); int t4_register_fw_msg_handler(struct adapter *, int, fw_msg_handler_t); +int t4_filter_rpl(struct sge_iq *, const struct rss_header *, struct mbuf *); /* t4_sge.c */ void t4_sge_modload(void); Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cThu Aug 16 19:22:34 2012 (r239337) +++ head/sys/dev/cxgbe/t4_main.cThu Aug 16 20:15:29 2012 (r239338) @@ -346,8 +346,6 @@ static int del_filter(struct adapter *, static void clear_filter(struct filter_entry *); static int set_filter_wr(struct adapter *, int); static int del_filter_wr(struct adapter *, int); -static int filter_rpl(struct sge_iq *, const struct rss_header *, -struct mbuf *); static int get_sge_context(struct adapter *, struct t4_sge_context *); static int read_card_mem(struct adapter *, struct t4_mem_range *); #ifdef TCP_OFFLOAD @@ -465,7 +463,7 @@ t4_attach(device_t dev) sc->cpl_handler[i] = cpl_not_handled; for (i = 0; i < ARRAY_SIZE(sc->fw_msg_handler); i++) sc->fw_msg_handler[i] = fw_msg_not_handled; - t4_register_cpl_handler(sc, CPL_SET_TCB_RPL, filter_rpl); + t4_register_cpl_handler(sc, CPL_SET_TCB_RPL, t4_filter_rpl); /* Prepare the adapter for operation */ rc = -t4_prep_adapter(sc); @@ -5000,8 +4998,8 @@ del_filter_wr(struct adapter *sc, int fi return (0); } -static int -filter_rpl(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) +int +t4_filter_rpl(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) { struct adapter *sc = iq->adapter; const struct cpl_set_tcb_rpl *rpl = (const void *)(rss + 1); Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c == --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Aug 16 19:22:34 2012 (r239337) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Aug 16 20:15:29 2012 (r239338) @@ -1262,6 +1262,51 @@ do_fw4_ack(struct sge_iq *iq, const stru return (0); } +static int +do_set_tcb_rpl(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) +{ + struct adapter *sc = iq->adapter; + const struct cpl_set_tcb_rpl *cpl = (const void *)(rss + 1); + unsigned int tid = GET_TID(cpl); +#ifdef INVARIANTS + unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl))); +#endif + + KASSERT(opcode == CPL_SET_TCB_RPL, + ("%s: unexpected opcode 0x%x", __func__, opcode)); + KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__)); + + if (tid >= sc->tids.ftid_base && + tid < sc->tids.ftid_base + sc->tids.nftids) + return (t4_filter_rpl(iq, rss, m)); /* TCB is a filter */ + + CXGBE_UNIMPLEMENTED(__func__); +} + +void +t4_set_tcb_field(struct adapter *sc, struct toepcb *toep, uint16_t word, +uint64_t mask, uint64_t val) +{ + struct wrqe *wr; + struct cpl_set_tcb_field *req; + + wr = alloc_wrqe(sizeof(*req), toep->ctrlq); + if (wr == NULL) { + /* XXX */ + panic("%s: allocation failure.", __func__); + } + req = wrtod(wr); + + INIT_TP_WR_MIT_CPL(req, CPL_SET_TCB_FIELD, toep->tid); + req->reply_ctrl = htobe16(V_NO_REPLY(1) | + V_QUEUENO(toep->ofld_rxq->iq.abs_id)); + req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(0)); + req->mask = htobe64(mask); + req->val = htobe64(val); + + t4_wrq_tx(sc, wr); +} + void t4_init_cpl_io_handlers(struct adapter *sc) { @@ -1272,5 +1317,13 @@ t4_init_cpl_io_handlers(struct adapter * t4_register_cpl_handler(sc, CPL_ABORT_RPL_RSS, do_abort_rpl); t4_register_cpl_handler(sc, CPL_RX_DATA, do_rx_data); t4_register_cpl_handler(sc, CPL_FW4_ACK, do_fw4_ack
svn commit: r239339 - head/sys/dev/cxgbe/firmware
Author: np Date: Thu Aug 16 20:30:14 2012 New Revision: 239339 URL: http://svn.freebsd.org/changeset/base/239339 Log: Make room for DDP page pods in the default configuration profile. While here, bump up the L2 table's size to 4K entries. MFC after:2 weeks Modified: head/sys/dev/cxgbe/firmware/t4fw_cfg.txt Modified: head/sys/dev/cxgbe/firmware/t4fw_cfg.txt == --- head/sys/dev/cxgbe/firmware/t4fw_cfg.txtThu Aug 16 20:15:29 2012 (r239338) +++ head/sys/dev/cxgbe/firmware/t4fw_cfg.txtThu Aug 16 20:30:14 2012 (r239339) @@ -20,7 +20,7 @@ filterMode = fragmentation, mpshittype, protocol, vlan, port, fcoe # TP rx and tx payload memory (% of the total EDRAM + DDR3). - tp_pmrx = 40 + tp_pmrx = 38 tp_pmtx = 60 tp_pmrx_pagesize = 64K tp_pmtx_pagesize = 64K @@ -67,7 +67,8 @@ # driver will mask off features it won't use protocol = ofld - tp_l2t = 100 + tp_l2t = 4096 + tp_ddp = 2 # TCAM has 8K cells; each region must start at a multiple of 128 cell. # Each entry in these categories takes 4 cells each. nhash will use the @@ -136,7 +137,7 @@ [fini] version = 0x1 - checksum = 0xdb5813f9 + checksum = 0x162df193 # # $FreeBSD$ # ___ 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: r239340 - in head: share/man/man4 sys/conf sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/de...
Author: jkim Date: Thu Aug 16 20:54:52 2012 New Revision: 239340 URL: http://svn.freebsd.org/changeset/base/239340 Log: Merge ACPICA 20120816. Added: head/sys/contrib/dev/acpica/components/utilities/utxfinit.c - copied, changed from r239333, vendor-sys/acpica/dist/source/components/utilities/utxfinit.c head/sys/contrib/dev/acpica/include/acbuffer.h - copied unchanged from r239333, vendor-sys/acpica/dist/source/include/acbuffer.h Modified: head/share/man/man4/acpi.4 head/sys/conf/files head/sys/contrib/dev/acpica/acpica_prep.sh head/sys/contrib/dev/acpica/changes.txt (contents, props changed) head/sys/contrib/dev/acpica/common/adisasm.c head/sys/contrib/dev/acpica/common/ahpredef.c head/sys/contrib/dev/acpica/common/dmtable.c head/sys/contrib/dev/acpica/common/dmtbdump.c head/sys/contrib/dev/acpica/common/dmtbinfo.c head/sys/contrib/dev/acpica/compiler/aslcompiler.h head/sys/contrib/dev/acpica/compiler/aslcompiler.y head/sys/contrib/dev/acpica/compiler/aslfold.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/asltree.c head/sys/contrib/dev/acpica/compiler/aslutils.c head/sys/contrib/dev/acpica/components/debugger/dbcmds.c head/sys/contrib/dev/acpica/components/debugger/dbexec.c head/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c head/sys/contrib/dev/acpica/components/dispatcher/dswload.c head/sys/contrib/dev/acpica/components/dispatcher/dswload2.c head/sys/contrib/dev/acpica/components/events/evgpe.c head/sys/contrib/dev/acpica/components/events/evxfgpe.c head/sys/contrib/dev/acpica/components/hardware/hwesleep.c head/sys/contrib/dev/acpica/components/hardware/hwgpe.c head/sys/contrib/dev/acpica/components/hardware/hwsleep.c head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c head/sys/contrib/dev/acpica/components/namespace/nsdump.c head/sys/contrib/dev/acpica/components/utilities/utosi.c head/sys/contrib/dev/acpica/components/utilities/utxface.c head/sys/contrib/dev/acpica/components/utilities/utxferror.c head/sys/contrib/dev/acpica/include/acdisasm.h head/sys/contrib/dev/acpica/include/achware.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acmacros.h head/sys/contrib/dev/acpica/include/acnames.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/actbl.h head/sys/contrib/dev/acpica/include/actbl1.h head/sys/contrib/dev/acpica/include/actbl2.h head/sys/contrib/dev/acpica/include/actbl3.h head/sys/contrib/dev/acpica/include/actypes.h head/sys/contrib/dev/acpica/include/platform/acenv.h head/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpivar.h head/sys/modules/acpi/acpi/Makefile head/sys/x86/acpica/acpi_wakeup.c head/usr.sbin/acpi/acpidb/Makefile Directory Properties: head/sys/contrib/dev/acpica/ (props changed) head/sys/contrib/dev/acpica/common/ (props changed) head/sys/contrib/dev/acpica/compiler/ (props changed) head/sys/contrib/dev/acpica/components/debugger/ (props changed) head/sys/contrib/dev/acpica/components/disassembler/ (props changed) head/sys/contrib/dev/acpica/components/dispatcher/ (props changed) head/sys/contrib/dev/acpica/components/events/ (props changed) head/sys/contrib/dev/acpica/components/hardware/ (props changed) head/sys/contrib/dev/acpica/components/namespace/ (props changed) head/sys/contrib/dev/acpica/components/utilities/ (props changed) head/sys/contrib/dev/acpica/include/ (props changed) head/sys/contrib/dev/acpica/os_specific/ (props changed) Modified: head/share/man/man4/acpi.4 == --- head/share/man/man4/acpi.4 Thu Aug 16 20:30:14 2012(r239339) +++ head/share/man/man4/acpi.4 Thu Aug 16 20:54:52 2012(r239340) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 4, 2012 +.Dd August 16, 2012 .Dt ACPI 4 .Os .Sh NAME @@ -219,14 +219,6 @@ Override any automatic quirks completely Beep the PC speaker on resume. This can help diagnose suspend/resume problems. Default is 0 (disabled). -.It Va debug.acpi.sleep_flags -Execute optional ACPI methods for suspend/resume. -If the bit 0 is set (1), it will try to execute _GTS (Going To Sleep) method -when entering suspend state. -If the bit 1 is set (2), it will try to execute _BFS (Back From Sleep) method -when leaving suspend state. -If both the bits are set (3), both the methods will be tried. -Default is 0 (disabled). .It Va hint.acpi.0.disabled Set this to 1 to disable all of ACPI. If ACPI has been disabled on your system due to a blacklist entry for your Modified: head/sys/conf/files == --- head/sys/conf/files Thu Aug 1
svn commit: r239341 - head/sys/dev/cxgbe
Author: np Date: Thu Aug 16 22:33:56 2012 New Revision: 239341 URL: http://svn.freebsd.org/changeset/base/239341 Log: Initialize various DDP parameters in the main cxgbe(4) driver: - Setup multiple DDP page sizes. When the driver attempts DDP it will try to combine physically contiguous pages into regions of these sizes. - Set the indicate size such that the payload carried in the indicate can be copied in the header mbuf (and the 16K rx buffer can be recycled). - Set DDP threshold to the max payload that the chip will coalesce and deliver to the driver (this is ~16K by default, which is also why the offload rx queue is backed by 16K buffers). If the chip is able to coalesce up to the max it's allowed to, it's a good sign that the peer is transmitting in bulk without any TCP PSH. MFC after:2 weeks Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hThu Aug 16 20:54:52 2012 (r239340) +++ head/sys/dev/cxgbe/adapter.hThu Aug 16 22:33:56 2012 (r239341) @@ -135,6 +135,7 @@ enum { #else FL_BUF_SIZES = 3, /* cluster, jumbo9k, jumbo16k */ #endif + OFLD_BUF_SIZE = MJUM16BYTES,/* size of fl buffer for TOE rxq */ CTRL_EQ_QSIZE = 128, @@ -143,6 +144,12 @@ enum { TX_WR_FLITS = SGE_MAX_WR_LEN / 8 }; +#ifdef T4_PKT_TIMESTAMP +#define RX_COPY_THRESHOLD (MINCLSIZE - 8) +#else +#define RX_COPY_THRESHOLD MINCLSIZE +#endif + enum { /* adapter intr_type */ INTR_INTX = (1 << 0), Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cThu Aug 16 20:54:52 2012 (r239340) +++ head/sys/dev/cxgbe/t4_main.cThu Aug 16 22:33:56 2012 (r239341) @@ -515,12 +515,16 @@ t4_attach(device_t dev) goto done; /* error message displayed already */ if (sc->flags & MASTER_PF) { + uint16_t indsz = min(RX_COPY_THRESHOLD - 1, M_INDICATESIZE); /* final tweaks to some settings */ t4_load_mtus(sc, sc->params.mtus, sc->params.a_wnd, sc->params.b_wnd); - t4_write_reg(sc, A_ULP_RX_TDDP_PSZ, V_HPZ0(PAGE_SHIFT - 12)); + /* 4K, 16K, 64K, 256K DDP "page sizes" */ + t4_write_reg(sc, A_ULP_RX_TDDP_PSZ, V_HPZ0(0) | V_HPZ1(2) | + V_HPZ2(4) | V_HPZ3(6)); + t4_set_reg_field(sc, A_ULP_RX_CTL, F_TDDPTAGTCB, F_TDDPTAGTCB); t4_set_reg_field(sc, A_TP_PARA_REG3, F_TUNNELCNGDROP0 | F_TUNNELCNGDROP1 | F_TUNNELCNGDROP2 | F_TUNNELCNGDROP3, F_TUNNELCNGDROP0 | F_TUNNELCNGDROP1 | F_TUNNELCNGDROP2 | @@ -528,7 +532,7 @@ t4_attach(device_t dev) t4_set_reg_field(sc, A_TP_PARA_REG5, V_INDICATESIZE(M_INDICATESIZE) | F_REARMDDPOFFSET | F_RESETDDPOFFSET, - V_INDICATESIZE(M_INDICATESIZE) | + V_INDICATESIZE(indsz) | F_REARMDDPOFFSET | F_RESETDDPOFFSET); } else { /* @@ -3228,10 +3232,13 @@ t4_sysctls(struct adapter *sc) sc->tt.ddp = 0; SYSCTL_ADD_INT(ctx, children, OID_AUTO, "ddp", CTLFLAG_RW, &sc->tt.ddp, 0, "DDP allowed"); - sc->tt.indsz = M_INDICATESIZE; + + sc->tt.indsz = G_INDICATESIZE(t4_read_reg(sc, A_TP_PARA_REG5)); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "indsz", CTLFLAG_RW, &sc->tt.indsz, 0, "DDP max indicate size allowed"); - sc->tt.ddp_thres = 3*4096; + + sc->tt.ddp_thres = + G_RXCOALESCESIZE(t4_read_reg(sc, A_TP_PARA_REG2)); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "ddp_thres", CTLFLAG_RW, &sc->tt.ddp_thres, 0, "DDP threshold"); } Modified: head/sys/dev/cxgbe/t4_sge.c == --- head/sys/dev/cxgbe/t4_sge.c Thu Aug 16 20:54:52 2012(r239340) +++ head/sys/dev/cxgbe/t4_sge.c Thu Aug 16 22:33:56 2012(r239341) @@ -627,7 +627,7 @@ t4_setup_port_queues(struct port_info *p snprintf(name, sizeof(name), "%s ofld_rxq%d-fl", device_get_nameunit(pi->dev), i); - init_fl(&ofld_rxq->fl, pi->qsize_rxq / 8, MJUM16BYTES, name); + init_fl(&ofld_rxq->fl, pi->qsize_rxq / 8, OFLD_BUF_SIZE, name); if (sc->flags & INTR_DIRECT || (sc->intr_count > 1 && pi->nofldrxq > pi->nrxq)) { @@ -1022,13 +1022,6 @@ service_iq(struct sge_iq *iq, int budget return (0); } - -#ifdef T4_PKT_
Re: svn commit: r239334 - head/sys/netinet
On Aug 16, 2012, at 3:34 PM, John Baldwin wrote: > On Thursday, August 16, 2012 1:55:17 pm Randall Stewart wrote: >> Author: rrs >> Date: Thu Aug 16 17:55:16 2012 >> New Revision: 239334 >> URL: http://svn.freebsd.org/changeset/base/239334 >> >> Log: >> Its never a good idea to double free the same >> address. >> >> MFC after: 1 week (after the other commits ahead of this gets MFC'd) >> >> Modified: >> head/sys/netinet/in.c >> >> Modified: head/sys/netinet/in.c >> > == >> --- head/sys/netinet/in.cThu Aug 16 17:27:11 2012(r239333) >> +++ head/sys/netinet/in.cThu Aug 16 17:55:16 2012(r239334) >> @@ -573,7 +573,7 @@ in_control(struct socket *so, u_long cmd >> } >> TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); >> IF_ADDR_WUNLOCK(ifp); >> -ifa_free(&ia->ia_ifa); /* if_addrhead */ >> +/* ifa_free(&ia->ia_ifa); - Double free?? */ /* if_addrhead */ > > This isn't a double free. This is dropping a reference count. In this case > as the comment suggests, it is removing the reference held by the per- > interface if_addrhead list that it was just removed from two lines above. > Later in the function when ifa_free() is invoked: > > LIST_REMOVE(ia, ia_hash); > IN_IFADDR_WUNLOCK(); > ... > ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ > > It is dropping the reference held by the in_ifaddrhead list which the ifa > was removed from by the above LIST_REMOVE(). Are you seeing a panic or > refcount underflow or some such? > No panic, I wish I were so lucky, I had a lockup/fault at: in_gif.c line 410 (this is 9 stable) --- IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia4, &V_in_ifaddrhead, ia_link) { if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0) <--fault in kernel HERE continue; if (ip->ip_src.s_addr == ia4->ia_broadaddr.sin_addr.s_addr) { IN_IFADDR_RUNLOCK(); return 0; } } IN_IFADDR_RUNLOCK(); I went through and made sure first that every reference using V_in_ifaddrhead was properly locking, and they were. The only thing I could find is this. From the instructions I could see in the assembly the ia4->ia_ifa.ifa_ifp was NULL. And thus caused a deref of a NULL pointer. Hmm, it takes two days of pounding to get this by the way. We are using a Shenick with our proxy that is adding and deleting addresses on a somewhat regular basis while traffic is flowing ;-0 Something that not a lot of folks do obviously… not sure why I did not get into DDB, two CPU's faulted at the same time though.. also the HP's that this thing was running on are not known for being kind on getting into even DDB ;-( Be glad when we get them all replaced with iX systems ;-) R > -- > John Baldwin > -- Randall Stewart 803-317-4952 (cell) ___ 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: r239344 - in head/sys: dev/cxgbe dev/cxgbe/common dev/cxgbe/tom modules/cxgbe/tom
Author: np Date: Fri Aug 17 00:49:29 2012 New Revision: 239344 URL: http://svn.freebsd.org/changeset/base/239344 Log: Support for TCP DDP (Direct Data Placement) in the T4 TOE module. Basically, this is automatic rx zero copy when feasible. TCP payload is DMA'd directly into the userspace buffer described by the uio submitted in soreceive by an application. - Works with sockets that are being handled by the TCP offload engine of a T4 chip (you need t4_tom.ko module loaded after cxgbe, and an "ifconfig +toe" on the cxgbe interface). - Does not require any modification to the application. - Not enabled by default. Use hw.t4nex..toe.ddp="1" to enable it. Added: head/sys/dev/cxgbe/tom/t4_ddp.c (contents, props changed) Modified: head/sys/dev/cxgbe/common/t4_hw.h head/sys/dev/cxgbe/common/t4_msg.h head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/tom/t4_connect.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_listen.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h head/sys/modules/cxgbe/tom/Makefile Modified: head/sys/dev/cxgbe/common/t4_hw.h == --- head/sys/dev/cxgbe/common/t4_hw.h Thu Aug 16 23:59:29 2012 (r239343) +++ head/sys/dev/cxgbe/common/t4_hw.h Fri Aug 17 00:49:29 2012 (r239344) @@ -161,10 +161,12 @@ struct pagepod { #define S_PPOD_TAG6 #define M_PPOD_TAG0xFF #define V_PPOD_TAG(x) ((x) << S_PPOD_TAG) +#define G_PPOD_TAG(x) (((x) >> S_PPOD_TAG) & M_PPOD_TAG) #define S_PPOD_PGSZ30 #define M_PPOD_PGSZ0x3 #define V_PPOD_PGSZ(x) ((x) << S_PPOD_PGSZ) +#define G_PPOD_PGSZ(x) (((x) >> S_PPOD_PGSZ) & M_PPOD_PGSZ) #define S_PPOD_TID32 #define M_PPOD_TID0xFF Modified: head/sys/dev/cxgbe/common/t4_msg.h == --- head/sys/dev/cxgbe/common/t4_msg.h Thu Aug 16 23:59:29 2012 (r239343) +++ head/sys/dev/cxgbe/common/t4_msg.h Fri Aug 17 00:49:29 2012 (r239344) @@ -792,6 +792,14 @@ struct cpl_set_tcb_field { __be64 val; }; +struct cpl_set_tcb_field_core { + union opcode_tid ot; + __be16 reply_ctrl; + __be16 word_cookie; + __be64 mask; + __be64 val; +}; + /* cpl_set_tcb_field.word_cookie fields */ #define S_WORD0 #define M_WORD0x1F @@ -1376,6 +1384,11 @@ struct cpl_rx_data_ack { __be32 credit_dack; }; +struct cpl_rx_data_ack_core { + union opcode_tid ot; + __be32 credit_dack; +}; + /* cpl_rx_data_ack.ack_seq fields */ #define S_RX_CREDITS0 #define M_RX_CREDITS0x3FF Modified: head/sys/dev/cxgbe/offload.h == --- head/sys/dev/cxgbe/offload.hThu Aug 16 23:59:29 2012 (r239343) +++ head/sys/dev/cxgbe/offload.hFri Aug 17 00:49:29 2012 (r239344) @@ -31,13 +31,16 @@ #ifndef __T4_OFFLOAD_H__ #define __T4_OFFLOAD_H__ -#define INIT_ULPTX_WR(w, wrlen, atomic, tid) do { \ - (w)->wr.wr_hi = htonl(V_FW_WR_OP(FW_ULPTX_WR) | V_FW_WR_ATOMIC(atomic)); \ - (w)->wr.wr_mid = htonl(V_FW_WR_LEN16(DIV_ROUND_UP(wrlen, 16)) | \ +#define INIT_ULPTX_WRH(w, wrlen, atomic, tid) do { \ + (w)->wr_hi = htonl(V_FW_WR_OP(FW_ULPTX_WR) | V_FW_WR_ATOMIC(atomic)); \ + (w)->wr_mid = htonl(V_FW_WR_LEN16(DIV_ROUND_UP(wrlen, 16)) | \ V_FW_WR_FLOWID(tid)); \ - (w)->wr.wr_lo = cpu_to_be64(0); \ + (w)->wr_lo = cpu_to_be64(0); \ } while (0) +#define INIT_ULPTX_WR(w, wrlen, atomic, tid) \ +INIT_ULPTX_WRH(&((w)->wr), wrlen, atomic, tid) + #define INIT_TP_WR(w, tid) do { \ (w)->wr.wr_hi = htonl(V_FW_WR_OP(FW_TP_WR) | \ V_FW_WR_IMMDLEN(sizeof(*w) - sizeof(w->wr))); \ Modified: head/sys/dev/cxgbe/tom/t4_connect.c == --- head/sys/dev/cxgbe/tom/t4_connect.c Thu Aug 16 23:59:29 2012 (r239343) +++ head/sys/dev/cxgbe/tom/t4_connect.c Fri Aug 17 00:49:29 2012 (r239344) @@ -247,10 +247,14 @@ calc_opt2a(struct socket *so) opt2 |= F_RX_COALESCE_VALID | V_RX_COALESCE(M_RX_COALESCE); opt2 |= F_RSS_QUEUE_VALID | V_RSS_QUEUE(toep->ofld_rxq->iq.abs_id); +#ifdef USE_DDP_RX_FLOW_CONTROL + if (toep->ulp_mode == ULP_MODE_TCPDDP) + opt2 |= F_RX_FC_VALID | F_RX_FC_DDP; +#endif + return (htobe32(opt2)); } - void t4_init_connect_cpl_handlers(struct adapter *sc) { @@ -320,7 +324,10 @@ t4_connect(struct toedev *tod, struct so toep->tid = atid; toep->l2te = e; - toep->ulp_mode = ULP_MODE_NONE; + if (sc->tt.ddp && (so->so_options & SO_NO_DDP) == 0) + set_tcpddp_ulp_mode(toep); + else + toep->ulp_mode = ULP_MODE_NONE; SOCKBUF_LOCK(&so->so_rcv); /* opt0 rcv_b
svn commit: r239345 - head/lib/libc/stdlib
Author: kevlo Date: Fri Aug 17 01:05:56 2012 New Revision: 239345 URL: http://svn.freebsd.org/changeset/base/239345 Log: Make 'junk' volatile so that compilers won't be tempted to optimize Reviewed by: ache MFC after:3 days Modified: head/lib/libc/stdlib/random.c Modified: head/lib/libc/stdlib/random.c == --- head/lib/libc/stdlib/random.c Fri Aug 17 00:49:29 2012 (r239344) +++ head/lib/libc/stdlib/random.c Fri Aug 17 01:05:56 2012 (r239345) @@ -315,7 +315,7 @@ srandomdev() if (!done) { struct timeval tv; - unsigned long junk; + volatile unsigned long junk; gettimeofday(&tv, NULL); srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk); ___ 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: r239346 - head/sys/netinet/khelp
Author: lstewart Date: Fri Aug 17 01:49:51 2012 New Revision: 239346 URL: http://svn.freebsd.org/changeset/base/239346 Log: The TCP PAWS fix for kernels with fast tick rates (r231767) changed the TCP timestamp related stack variables to reference ms directly instead of ticks. The h_ertt(4) Khelp module relies on TCP timestamp information in order to calculate its enhanced RTT estimates, but was not updated as part of r231767. Consequently, h_ertt has not been calculating correct RTT estimates since r231767 was comitted, which in turn broke all delay-based congestion control algorithms because they rely on the h_ertt RTT estimates. Fix the breakage by switching h_ertt to use tcp_ts_getticks() in place of all previous uses of the ticks variable. This ensures all timestamp related variables in h_ertt use the same units as the TCP stack and therefore results in meaningful comparisons and RTT estimate calculations. Reported & tested by: Naeem Khademi (naeemk at ifi uio no) Discussed with: bz MFC after:3 days Modified: head/sys/netinet/khelp/h_ertt.c Modified: head/sys/netinet/khelp/h_ertt.c == --- head/sys/netinet/khelp/h_ertt.c Fri Aug 17 01:05:56 2012 (r239345) +++ head/sys/netinet/khelp/h_ertt.c Fri Aug 17 01:49:51 2012 (r239346) @@ -151,11 +151,13 @@ marked_packet_rtt(struct txseginfo *txsi *prtt_bytes_adjust += *pmeasurenext_len; } else { if (mflag & FORCED_MEASUREMENT) { - e_t->markedpkt_rtt = ticks - *pmeasurenext + 1; + e_t->markedpkt_rtt = tcp_ts_getticks() - + *pmeasurenext + 1; e_t->bytes_tx_in_marked_rtt = e_t->bytes_tx_in_rtt + *pmeasurenext_len - *prtt_bytes_adjust; } else { - e_t->markedpkt_rtt = ticks - txsi->tx_ts + 1; + e_t->markedpkt_rtt = tcp_ts_getticks() - + txsi->tx_ts + 1; e_t->bytes_tx_in_marked_rtt = e_t->bytes_tx_in_rtt - *prtt_bytes_adjust; } @@ -349,7 +351,7 @@ ertt_packet_measurement_hook(int hhook_t */ if (!e_t->dlyack_rx || multiack || new_sacked_bytes) { /* Make an accurate new measurement. */ - e_t->rtt = ticks - txsi->tx_ts + 1; + e_t->rtt = tcp_ts_getticks() - txsi->tx_ts + 1; if (e_t->rtt < e_t->minrtt || e_t->minrtt == 0) e_t->minrtt = e_t->rtt; @@ -477,7 +479,7 @@ ertt_add_tx_segment_info_hook(int hhook_ tp->ts_offset; txsi->rx_ts = ntohl(to->to_tsecr); } else { - txsi->tx_ts = ticks; + txsi->tx_ts = tcp_ts_getticks(); txsi->rx_ts = 0; /* No received time stamp. */ } TAILQ_INSERT_TAIL(&e_t->txsegi_q, txsi, txsegi_lnk); ___ 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: r239347 - in head: lib/libc/gen lib/libc/sys lib/libthr/thread sys/compat/freebsd32 sys/kern sys/sys
Author: davidxu Date: Fri Aug 17 02:26:31 2012 New Revision: 239347 URL: http://svn.freebsd.org/changeset/base/239347 Log: Implement syscall clock_getcpuclockid2, so we can get a clock id for process, thread or others we want to support. Use the syscall to implement POSIX API clock_getcpuclock and pthread_getcpuclockid. PR: 168417 Added: head/lib/libc/gen/clock_getcpuclockid.c (contents, props changed) Modified: head/lib/libc/gen/Makefile.inc head/lib/libc/gen/Symbol.map head/lib/libc/gen/sysconf.c head/lib/libc/sys/Symbol.map head/lib/libthr/thread/thr_getcpuclockid.c head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/compat/freebsd32/syscalls.master head/sys/kern/init_sysent.c head/sys/kern/kern_time.c head/sys/kern/syscalls.c head/sys/kern/syscalls.master head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h head/sys/sys/time.h head/sys/sys/unistd.h Modified: head/lib/libc/gen/Makefile.inc == --- head/lib/libc/gen/Makefile.inc Fri Aug 17 01:49:51 2012 (r239346) +++ head/lib/libc/gen/Makefile.inc Fri Aug 17 02:26:31 2012 (r239347) @@ -8,7 +8,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 auxv.c basename.c check_utility_compat.c \ - clock.c closedir.c confstr.c \ + clock.c clock_getcpuclockid.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 \ exec.c fdevname.c feature_present.c fmtcheck.c fmtmsg.c fnmatch.c \ Modified: head/lib/libc/gen/Symbol.map == --- head/lib/libc/gen/Symbol.mapFri Aug 17 01:49:51 2012 (r239346) +++ head/lib/libc/gen/Symbol.mapFri Aug 17 02:26:31 2012 (r239347) @@ -382,6 +382,7 @@ FBSD_1.2 { }; FBSD_1.3 { + clock_getcpuclockid; dirfd; fdlopen; __FreeBSD_libc_enter_restricted_mode; Added: head/lib/libc/gen/clock_getcpuclockid.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/gen/clock_getcpuclockid.c Fri Aug 17 02:26:31 2012 (r239347) @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2012 David Xu . + * 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 DANIEL EISCHEN 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +clockid_t +clock_getcpuclockid(pid_t pid, clockid_t *clock_id) +{ + return clock_getcpuclockid2(pid, CPUCLOCK_WHICH_PID, clock_id); +} Modified: head/lib/libc/gen/sysconf.c == --- head/lib/libc/gen/sysconf.c Fri Aug 17 01:49:51 2012(r239346) +++ head/lib/libc/gen/sysconf.c Fri Aug 17 02:26:31 2012(r239347) @@ -359,11 +359,7 @@ yesno: return (_POSIX_CLOCK_SELECTION); #endif case _SC_CPUTIME: -#if _POSIX_CPUTIME == 0 -#error "_POSIX_CPUTIME" -#else return (_POSIX_CPUTIME); -#endif #ifdef notdef case _SC_FILE_LOCKING: /* Modified: head/lib/libc/sys/Symbol.map == --- head/lib/libc/
svn commit: r239348 - in head: contrib/file lib/libmagic
Author: mckay Date: Fri Aug 17 02:27:17 2012 New Revision: 239348 URL: http://svn.freebsd.org/changeset/base/239348 Log: Correct a regression introduced during the import of file(1) 5.11. Magic tests containing "search" or "regex" directives were incorrectly compiled by "mkmagic" and were effectively ignored. This caused troff files (for example) to be detected as simply "ASCII text" instead of as "troff or preprocessor input, ASCII text". PR: bin/170415 Approved by: consensus on developers@ MFC after:3 days Modified: head/contrib/file/apprentice.c head/lib/libmagic/Makefile Modified: head/contrib/file/apprentice.c == --- head/contrib/file/apprentice.c Fri Aug 17 02:26:31 2012 (r239347) +++ head/contrib/file/apprentice.c Fri Aug 17 02:27:17 2012 (r239348) @@ -648,7 +648,6 @@ set_test_type(struct magic *mstart, stru break; case FILE_REGEX: case FILE_SEARCH: -#ifndef COMPILE_ONLY /* Check for override */ if (mstart->str_flags & STRING_BINTEST) mstart->flag |= BINTEST; @@ -664,7 +663,6 @@ set_test_type(struct magic *mstart, stru mstart->flag |= BINTEST; else mstart->flag |= TEXTTEST; -#endif break; case FILE_DEFAULT: /* can't deduce anything; we shouldn't see this at the Modified: head/lib/libmagic/Makefile == --- head/lib/libmagic/Makefile Fri Aug 17 02:26:31 2012(r239347) +++ head/lib/libmagic/Makefile Fri Aug 17 02:27:17 2012(r239348) @@ -39,7 +39,7 @@ magic.mgc: mkmagic magic CLEANFILES+= mkmagic build-tools: mkmagic -mkmagic: apprentice.c funcs.c getline.c magic.c print.c +mkmagic: apprentice.c encoding.c funcs.c getline.c magic.c print.c ${CC} ${CFLAGS} -DCOMPILE_ONLY -DHOSTPROG ${LDFLAGS} \ -o ${.TARGET} ${.ALLSRC} ___ 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: r239349 - in head/sys: compat/freebsd32 kern sys
Author: davidxu Date: Fri Aug 17 02:47:16 2012 New Revision: 239349 URL: http://svn.freebsd.org/changeset/base/239349 Log: regen. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_proto.h == --- head/sys/compat/freebsd32/freebsd32_proto.h Fri Aug 17 02:27:17 2012 (r239348) +++ head/sys/compat/freebsd32/freebsd32_proto.h Fri Aug 17 02:47:16 2012 (r239349) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 239296 2012-08-15 15:17:56Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 239347 2012-08-17 02:26:31Z davidxu */ #ifndef _FREEBSD32_SYSPROTO_H_ Modified: head/sys/compat/freebsd32/freebsd32_syscall.h == --- head/sys/compat/freebsd32/freebsd32_syscall.h Fri Aug 17 02:27:17 2012(r239348) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Fri Aug 17 02:47:16 2012(r239349) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 239296 2012-08-15 15:17:56Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 239347 2012-08-17 02:26:31Z davidxu */ #defineFREEBSD32_SYS_syscall 0 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c == --- head/sys/compat/freebsd32/freebsd32_syscalls.c Fri Aug 17 02:27:17 2012(r239348) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Fri Aug 17 02:47:16 2012(r239349) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 239296 2012-08-15 15:17:56Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 239347 2012-08-17 02:26:31Z davidxu */ const char *freebsd32_syscallnames[] = { Modified: head/sys/compat/freebsd32/freebsd32_sysent.c == --- head/sys/compat/freebsd32/freebsd32_sysent.cFri Aug 17 02:27:17 2012(r239348) +++ head/sys/compat/freebsd32/freebsd32_sysent.cFri Aug 17 02:47:16 2012(r239349) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 239296 2012-08-15 15:17:56Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 239347 2012-08-17 02:26:31Z davidxu */ #include "opt_compat.h" Modified: head/sys/kern/init_sysent.c == --- head/sys/kern/init_sysent.c Fri Aug 17 02:27:17 2012(r239348) +++ head/sys/kern/init_sysent.c Fri Aug 17 02:47:16 2012(r239349) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 236026 2012-05-25 21:50:48Z ed + * created from FreeBSD: head/sys/kern/syscalls.master 239347 2012-08-17 02:26:31Z davidxu */ #include "opt_compat.h" Modified: head/sys/kern/syscalls.c == --- head/sys/kern/syscalls.cFri Aug 17 02:27:17 2012(r239348) +++ head/sys/kern/syscalls.cFri Aug 17 02:47:16 2012(r239349) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 236026 2012-05-25 21:50:48Z ed + * created from FreeBSD: head/sys/kern/syscalls.master 239347 2012-08-17 02:26:31Z davidxu */ const char *syscallnames[] = { Modified: head/sys/sys/syscall.h == --- head/sys/sys/syscall.h Fri Aug 17 02:27:17 2012(r239348) +++ head/sys/sys/syscall.h Fri Aug 17 02:47:16 2012(r239349) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 236026 2012-05-25 21:50:48Z ed + * created from FreeBSD: head/sys/kern/syscalls.master 239347 2012-08-17 02:26:31Z davidxu */ #defineSYS_syscall 0 Modified: head/sys/sys/syscall.mk == --- head/sys/sys/
svn commit: r239351 - in head/sys: arm/xscale/ixp425 mips/atheros mips/cavium mips/rt305x
Author: rpaulo Date: Fri Aug 17 04:44:57 2012 New Revision: 239351 URL: http://svn.freebsd.org/changeset/base/239351 Log: The GPIO drivers were initialising their mutexes with type of MTX_NETWORK_LOCK. This is wrong since these mutexes have nothing to do with networking. Modified: head/sys/arm/xscale/ixp425/cambria_gpio.c head/sys/mips/atheros/ar71xx_gpio.c head/sys/mips/cavium/octeon_gpio.c head/sys/mips/rt305x/rt305x_gpio.c Modified: head/sys/arm/xscale/ixp425/cambria_gpio.c == --- head/sys/arm/xscale/ixp425/cambria_gpio.c Fri Aug 17 03:10:48 2012 (r239350) +++ head/sys/arm/xscale/ixp425/cambria_gpio.c Fri Aug 17 04:44:57 2012 (r239351) @@ -435,8 +435,7 @@ cambria_gpio_attach(device_t dev) sc->sc_iot = ixp425_softc->sc_iot; sc->sc_gpio_ioh = ixp425_softc->sc_gpio_ioh; - mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); for (pin = 0; pin < GPIO_PINS; pin++) { struct cambria_gpio_pin *p = &cambria_gpio_pins[pin]; Modified: head/sys/mips/atheros/ar71xx_gpio.c == --- head/sys/mips/atheros/ar71xx_gpio.c Fri Aug 17 03:10:48 2012 (r239350) +++ head/sys/mips/atheros/ar71xx_gpio.c Fri Aug 17 04:44:57 2012 (r239351) @@ -335,8 +335,7 @@ ar71xx_gpio_attach(device_t dev) KASSERT((device_get_unit(dev) == 0), ("ar71xx_gpio: Only one gpio module supported")); - mtx_init(&sc->gpio_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); + mtx_init(&sc->gpio_mtx, device_get_nameunit(dev), NULL, MTX_DEF); /* Map control/status registers. */ sc->gpio_mem_rid = 0; Modified: head/sys/mips/cavium/octeon_gpio.c == --- head/sys/mips/cavium/octeon_gpio.c Fri Aug 17 03:10:48 2012 (r239350) +++ head/sys/mips/cavium/octeon_gpio.c Fri Aug 17 04:44:57 2012 (r239351) @@ -383,8 +383,7 @@ octeon_gpio_attach(device_t dev) KASSERT((device_get_unit(dev) == 0), ("octeon_gpio: Only one gpio module supported")); - mtx_init(&sc->gpio_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); + mtx_init(&sc->gpio_mtx, device_get_nameunit(dev), NULL, MTX_DEF); for ( i = 0; i < OCTEON_GPIO_IRQS; i++) { if ((sc->gpio_irq_res[i] = bus_alloc_resource(dev, Modified: head/sys/mips/rt305x/rt305x_gpio.c == --- head/sys/mips/rt305x/rt305x_gpio.c Fri Aug 17 03:10:48 2012 (r239350) +++ head/sys/mips/rt305x/rt305x_gpio.c Fri Aug 17 04:44:57 2012 (r239351) @@ -447,8 +447,7 @@ rt305x_gpio_attach(device_t dev) KASSERT((device_get_unit(dev) == 0), ("rt305x_gpio_gpio: Only one gpio module supported")); - mtx_init(&sc->gpio_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); + mtx_init(&sc->gpio_mtx, device_get_nameunit(dev), NULL, MTX_DEF); /* Map control/status registers. */ sc->gpio_mem_rid = 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: r239352 - head/sys/mips/mips
Author: alc Date: Fri Aug 17 05:02:29 2012 New Revision: 239352 URL: http://svn.freebsd.org/changeset/base/239352 Log: Fix two problems with pmap_clear_modify(). First, pmap_clear_modify() is write protecting all mappings to the specified page, not just clearing the modified bit. Specifically, it sets PTE_RO on the PTE, which is wrong. Moreover, it is calling vm_page_dirty(), which is not the expected behavior for pmap_clear_modify(). Generally speaking, the machine-independent VM layer masks these mistakes. For example, setting PTE_RO will result in additional soft faults, but not a catastrophe. Second, pmap_clear_modify() may not clear the modified bits because it only iterates over the PV list when the page has the PV_TABLE_MOD flag set and elsewhere the pmap clears the PV_TABLE_MOD flag anytime a modified mapping is write protected or destroyed. However, the page may still have other mappings with the modified bit set. Eliminate a stale comment. Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c == --- head/sys/mips/mips/pmap.c Fri Aug 17 04:44:57 2012(r239351) +++ head/sys/mips/mips/pmap.c Fri Aug 17 05:02:29 2012(r239352) @@ -179,7 +179,6 @@ static vm_page_t pmap_pv_reclaim(pmap_t static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va); -static __inline void pmap_changebit(vm_page_t m, int bit, boolean_t setem); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); static int pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va, @@ -2664,8 +2663,6 @@ pmap_remove_pages(pmap_t pmap) /* * pmap_testbit tests bits in pte's - * note that the testbit/changebit routines are inline, - * and a lot of things compile-time evaluate. */ static boolean_t pmap_testbit(vm_page_t m, int bit) @@ -2692,51 +2689,6 @@ pmap_testbit(vm_page_t m, int bit) } /* - * this routine is used to clear dirty bits in ptes - */ -static __inline void -pmap_changebit(vm_page_t m, int bit, boolean_t setem) -{ - pv_entry_t pv; - pmap_t pmap; - pt_entry_t *pte; - - if (m->oflags & VPO_UNMANAGED) - return; - - rw_assert(&pvh_global_lock, RA_WLOCKED); - /* -* Loop over all current mappings setting/clearing as appropos If -* setting RO do we need to clear the VAC? -*/ - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - pmap = PV_PMAP(pv); - PMAP_LOCK(pmap); - pte = pmap_pte(pmap, pv->pv_va); - if (setem) { - *pte |= bit; - pmap_update_page(pmap, pv->pv_va, *pte); - } else { - pt_entry_t pbits = *pte; - - if (pbits & bit) { - if (bit == PTE_D) { - if (pbits & PTE_D) - vm_page_dirty(m); - *pte = (pbits & ~PTE_D) | PTE_RO; - } else { - *pte = pbits & ~bit; - } - pmap_update_page(pmap, pv->pv_va, *pte); - } - } - PMAP_UNLOCK(pmap); - } - if (!setem && bit == PTE_D) - vm_page_aflag_clear(m, PGA_WRITEABLE); -} - -/* * pmap_page_wired_mappings: * * Return the number of managed mappings to the given physical page @@ -2896,6 +2848,9 @@ pmap_is_prefaultable(pmap_t pmap, vm_off void pmap_clear_modify(vm_page_t m) { + pmap_t pmap; + pt_entry_t *pte; + pv_entry_t pv; KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); @@ -2911,10 +2866,17 @@ pmap_clear_modify(vm_page_t m) if ((m->aflags & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); - if (m->md.pv_flags & PV_TABLE_MOD) { - pmap_changebit(m, PTE_D, FALSE); - m->md.pv_flags &= ~PV_TABLE_MOD; + TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + pmap = PV_PMAP(pv); + PMAP_LOCK(pmap); + pte = pmap_pte(pmap, pv->pv_va); + if (pte_test(pte, PTE_D)) { + pte_clear(pte, PTE_D); + pmap_update_page(pmap, pv->pv_va, *pte); + } + PMAP_UNLOCK(pmap); } + m->md.pv_flags &= ~PV_TABLE_MOD; rw_wunlock(&pvh_global_lock); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-he
svn commit: r239353 - head/sys/netinet
Author: rrs Date: Fri Aug 17 05:51:46 2012 New Revision: 239353 URL: http://svn.freebsd.org/changeset/base/239353 Log: Ok jhb, lets move the ifa_free() down to the bottom to assure that *all* tables and such are removed before we start to free. This won't protect the Hash in ip_input.c but in theory should protect any other uses that *do* use locks. MFC after:1 week (or more) Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c == --- head/sys/netinet/in.c Fri Aug 17 05:02:29 2012(r239352) +++ head/sys/netinet/in.c Fri Aug 17 05:51:46 2012(r239353) @@ -573,7 +573,6 @@ in_control(struct socket *so, u_long cmd } TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); -/* ifa_free(&ia->ia_ifa); - Double free?? */ /* if_addrhead */ IN_IFADDR_WLOCK(); TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); @@ -597,6 +596,7 @@ in_control(struct socket *so, u_long cmd } else ifa_free(&iap->ia_ifa); + ifa_free(&ia->ia_ifa); /* if_addrhead */ ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ out: if (ia != NULL) ___ 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"