From owner-svn-src-head@freebsd.org Sun Sep 6 05:50:53 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2220C9CB5EA; Sun, 6 Sep 2015 05:50:53 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1358112EA; Sun, 6 Sep 2015 05:50:53 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t865oqNJ068448; Sun, 6 Sep 2015 05:50:52 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t865oqkB068441; Sun, 6 Sep 2015 05:50:52 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201509060550.t865oqkB068441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sun, 6 Sep 2015 05:50:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287497 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2015 05:50:53 -0000 Author: mckusick Date: Sun Sep 6 05:50:51 2015 New Revision: 287497 URL: https://svnweb.freebsd.org/changeset/base/287497 Log: Track changes to kern.maxvnodes and appropriately increase or decrease the size of the name cache hash table (mapping file names to vnodes) and the vnode hash table (mapping mount point and inode number to vnode). An appropriate locking strategy is the key to changing hash table sizes while they are in active use. Reviewed by: kib Tested by: Peter Holm Differential Revision: https://reviews.freebsd.org/D2265 MFC after: 2 weeks Modified: head/sys/kern/vfs_cache.c head/sys/kern/vfs_hash.c head/sys/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Sep 5 23:22:59 2015 (r287496) +++ head/sys/kern/vfs_cache.c Sun Sep 6 05:50:51 2015 (r287497) @@ -327,11 +327,17 @@ sysctl_debug_hashstat_rawnchash(SYSCTL_H struct namecache *ncp; int i, error, n_nchash, *cntbuf; +retry: n_nchash = nchash + 1; /* nchash is max index, not count */ if (req->oldptr == NULL) return SYSCTL_OUT(req, 0, n_nchash * sizeof(int)); cntbuf = malloc(n_nchash * sizeof(int), M_TEMP, M_ZERO | M_WAITOK); CACHE_RLOCK(); + if (n_nchash != nchash + 1) { + CACHE_RUNLOCK(); + free(cntbuf, M_TEMP); + goto retry; + } /* Scan hash tables counting entries */ for (ncpp = nchashtbl, i = 0; i < n_nchash; ncpp++, i++) LIST_FOREACH(ncp, ncpp, nc_hash) @@ -930,6 +936,44 @@ nchinit(void *dummy __unused) } SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_SECOND, nchinit, NULL); +void +cache_changesize(int newmaxvnodes) +{ + struct nchashhead *new_nchashtbl, *old_nchashtbl; + u_long new_nchash, old_nchash; + struct namecache *ncp; + uint32_t hash; + int i; + + new_nchashtbl = hashinit(newmaxvnodes * 2, M_VFSCACHE, &new_nchash); + /* If same hash table size, nothing to do */ + if (nchash == new_nchash) { + free(new_nchashtbl, M_VFSCACHE); + return; + } + /* + * Move everything from the old hash table to the new table. + * None of the namecache entries in the table can be removed + * because to do so, they have to be removed from the hash table. + */ + CACHE_WLOCK(); + old_nchashtbl = nchashtbl; + old_nchash = nchash; + nchashtbl = new_nchashtbl; + nchash = new_nchash; + for (i = 0; i <= old_nchash; i++) { + while ((ncp = LIST_FIRST(&old_nchashtbl[i])) != NULL) { + hash = fnv_32_buf(nc_get_name(ncp), ncp->nc_nlen, + FNV1_32_INIT); + hash = fnv_32_buf(&ncp->nc_dvp, sizeof(ncp->nc_dvp), + hash); + LIST_REMOVE(ncp, nc_hash); + LIST_INSERT_HEAD(NCHHASH(hash), ncp, nc_hash); + } + } + CACHE_WUNLOCK(); + free(old_nchashtbl, M_VFSCACHE); +} /* * Invalidate all entries to a particular vnode. Modified: head/sys/kern/vfs_hash.c ============================================================================== --- head/sys/kern/vfs_hash.c Sat Sep 5 23:22:59 2015 (r287496) +++ head/sys/kern/vfs_hash.c Sun Sep 6 05:50:51 2015 (r287497) @@ -161,3 +161,40 @@ vfs_hash_rehash(struct vnode *vp, u_int vp->v_hash = hash; rw_wunlock(&vfs_hash_lock); } + +void +vfs_hash_changesize(int newmaxvnodes) +{ + struct vfs_hash_head *vfs_hash_newtbl, *vfs_hash_oldtbl; + u_long vfs_hash_newmask, vfs_hash_oldmask; + struct vnode *vp; + int i; + + vfs_hash_newtbl = hashinit(newmaxvnodes, M_VFS_HASH, + &vfs_hash_newmask); + /* If same hash table size, nothing to do */ + if (vfs_hash_mask == vfs_hash_newmask) { + free(vfs_hash_newtbl, M_VFS_HASH); + return; + } + /* + * Move everything from the old hash table to the new table. + * None of the vnodes in the table can be recycled because to + * do so, they have to be removed from the hash table. + */ + rw_wlock(&vfs_hash_lock); + vfs_hash_oldtbl = vfs_hash_tbl; + vfs_hash_oldmask = vfs_hash_mask; + vfs_hash_tbl = vfs_hash_newtbl; + vfs_hash_mask = vfs_hash_newmask; + for (i = 0; i <= vfs_hash_oldmask; i++) { + while ((vp = LIST_FIRST(&vfs_hash_oldtbl[i])) != NULL) { + LIST_REMOVE(vp, v_hashlist); + LIST_INSERT_HEAD( + vfs_hash_bucket(vp->v_mount, vp->v_hash), + vp, v_hashlist); + } + } + rw_wunlock(&vfs_hash_lock); + free(vfs_hash_oldtbl, M_VFS_HASH); +} Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sat Sep 5 23:22:59 2015 (r287496) +++ head/sys/kern/vfs_subr.c Sun Sep 6 05:50:51 2015 (r287497) @@ -281,8 +281,25 @@ static enum { SYNCER_RUNNING, SYNCER_SHU * XXX desiredvnodes is historical cruft and should not exist. */ int desiredvnodes; -SYSCTL_INT(_kern, KERN_MAXVNODES, maxvnodes, CTLFLAG_RW, - &desiredvnodes, 0, "Maximum number of vnodes"); + +static int +sysctl_update_desiredvnodes(SYSCTL_HANDLER_ARGS) +{ + int error, old_desiredvnodes; + + old_desiredvnodes = desiredvnodes; + if ((error = sysctl_handle_int(oidp, arg1, arg2, req)) != 0) + return (error); + if (old_desiredvnodes != desiredvnodes) { + vfs_hash_changesize(desiredvnodes); + cache_changesize(desiredvnodes); + } + return (0); +} + +SYSCTL_PROC(_kern, KERN_MAXVNODES, maxvnodes, + CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, &desiredvnodes, 0, + sysctl_update_desiredvnodes, "I", "Maximum number of vnodes"); SYSCTL_ULONG(_kern, OID_AUTO, minvnodes, CTLFLAG_RW, &wantfreevnodes, 0, "Minimum number of vnodes (legacy)"); static int vnlru_nowhere; Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Sat Sep 5 23:22:59 2015 (r287496) +++ head/sys/sys/vnode.h Sun Sep 6 05:50:51 2015 (r287497) @@ -607,6 +607,7 @@ struct vnode; typedef int (*vn_get_ino_t)(struct mount *, void *, int, struct vnode **); /* cache_* may belong in namei.h. */ +void cache_changesize(int newhashsize); #define cache_enter(dvp, vp, cnp) \ cache_enter_time(dvp, vp, cnp, NULL, NULL) void cache_enter_time(struct vnode *dvp, struct vnode *vp, @@ -843,6 +844,7 @@ int fifo_printinfo(struct vnode *); /* vfs_hash.c */ typedef int vfs_hash_cmp_t(struct vnode *vp, void *arg); +void vfs_hash_changesize(int newhashsize); int vfs_hash_get(const struct mount *mp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg); u_int vfs_hash_index(struct vnode *vp); int vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg); From owner-svn-src-head@freebsd.org Sun Sep 6 09:54:57 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 793C99CB9B1; Sun, 6 Sep 2015 09:54:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 686861915; Sun, 6 Sep 2015 09:54:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t869svaI069257; Sun, 6 Sep 2015 09:54:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t869sufK069253; Sun, 6 Sep 2015 09:54:56 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509060954.t869sufK069253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 6 Sep 2015 09:54:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287499 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2015 09:54:57 -0000 Author: mav Date: Sun Sep 6 09:54:56 2015 New Revision: 287499 URL: https://svnweb.freebsd.org/changeset/base/287499 Log: Move setting of media parameters inside open routines. This is preparation for possibility to open/close media several times per LUN life cycle. While there, rename variables to reduce confusion. As additional bonus this allows to open read-only media, such as ZFS snapshots. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend.h head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Sep 6 09:41:08 2015 (r287498) +++ head/sys/cam/ctl/ctl.c Sun Sep 6 09:54:56 2015 (r287499) @@ -4001,7 +4001,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft struct ctl_lun *nlun, *lun; struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; - const char *eui, *naa, *scsiname, *vendor, *value; + const char *eui, *naa, *scsiname, *vendor; int lun_number, i, lun_malloced; int devidlen, idlen1, idlen2 = 0, len; @@ -4167,21 +4167,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft if (be_lun->flags & CTL_LUN_FLAG_PRIMARY) lun->flags |= CTL_LUN_PRIMARY_SC; - value = ctl_get_opt(&be_lun->options, "readonly"); - if (value != NULL && strcmp(value, "on") == 0) - lun->flags |= CTL_LUN_READONLY; - - lun->serseq = CTL_LUN_SERSEQ_OFF; - if (be_lun->flags & CTL_LUN_FLAG_SERSEQ_READ) - lun->serseq = CTL_LUN_SERSEQ_READ; - value = ctl_get_opt(&be_lun->options, "serseq"); - if (value != NULL && strcmp(value, "on") == 0) - lun->serseq = CTL_LUN_SERSEQ_ON; - else if (value != NULL && strcmp(value, "read") == 0) - lun->serseq = CTL_LUN_SERSEQ_READ; - else if (value != NULL && strcmp(value, "off") == 0) - lun->serseq = CTL_LUN_SERSEQ_OFF; - lun->ctl_softc = ctl_softc; #ifdef CTL_TIME_IO lun->last_busy = getsbinuptime(); @@ -6274,7 +6259,7 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) header->datalen = MIN(total_len - 1, 254); if (control_dev == 0) { header->dev_specific = 0x10; /* DPOFUA */ - if ((lun->flags & CTL_LUN_READONLY) || + if ((lun->be_lun->flags & CTL_LUN_FLAG_READONLY) || (lun->mode_pages.control_page[CTL_PAGE_CURRENT] .eca_and_aen & SCP_SWP) != 0) header->dev_specific |= 0x80; /* WP */ @@ -6297,7 +6282,7 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) scsi_ulto2b(datalen, header->datalen); if (control_dev == 0) { header->dev_specific = 0x10; /* DPOFUA */ - if ((lun->flags & CTL_LUN_READONLY) || + if ((lun->be_lun->flags & CTL_LUN_FLAG_READONLY) || (lun->mode_pages.control_page[CTL_PAGE_CURRENT] .eca_and_aen & SCP_SWP) != 0) header->dev_specific |= 0x80; /* WP */ @@ -10530,15 +10515,16 @@ ctl_check_for_blockage(struct ctl_lun *l return (CTL_ACTION_BLOCK); case CTL_SER_EXTENT: return (ctl_extent_check(ooa_io, pending_io, - (lun->serseq == CTL_LUN_SERSEQ_ON))); + (lun->be_lun && lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); case CTL_SER_EXTENTOPT: if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT].queue_flags & SCP_QUEUE_ALG_MASK) != SCP_QUEUE_ALG_UNRESTRICTED) return (ctl_extent_check(ooa_io, pending_io, - (lun->serseq == CTL_LUN_SERSEQ_ON))); + (lun->be_lun && + lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); return (CTL_ACTION_PASS); case CTL_SER_EXTENTSEQ: - if (lun->serseq != CTL_LUN_SERSEQ_OFF) + if (lun->be_lun && lun->be_lun->serseq != CTL_LUN_SERSEQ_OFF) return (ctl_extent_check_seq(ooa_io, pending_io)); return (CTL_ACTION_PASS); case CTL_SER_PASS: @@ -10765,7 +10751,8 @@ ctl_scsiio_lun_check(struct ctl_lun *lun } if (entry->pattern & CTL_LUN_PAT_WRITE) { - if (lun->flags & CTL_LUN_READONLY) { + if (lun->be_lun && + lun->be_lun->flags & CTL_LUN_FLAG_READONLY) { ctl_set_sense(ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_DATA_PROTECT, /*asc*/ 0x27, /*ascq*/ 0x01, SSD_ELEM_NONE); Modified: head/sys/cam/ctl/ctl_backend.h ============================================================================== --- head/sys/cam/ctl/ctl_backend.h Sun Sep 6 09:41:08 2015 (r287498) +++ head/sys/cam/ctl/ctl_backend.h Sun Sep 6 09:54:56 2015 (r287499) @@ -86,9 +86,15 @@ typedef enum { CTL_LUN_FLAG_DEV_TYPE = 0x40, CTL_LUN_FLAG_UNMAP = 0x80, CTL_LUN_FLAG_OFFLINE = 0x100, - CTL_LUN_FLAG_SERSEQ_READ = 0x200 + CTL_LUN_FLAG_READONLY = 0x200 } ctl_backend_lun_flags; +typedef enum { + CTL_LUN_SERSEQ_OFF, + CTL_LUN_SERSEQ_READ, + CTL_LUN_SERSEQ_ON +} ctl_lun_serseq; + #ifdef _KERNEL #define CTL_BACKEND_DECLARE(name, driver) \ @@ -195,6 +201,7 @@ typedef void (*be_lun_config_t)(void *be struct ctl_be_lun { uint8_t lun_type; /* passed to CTL */ ctl_backend_lun_flags flags; /* passed to CTL */ + ctl_lun_serseq serseq; /* passed to CTL */ void *be_lun; /* passed to CTL */ uint64_t maxlba; /* passed to CTL */ uint32_t blocksize; /* passed to CTL */ Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Sun Sep 6 09:41:08 2015 (r287498) +++ head/sys/cam/ctl/ctl_backend_block.c Sun Sep 6 09:54:56 2015 (r287499) @@ -116,7 +116,6 @@ typedef enum { CTL_BE_BLOCK_LUN_UNCONFIGURED = 0x01, CTL_BE_BLOCK_LUN_CONFIG_ERR = 0x02, CTL_BE_BLOCK_LUN_WAITING = 0x04, - CTL_BE_BLOCK_LUN_MULTI_THREAD = 0x08 } ctl_be_block_lun_flags; typedef enum { @@ -167,18 +166,11 @@ struct ctl_be_block_lun { uma_zone_t lun_zone; uint64_t size_blocks; uint64_t size_bytes; - uint32_t blocksize; - uint16_t pblockexp; - uint16_t pblockoff; - uint16_t ublockexp; - uint16_t ublockoff; - uint32_t atomicblock; - uint32_t opttxferlen; struct ctl_be_block_softc *softc; struct devstat *disk_stats; ctl_be_block_lun_flags flags; STAILQ_ENTRY(ctl_be_block_lun) links; - struct ctl_be_lun ctl_be_lun; + struct ctl_be_lun cbe_lun; struct taskqueue *io_taskqueue; struct task io_task; int num_threads; @@ -768,7 +760,7 @@ ctl_be_block_gls_file(struct ctl_be_bloc DPRINTF("entered\n"); - off = roff = ((off_t)lbalen->lba) * be_lun->blocksize; + off = roff = ((off_t)lbalen->lba) * be_lun->cbe_lun.blocksize; vn_lock(be_lun->vn, LK_SHARED | LK_RETRY); error = VOP_IOCTL(be_lun->vn, FIOSEEKHOLE, &off, 0, curthread->td_ucred, curthread); @@ -788,8 +780,8 @@ ctl_be_block_gls_file(struct ctl_be_bloc data = (struct scsi_get_lba_status_data *)io->scsiio.kern_data_ptr; scsi_u64to8b(lbalen->lba, data->descr[0].addr); - scsi_ulto4b(MIN(UINT32_MAX, off / be_lun->blocksize - lbalen->lba), - data->descr[0].length); + scsi_ulto4b(MIN(UINT32_MAX, off / be_lun->cbe_lun.blocksize - + lbalen->lba), data->descr[0].length); data->descr[0].status = status; ctl_complete_beio(beio); @@ -810,14 +802,14 @@ ctl_be_block_getattr_file(struct ctl_be_ if (strcmp(attrname, "blocksused") == 0) { error = VOP_GETATTR(be_lun->vn, &vattr, curthread->td_ucred); if (error == 0) - val = vattr.va_bytes / be_lun->blocksize; + val = vattr.va_bytes / be_lun->cbe_lun.blocksize; } if (strcmp(attrname, "blocksavail") == 0 && (be_lun->vn->v_iflag & VI_DOOMED) == 0) { error = VFS_STATFS(be_lun->vn->v_mount, &statfs); if (error == 0) val = statfs.f_bavail * statfs.f_bsize / - be_lun->blocksize; + be_lun->cbe_lun.blocksize; } VOP_UNLOCK(be_lun->vn, 0); return (val); @@ -928,7 +920,7 @@ ctl_be_block_gls_zvol(struct ctl_be_bloc DPRINTF("entered\n"); - off = roff = ((off_t)lbalen->lba) * be_lun->blocksize; + off = roff = ((off_t)lbalen->lba) * be_lun->cbe_lun.blocksize; error = (*dev_data->csw->d_ioctl)(dev_data->cdev, FIOSEEKHOLE, (caddr_t)&off, FREAD, curthread); if (error == 0 && off > roff) @@ -946,8 +938,8 @@ ctl_be_block_gls_zvol(struct ctl_be_bloc data = (struct scsi_get_lba_status_data *)io->scsiio.kern_data_ptr; scsi_u64to8b(lbalen->lba, data->descr[0].addr); - scsi_ulto4b(MIN(UINT32_MAX, off / be_lun->blocksize - lbalen->lba), - data->descr[0].length); + scsi_ulto4b(MIN(UINT32_MAX, off / be_lun->cbe_lun.blocksize - + lbalen->lba), data->descr[0].length); data->descr[0].status = status; ctl_complete_beio(beio); @@ -1003,7 +995,7 @@ ctl_be_block_unmap_dev_range(struct ctl_ uint64_t maxlen; dev_data = &be_lun->backend.dev; - maxlen = LONG_MAX - (LONG_MAX % be_lun->blocksize); + maxlen = LONG_MAX - (LONG_MAX % be_lun->cbe_lun.blocksize); while (len > 0) { bio = g_alloc_bio(); bio->bio_cmd = BIO_DELETE; @@ -1013,7 +1005,7 @@ ctl_be_block_unmap_dev_range(struct ctl_ bio->bio_data = 0; bio->bio_done = ctl_be_block_biodone; bio->bio_caller1 = beio; - bio->bio_pblkno = off / be_lun->blocksize; + bio->bio_pblkno = off / be_lun->cbe_lun.blocksize; off += bio->bio_length; len -= bio->bio_length; @@ -1055,11 +1047,11 @@ ctl_be_block_unmap_dev(struct ctl_be_blo end = buf + ptrlen->len / sizeof(*buf); for (; buf < end; buf++) { len = (uint64_t)scsi_4btoul(buf->length) * - be_lun->blocksize; + be_lun->cbe_lun.blocksize; beio->io_len += len; ctl_be_block_unmap_dev_range(be_lun, beio, - scsi_8btou64(buf->lba) * be_lun->blocksize, len, - (end - buf < 2) ? TRUE : FALSE); + scsi_8btou64(buf->lba) * be_lun->cbe_lun.blocksize, + len, (end - buf < 2) ? TRUE : FALSE); } } else ctl_be_block_unmap_dev_range(be_lun, beio, @@ -1111,7 +1103,7 @@ ctl_be_block_dispatch_dev(struct ctl_be_ bio->bio_offset = cur_offset; bio->bio_data = cur_ptr; bio->bio_done = ctl_be_block_biodone; - bio->bio_pblkno = cur_offset / be_lun->blocksize; + bio->bio_pblkno = cur_offset / be_lun->cbe_lun.blocksize; cur_offset += bio->bio_length; cur_ptr += bio->bio_length; @@ -1158,6 +1150,7 @@ static void ctl_be_block_cw_dispatch_sync(struct ctl_be_block_lun *be_lun, union ctl_io *io) { + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; struct ctl_be_block_io *beio; struct ctl_lba_len_flags *lbalen; @@ -1165,8 +1158,8 @@ ctl_be_block_cw_dispatch_sync(struct ctl beio = (struct ctl_be_block_io *)PRIV(io)->ptr; lbalen = (struct ctl_lba_len_flags *)&io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; - beio->io_len = lbalen->len * be_lun->blocksize; - beio->io_offset = lbalen->lba * be_lun->blocksize; + beio->io_len = lbalen->len * cbe_lun->blocksize; + beio->io_offset = lbalen->lba * cbe_lun->blocksize; beio->io_arg = (lbalen->flags & SSC_IMMED) != 0; beio->bio_cmd = BIO_FLUSH; beio->ds_trans_type = DEVSTAT_NO_DATA; @@ -1195,6 +1188,7 @@ static void ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun, union ctl_io *io) { + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; struct ctl_be_block_io *beio; struct ctl_lba_len_flags *lbalen; uint64_t len_left, lba; @@ -1221,8 +1215,8 @@ ctl_be_block_cw_dispatch_ws(struct ctl_b } if (lbalen->flags & (SWS_UNMAP | SWS_ANCHOR)) { - beio->io_offset = lbalen->lba * be_lun->blocksize; - beio->io_len = (uint64_t)lbalen->len * be_lun->blocksize; + beio->io_offset = lbalen->lba * cbe_lun->blocksize; + beio->io_len = (uint64_t)lbalen->len * cbe_lun->blocksize; beio->bio_cmd = BIO_DELETE; beio->ds_trans_type = DEVSTAT_FREE; @@ -1236,27 +1230,27 @@ ctl_be_block_cw_dispatch_ws(struct ctl_b DPRINTF("WRITE SAME at LBA %jx len %u\n", (uintmax_t)lbalen->lba, lbalen->len); - pb = be_lun->blocksize << be_lun->pblockexp; - if (be_lun->pblockoff > 0) - pbo = pb - be_lun->blocksize * be_lun->pblockoff; + pb = cbe_lun->blocksize << be_lun->cbe_lun.pblockexp; + if (be_lun->cbe_lun.pblockoff > 0) + pbo = pb - cbe_lun->blocksize * be_lun->cbe_lun.pblockoff; else pbo = 0; - len_left = (uint64_t)lbalen->len * be_lun->blocksize; + len_left = (uint64_t)lbalen->len * cbe_lun->blocksize; for (i = 0, lba = 0; i < CTLBLK_MAX_SEGS && len_left > 0; i++) { /* * Setup the S/G entry for this chunk. */ seglen = MIN(CTLBLK_MAX_SEG, len_left); - if (pb > be_lun->blocksize) { - adj = ((lbalen->lba + lba) * be_lun->blocksize + + if (pb > cbe_lun->blocksize) { + adj = ((lbalen->lba + lba) * cbe_lun->blocksize + seglen - pbo) % pb; if (seglen > adj) seglen -= adj; else - seglen -= seglen % be_lun->blocksize; + seglen -= seglen % cbe_lun->blocksize; } else - seglen -= seglen % be_lun->blocksize; + seglen -= seglen % cbe_lun->blocksize; beio->sg_segs[i].len = seglen; beio->sg_segs[i].addr = uma_zalloc(be_lun->lun_zone, M_WAITOK); @@ -1268,16 +1262,16 @@ ctl_be_block_cw_dispatch_ws(struct ctl_b buf = beio->sg_segs[i].addr; end = buf + seglen; - for (; buf < end; buf += be_lun->blocksize) { - memcpy(buf, io->scsiio.kern_data_ptr, be_lun->blocksize); + for (; buf < end; buf += cbe_lun->blocksize) { + memcpy(buf, io->scsiio.kern_data_ptr, cbe_lun->blocksize); if (lbalen->flags & SWS_LBDATA) scsi_ulto4b(lbalen->lba + lba, buf); lba++; } } - beio->io_offset = lbalen->lba * be_lun->blocksize; - beio->io_len = lba * be_lun->blocksize; + beio->io_offset = lbalen->lba * cbe_lun->blocksize; + beio->io_len = lba * cbe_lun->blocksize; /* We can not do all in one run. Correct and schedule rerun. */ if (len_left > 0) { @@ -1462,6 +1456,7 @@ static void ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun, union ctl_io *io) { + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; struct ctl_be_block_io *beio; struct ctl_be_block_softc *softc; struct ctl_lba_len_flags *lbalen; @@ -1516,9 +1511,9 @@ ctl_be_block_dispatch(struct ctl_be_bloc lbas = CTLBLK_HALF_IO_SIZE; else lbas = CTLBLK_MAX_IO_SIZE; - lbas = MIN(lbalen->len - bptrlen->len, lbas / be_lun->blocksize); - beio->io_offset = (lbalen->lba + bptrlen->len) * be_lun->blocksize; - beio->io_len = lbas * be_lun->blocksize; + lbas = MIN(lbalen->len - bptrlen->len, lbas / cbe_lun->blocksize); + beio->io_offset = (lbalen->lba + bptrlen->len) * cbe_lun->blocksize; + beio->io_len = lbas * cbe_lun->blocksize; bptrlen->len += lbas; for (i = 0, len_left = beio->io_len; len_left > 0; i++) { @@ -1663,13 +1658,13 @@ static int ctl_be_block_submit(union ctl_io *io) { struct ctl_be_block_lun *be_lun; - struct ctl_be_lun *ctl_be_lun; + struct ctl_be_lun *cbe_lun; DPRINTF("entered\n"); - ctl_be_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[ + cbe_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[ CTL_PRIV_BACKEND_LUN].ptr; - be_lun = (struct ctl_be_block_lun *)ctl_be_lun->be_lun; + be_lun = (struct ctl_be_block_lun *)cbe_lun->be_lun; /* * Make sure we only get SCSI I/O. @@ -1739,6 +1734,7 @@ ctl_be_block_ioctl(struct cdev *dev, u_l static int ctl_be_block_open_file(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) { + struct ctl_be_lun *cbe_lun; struct ctl_be_block_filedata *file_data; struct ctl_lun_create_params *params; char *value; @@ -1747,6 +1743,7 @@ ctl_be_block_open_file(struct ctl_be_blo int error; error = 0; + cbe_lun = &be_lun->cbe_lun; file_data = &be_lun->backend.file; params = &be_lun->params; @@ -1755,6 +1752,8 @@ ctl_be_block_open_file(struct ctl_be_blo be_lun->lun_flush = ctl_be_block_flush_file; be_lun->get_lba_status = ctl_be_block_gls_file; be_lun->getattr = ctl_be_block_getattr_file; + be_lun->unmap = NULL; + cbe_lun->flags &= ~CTL_LUN_FLAG_UNMAP; error = VOP_GETATTR(be_lun->vn, &vattr, curthread->td_ucred); if (error != 0) { @@ -1779,19 +1778,11 @@ ctl_be_block_open_file(struct ctl_be_blo } } - file_data->cred = crhold(curthread->td_ucred); if (params->lun_size_bytes != 0) be_lun->size_bytes = params->lun_size_bytes; else be_lun->size_bytes = vattr.va_size; - /* - * We set the multi thread flag for file operations because all - * filesystems (in theory) are capable of allowing multiple readers - * of a file at once. So we want to get the maximum possible - * concurrency. - */ - be_lun->flags |= CTL_BE_BLOCK_LUN_MULTI_THREAD; /* * For files we can use any logical block size. Prefer 512 bytes @@ -1800,59 +1791,63 @@ ctl_be_block_open_file(struct ctl_be_blo * logical block size -- report it as physical block size. */ if (params->blocksize_bytes != 0) - be_lun->blocksize = params->blocksize_bytes; + cbe_lun->blocksize = params->blocksize_bytes; else - be_lun->blocksize = 512; + cbe_lun->blocksize = 512; + be_lun->size_blocks = be_lun->size_bytes / cbe_lun->blocksize; + cbe_lun->maxlba = (be_lun->size_blocks == 0) ? + 0 : (be_lun->size_blocks - 1); us = ps = vattr.va_blocksize; uo = po = 0; - value = ctl_get_opt(&be_lun->ctl_be_lun.options, "pblocksize"); + value = ctl_get_opt(&cbe_lun->options, "pblocksize"); if (value != NULL) ctl_expand_number(value, &ps); - value = ctl_get_opt(&be_lun->ctl_be_lun.options, "pblockoffset"); + value = ctl_get_opt(&cbe_lun->options, "pblockoffset"); if (value != NULL) ctl_expand_number(value, &po); - pss = ps / be_lun->blocksize; - pos = po / be_lun->blocksize; - if ((pss > 0) && (pss * be_lun->blocksize == ps) && (pss >= pos) && - ((pss & (pss - 1)) == 0) && (pos * be_lun->blocksize == po)) { - be_lun->pblockexp = fls(pss) - 1; - be_lun->pblockoff = (pss - pos) % pss; + pss = ps / cbe_lun->blocksize; + pos = po / cbe_lun->blocksize; + if ((pss > 0) && (pss * cbe_lun->blocksize == ps) && (pss >= pos) && + ((pss & (pss - 1)) == 0) && (pos * cbe_lun->blocksize == po)) { + cbe_lun->pblockexp = fls(pss) - 1; + cbe_lun->pblockoff = (pss - pos) % pss; } - value = ctl_get_opt(&be_lun->ctl_be_lun.options, "ublocksize"); + value = ctl_get_opt(&cbe_lun->options, "ublocksize"); if (value != NULL) ctl_expand_number(value, &us); - value = ctl_get_opt(&be_lun->ctl_be_lun.options, "ublockoffset"); + value = ctl_get_opt(&cbe_lun->options, "ublockoffset"); if (value != NULL) ctl_expand_number(value, &uo); - uss = us / be_lun->blocksize; - uos = uo / be_lun->blocksize; - if ((uss > 0) && (uss * be_lun->blocksize == us) && (uss >= uos) && - ((uss & (uss - 1)) == 0) && (uos * be_lun->blocksize == uo)) { - be_lun->ublockexp = fls(uss) - 1; - be_lun->ublockoff = (uss - uos) % uss; + uss = us / cbe_lun->blocksize; + uos = uo / cbe_lun->blocksize; + if ((uss > 0) && (uss * cbe_lun->blocksize == us) && (uss >= uos) && + ((uss & (uss - 1)) == 0) && (uos * cbe_lun->blocksize == uo)) { + cbe_lun->ublockexp = fls(uss) - 1; + cbe_lun->ublockoff = (uss - uos) % uss; } /* * Sanity check. The media size has to be at least one * sector long. */ - if (be_lun->size_bytes < be_lun->blocksize) { + if (be_lun->size_bytes < cbe_lun->blocksize) { error = EINVAL; snprintf(req->error_str, sizeof(req->error_str), "file %s size %ju < block size %u", be_lun->dev_path, - (uintmax_t)be_lun->size_bytes, be_lun->blocksize); + (uintmax_t)be_lun->size_bytes, cbe_lun->blocksize); } - be_lun->opttxferlen = CTLBLK_MAX_IO_SIZE / be_lun->blocksize; + cbe_lun->opttxferlen = CTLBLK_MAX_IO_SIZE / cbe_lun->blocksize; return (error); } static int ctl_be_block_open_dev(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) { + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; struct ctl_lun_create_params *params; struct vattr vattr; struct cdev *dev; @@ -1875,6 +1870,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc atomic = maxio = CTLBLK_MAX_IO_SIZE; } else { be_lun->dispatch = ctl_be_block_dispatch_dev; + be_lun->get_lba_status = NULL; atomic = 0; maxio = be_lun->backend.dev.cdev->si_iosize_max; if (maxio <= 0) @@ -1884,6 +1880,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc } be_lun->lun_flush = ctl_be_block_flush_dev; be_lun->getattr = ctl_be_block_getattr_dev; + be_lun->unmap = ctl_be_block_unmap_dev; error = VOP_GETATTR(be_lun->vn, &vattr, NOCRED); if (error) { @@ -1920,7 +1917,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc if ((params->blocksize_bytes != 0) && (params->blocksize_bytes >= tmp)) { if (params->blocksize_bytes % tmp == 0) { - be_lun->blocksize = params->blocksize_bytes; + cbe_lun->blocksize = params->blocksize_bytes; } else { snprintf(req->error_str, sizeof(req->error_str), "requested blocksize %u is not an even " @@ -1935,7 +1932,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc "blocksize %u", params->blocksize_bytes, tmp); return (EINVAL); } else - be_lun->blocksize = tmp; + cbe_lun->blocksize = tmp; error = devsw->d_ioctl(dev, DIOCGMEDIASIZE, (caddr_t)&otmp, FREAD, curthread); @@ -1960,6 +1957,9 @@ ctl_be_block_open_dev(struct ctl_be_bloc be_lun->size_bytes = params->lun_size_bytes; } else be_lun->size_bytes = otmp; + be_lun->size_blocks = be_lun->size_bytes / cbe_lun->blocksize; + cbe_lun->maxlba = (be_lun->size_blocks == 0) ? + 0 : (be_lun->size_blocks - 1); error = devsw->d_ioctl(dev, DIOCGSTRIPESIZE, (caddr_t)&ps, FREAD, curthread); @@ -1974,36 +1974,36 @@ ctl_be_block_open_dev(struct ctl_be_bloc us = ps; uo = po; - value = ctl_get_opt(&be_lun->ctl_be_lun.options, "pblocksize"); + value = ctl_get_opt(&cbe_lun->options, "pblocksize"); if (value != NULL) ctl_expand_number(value, &ps); - value = ctl_get_opt(&be_lun->ctl_be_lun.options, "pblockoffset"); + value = ctl_get_opt(&cbe_lun->options, "pblockoffset"); if (value != NULL) ctl_expand_number(value, &po); - pss = ps / be_lun->blocksize; - pos = po / be_lun->blocksize; - if ((pss > 0) && (pss * be_lun->blocksize == ps) && (pss >= pos) && - ((pss & (pss - 1)) == 0) && (pos * be_lun->blocksize == po)) { - be_lun->pblockexp = fls(pss) - 1; - be_lun->pblockoff = (pss - pos) % pss; + pss = ps / cbe_lun->blocksize; + pos = po / cbe_lun->blocksize; + if ((pss > 0) && (pss * cbe_lun->blocksize == ps) && (pss >= pos) && + ((pss & (pss - 1)) == 0) && (pos * cbe_lun->blocksize == po)) { + cbe_lun->pblockexp = fls(pss) - 1; + cbe_lun->pblockoff = (pss - pos) % pss; } - value = ctl_get_opt(&be_lun->ctl_be_lun.options, "ublocksize"); + value = ctl_get_opt(&cbe_lun->options, "ublocksize"); if (value != NULL) ctl_expand_number(value, &us); - value = ctl_get_opt(&be_lun->ctl_be_lun.options, "ublockoffset"); + value = ctl_get_opt(&cbe_lun->options, "ublockoffset"); if (value != NULL) ctl_expand_number(value, &uo); - uss = us / be_lun->blocksize; - uos = uo / be_lun->blocksize; - if ((uss > 0) && (uss * be_lun->blocksize == us) && (uss >= uos) && - ((uss & (uss - 1)) == 0) && (uos * be_lun->blocksize == uo)) { - be_lun->ublockexp = fls(uss) - 1; - be_lun->ublockoff = (uss - uos) % uss; + uss = us / cbe_lun->blocksize; + uos = uo / cbe_lun->blocksize; + if ((uss > 0) && (uss * cbe_lun->blocksize == us) && (uss >= uos) && + ((uss & (uss - 1)) == 0) && (uos * cbe_lun->blocksize == uo)) { + cbe_lun->ublockexp = fls(uss) - 1; + cbe_lun->ublockoff = (uss - uos) % uss; } - be_lun->atomicblock = atomic / be_lun->blocksize; - be_lun->opttxferlen = maxio / be_lun->blocksize; + cbe_lun->atomicblock = atomic / cbe_lun->blocksize; + cbe_lun->opttxferlen = maxio / cbe_lun->blocksize; if (be_lun->dispatch == ctl_be_block_dispatch_zvol) { unmap = 1; @@ -2016,11 +2016,13 @@ ctl_be_block_open_dev(struct ctl_be_bloc (caddr_t)&arg, FREAD, curthread); unmap = (error == 0) ? arg.value.i : 0; } - value = ctl_get_opt(&be_lun->ctl_be_lun.options, "unmap"); + value = ctl_get_opt(&cbe_lun->options, "unmap"); if (value != NULL) unmap = (strcmp(value, "on") == 0); if (unmap) - be_lun->unmap = ctl_be_block_unmap_dev; + cbe_lun->flags |= CTL_LUN_FLAG_UNMAP; + else + cbe_lun->flags &= ~CTL_LUN_FLAG_UNMAP; return (0); } @@ -2028,10 +2030,10 @@ ctl_be_block_open_dev(struct ctl_be_bloc static int ctl_be_block_close(struct ctl_be_block_lun *be_lun) { - DROP_GIANT(); - if (be_lun->vn) { - int flags = FREAD | FWRITE; + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; + int flags; + if (be_lun->vn) { switch (be_lun->dev_type) { case CTL_BE_BLOCK_DEV: if (be_lun->backend.dev.csw) { @@ -2050,6 +2052,9 @@ ctl_be_block_close(struct ctl_be_block_l break; } + flags = FREAD; + if ((cbe_lun->flags & CTL_LUN_FLAG_READONLY) == 0) + flags |= FWRITE; (void)vn_close(be_lun->vn, flags, NOCRED, curthread); be_lun->vn = NULL; @@ -2070,36 +2075,47 @@ ctl_be_block_close(struct ctl_be_block_l } be_lun->dev_type = CTL_BE_BLOCK_NONE; } - PICKUP_GIANT(); - return (0); } static int ctl_be_block_open(struct ctl_be_block_softc *softc, - struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) + struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) { + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; struct nameidata nd; - int flags; - int error; + char *value; + int error, flags; - /* - * XXX KDM allow a read-only option? - */ - flags = FREAD | FWRITE; error = 0; - if (rootvnode == NULL) { snprintf(req->error_str, sizeof(req->error_str), "Root filesystem is not mounted"); return (1); } - pwd_ensure_dirs(); - again: + value = ctl_get_opt(&cbe_lun->options, "file"); + if (value == NULL) { + snprintf(req->error_str, sizeof(req->error_str), + "no file argument specified"); + return (1); + } + free(be_lun->dev_path, M_CTLBLK); + be_lun->dev_path = strdup(value, M_CTLBLK); + + flags = FREAD; + value = ctl_get_opt(&cbe_lun->options, "readonly"); + if (value == NULL || strcmp(value, "on") != 0) + flags |= FWRITE; + +again: NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, be_lun->dev_path, curthread); error = vn_open(&nd, &flags, 0, NULL); + if ((error == EROFS || error == EACCES) && (flags & FWRITE)) { + flags &= ~FWRITE; + goto again; + } if (error) { /* * This is the only reasonable guess we can make as far as @@ -2108,28 +2124,24 @@ ctl_be_block_open(struct ctl_be_block_so * full path. */ if (be_lun->dev_path[0] != '/') { - char *dev_path = "/dev/"; char *dev_name; - /* Try adding device path at beginning of name */ - dev_name = malloc(strlen(be_lun->dev_path) - + strlen(dev_path) + 1, - M_CTLBLK, M_WAITOK); - if (dev_name) { - sprintf(dev_name, "%s%s", dev_path, - be_lun->dev_path); - free(be_lun->dev_path, M_CTLBLK); - be_lun->dev_path = dev_name; - goto again; - } + asprintf(&dev_name, M_CTLBLK, "/dev/%s", + be_lun->dev_path); + free(be_lun->dev_path, M_CTLBLK); + be_lun->dev_path = dev_name; + goto again; } snprintf(req->error_str, sizeof(req->error_str), "error opening %s: %d", be_lun->dev_path, error); return (error); } + if (flags & FWRITE) + cbe_lun->flags &= ~CTL_LUN_FLAG_READONLY; + else + cbe_lun->flags |= CTL_LUN_FLAG_READONLY; NDFREE(&nd, NDF_ONLY_PNBUF); - be_lun->vn = nd.ni_vp; /* We only support disks and files. */ @@ -2146,12 +2158,23 @@ ctl_be_block_open(struct ctl_be_block_so if (error != 0) ctl_be_block_close(be_lun); + cbe_lun->serseq = CTL_LUN_SERSEQ_OFF; + if (be_lun->dispatch != ctl_be_block_dispatch_dev) + cbe_lun->serseq = CTL_LUN_SERSEQ_READ; + value = ctl_get_opt(&cbe_lun->options, "serseq"); + if (value != NULL && strcmp(value, "on") == 0) + cbe_lun->serseq = CTL_LUN_SERSEQ_ON; + else if (value != NULL && strcmp(value, "read") == 0) + cbe_lun->serseq = CTL_LUN_SERSEQ_READ; + else if (value != NULL && strcmp(value, "off") == 0) + cbe_lun->serseq = CTL_LUN_SERSEQ_OFF; return (0); } static int ctl_be_block_create(struct ctl_be_block_softc *softc, struct ctl_lun_req *req) { + struct ctl_be_lun *cbe_lun; struct ctl_be_block_lun *be_lun; struct ctl_lun_create_params *params; char num_thread_str[16]; @@ -2164,10 +2187,9 @@ ctl_be_block_create(struct ctl_be_block_ retval = 0; req->status = CTL_LUN_OK; - num_threads = cbb_num_threads; - be_lun = malloc(sizeof(*be_lun), M_CTLBLK, M_ZERO | M_WAITOK); - + cbe_lun = &be_lun->cbe_lun; + cbe_lun->be_lun = be_lun; be_lun->params = req->reqdata.create; be_lun->softc = softc; STAILQ_INIT(&be_lun->input_queue); @@ -2177,12 +2199,10 @@ ctl_be_block_create(struct ctl_be_block_ sprintf(be_lun->lunname, "cblk%d", softc->num_luns); mtx_init(&be_lun->io_lock, "cblk io lock", NULL, MTX_DEF); mtx_init(&be_lun->queue_lock, "cblk queue lock", NULL, MTX_DEF); - ctl_init_opts(&be_lun->ctl_be_lun.options, + ctl_init_opts(&cbe_lun->options, req->num_be_args, req->kern_be_args); - be_lun->lun_zone = uma_zcreate(be_lun->lunname, CTLBLK_MAX_SEG, NULL, NULL, NULL, NULL, /*align*/ 0, /*flags*/0); - if (be_lun->lun_zone == NULL) { snprintf(req->error_str, sizeof(req->error_str), "error allocating UMA zone"); @@ -2190,46 +2210,29 @@ ctl_be_block_create(struct ctl_be_block_ } if (params->flags & CTL_LUN_FLAG_DEV_TYPE) - be_lun->ctl_be_lun.lun_type = params->device_type; + cbe_lun->lun_type = params->device_type; else - be_lun->ctl_be_lun.lun_type = T_DIRECT; + cbe_lun->lun_type = T_DIRECT; + be_lun->flags = CTL_BE_BLOCK_LUN_UNCONFIGURED; + cbe_lun->flags = CTL_LUN_FLAG_PRIMARY; - if (be_lun->ctl_be_lun.lun_type == T_DIRECT) { - value = ctl_get_opt(&be_lun->ctl_be_lun.options, "file"); - if (value == NULL) { - snprintf(req->error_str, sizeof(req->error_str), - "no file argument specified"); - goto bailout_error; - } - be_lun->dev_path = strdup(value, M_CTLBLK); + if (cbe_lun->lun_type == T_DIRECT) { be_lun->size_bytes = params->lun_size_bytes; if (params->blocksize_bytes != 0) - be_lun->blocksize = params->blocksize_bytes; + cbe_lun->blocksize = params->blocksize_bytes; else - be_lun->blocksize = 512; + cbe_lun->blocksize = 512; + be_lun->size_blocks = be_lun->size_bytes / cbe_lun->blocksize; + cbe_lun->maxlba = (be_lun->size_blocks == 0) ? + 0 : (be_lun->size_blocks - 1); retval = ctl_be_block_open(softc, be_lun, req); - be_lun->size_blocks = be_lun->size_bytes / be_lun->blocksize; if (retval != 0) { retval = 0; req->status = CTL_LUN_WARNING; } + num_threads = cbb_num_threads; } else { - /* - * For processor devices, we don't have any size. - */ - be_lun->blocksize = 0; - be_lun->pblockexp = 0; - be_lun->pblockoff = 0; - be_lun->ublockexp = 0; - be_lun->ublockoff = 0; - be_lun->size_blocks = 0; - be_lun->size_bytes = 0; - be_lun->ctl_be_lun.maxlba = 0; - - /* - * Default to just 1 thread for processor devices. - */ num_threads = 1; } @@ -2237,7 +2240,7 @@ ctl_be_block_create(struct ctl_be_block_ * XXX This searching loop might be refactored to be combined with * the loop above, */ - value = ctl_get_opt(&be_lun->ctl_be_lun.options, "num_threads"); + value = ctl_get_opt(&cbe_lun->options, "num_threads"); if (value != NULL) { tmp_num_threads = strtol(value, NULL, 0); @@ -2255,67 +2258,46 @@ ctl_be_block_create(struct ctl_be_block_ num_threads = tmp_num_threads; } - be_lun->flags = CTL_BE_BLOCK_LUN_UNCONFIGURED; - be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; if (be_lun->vn == NULL) - be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_OFFLINE; - if (be_lun->unmap != NULL) - be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP; - if (be_lun->dispatch != ctl_be_block_dispatch_dev) - be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_SERSEQ_READ; - be_lun->ctl_be_lun.be_lun = be_lun; - be_lun->ctl_be_lun.maxlba = (be_lun->size_blocks == 0) ? - 0 : (be_lun->size_blocks - 1); - be_lun->ctl_be_lun.blocksize = be_lun->blocksize; - be_lun->ctl_be_lun.pblockexp = be_lun->pblockexp; - be_lun->ctl_be_lun.pblockoff = be_lun->pblockoff; - be_lun->ctl_be_lun.ublockexp = be_lun->ublockexp; - be_lun->ctl_be_lun.ublockoff = be_lun->ublockoff; - be_lun->ctl_be_lun.atomicblock = be_lun->atomicblock; - be_lun->ctl_be_lun.opttxferlen = be_lun->opttxferlen; + cbe_lun->flags |= CTL_LUN_FLAG_OFFLINE; /* Tell the user the blocksize we ended up using */ params->lun_size_bytes = be_lun->size_bytes; - params->blocksize_bytes = be_lun->blocksize; + params->blocksize_bytes = cbe_lun->blocksize; if (params->flags & CTL_LUN_FLAG_ID_REQ) { - be_lun->ctl_be_lun.req_lun_id = params->req_lun_id; - be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_ID_REQ; + cbe_lun->req_lun_id = params->req_lun_id; + cbe_lun->flags |= CTL_LUN_FLAG_ID_REQ; } else - be_lun->ctl_be_lun.req_lun_id = 0; + cbe_lun->req_lun_id = 0; - be_lun->ctl_be_lun.lun_shutdown = ctl_be_block_lun_shutdown; - be_lun->ctl_be_lun.lun_config_status = - ctl_be_block_lun_config_status; - be_lun->ctl_be_lun.be = &ctl_be_block_driver; + cbe_lun->lun_shutdown = ctl_be_block_lun_shutdown; + cbe_lun->lun_config_status = ctl_be_block_lun_config_status; + cbe_lun->be = &ctl_be_block_driver; if ((params->flags & CTL_LUN_FLAG_SERIAL_NUM) == 0) { snprintf(tmpstr, sizeof(tmpstr), "MYSERIAL%4d", softc->num_luns); - strncpy((char *)be_lun->ctl_be_lun.serial_num, tmpstr, - MIN(sizeof(be_lun->ctl_be_lun.serial_num), - sizeof(tmpstr))); + strncpy((char *)cbe_lun->serial_num, tmpstr, + MIN(sizeof(cbe_lun->serial_num), sizeof(tmpstr))); /* Tell the user what we used for a serial number */ strncpy((char *)params->serial_num, tmpstr, MIN(sizeof(params->serial_num), sizeof(tmpstr))); } else { - strncpy((char *)be_lun->ctl_be_lun.serial_num, - params->serial_num, - MIN(sizeof(be_lun->ctl_be_lun.serial_num), + strncpy((char *)cbe_lun->serial_num, params->serial_num, + MIN(sizeof(cbe_lun->serial_num), sizeof(params->serial_num))); } if ((params->flags & CTL_LUN_FLAG_DEVID) == 0) { snprintf(tmpstr, sizeof(tmpstr), "MYDEVID%4d", softc->num_luns); - strncpy((char *)be_lun->ctl_be_lun.device_id, tmpstr, - MIN(sizeof(be_lun->ctl_be_lun.device_id), - sizeof(tmpstr))); + strncpy((char *)cbe_lun->device_id, tmpstr, + MIN(sizeof(cbe_lun->device_id), sizeof(tmpstr))); /* Tell the user what we used for a device ID */ strncpy((char *)params->device_id, tmpstr, MIN(sizeof(params->device_id), sizeof(tmpstr))); } else { - strncpy((char *)be_lun->ctl_be_lun.device_id, - params->device_id, - MIN(sizeof(be_lun->ctl_be_lun.device_id), + strncpy((char *)cbe_lun->device_id, params->device_id, + MIN(sizeof(cbe_lun->device_id), sizeof(params->device_id))); } @@ -2361,7 +2343,7 @@ ctl_be_block_create(struct ctl_be_block_ mtx_unlock(&softc->lock); - retval = ctl_add_lun(&be_lun->ctl_be_lun); + retval = ctl_add_lun(&be_lun->cbe_lun); if (retval != 0) { mtx_lock(&softc->lock); STAILQ_REMOVE(&softc->lun_list, be_lun, ctl_be_block_lun, @@ -2399,15 +2381,15 @@ ctl_be_block_create(struct ctl_be_block_ mtx_unlock(&softc->lock); goto bailout_error; } else { - params->req_lun_id = be_lun->ctl_be_lun.lun_id; + params->req_lun_id = cbe_lun->lun_id; } mtx_unlock(&softc->lock); be_lun->disk_stats = devstat_new_entry("cbb", params->req_lun_id, - be_lun->blocksize, + cbe_lun->blocksize, DEVSTAT_ALL_SUPPORTED, - be_lun->ctl_be_lun.lun_type + cbe_lun->lun_type | DEVSTAT_TYPE_IF_OTHER, DEVSTAT_PRIORITY_OTHER); @@ -2423,7 +2405,7 @@ bailout_error: free(be_lun->dev_path, M_CTLBLK); if (be_lun->lun_zone != NULL) uma_zdestroy(be_lun->lun_zone); - ctl_free_opts(&be_lun->ctl_be_lun.options); + ctl_free_opts(&cbe_lun->options); mtx_destroy(&be_lun->queue_lock); mtx_destroy(&be_lun->io_lock); free(be_lun, M_CTLBLK); @@ -2445,7 +2427,7 @@ ctl_be_block_rm(struct ctl_be_block_soft be_lun = NULL; STAILQ_FOREACH(be_lun, &softc->lun_list, links) { - if (be_lun->ctl_be_lun.lun_id == params->lun_id) + if (be_lun->cbe_lun.lun_id == params->lun_id) break; } mtx_unlock(&softc->lock); @@ -2457,7 +2439,7 @@ ctl_be_block_rm(struct ctl_be_block_soft goto bailout_error; } - retval = ctl_disable_lun(&be_lun->ctl_be_lun); + retval = ctl_disable_lun(&be_lun->cbe_lun); if (retval != 0) { snprintf(req->error_str, sizeof(req->error_str), @@ -2467,7 +2449,7 @@ ctl_be_block_rm(struct ctl_be_block_soft } - retval = ctl_invalidate_lun(&be_lun->ctl_be_lun); + retval = ctl_invalidate_lun(&be_lun->cbe_lun); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Sep 6 11:23:05 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 019349C550C; Sun, 6 Sep 2015 11:23:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4E532FB; Sun, 6 Sep 2015 11:23:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t86BN4Kc006520; Sun, 6 Sep 2015 11:23:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t86BN2lr006508; Sun, 6 Sep 2015 11:23:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509061123.t86BN2lr006508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 6 Sep 2015 11:23:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287500 - in head: sys/cam/ctl usr.sbin/ctladm usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2015 11:23:05 -0000 Author: mav Date: Sun Sep 6 11:23:01 2015 New Revision: 287500 URL: https://svnweb.freebsd.org/changeset/base/287500 Log: Allow LUN options modification via CTL_LUNREQ_MODIFY. Not all changes take effect, but that is a different question. Modified: head/sys/cam/ctl/ctl.h head/sys/cam/ctl/ctl_backend.c head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/usr.sbin/ctladm/ctladm.8 head/usr.sbin/ctladm/ctladm.c head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/kernel.c Modified: head/sys/cam/ctl/ctl.h ============================================================================== --- head/sys/cam/ctl/ctl.h Sun Sep 6 09:54:56 2015 (r287499) +++ head/sys/cam/ctl/ctl.h Sun Sep 6 11:23:01 2015 (r287500) @@ -208,6 +208,8 @@ typedef STAILQ_HEAD(ctl_options, ctl_opt struct ctl_be_arg; void ctl_init_opts(ctl_options_t *opts, int num_args, struct ctl_be_arg *args); +void ctl_update_opts(ctl_options_t *opts, int num_args, + struct ctl_be_arg *args); void ctl_free_opts(ctl_options_t *opts); char * ctl_get_opt(ctl_options_t *opts, const char *name); int ctl_expand_number(const char *buf, uint64_t *num); Modified: head/sys/cam/ctl/ctl_backend.c ============================================================================== --- head/sys/cam/ctl/ctl_backend.c Sun Sep 6 09:54:56 2015 (r287499) +++ head/sys/cam/ctl/ctl_backend.c Sun Sep 6 11:23:01 2015 (r287500) @@ -185,15 +185,48 @@ ctl_init_opts(ctl_options_t *opts, int n if ((args[i].flags & CTL_BEARG_ASCII) == 0) continue; opt = malloc(sizeof(*opt), M_CTL, M_WAITOK); - opt->name = malloc(strlen(args[i].kname) + 1, M_CTL, M_WAITOK); - strcpy(opt->name, args[i].kname); - opt->value = malloc(strlen(args[i].kvalue) + 1, M_CTL, M_WAITOK); - strcpy(opt->value, args[i].kvalue); + opt->name = strdup(args[i].kname, M_CTL); + opt->value = strdup(args[i].kvalue, M_CTL); STAILQ_INSERT_TAIL(opts, opt, links); } } void +ctl_update_opts(ctl_options_t *opts, int num_args, struct ctl_be_arg *args) +{ + struct ctl_option *opt; + int i; + + for (i = 0; i < num_args; i++) { + if ((args[i].flags & CTL_BEARG_RD) == 0) + continue; + if ((args[i].flags & CTL_BEARG_ASCII) == 0) + continue; + STAILQ_FOREACH(opt, opts, links) { + if (strcmp(opt->name, args[i].kname) == 0) + break; + } + if (args[i].kvalue != NULL && + ((char *)args[i].kvalue)[0] != 0) { + if (opt) { + free(opt->value, M_CTL); + opt->value = strdup(args[i].kvalue, M_CTL); + } else { + opt = malloc(sizeof(*opt), M_CTL, M_WAITOK); + opt->name = strdup(args[i].kname, M_CTL); + opt->value = strdup(args[i].kvalue, M_CTL); + STAILQ_INSERT_TAIL(opts, opt, links); + } + } else if (opt) { + STAILQ_REMOVE(opts, opt, ctl_option, links); + free(opt->name, M_CTL); + free(opt->value, M_CTL); + free(opt, M_CTL); + } + } +} + +void ctl_free_opts(ctl_options_t *opts) { struct ctl_option *opt; Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Sun Sep 6 09:54:56 2015 (r287499) +++ head/sys/cam/ctl/ctl_backend_block.c Sun Sep 6 11:23:01 2015 (r287500) @@ -2423,9 +2423,6 @@ ctl_be_block_rm(struct ctl_be_block_soft params = &req->reqdata.rm; mtx_lock(&softc->lock); - - be_lun = NULL; - STAILQ_FOREACH(be_lun, &softc->lun_list, links) { if (be_lun->cbe_lun.lun_id == params->lun_id) break; @@ -2589,13 +2586,13 @@ ctl_be_block_modify(struct ctl_be_block_ { struct ctl_lun_modify_params *params; struct ctl_be_block_lun *be_lun; + struct ctl_be_lun *cbe_lun; uint64_t oldsize; int error; params = &req->reqdata.modify; mtx_lock(&softc->lock); - be_lun = NULL; STAILQ_FOREACH(be_lun, &softc->lun_list, links) { if (be_lun->cbe_lun.lun_id == params->lun_id) break; @@ -2608,8 +2605,11 @@ ctl_be_block_modify(struct ctl_be_block_ params->lun_id); goto bailout_error; } + cbe_lun = &be_lun->cbe_lun; - be_lun->params.lun_size_bytes = params->lun_size_bytes; + if (params->lun_size_bytes != 0) + be_lun->params.lun_size_bytes = params->lun_size_bytes; + ctl_update_opts(&cbe_lun->options, req->num_be_args, req->kern_be_args); oldsize = be_lun->size_blocks; if (be_lun->vn == NULL) @@ -2622,11 +2622,11 @@ ctl_be_block_modify(struct ctl_be_block_ error = EINVAL; if (be_lun->size_blocks != oldsize) - ctl_lun_capacity_changed(&be_lun->cbe_lun); - if ((be_lun->cbe_lun.flags & CTL_LUN_FLAG_OFFLINE) && + ctl_lun_capacity_changed(cbe_lun); + if ((cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) && be_lun->vn != NULL) { - be_lun->cbe_lun.flags &= ~CTL_LUN_FLAG_OFFLINE; - ctl_lun_online(&be_lun->cbe_lun); + cbe_lun->flags &= ~CTL_LUN_FLAG_OFFLINE; + ctl_lun_online(cbe_lun); } /* Tell the user the exact size we ended up using */ Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Sun Sep 6 09:54:56 2015 (r287499) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Sun Sep 6 11:23:01 2015 (r287500) @@ -73,6 +73,7 @@ typedef enum { } ctl_be_ramdisk_lun_flags; struct ctl_be_ramdisk_lun { + struct ctl_lun_create_params params; char lunname[32]; uint64_t size_bytes; uint64_t size_blocks; @@ -535,6 +536,7 @@ ctl_backend_ramdisk_create(struct ctl_be be_lun = malloc(sizeof(*be_lun), M_RAMDISK, M_ZERO | M_WAITOK); cbe_lun = &be_lun->cbe_lun; cbe_lun->be_lun = be_lun; + be_lun->params = req->reqdata.create; be_lun->softc = softc; sprintf(be_lun->lunname, "cram%d", softc->num_luns); ctl_init_opts(&cbe_lun->options, req->num_be_args, req->kern_be_args); @@ -713,13 +715,12 @@ ctl_backend_ramdisk_modify(struct ctl_be struct ctl_lun_req *req) { struct ctl_be_ramdisk_lun *be_lun; + struct ctl_be_lun *cbe_lun; struct ctl_lun_modify_params *params; uint32_t blocksize; params = &req->reqdata.modify; - be_lun = NULL; - mtx_lock(&softc->lock); STAILQ_FOREACH(be_lun, &softc->lun_list, links) { if (be_lun->cbe_lun.lun_id == params->lun_id) @@ -733,32 +734,22 @@ ctl_backend_ramdisk_modify(struct ctl_be __func__, params->lun_id); goto bailout_error; } + cbe_lun = &be_lun->cbe_lun; - if (params->lun_size_bytes == 0) { - snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN size \"auto\" not supported " - "by the ramdisk backend", __func__); - goto bailout_error; - } - + if (params->lun_size_bytes != 0) + be_lun->params.lun_size_bytes = params->lun_size_bytes; + ctl_update_opts(&cbe_lun->options, req->num_be_args, req->kern_be_args); blocksize = be_lun->cbe_lun.blocksize; - if (params->lun_size_bytes < blocksize) { + if (be_lun->params.lun_size_bytes < blocksize) { snprintf(req->error_str, sizeof(req->error_str), "%s: LUN size %ju < blocksize %u", __func__, - params->lun_size_bytes, blocksize); + be_lun->params.lun_size_bytes, blocksize); goto bailout_error; } - be_lun->size_blocks = params->lun_size_bytes / blocksize; + be_lun->size_blocks = be_lun->params.lun_size_bytes / blocksize; be_lun->size_bytes = be_lun->size_blocks * blocksize; - - /* - * The maximum LBA is the size - 1. - * - * XXX: Note that this field is being updated without locking, - * which might cause problems on 32-bit architectures. - */ be_lun->cbe_lun.maxlba = be_lun->size_blocks - 1; ctl_lun_capacity_changed(&be_lun->cbe_lun); Modified: head/usr.sbin/ctladm/ctladm.8 ============================================================================== --- head/usr.sbin/ctladm/ctladm.8 Sun Sep 6 09:54:56 2015 (r287499) +++ head/usr.sbin/ctladm/ctladm.8 Sun Sep 6 11:23:01 2015 (r287500) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd June 3, 2015 +.Dd September 6, 2015 .Dt CTLADM 8 .Os .Sh NAME @@ -166,6 +166,7 @@ .Ic modify .Aq Fl b Ar backend .Aq Fl l Ar lun_id +.Op Fl o Ar name=value .Aq Fl s Ar size_bytes .Nm .Ic devlist @@ -859,6 +860,12 @@ and .Dq block . .It Fl l Ar lun_id Specify the LUN number to remove. +.It Fl o Ar name=value +Specify a backend-specific name/value pair. +Multiple +.Fl o +arguments may be specified. +Refer to the backend documentation for arguments that may be used. .It Fl s Ar size_bytes Specify the size of the LUN in bytes. For the Modified: head/usr.sbin/ctladm/ctladm.c ============================================================================== --- head/usr.sbin/ctladm/ctladm.c Sun Sep 6 09:54:56 2015 (r287499) +++ head/usr.sbin/ctladm/ctladm.c Sun Sep 6 11:23:01 2015 (r287500) @@ -183,7 +183,7 @@ static struct ctladm_opts option_table[] {"lunlist", CTLADM_CMD_LUNLIST, CTLADM_ARG_NONE, NULL}, {"lunmap", CTLADM_CMD_LUNMAP, CTLADM_ARG_NONE, "p:l:L:"}, {"modesense", CTLADM_CMD_MODESENSE, CTLADM_ARG_NEED_TL, "P:S:dlm:c:"}, - {"modify", CTLADM_CMD_MODIFY, CTLADM_ARG_NONE, "b:l:s:"}, + {"modify", CTLADM_CMD_MODIFY, CTLADM_ARG_NONE, "b:l:o:s:"}, {"port", CTLADM_CMD_PORT, CTLADM_ARG_NONE, "lo:p:qt:w:W:x"}, {"portlist", CTLADM_CMD_PORTLIST, CTLADM_ARG_NONE, "f:ilp:qvx"}, {"prin", CTLADM_CMD_PRES_IN, CTLADM_ARG_NEED_TL, "a:"}, @@ -3169,8 +3169,11 @@ cctl_modify_lun(int fd, int argc, char * uint32_t lun_id = 0; int lun_id_set = 0, lun_size_set = 0; char *backend_name = NULL; + STAILQ_HEAD(, cctl_req_option) option_list; + int num_options = 0; int retval = 0, c; + STAILQ_INIT(&option_list); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { case 'b': @@ -3180,6 +3183,43 @@ cctl_modify_lun(int fd, int argc, char * lun_id = strtoul(optarg, NULL, 0); lun_id_set = 1; break; + case 'o': { + struct cctl_req_option *option; + char *tmpstr; + char *name, *value; + + tmpstr = strdup(optarg); + name = strsep(&tmpstr, "="); + if (name == NULL) { + warnx("%s: option -o takes \"name=value\"" + "argument", __func__); + retval = 1; + goto bailout; + } + value = strsep(&tmpstr, "="); + if (value == NULL) { + warnx("%s: option -o takes \"name=value\"" + "argument", __func__); + retval = 1; + goto bailout; + } + option = malloc(sizeof(*option)); + if (option == NULL) { + warn("%s: error allocating %zd bytes", + __func__, sizeof(*option)); + retval = 1; + goto bailout; + } + option->name = strdup(name); + option->namelen = strlen(name) + 1; + option->value = strdup(value); + option->vallen = strlen(value) + 1; + free(tmpstr); + + STAILQ_INSERT_TAIL(&option_list, option, links); + num_options++; + break; + } case 's': if (strcasecmp(optarg, "auto") != 0) { retval = expand_number(optarg, &lun_size); @@ -3203,8 +3243,9 @@ cctl_modify_lun(int fd, int argc, char * if (lun_id_set == 0) errx(1, "%s: LUN id (-l) must be specified", __func__); - if (lun_size_set == 0) - errx(1, "%s: size (-s) must be specified", __func__); + if (lun_size_set == 0 && num_options == 0) + errx(1, "%s: size (-s) or options (-o) must be specified", + __func__); bzero(&req, sizeof(req)); @@ -3214,6 +3255,42 @@ cctl_modify_lun(int fd, int argc, char * req.reqdata.modify.lun_id = lun_id; req.reqdata.modify.lun_size_bytes = lun_size; + req.num_be_args = num_options; + if (num_options > 0) { + struct cctl_req_option *option, *next_option; + int i; + + req.be_args = malloc(num_options * sizeof(*req.be_args)); + if (req.be_args == NULL) { + warn("%s: error allocating %zd bytes", __func__, + num_options * sizeof(*req.be_args)); + retval = 1; + goto bailout; + } + + for (i = 0, option = STAILQ_FIRST(&option_list); + i < num_options; i++, option = next_option) { + next_option = STAILQ_NEXT(option, links); + + req.be_args[i].namelen = option->namelen; + req.be_args[i].name = strdup(option->name); + req.be_args[i].vallen = option->vallen; + req.be_args[i].value = strdup(option->value); + /* + * XXX KDM do we want a way to specify a writeable + * flag of some sort? Do we want a way to specify + * binary data? + */ + req.be_args[i].flags = CTL_BEARG_ASCII | CTL_BEARG_RD; + + STAILQ_REMOVE(&option_list, option, cctl_req_option, + links); + free(option->name); + free(option->value); + free(option); + } + } + if (ioctl(fd, CTL_LUN_REQ, &req) == -1) { warn("%s: error issuing CTL_LUN_REQ ioctl", __func__); retval = 1; Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Sun Sep 6 09:54:56 2015 (r287499) +++ head/usr.sbin/ctld/ctld.c Sun Sep 6 11:23:01 2015 (r287500) @@ -1961,18 +1961,14 @@ conf_apply(struct conf *oldconf, struct TAILQ_FOREACH_SAFE(newlun, &newconf->conf_luns, l_next, tmplun) { oldlun = lun_find(oldconf, newlun->l_name); if (oldlun != NULL) { - if (newlun->l_size != oldlun->l_size || - newlun->l_size == 0) { - log_debugx("resizing lun \"%s\", CTL lun %d", + log_debugx("modifying lun \"%s\", CTL lun %d", + newlun->l_name, newlun->l_ctl_lun); + error = kernel_lun_modify(newlun); + if (error != 0) { + log_warnx("failed to " + "modify lun \"%s\", CTL lun %d", newlun->l_name, newlun->l_ctl_lun); - error = kernel_lun_resize(newlun); - if (error != 0) { - log_warnx("failed to " - "resize lun \"%s\", CTL lun %d", - newlun->l_name, - newlun->l_ctl_lun); - cumulated_error++; - } + cumulated_error++; } continue; } Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Sun Sep 6 09:54:56 2015 (r287499) +++ head/usr.sbin/ctld/ctld.h Sun Sep 6 11:23:01 2015 (r287500) @@ -391,7 +391,7 @@ void lun_option_set(struct lun_option void kernel_init(void); int kernel_lun_add(struct lun *lun); -int kernel_lun_resize(struct lun *lun); +int kernel_lun_modify(struct lun *lun); int kernel_lun_remove(struct lun *lun); void kernel_handoff(struct connection *conn); void kernel_limits(const char *offload, Modified: head/usr.sbin/ctld/kernel.c ============================================================================== --- head/usr.sbin/ctld/kernel.c Sun Sep 6 09:54:56 2015 (r287499) +++ head/usr.sbin/ctld/kernel.c Sun Sep 6 11:23:01 2015 (r287500) @@ -743,9 +743,11 @@ kernel_lun_add(struct lun *lun) } int -kernel_lun_resize(struct lun *lun) +kernel_lun_modify(struct lun *lun) { + struct lun_option *lo; struct ctl_lun_req req; + int error, i, num_options; bzero(&req, sizeof(req)); @@ -755,7 +757,30 @@ kernel_lun_resize(struct lun *lun) req.reqdata.modify.lun_id = lun->l_ctl_lun; req.reqdata.modify.lun_size_bytes = lun->l_size; - if (ioctl(ctl_fd, CTL_LUN_REQ, &req) == -1) { + num_options = 0; + TAILQ_FOREACH(lo, &lun->l_options, lo_next) + num_options++; + + req.num_be_args = num_options; + if (num_options > 0) { + req.be_args = malloc(num_options * sizeof(*req.be_args)); + if (req.be_args == NULL) { + log_warn("error allocating %zd bytes", + num_options * sizeof(*req.be_args)); + return (1); + } + + i = 0; + TAILQ_FOREACH(lo, &lun->l_options, lo_next) { + str_arg(&req.be_args[i], lo->lo_name, lo->lo_value); + i++; + } + assert(i == num_options); + } + + error = ioctl(ctl_fd, CTL_LUN_REQ, &req); + free(req.be_args); + if (error != 0) { log_warn("error issuing CTL_LUN_REQ ioctl"); return (1); } From owner-svn-src-head@freebsd.org Sun Sep 6 11:48:51 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CE2A9CB151; Sun, 6 Sep 2015 11:48:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D957EA4; Sun, 6 Sep 2015 11:48:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t86BmoLf015005; Sun, 6 Sep 2015 11:48:50 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t86BmoJg015004; Sun, 6 Sep 2015 11:48:50 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201509061148.t86BmoJg015004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 6 Sep 2015 11:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287501 - head/contrib/llvm/tools/lldb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2015 11:48:51 -0000 Author: dim Date: Sun Sep 6 11:48:50 2015 New Revision: 287501 URL: https://svnweb.freebsd.org/changeset/base/287501 Log: Update lldb's FREEBSD-Xlist to match reality. Modified: head/contrib/llvm/tools/lldb/FREEBSD-Xlist Modified: head/contrib/llvm/tools/lldb/FREEBSD-Xlist ============================================================================== --- head/contrib/llvm/tools/lldb/FREEBSD-Xlist Sun Sep 6 11:23:01 2015 (r287500) +++ head/contrib/llvm/tools/lldb/FREEBSD-Xlist Sun Sep 6 11:48:50 2015 (r287501) @@ -3,6 +3,7 @@ .clang-format .gitignore CMakeLists.txt +CODE_OWNERS.txt INSTALL.txt Makefile cmake/ @@ -27,6 +28,7 @@ include/lldb/Host/msvc/ include/lldb/Host/windows/ include/lldb/Makefile lib/ +lit/ lldb.xcodeproj/ lldb.xcworkspace/ resources/ @@ -46,12 +48,15 @@ source/Expression/CMakeLists.txt source/Expression/Makefile source/Host/CMakeLists.txt source/Host/Makefile +source/Host/android/ source/Host/common/Makefile source/Host/freebsd/Makefile source/Host/linux/ source/Host/macosx/ source/Host/posix/Makefile source/Host/windows/ +source/Initialization/CMakeLists.txt +source/Initialization/Makefile source/Interpreter/CMakeLists.txt source/Interpreter/Makefile source/Makefile @@ -62,8 +67,18 @@ source/Plugins/ABI/MacOSX-arm64/CMakeLis source/Plugins/ABI/MacOSX-arm64/Makefile source/Plugins/ABI/MacOSX-i386/CMakeLists.txt source/Plugins/ABI/MacOSX-i386/Makefile +source/Plugins/ABI/SysV-arm/CMakeLists.txt +source/Plugins/ABI/SysV-arm/Makefile +source/Plugins/ABI/SysV-arm64/CMakeLists.txt +source/Plugins/ABI/SysV-arm64/Makefile source/Plugins/ABI/SysV-hexagon/CMakeLists.txt source/Plugins/ABI/SysV-hexagon/Makefile +source/Plugins/ABI/SysV-i386/CMakeLists.txt +source/Plugins/ABI/SysV-i386/Makefile +source/Plugins/ABI/SysV-mips/CMakeLists.txt +source/Plugins/ABI/SysV-mips/Makefile +source/Plugins/ABI/SysV-mips64/CMakeLists.txt +source/Plugins/ABI/SysV-mips64/Makefile source/Plugins/ABI/SysV-ppc/CMakeLists.txt source/Plugins/ABI/SysV-ppc/Makefile source/Plugins/ABI/SysV-ppc64/CMakeLists.txt @@ -88,6 +103,10 @@ source/Plugins/Instruction/ARM/Makefile source/Plugins/Instruction/ARM64/CMakeLists.txt source/Plugins/Instruction/ARM64/Makefile source/Plugins/Instruction/CMakeLists.txt +source/Plugins/Instruction/MIPS/CMakeLists.txt +source/Plugins/Instruction/MIPS/Makefile +source/Plugins/Instruction/MIPS64/CMakeLists.txt +source/Plugins/Instruction/MIPS64/Makefile source/Plugins/InstrumentationRuntime/AddressSanitizer/CMakeLists.txt source/Plugins/InstrumentationRuntime/AddressSanitizer/Makefile source/Plugins/InstrumentationRuntime/CMakeLists.txt @@ -99,6 +118,9 @@ source/Plugins/LanguageRuntime/CPlusPlus source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/CMakeLists.txt source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/Makefile source/Plugins/LanguageRuntime/ObjC/ +source/Plugins/LanguageRuntime/RenderScript/CMakeLists.txt +source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt +source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/Makefile source/Plugins/Makefile source/Plugins/MemoryHistory/CMakeLists.txt source/Plugins/MemoryHistory/asan/CMakeLists.txt @@ -117,6 +139,7 @@ source/Plugins/ObjectFile/PECOFF/ source/Plugins/OperatingSystem/CMakeLists.txt source/Plugins/OperatingSystem/Python/CMakeLists.txt source/Plugins/OperatingSystem/Python/Makefile +source/Plugins/Platform/Android/ source/Plugins/Platform/CMakeLists.txt source/Plugins/Platform/FreeBSD/CMakeLists.txt source/Plugins/Platform/FreeBSD/Makefile @@ -168,6 +191,7 @@ source/Utility/Makefile test/ tools/CMakeLists.txt tools/Makefile +tools/argdumper/CMakeLists.txt tools/darwin-debug/ tools/darwin-threads/ tools/debugserver/ @@ -180,7 +204,9 @@ tools/lldb-mi/CMakeLists.txt tools/lldb-mi/Makefile tools/lldb-mi/lldb-Info.plist tools/lldb-perf/ -tools/lldb-platform/CMakeLists.txt -tools/lldb-platform/Makefile +tools/lldb-platform/ +tools/lldb-server/CMakeLists.txt +tools/lldb-server/Makefile +unittests/ utils/ www/ From owner-svn-src-head@freebsd.org Sun Sep 6 17:47:04 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3E569CB992; Sun, 6 Sep 2015 17:47:04 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 934331C99; Sun, 6 Sep 2015 17:47:04 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t86Hl41v062798; Sun, 6 Sep 2015 17:47:04 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t86Hl4k1062797; Sun, 6 Sep 2015 17:47:04 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201509061747.t86Hl4k1062797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sun, 6 Sep 2015 17:47:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287509 - head/usr.bin/procstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2015 17:47:04 -0000 Author: allanjude Date: Sun Sep 6 17:47:03 2015 New Revision: 287509 URL: https://svnweb.freebsd.org/changeset/base/287509 Log: Fix inverted output re: stack protection no-execute flag in procstat(1) PR: 196110 Submitted by: Joerg Pernfuss Approved by: bapt (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D3576 Modified: head/usr.bin/procstat/procstat_auxv.c Modified: head/usr.bin/procstat/procstat_auxv.c ============================================================================== --- head/usr.bin/procstat/procstat_auxv.c Sun Sep 6 17:36:09 2015 (r287508) +++ head/usr.bin/procstat/procstat_auxv.c Sun Sep 6 17:47:03 2015 (r287509) @@ -165,11 +165,11 @@ procstat_auxv(struct procstat *procstat, if ((auxv[i].a_un.a_val & VM_PROT_EXECUTE) != 0) xo_emit("{dw:/%s}{Lw:/%-16s/%s}" "{:AT_STACKPROT/%s}\n", prefix, - "AT_STACKPROT", "NONEXECUTABLE"); + "AT_STACKPROT", "EXECUTABLE"); else xo_emit("{dw:/%s}{Lw:/%-16s/%s}" "{:AT_STACKPROT/%s}\n", prefix, - "AT_STACKPROT", "EXECUTABLE"); + "AT_STACKPROT", "NONEXECUTABLE"); break; #ifdef AT_TIMEKEEP case AT_TIMEKEEP: From owner-svn-src-head@freebsd.org Sun Sep 6 18:58:34 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7ACB69CBC59; Sun, 6 Sep 2015 18:58:34 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AF779EE; Sun, 6 Sep 2015 18:58:34 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t86IwYLG091944; Sun, 6 Sep 2015 18:58:34 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t86IwYcn091942; Sun, 6 Sep 2015 18:58:34 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509061858.t86IwYcn091942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 6 Sep 2015 18:58:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287520 - head/usr.sbin/ntp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2015 18:58:34 -0000 Author: ngie Date: Sun Sep 6 18:58:33 2015 New Revision: 287520 URL: https://svnweb.freebsd.org/changeset/base/287520 Log: Parallelize the usr.sbin/ntp subdirectory build Articulate all needed dependencies for the subdirectories MFC after: 1 week Modified: head/usr.sbin/ntp/Makefile Modified: head/usr.sbin/ntp/Makefile ============================================================================== --- head/usr.sbin/ntp/Makefile Sun Sep 6 18:48:28 2015 (r287519) +++ head/usr.sbin/ntp/Makefile Sun Sep 6 18:58:33 2015 (r287520) @@ -5,4 +5,14 @@ SUBDIR= libopts libntp libntpevent libpa ntptime ntp-keygen sntp SUBDIR+= doc +SUBDIR_DEPEND_ntpd= libntp libopts libparse +SUBDIR_DEPEND_ntpdate= libntp +SUBDIR_DEPEND_ntpdc= libntp libopts +SUBDIR_DEPEND_ntpq= libntp libopts +SUBDIR_DEPEND_ntptime= libntp +SUBDIR_DEPEND_ntp-keygen= libntp libopts +SUBDIR_DEPEND_sntp= libntp libntpevent libopts + +SUBDIR_PARALLEL= + .include From owner-svn-src-head@freebsd.org Sun Sep 6 20:05:31 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 132A69CBC4B; Sun, 6 Sep 2015 20:05:31 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DEFE3D44; Sun, 6 Sep 2015 20:05:30 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t86K5Upo021069; Sun, 6 Sep 2015 20:05:30 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t86K5Uu7021064; Sun, 6 Sep 2015 20:05:30 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509062005.t86K5Uu7021064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 6 Sep 2015 20:05:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287522 - head/usr.sbin/pciconf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2015 20:05:31 -0000 Author: bapt Date: Sun Sep 6 20:05:29 2015 New Revision: 287522 URL: https://svnweb.freebsd.org/changeset/base/287522 Log: Prefer pciids database from ports if present Given the pciids database on ports is updated more often than the one in base prefer this version if present, otherwise read the one from base. MFC after: 1 week Relnotes: yes Differential Revision: https://reviews.freebsd.org/D3391 Modified: head/usr.sbin/pciconf/pathnames.h head/usr.sbin/pciconf/pciconf.8 head/usr.sbin/pciconf/pciconf.c Modified: head/usr.sbin/pciconf/pathnames.h ============================================================================== --- head/usr.sbin/pciconf/pathnames.h Sun Sep 6 19:58:48 2015 (r287521) +++ head/usr.sbin/pciconf/pathnames.h Sun Sep 6 20:05:29 2015 (r287522) @@ -1,3 +1,4 @@ /* $FreeBSD$ */ #define _PATH_DEVPCI "/dev/pci" #define _PATH_PCIVDB "/usr/share/misc/pci_vendors" +#define _PATH_LPCIVDB "/usr/local/share/pciids/pci.ids" Modified: head/usr.sbin/pciconf/pciconf.8 ============================================================================== --- head/usr.sbin/pciconf/pciconf.8 Sun Sep 6 19:58:48 2015 (r287521) +++ head/usr.sbin/pciconf/pciconf.8 Sun Sep 6 20:05:29 2015 (r287522) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 20, 2014 +.Dd September 06, 2015 .Dt PCICONF 8 .Os .Sh NAME @@ -281,7 +281,9 @@ indicates a halfword (two-byte) operatio The default is to read or write a longword (four bytes). .Sh ENVIRONMENT -The PCI vendor/device information database is normally read from +PCI vendor and device information is read from +.Pa /usr/local/share/pciids/pci.ids . +If that file is not present, it is read from .Pa /usr/share/misc/pci_vendors . This path can be overridden by setting the environment variable .Ev PCICONF_VENDOR_DATABASE . Modified: head/usr.sbin/pciconf/pciconf.c ============================================================================== --- head/usr.sbin/pciconf/pciconf.c Sun Sep 6 19:58:48 2015 (r287521) +++ head/usr.sbin/pciconf/pciconf.c Sun Sep 6 20:05:29 2015 (r287522) @@ -549,9 +549,12 @@ load_vendors(void) */ TAILQ_INIT(&pci_vendors); if ((dbf = getenv("PCICONF_VENDOR_DATABASE")) == NULL) + dbf = _PATH_LPCIVDB; + if ((db = fopen(dbf, "r")) == NULL) { dbf = _PATH_PCIVDB; - if ((db = fopen(dbf, "r")) == NULL) - return(1); + if ((db = fopen(dbf, "r")) == NULL) + return(1); + } cv = NULL; cd = NULL; error = 0; From owner-svn-src-head@freebsd.org Sun Sep 6 20:17:15 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94E0F9CC17A; Sun, 6 Sep 2015 20:17:15 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 856AA1227; Sun, 6 Sep 2015 20:17:15 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t86KHF3d025519; Sun, 6 Sep 2015 20:17:15 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t86KHFIB025518; Sun, 6 Sep 2015 20:17:15 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509062017.t86KHFIB025518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 6 Sep 2015 20:17:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287523 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2015 20:17:15 -0000 Author: bapt Date: Sun Sep 6 20:17:14 2015 New Revision: 287523 URL: https://svnweb.freebsd.org/changeset/base/287523 Log: Remove last traces of USEPRIVATELIB Modified: head/share/mk/src.libnames.mk Modified: head/share/mk/src.libnames.mk ============================================================================== --- head/share/mk/src.libnames.mk Sun Sep 6 20:05:29 2015 (r287522) +++ head/share/mk/src.libnames.mk Sun Sep 6 20:17:14 2015 (r287523) @@ -298,9 +298,6 @@ DPADD_gssapi_krb5+= ${DPADD_pthread} LDADD_gssapi_krb5+= ${LDADD_pthread} .for _l in ${LIBADD} -.if ${_PRIVATELIBS:M${_l}} -USEPRIVATELIB+= ${_l} -.endif DPADD+= ${DPADD_${_l}:Umissing-dpadd_${_l}} LDADD+= ${LDADD_${_l}} .endfor From owner-svn-src-head@freebsd.org Sun Sep 6 20:20:49 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99BF09CC3A6; Sun, 6 Sep 2015 20:20:49 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89F8A15DE; Sun, 6 Sep 2015 20:20:49 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t86KKnar026531; Sun, 6 Sep 2015 20:20:49 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t86KKnob026516; Sun, 6 Sep 2015 20:20:49 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509062020.t86KKnob026516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 6 Sep 2015 20:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287524 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2015 20:20:49 -0000 Author: adrian Date: Sun Sep 6 20:20:48 2015 New Revision: 287524 URL: https://svnweb.freebsd.org/changeset/base/287524 Log: Replace rss_m2cpuid with rss_soft_m2cpuid_v4 for ip_direct_nh.nh_m2cpuid, because the RSS hash may need to be recalculated. Submitted by: Tiwei Bie Differential Revision: https://reviews.freebsd.org/D3564 Modified: head/sys/netinet/ip_input.c Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Sun Sep 6 20:17:14 2015 (r287523) +++ head/sys/netinet/ip_input.c Sun Sep 6 20:20:48 2015 (r287524) @@ -160,7 +160,7 @@ static struct netisr_handler ip_direct_n .nh_name = "ip_direct", .nh_handler = ip_direct_input, .nh_proto = NETISR_IP_DIRECT, - .nh_m2cpuid = rss_m2cpuid, + .nh_m2cpuid = rss_soft_m2cpuid_v4, .nh_policy = NETISR_POLICY_CPU, .nh_dispatch = NETISR_DISPATCH_HYBRID, }; From owner-svn-src-head@freebsd.org Sun Sep 6 20:57:59 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71AEC9CB448; Sun, 6 Sep 2015 20:57:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61FDBAFA; Sun, 6 Sep 2015 20:57:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t86KvxJ3042748; Sun, 6 Sep 2015 20:57:59 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t86KvwYT042745; Sun, 6 Sep 2015 20:57:58 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509062057.t86KvwYT042745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 6 Sep 2015 20:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287525 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2015 20:57:59 -0000 Author: adrian Date: Sun Sep 6 20:57:57 2015 New Revision: 287525 URL: https://svnweb.freebsd.org/changeset/base/287525 Log: Add support for receiving flowtype, flowid and RSS bucket information as part of recvmsg(). Submitted by: Tiwei Bie Differential Revision: https://reviews.freebsd.org/D3562 Modified: head/sys/netinet6/in6.h head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/in6.h ============================================================================== --- head/sys/netinet6/in6.h Sun Sep 6 20:20:48 2015 (r287524) +++ head/sys/netinet6/in6.h Sun Sep 6 20:57:57 2015 (r287525) @@ -485,6 +485,8 @@ struct route_in6 { #define IPV6_FLOWID 67 /* int; flowid of given socket */ #define IPV6_FLOWTYPE 68 /* int; flowtype of given socket */ #define IPV6_RSSBUCKETID 69 /* int; RSS bucket ID of given socket */ +#define IPV6_RECVFLOWID 70 /* bool; receive IP6 flowid/flowtype w/ datagram */ +#define IPV6_RECVRSSBUCKETID 71 /* bool; receive IP6 RSS bucket id w/ datagram */ /* * The following option is private; do not use it from user applications. Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Sun Sep 6 20:20:48 2015 (r287524) +++ head/sys/netinet6/ip6_input.c Sun Sep 6 20:57:57 2015 (r287525) @@ -93,6 +93,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1349,6 +1350,44 @@ ip6_savecontrol(struct inpcb *in6p, stru loopend: ; } + + if (in6p->inp_flags2 & INP_RECVFLOWID) { + uint32_t flowid, flow_type; + + flowid = m->m_pkthdr.flowid; + flow_type = M_HASHTYPE_GET(m); + + /* + * XXX should handle the failure of one or the + * other - don't populate both? + */ + *mp = sbcreatecontrol((caddr_t) &flowid, + sizeof(uint32_t), IPV6_FLOWID, IPPROTO_IPV6); + if (*mp) + mp = &(*mp)->m_next; + *mp = sbcreatecontrol((caddr_t) &flow_type, + sizeof(uint32_t), IPV6_FLOWTYPE, IPPROTO_IPV6); + if (*mp) + mp = &(*mp)->m_next; + } + +#ifdef RSS + if (in6p->inp_flags2 & INP_RECVRSSBUCKETID) { + uint32_t flowid, flow_type; + uint32_t rss_bucketid; + + flowid = m->m_pkthdr.flowid; + flow_type = M_HASHTYPE_GET(m); + + if (rss_hash2bucket(flowid, flow_type, &rss_bucketid) == 0) { + *mp = sbcreatecontrol((caddr_t) &rss_bucketid, + sizeof(uint32_t), IPV6_RSSBUCKETID, IPPROTO_IPV6); + if (*mp) + mp = &(*mp)->m_next; + } + } +#endif + } #undef IS2292 Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sun Sep 6 20:20:48 2015 (r287524) +++ head/sys/netinet6/ip6_output.c Sun Sep 6 20:57:57 2015 (r287525) @@ -1400,6 +1400,10 @@ ip6_ctloutput(struct socket *so, struct case IPV6_RECVRTHDR: case IPV6_RECVPATHMTU: case IPV6_RECVTCLASS: + case IPV6_RECVFLOWID: +#ifdef RSS + case IPV6_RECVRSSBUCKETID: +#endif case IPV6_V6ONLY: case IPV6_AUTOFLOWLABEL: case IPV6_BINDANY: @@ -1548,6 +1552,16 @@ do { \ OPTSET(IN6P_MTU); break; + case IPV6_RECVFLOWID: + OPTSET2(INP_RECVFLOWID, optval); + break; + +#ifdef RSS + case IPV6_RECVRSSBUCKETID: + OPTSET2(INP_RECVRSSBUCKETID, optval); + break; +#endif + case IPV6_V6ONLY: /* * make setsockopt(IPV6_V6ONLY) @@ -1811,8 +1825,10 @@ do { \ case IPV6_BINDANY: case IPV6_FLOWID: case IPV6_FLOWTYPE: + case IPV6_RECVFLOWID: #ifdef RSS case IPV6_RSSBUCKETID: + case IPV6_RECVRSSBUCKETID: #endif switch (optname) { @@ -1883,6 +1899,10 @@ do { \ case IPV6_FLOWTYPE: optval = in6p->inp_flowtype; break; + + case IPV6_RECVFLOWID: + optval = OPTBIT2(INP_RECVFLOWID); + break; #ifdef RSS case IPV6_RSSBUCKETID: retval = @@ -1894,6 +1914,10 @@ do { \ else error = EINVAL; break; + + case IPV6_RECVRSSBUCKETID: + optval = OPTBIT2(INP_RECVRSSBUCKETID); + break; #endif case IPV6_BINDMULTI: From owner-svn-src-head@freebsd.org Mon Sep 7 01:21:57 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 304CC9CB129; Mon, 7 Sep 2015 01:21:57 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E93EA1F; Mon, 7 Sep 2015 01:21:57 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t871LuEs054675; Mon, 7 Sep 2015 01:21:56 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t871Luhr054674; Mon, 7 Sep 2015 01:21:56 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201509070121.t871Luhr054674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Mon, 7 Sep 2015 01:21:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287528 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 01:21:57 -0000 Author: allanjude Date: Mon Sep 7 01:21:56 2015 New Revision: 287528 URL: https://svnweb.freebsd.org/changeset/base/287528 Log: Document the sctp blackhole sysctl MIB PR: 184110 Submitted by: Marie Helene Kvello-Aune Reviewed by: wblock Approved by: wblock (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3528 Modified: head/share/man/man4/blackhole.4 Modified: head/share/man/man4/blackhole.4 ============================================================================== --- head/share/man/man4/blackhole.4 Sun Sep 6 22:05:55 2015 (r287527) +++ head/share/man/man4/blackhole.4 Mon Sep 7 01:21:56 2015 (r287528) @@ -12,25 +12,35 @@ .\" .\" .\" $FreeBSD$ -.Dd January 1, 2007 +.Dd September 6, 2015 .Dt BLACKHOLE 4 .Os .Sh NAME .Nm blackhole .Nd a .Xr sysctl 8 -MIB for manipulating behaviour in respect of refused TCP or UDP connection +MIB for manipulating behaviour in respect of refused SCTP, TCP, or UDP connection attempts .Sh SYNOPSIS -.Cd sysctl net.inet.tcp.blackhole[=[0 | 1 | 2]] -.Cd sysctl net.inet.udp.blackhole[=[0 | 1]] +.Cd sysctl net.inet.sctp.blackhole Ns Op = Ns Brq "0 | 1 | 2" +.Cd sysctl net.inet.tcp.blackhole Ns Op = Ns Brq "0 | 1 | 2" +.Cd sysctl net.inet.udp.blackhole Ns Op = Ns Brq "0 | 1" .Sh DESCRIPTION The .Nm .Xr sysctl 8 MIB is used to control system behaviour when connection requests -are received on TCP or UDP ports where there is no socket listening. +are received on SCTP, TCP, or UDP ports where there is no socket listening. .Pp +The blackhole behaviour is useful to slow down an attacker who is port-scanning +a system in an attempt to detect vulnerable services. +It might also slow down an attempted denial of service attack. +.Ss SCTP +Setting the SCTP blackhole MIB to a numeric value of one +will prevent sending an ABORT packet in response to an incoming INIT. +A MIB value of two will do the same, but will also prevent sending an ABORT packet +when unexpected packets are received. +.Ss TCP Normal behaviour, when a TCP SYN segment is received on a port where there is no socket accepting connections, is for the system to return a RST segment, and drop the connection. @@ -44,20 +54,15 @@ as a blackhole. By setting the MIB value to two, any segment arriving on a closed port is dropped without returning a RST. This provides some degree of protection against stealth port scans. -.Pp -In the UDP instance, enabling blackhole behaviour turns off the sending +.Ss UDP +Enabling blackhole behaviour turns off the sending of an ICMP port unreachable message in response to a UDP datagram which arrives on a port where there is no socket listening. It must be noted that this behaviour will prevent remote systems from running .Xr traceroute 8 to a system. -.Pp -The blackhole behaviour is useful to slow down anyone who is port scanning -a system, attempting to detect vulnerable services on a system. -It could potentially also slow down someone who is attempting a denial -of service attack. .Sh WARNING -The TCP and UDP blackhole features should not be regarded as a replacement +The SCTP, TCP, and UDP blackhole features should not be regarded as a replacement for firewall solutions. Better security would consist of the .Nm @@ -68,6 +73,7 @@ This mechanism is not a substitute for s It should be used together with other security mechanisms. .Sh SEE ALSO .Xr ip 4 , +.Xr sctp 4 , .Xr tcp 4 , .Xr udp 4 , .Xr ipf 8 , @@ -80,5 +86,10 @@ The TCP and UDP MIBs first appeared in .Fx 4.0 . +.Pp +The SCTP +.Nm +MIB first appeared in +.Fx 9.1 . .Sh AUTHORS .An Geoffrey M. Rehmet From owner-svn-src-head@freebsd.org Mon Sep 7 02:00:06 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D3149CC6D9; Mon, 7 Sep 2015 02:00:06 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E025C1B; Mon, 7 Sep 2015 02:00:06 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87206id068098; Mon, 7 Sep 2015 02:00:06 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87206eB068097; Mon, 7 Sep 2015 02:00:06 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201509070200.t87206eB068097@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Mon, 7 Sep 2015 02:00:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287529 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 02:00:06 -0000 Author: allanjude Date: Mon Sep 7 02:00:05 2015 New Revision: 287529 URL: https://svnweb.freebsd.org/changeset/base/287529 Log: missed file that should have been included in r287528 PR: 184110 Submitted by: Marie Helene Kvello-Aune Approved by: wblock (mentor) Modified: head/sys/netinet/sctp_sysctl.h Modified: head/sys/netinet/sctp_sysctl.h ============================================================================== --- head/sys/netinet/sctp_sysctl.h Mon Sep 7 01:21:56 2015 (r287528) +++ head/sys/netinet/sctp_sysctl.h Mon Sep 7 02:00:05 2015 (r287529) @@ -545,7 +545,7 @@ struct sctp_sysctl { #define SCTPCTL_RTTVAR_DCCCECN_MAX 1 #define SCTPCTL_RTTVAR_DCCCECN_DEFAULT 1 /* 0 means disable feature */ -#define SCTPCTL_BLACKHOLE_DESC "Enable SCTP blackholing" +#define SCTPCTL_BLACKHOLE_DESC "Enable SCTP blackholing. See blackhole(4) man page for more details." #define SCTPCTL_BLACKHOLE_MIN 0 #define SCTPCTL_BLACKHOLE_MAX 2 #define SCTPCTL_BLACKHOLE_DEFAULT SCTPCTL_BLACKHOLE_MIN From owner-svn-src-head@freebsd.org Mon Sep 7 10:13:15 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD7CE9C5B4A; Mon, 7 Sep 2015 10:13:15 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E0C21D54; Mon, 7 Sep 2015 10:13:15 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87ADFep073116; Mon, 7 Sep 2015 10:13:15 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87ADFoT073115; Mon, 7 Sep 2015 10:13:15 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201509071013.t87ADFoT073115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 7 Sep 2015 10:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287532 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 10:13:15 -0000 Author: andrew Date: Mon Sep 7 10:13:14 2015 New Revision: 287532 URL: https://svnweb.freebsd.org/changeset/base/287532 Log: When dropping to EL1 ensure we have written to all special registers by moving the instruction barrier to just before we drop exception level. Sponsored by: ABT Systems Ltd Modified: head/sys/arm64/arm64/locore.S Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Mon Sep 7 07:22:35 2015 (r287531) +++ head/sys/arm64/arm64/locore.S Mon Sep 7 10:13:14 2015 (r287532) @@ -246,11 +246,11 @@ drop_to_el1: mrs x2, icc_sre_el2 orr x2, x2, #ICC_SRE_EL2_EN /* Enable access from insecure EL1 */ msr icc_sre_el2, x2 - isb 2: /* Set the address to return to our return address */ msr elr_el2, x30 + isb eret From owner-svn-src-head@freebsd.org Mon Sep 7 13:43:07 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44B2A9CCDD1; Mon, 7 Sep 2015 13:43:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A8DA195F; Mon, 7 Sep 2015 13:43:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87Dh7Mh059927; Mon, 7 Sep 2015 13:43:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87Dh5S0059921; Mon, 7 Sep 2015 13:43:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509071343.t87Dh5S0059921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 7 Sep 2015 13:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287534 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 13:43:07 -0000 Author: mav Date: Mon Sep 7 13:43:05 2015 New Revision: 287534 URL: https://svnweb.freebsd.org/changeset/base/287534 Log: Add two new portal group options "tag" and "foreign". They are going to be useful in clustered setups. Modified: head/usr.sbin/ctld/ctl.conf.5 head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/token.l Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Mon Sep 7 13:02:25 2015 (r287533) +++ head/usr.sbin/ctld/ctl.conf.5 Mon Sep 7 13:43:05 2015 (r287534) @@ -1,4 +1,5 @@ .\" Copyright (c) 2012 The FreeBSD Foundation +.\" Copyright (c) 2015 Alexander Motin .\" All rights reserved. .\" .\" This software was developed by Edward Tomasz Napierala under sponsorship @@ -27,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 24, 2015 +.Dd September 7, 2015 .Dt CTL.CONF 5 .Os .Sh NAME @@ -236,6 +237,15 @@ Redirection happens before authenticatio or .Sy initiator-portal checks are skipped. +.It Ic tag Ar value +Unique 16-bit tag value of this +.Sy portal-group . +If not specified, the value is generated automatically. +.It Ic foreign +Specifies that this +.Sy portal-group +is listened by some other host. +This host will announce it on discovery stage, but won't listen. .El .Ss target Context .Bl -tag -width indent Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Mon Sep 7 13:02:25 2015 (r287533) +++ head/usr.sbin/ctld/ctld.c Mon Sep 7 13:43:05 2015 (r287534) @@ -59,7 +59,7 @@ static volatile bool sigterm_received = static volatile bool sigalrm_received = false; static int nchildren = 0; -static uint16_t last_portal_group_tag = 0; +static uint16_t last_portal_group_tag = 0xff; static void usage(void) @@ -1229,6 +1229,7 @@ port_new(struct conf *conf, struct targe port->p_target = target; TAILQ_INSERT_TAIL(&pg->pg_ports, port, p_pgs); port->p_portal_group = pg; + port->p_foreign = pg->pg_foreign; return (port); } @@ -1734,14 +1735,16 @@ conf_verify(struct conf *conf) if (pg->pg_discovery_filter == PG_FILTER_UNKNOWN) pg->pg_discovery_filter = PG_FILTER_NONE; - if (!TAILQ_EMPTY(&pg->pg_ports)) { - if (pg->pg_redirection != NULL) { + if (pg->pg_redirection != NULL) { + if (!TAILQ_EMPTY(&pg->pg_ports)) { log_debugx("portal-group \"%s\" assigned " "to target, but configured " "for redirection", pg->pg_name); } pg->pg_unassigned = false; + } else if (!TAILQ_EMPTY(&pg->pg_ports)) { + pg->pg_unassigned = false; } else { if (strcmp(pg->pg_name, "default") != 0) log_warnx("portal-group \"%s\" not assigned " @@ -1835,6 +1838,8 @@ conf_apply(struct conf *oldconf, struct * Go through the new portal groups, assigning tags or preserving old. */ TAILQ_FOREACH(newpg, &newconf->conf_portal_groups, pg_next) { + if (newpg->pg_tag != 0) + continue; oldpg = portal_group_find(oldconf, newpg->pg_name); if (oldpg != NULL) newpg->pg_tag = oldpg->pg_tag; @@ -1864,8 +1869,10 @@ conf_apply(struct conf *oldconf, struct * and missing in the new one. */ TAILQ_FOREACH_SAFE(oldport, &oldconf->conf_ports, p_next, tmpport) { + if (oldport->p_foreign) + continue; newport = port_find(newconf, oldport->p_name); - if (newport != NULL) + if (newport != NULL && !newport->p_foreign) continue; log_debugx("removing port \"%s\"", oldport->p_name); error = kernel_port_remove(oldport); @@ -1985,9 +1992,11 @@ conf_apply(struct conf *oldconf, struct * Now add new ports or modify existing ones. */ TAILQ_FOREACH(newport, &newconf->conf_ports, p_next) { + if (newport->p_foreign) + continue; oldport = port_find(oldconf, newport->p_name); - if (oldport == NULL) { + if (oldport == NULL || oldport->p_foreign) { log_debugx("adding port \"%s\"", newport->p_name); error = kernel_port_add(newport); } else { @@ -2011,6 +2020,8 @@ conf_apply(struct conf *oldconf, struct * Go through the new portals, opening the sockets as neccessary. */ TAILQ_FOREACH(newpg, &newconf->conf_portal_groups, pg_next) { + if (newpg->pg_foreign) + continue; if (newpg->pg_unassigned) { log_debugx("not listening on portal-group \"%s\", " "not assigned to any target", Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Mon Sep 7 13:02:25 2015 (r287533) +++ head/usr.sbin/ctld/ctld.h Mon Sep 7 13:43:05 2015 (r287534) @@ -116,6 +116,7 @@ struct portal_group { char *pg_name; struct auth_group *pg_discovery_auth_group; int pg_discovery_filter; + int pg_foreign; bool pg_unassigned; TAILQ_HEAD(, portal) pg_portals; TAILQ_HEAD(, port) pg_ports; @@ -145,6 +146,7 @@ struct port { struct portal_group *p_portal_group; struct pport *p_pport; struct target *p_target; + int p_foreign; uint32_t p_ctl_port; }; Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Mon Sep 7 13:02:25 2015 (r287533) +++ head/usr.sbin/ctld/parse.y Mon Sep 7 13:43:05 2015 (r287534) @@ -58,10 +58,11 @@ extern void yyrestart(FILE *); %token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL %token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP DISCOVERY_FILTER +%token FOREIGN %token INITIATOR_NAME INITIATOR_PORTAL ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT %token LISTEN LISTEN_ISER LUN MAXPROC OFFLOAD OPENING_BRACKET OPTION %token PATH PIDFILE PORT PORTAL_GROUP REDIRECT SEMICOLON SERIAL SIZE STR -%token TARGET TIMEOUT +%token TAG TARGET TIMEOUT %union { @@ -337,6 +338,8 @@ portal_group_entry: | portal_group_discovery_filter | + portal_group_foreign + | portal_group_listen | portal_group_listen_iser @@ -344,6 +347,8 @@ portal_group_entry: portal_group_offload | portal_group_redirect + | + portal_group_tag ; portal_group_discovery_auth_group: DISCOVERY_AUTH_GROUP STR @@ -377,6 +382,13 @@ portal_group_discovery_filter: DISCOVERY } ; +portal_group_foreign: FOREIGN + { + + portal_group->pg_foreign = 1; + } + ; + portal_group_listen: LISTEN STR { int error; @@ -421,6 +433,20 @@ portal_group_redirect: REDIRECT STR } ; +portal_group_tag: TAG STR + { + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + yyerror("invalid numeric value"); + free($2); + return (1); + } + + portal_group->pg_tag = tmp; + } + ; + lun: LUN lun_name OPENING_BRACKET lun_entries CLOSING_BRACKET { Modified: head/usr.sbin/ctld/token.l ============================================================================== --- head/usr.sbin/ctld/token.l Mon Sep 7 13:02:25 2015 (r287533) +++ head/usr.sbin/ctld/token.l Mon Sep 7 13:43:05 2015 (r287534) @@ -58,6 +58,7 @@ debug { return DEBUG; } device-id { return DEVICE_ID; } discovery-auth-group { return DISCOVERY_AUTH_GROUP; } discovery-filter { return DISCOVERY_FILTER; } +foreign { return FOREIGN; } initiator-name { return INITIATOR_NAME; } initiator-portal { return INITIATOR_PORTAL; } listen { return LISTEN; } @@ -76,6 +77,7 @@ portal-group { return PORTAL_GROUP; } redirect { return REDIRECT; } serial { return SERIAL; } size { return SIZE; } +tag { return TAG; } target { return TARGET; } timeout { return TIMEOUT; } \"[^"]+\" { yylval.str = strndup(yytext + 1, From owner-svn-src-head@freebsd.org Mon Sep 7 14:00:39 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AFE39CB86A; Mon, 7 Sep 2015 14:00:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C2B611DC; Mon, 7 Sep 2015 14:00:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87E0dqv064633; Mon, 7 Sep 2015 14:00:39 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87E0dHW064632; Mon, 7 Sep 2015 14:00:39 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201509071400.t87E0dHW064632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 7 Sep 2015 14:00:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287535 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 14:00:39 -0000 Author: tuexen Date: Mon Sep 7 14:00:38 2015 New Revision: 287535 URL: https://svnweb.freebsd.org/changeset/base/287535 Log: RFC 4960 requires that packets containing an INIT chunk bundled with another chunk are silently discarded. Do so, instead of sending an ABORT. MFC after: 1 week Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Mon Sep 7 13:43:05 2015 (r287534) +++ head/sys/netinet/sctp_input.c Mon Sep 7 14:00:38 2015 (r287535) @@ -4819,13 +4819,11 @@ process_control_chunks: /* The INIT chunk must be the only chunk. */ if ((num_chunks > 1) || (length - *offset > (int)SCTP_SIZE32(chk_length))) { - op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), - "INIT not the only chunk"); - sctp_abort_association(inp, stcb, m, iphlen, - src, dst, sh, op_err, - mflowtype, mflowid, - vrf_id, port); + /* RFC 4960 requires that no ABORT is sent */ *offset = length; + if (locked_tcb) { + SCTP_TCB_UNLOCK(locked_tcb); + } return (NULL); } /* Honor our resource limit. */ From owner-svn-src-head@freebsd.org Mon Sep 7 14:01:19 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 291AB9CB8C5; Mon, 7 Sep 2015 14:01:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A49B1396; Mon, 7 Sep 2015 14:01:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87E1Iar065373; Mon, 7 Sep 2015 14:01:18 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87E1IgI065372; Mon, 7 Sep 2015 14:01:18 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201509071401.t87E1IgI065372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 7 Sep 2015 14:01:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287536 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 14:01:19 -0000 Author: andrew Date: Mon Sep 7 14:01:18 2015 New Revision: 287536 URL: https://svnweb.freebsd.org/changeset/base/287536 Log: Use load-acquire semantics while waiting for td_lock to be released. The store should have release semantics and will have due to the dsb above it so add a comment to explain this. [1] While here update the code to not reload the current thread, it's already in a register, we just need to not trash it. Suggested by: kib [1] Sponsored by: ABT Systems Ltd Modified: head/sys/arm64/arm64/swtch.S Modified: head/sys/arm64/arm64/swtch.S ============================================================================== --- head/sys/arm64/arm64/swtch.S Mon Sep 7 14:00:38 2015 (r287535) +++ head/sys/arm64/arm64/swtch.S Mon Sep 7 14:01:18 2015 (r287536) @@ -160,17 +160,18 @@ ENTRY(cpu_switch) dsb sy isb - /* Release the old thread */ + /* + * Release the old thread. This doesn't need to be a store-release + * as the above dsb instruction will provide release semantics. + */ str x2, [x0, #TD_LOCK] #if defined(SCHED_ULE) && defined(SMP) /* Read the value in blocked_lock */ ldr x0, =_C_LABEL(blocked_lock) - ldr x1, [x0] - /* Load curthread */ - ldr x2, [x18, #PC_CURTHREAD] + ldr x2, [x0] 1: - ldr x3, [x2, #TD_LOCK] - cmp x3, x1 + ldar x3, [x1, #TD_LOCK] + cmp x3, x2 b.eq 1b #endif From owner-svn-src-head@freebsd.org Mon Sep 7 16:44:30 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 576EA9CB086; Mon, 7 Sep 2015 16:44:30 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2EF3912DB; Mon, 7 Sep 2015 16:44:30 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87GiU6I040371; Mon, 7 Sep 2015 16:44:30 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87GiTut040367; Mon, 7 Sep 2015 16:44:29 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201509071644.t87GiTut040367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Mon, 7 Sep 2015 16:44:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287537 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 16:44:30 -0000 Author: cem Date: Mon Sep 7 16:44:28 2015 New Revision: 287537 URL: https://svnweb.freebsd.org/changeset/base/287537 Log: Follow-up to r287442: Move sysctl to compiled-once file Avoid duplicate sysctl nodes. Found by: tijl Approved by: markj (mentor) Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3586 Modified: head/sys/kern/imgact_elf.c head/sys/kern/kern_exec.c head/sys/sys/exec.h Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Mon Sep 7 14:01:18 2015 (r287536) +++ head/sys/kern/imgact_elf.c Mon Sep 7 16:44:28 2015 (r287537) @@ -1902,11 +1902,6 @@ __elfN(note_procstat_proc)(void *arg, st CTASSERT(sizeof(struct kinfo_file) == KINFO_FILE_SIZE); #endif -static int pack_fileinfo = 1; -SYSCTL_INT(_kern, OID_AUTO, coredump_pack_fileinfo, CTLFLAG_RWTUN, - &pack_fileinfo, 0, - "Enable file path packing in 'procstat -f' coredump notes"); - static void note_procstat_files(void *arg, struct sbuf *sb, size_t *sizep) { @@ -1915,7 +1910,7 @@ note_procstat_files(void *arg, struct sb ssize_t start_len, sect_len; int structsize, filedesc_flags; - if (pack_fileinfo) + if (coredump_pack_fileinfo) filedesc_flags = KERN_FILEDESC_PACK_KINFO; else filedesc_flags = 0; Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Sep 7 14:01:18 2015 (r287536) +++ head/sys/kern/kern_exec.c Mon Sep 7 16:44:28 2015 (r287537) @@ -100,6 +100,11 @@ SDT_PROBE_DEFINE1(proc, kernel, , exec__ MALLOC_DEFINE(M_PARGS, "proc-args", "Process arguments"); +int coredump_pack_fileinfo = 1; +SYSCTL_INT(_kern, OID_AUTO, coredump_pack_fileinfo, CTLFLAG_RWTUN, + &coredump_pack_fileinfo, 0, + "Enable file path packing in 'procstat -f' coredump notes"); + static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS); static int sysctl_kern_usrstack(SYSCTL_HANDLER_ARGS); static int sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS); Modified: head/sys/sys/exec.h ============================================================================== --- head/sys/sys/exec.h Mon Sep 7 14:01:18 2015 (r287536) +++ head/sys/sys/exec.h Mon Sep 7 16:44:28 2015 (r287537) @@ -83,6 +83,8 @@ void exec_unmap_first_page(struct image_ int exec_register(const struct execsw *); int exec_unregister(const struct execsw *); +extern int coredump_pack_fileinfo; + /* * note: name##_mod cannot be const storage because the * linker_file_sysinit() function modifies _file in the From owner-svn-src-head@freebsd.org Mon Sep 7 17:15:25 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19A769C53B9; Mon, 7 Sep 2015 17:15:25 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-yk0-f179.google.com (mail-yk0-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3F1A1604; Mon, 7 Sep 2015 17:15:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by ykei199 with SMTP id i199so86275412yke.0; Mon, 07 Sep 2015 10:15:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=PBoEd8SwBl1OlnvMSkgOembhkK/vydMcw5udlMUditY=; b=XxAa14Hv7oMHqOakkAw3XmEiW8Uj2wvZDrNAAOHjeANLszFwTlR620exwyJi7EuKoO TsXCYoEDGfwro84uB0uWDN9e8j6Q04r3BFGhd4oAYHInG4hmNpdpTNKRpLRHBiSh6/sa DvCTWEbkebIipbBySrDybMiLjI+Ta/xmfd7V8Suh/U8gyY1qdF4qu9fH8pLQ9s347L/1 hWmHtWqWXlEqupPzhvxaWsOR0xsRJTxoD9+JA3gs6LemqySh8tEL8X8MRD7t1W0ZUW82 YFM7h9tV83WIblEEIDIwpB63NoSUPsYJPgeQ2p8vSqksMeyiedQCDlwcltjyiYLPwwPm r3zw== X-Received: by 10.170.110.210 with SMTP id c201mr21598869ykb.1.1441644504233; Mon, 07 Sep 2015 09:48:24 -0700 (PDT) Received: from mail-yk0-f170.google.com (mail-yk0-f170.google.com. [209.85.160.170]) by smtp.gmail.com with ESMTPSA id w200sm147553ywd.19.2015.09.07.09.48.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Sep 2015 09:48:24 -0700 (PDT) Received: by ykcf206 with SMTP id f206so85398068ykc.3; Mon, 07 Sep 2015 09:48:23 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.13.217.5 with SMTP id b5mr11423853ywe.166.1441644503721; Mon, 07 Sep 2015 09:48:23 -0700 (PDT) Reply-To: cem@FreeBSD.org Received: by 10.37.48.134 with HTTP; Mon, 7 Sep 2015 09:48:23 -0700 (PDT) In-Reply-To: <20150905160425.2b7c4088@kalimero.tijl.coosemans.org> References: <201509032032.t83KWAtl043698@repo.freebsd.org> <20150905160425.2b7c4088@kalimero.tijl.coosemans.org> Date: Mon, 7 Sep 2015 09:48:23 -0700 Message-ID: Subject: Re: svn commit: r287442 - in head: lib/libprocstat lib/libutil share/man/man5 sys/kern sys/sys From: Conrad Meyer To: Tijl Coosemans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 17:15:25 -0000 On Sat, Sep 5, 2015 at 7:04 AM, Tijl Coosemans wrote: > This file can be compiled twice (included by both imgact_elf32.c and > imgact_elf64.c) so this sysctl can be added twice and the second time > results in an error message in dmesg: "can't re-use a leaf". Fixed in r287537, thanks! Conrad From owner-svn-src-head@freebsd.org Mon Sep 7 17:56:50 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8E739CCF13; Mon, 7 Sep 2015 17:56:50 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD1F514D6; Mon, 7 Sep 2015 17:56:50 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87HuoGb079197; Mon, 7 Sep 2015 17:56:50 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87HuoRu079196; Mon, 7 Sep 2015 17:56:50 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201509071756.t87HuoRu079196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Mon, 7 Sep 2015 17:56:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287538 - head/sys/boot/efi/loader/arch/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 17:56:51 -0000 Author: marcel Date: Mon Sep 7 17:56:49 2015 New Revision: 287538 URL: https://svnweb.freebsd.org/changeset/base/287538 Log: As expected, things aren't as simple as hoped. Consequently, we have no option but to use the smbios information to fill in the blanks. It's a good thing UGA is a protocol of the past and GOP has all the info we need. Anyway, the logic has been tweaked a little to get the easier bits of information up front. This includes the resolution and the frame buffer address. Then we look at the smbios information and define expected values as well as the missing bits (frame buffer offset and stride). If the values obtained match the expect values, we fill in the blanks and return. Otherwise we use the existing detection logic to figure it out. Rename the environment variables from uga_framebuffer abd uga_stride to hw.efifb.address and hw.efifb.stride. The latter names are more in line with other variable names. We currently have hardcoded settings for: 1. Mid-2007 iMac (iMac7,1) 2. Late-2007 MacBook (MacBook3,1) Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c ============================================================================== --- head/sys/boot/efi/loader/arch/amd64/framebuffer.c Mon Sep 7 16:44:28 2015 (r287537) +++ head/sys/boot/efi/loader/arch/amd64/framebuffer.c Mon Sep 7 17:56:49 2015 (r287538) @@ -269,8 +269,10 @@ efifb_from_uga(struct efi_fb *efifb, EFI EFI_PCI_IO_PROTOCOL *pciio; char *ev, *p; EFI_STATUS status; - ssize_t ofs; - uint32_t np, horiz, vert, depth, refresh; + ssize_t offset; + uint64_t fbaddr, fbsize; + uint32_t horiz, vert, stride; + uint32_t np, depth, refresh; status = uga->GetMode(uga, &horiz, &vert, &depth, &refresh); if (EFI_ERROR(status)) @@ -285,6 +287,63 @@ efifb_from_uga(struct efi_fb *efifb, EFI efifb_mask_from_pixfmt(efifb, PixelBlueGreenRedReserved8BitPerColor, NULL); + /* pciio can be NULL on return! */ + pciio = efifb_uga_get_pciio(); + + /* Try to find the frame buffer. */ + status = efifb_uga_locate_framebuffer(pciio, &efifb->fb_addr, + &efifb->fb_size); + if (EFI_ERROR(status)) { + efifb->fb_addr = 0; + efifb->fb_size = 0; + } + + /* + * There's no reliable way to detect the frame buffer or the + * offset within the frame buffer of the visible region, nor + * the stride. Our only option is to look at the system and + * fill in the blanks based on that. Luckily, UGA was mostly + * only used on Apple hardware. + */ + offset = -1; + ev = getenv("smbios.system.maker"); + if (ev != NULL && !strcmp(ev, "Apple Inc.")) { + ev = getenv("smbios.system.product"); + if (ev != NULL && !strcmp(ev, "iMac7,1")) { + /* These are the expected values we should have. */ + horiz = 1680; + vert = 1050; + fbaddr = 0xc0000000; + /* These are the missing bits. */ + offset = 0x10000; + stride = 1728; + } else if (ev != NULL && !strcmp(ev, "MacBook3,1")) { + /* These are the expected values we should have. */ + horiz = 1280; + vert = 800; + fbaddr = 0xc0000000; + /* These are the missing bits. */ + offset = 0x0; + stride = 2048; + } + } + + /* + * If this is hardware we know, make sure that it looks familiar + * before we accept our hardcoded values. + */ + if (offset >= 0 && efifb->fb_width == horiz && + efifb->fb_height == vert && efifb->fb_addr == fbaddr) { + efifb->fb_addr += offset; + efifb->fb_size -= offset; + efifb->fb_stride = stride; + return (0); + } else if (offset >= 0) { + printf("Hardware make/model known, but graphics not " + "as expected.\n"); + printf("Console may not work!\n"); + } + /* * The stride is equal or larger to the width. Often it's the * next larger power of two. We'll start with that... @@ -298,16 +357,11 @@ efifb_from_uga(struct efi_fb *efifb, EFI } } while (np); - /* pciio can be NULL on return! */ - pciio = efifb_uga_get_pciio(); - - ev = getenv("uga_framebuffer"); + ev = getenv("hw.efifb.address"); if (ev == NULL) { - /* Try to find the frame buffer. */ - status = efifb_uga_locate_framebuffer(pciio, &efifb->fb_addr, - &efifb->fb_size); - if (EFI_ERROR(status)) { - printf("Please set uga_framebuffer!\n"); + if (efifb->fb_addr == 0) { + printf("Please set hw.efifb.address and " + "hw.efifb.stride.\n"); return (1); } @@ -328,30 +382,30 @@ efifb_from_uga(struct efi_fb *efifb, EFI * to not appear to hang when we can't read from the * frame buffer. */ - ofs = efifb_uga_find_pixel(uga, 0, pciio, efifb->fb_addr, + offset = efifb_uga_find_pixel(uga, 0, pciio, efifb->fb_addr, efifb->fb_size >> 8); - if (ofs == -1) { + if (offset == -1) { printf("Unable to reliably detect frame buffer.\n"); - } else if (ofs > 0) { - efifb->fb_addr += ofs; - efifb->fb_size -= ofs; + } else if (offset > 0) { + efifb->fb_addr += offset; + efifb->fb_size -= offset; } } else { - ofs = 0; + offset = 0; efifb->fb_size = efifb->fb_height * efifb->fb_stride * 4; efifb->fb_addr = strtoul(ev, &p, 0); if (*p != '\0') return (1); } - ev = getenv("uga_stride"); + ev = getenv("hw.efifb.stride"); if (ev == NULL) { - if (pciio != NULL && ofs != -1) { + if (pciio != NULL && offset != -1) { /* Determine the stride. */ - ofs = efifb_uga_find_pixel(uga, 1, pciio, + offset = efifb_uga_find_pixel(uga, 1, pciio, efifb->fb_addr, horiz * 8); - if (ofs != -1) - efifb->fb_stride = ofs >> 2; + if (offset != -1) + efifb->fb_stride = offset >> 2; } else { printf("Unable to reliably detect the stride.\n"); } From owner-svn-src-head@freebsd.org Mon Sep 7 19:38:58 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84DF89CD3C1; Mon, 7 Sep 2015 19:38:58 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x22f.google.com (mail-ig0-x22f.google.com [IPv6:2607:f8b0:4001:c05::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 51ACA1982; Mon, 7 Sep 2015 19:38:58 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by igbni9 with SMTP id ni9so62889945igb.0; Mon, 07 Sep 2015 12:38:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=acW0H07HmMOZ8XMsQOC5Bn5daaJcKIF2Sc2ZOyT8hXg=; b=alAzOl4oMtfaeEE+mcfkXhNRRUtIP6JYKbREoKcRpgUPODlNAaxv21VORULyL9nWjI bL0bRmin9hjRbKp7v1TjtmI3shhEA4pknQsrqd0easQ3dwSgwlwg+qBA/+08eRo/XCkV HEKOfTzCxhGZsyUSdA38m9cxxqo6Zkp2iINsPvd255O73+LKWC/uEsH7q0KEl5dbyv4k vEL09+sZRMlGt6g3qdieNPg37yL/bA8XyqTJvE4PQpMM96/NJv1hqaBqUBUb/IV+8y3H 2P3V+kw8KaBvUfEKVcyEw3DhZt/d3+ri/KFroUTwi0zAQ+o89RyfnCzfgCgfPLr1ohLA TtRQ== MIME-Version: 1.0 X-Received: by 10.50.61.243 with SMTP id t19mr30772378igr.22.1441654737534; Mon, 07 Sep 2015 12:38:57 -0700 (PDT) Received: by 10.36.28.208 with HTTP; Mon, 7 Sep 2015 12:38:57 -0700 (PDT) In-Reply-To: <201509071756.t87HuoRu079196@repo.freebsd.org> References: <201509071756.t87HuoRu079196@repo.freebsd.org> Date: Mon, 7 Sep 2015 12:38:57 -0700 Message-ID: Subject: Re: svn commit: r287538 - head/sys/boot/efi/loader/arch/amd64 From: Adrian Chadd To: Marcel Moolenaar Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 19:38:58 -0000 Hi, every time I see efi framebuffer changes I get a little queasy. There's quite a lot of variance in well, what I once thought would be better than just dealing with a VESA framebuffer. So I'd really appreciate it (and I'm sure others would too!) if you listed all of the things you tested out changes on successfully when you do make changes. That way I and others can have a hope of actually reproducing what's going on and also testing on setups that you don't have. Thanks, -adrian (I'm really surprised this stuff is more complicated than VESA 2.0..) On 7 September 2015 at 10:56, Marcel Moolenaar wrote: > Author: marcel > Date: Mon Sep 7 17:56:49 2015 > New Revision: 287538 > URL: https://svnweb.freebsd.org/changeset/base/287538 > > Log: > As expected, things aren't as simple as hoped. Consequently, we have > no option but to use the smbios information to fill in the blanks. > It's a good thing UGA is a protocol of the past and GOP has all the > info we need. > > Anyway, the logic has been tweaked a little to get the easier bits > of information up front. This includes the resolution and the frame > buffer address. Then we look at the smbios information and define > expected values as well as the missing bits (frame buffer offset and > stride). If the values obtained match the expect values, we fill in > the blanks and return. Otherwise we use the existing detection logic > to figure it out. > > Rename the environment variables from uga_framebuffer abd uga_stride > to hw.efifb.address and hw.efifb.stride. The latter names are more > in line with other variable names. > > We currently have hardcoded settings for: > 1. Mid-2007 iMac (iMac7,1) > 2. Late-2007 MacBook (MacBook3,1) > > Modified: > head/sys/boot/efi/loader/arch/amd64/framebuffer.c > > Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c > ============================================================================== > --- head/sys/boot/efi/loader/arch/amd64/framebuffer.c Mon Sep 7 16:44:28 2015 (r287537) > +++ head/sys/boot/efi/loader/arch/amd64/framebuffer.c Mon Sep 7 17:56:49 2015 (r287538) > @@ -269,8 +269,10 @@ efifb_from_uga(struct efi_fb *efifb, EFI > EFI_PCI_IO_PROTOCOL *pciio; > char *ev, *p; > EFI_STATUS status; > - ssize_t ofs; > - uint32_t np, horiz, vert, depth, refresh; > + ssize_t offset; > + uint64_t fbaddr, fbsize; > + uint32_t horiz, vert, stride; > + uint32_t np, depth, refresh; > > status = uga->GetMode(uga, &horiz, &vert, &depth, &refresh); > if (EFI_ERROR(status)) > @@ -285,6 +287,63 @@ efifb_from_uga(struct efi_fb *efifb, EFI > efifb_mask_from_pixfmt(efifb, PixelBlueGreenRedReserved8BitPerColor, > NULL); > > + /* pciio can be NULL on return! */ > + pciio = efifb_uga_get_pciio(); > + > + /* Try to find the frame buffer. */ > + status = efifb_uga_locate_framebuffer(pciio, &efifb->fb_addr, > + &efifb->fb_size); > + if (EFI_ERROR(status)) { > + efifb->fb_addr = 0; > + efifb->fb_size = 0; > + } > + > + /* > + * There's no reliable way to detect the frame buffer or the > + * offset within the frame buffer of the visible region, nor > + * the stride. Our only option is to look at the system and > + * fill in the blanks based on that. Luckily, UGA was mostly > + * only used on Apple hardware. > + */ > + offset = -1; > + ev = getenv("smbios.system.maker"); > + if (ev != NULL && !strcmp(ev, "Apple Inc.")) { > + ev = getenv("smbios.system.product"); > + if (ev != NULL && !strcmp(ev, "iMac7,1")) { > + /* These are the expected values we should have. */ > + horiz = 1680; > + vert = 1050; > + fbaddr = 0xc0000000; > + /* These are the missing bits. */ > + offset = 0x10000; > + stride = 1728; > + } else if (ev != NULL && !strcmp(ev, "MacBook3,1")) { > + /* These are the expected values we should have. */ > + horiz = 1280; > + vert = 800; > + fbaddr = 0xc0000000; > + /* These are the missing bits. */ > + offset = 0x0; > + stride = 2048; > + } > + } > + > + /* > + * If this is hardware we know, make sure that it looks familiar > + * before we accept our hardcoded values. > + */ > + if (offset >= 0 && efifb->fb_width == horiz && > + efifb->fb_height == vert && efifb->fb_addr == fbaddr) { > + efifb->fb_addr += offset; > + efifb->fb_size -= offset; > + efifb->fb_stride = stride; > + return (0); > + } else if (offset >= 0) { > + printf("Hardware make/model known, but graphics not " > + "as expected.\n"); > + printf("Console may not work!\n"); > + } > + > /* > * The stride is equal or larger to the width. Often it's the > * next larger power of two. We'll start with that... > @@ -298,16 +357,11 @@ efifb_from_uga(struct efi_fb *efifb, EFI > } > } while (np); > > - /* pciio can be NULL on return! */ > - pciio = efifb_uga_get_pciio(); > - > - ev = getenv("uga_framebuffer"); > + ev = getenv("hw.efifb.address"); > if (ev == NULL) { > - /* Try to find the frame buffer. */ > - status = efifb_uga_locate_framebuffer(pciio, &efifb->fb_addr, > - &efifb->fb_size); > - if (EFI_ERROR(status)) { > - printf("Please set uga_framebuffer!\n"); > + if (efifb->fb_addr == 0) { > + printf("Please set hw.efifb.address and " > + "hw.efifb.stride.\n"); > return (1); > } > > @@ -328,30 +382,30 @@ efifb_from_uga(struct efi_fb *efifb, EFI > * to not appear to hang when we can't read from the > * frame buffer. > */ > - ofs = efifb_uga_find_pixel(uga, 0, pciio, efifb->fb_addr, > + offset = efifb_uga_find_pixel(uga, 0, pciio, efifb->fb_addr, > efifb->fb_size >> 8); > - if (ofs == -1) { > + if (offset == -1) { > printf("Unable to reliably detect frame buffer.\n"); > - } else if (ofs > 0) { > - efifb->fb_addr += ofs; > - efifb->fb_size -= ofs; > + } else if (offset > 0) { > + efifb->fb_addr += offset; > + efifb->fb_size -= offset; > } > } else { > - ofs = 0; > + offset = 0; > efifb->fb_size = efifb->fb_height * efifb->fb_stride * 4; > efifb->fb_addr = strtoul(ev, &p, 0); > if (*p != '\0') > return (1); > } > > - ev = getenv("uga_stride"); > + ev = getenv("hw.efifb.stride"); > if (ev == NULL) { > - if (pciio != NULL && ofs != -1) { > + if (pciio != NULL && offset != -1) { > /* Determine the stride. */ > - ofs = efifb_uga_find_pixel(uga, 1, pciio, > + offset = efifb_uga_find_pixel(uga, 1, pciio, > efifb->fb_addr, horiz * 8); > - if (ofs != -1) > - efifb->fb_stride = ofs >> 2; > + if (offset != -1) > + efifb->fb_stride = offset >> 2; > } else { > printf("Unable to reliably detect the stride.\n"); > } > From owner-svn-src-head@freebsd.org Mon Sep 7 20:02:57 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4D549CDEA5; Mon, 7 Sep 2015 20:02:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B57F51640; Mon, 7 Sep 2015 20:02:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87K2vBk045190; Mon, 7 Sep 2015 20:02:57 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87K2uRv045187; Mon, 7 Sep 2015 20:02:56 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201509072002.t87K2uRv045187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 7 Sep 2015 20:02:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287539 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 20:02:57 -0000 Author: mjg Date: Mon Sep 7 20:02:56 2015 New Revision: 287539 URL: https://svnweb.freebsd.org/changeset/base/287539 Log: fd: make the common case in filecaps_copy work lockless The filedesc lock is only needed if ioctls caps are present, which is a rare situation. This is a step towards reducing the scope of the filedesc lock. Modified: head/sys/kern/kern_descrip.c head/sys/kern/uipc_usrreq.c head/sys/sys/filedesc.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Sep 7 17:56:49 2015 (r287538) +++ head/sys/kern/kern_descrip.c Mon Sep 7 20:02:56 2015 (r287539) @@ -911,7 +911,7 @@ kern_dup(struct thread *td, u_int mode, #endif filecaps_free(&newfde->fde_caps); memcpy(newfde, oldfde, fde_change_size); - filecaps_copy(&oldfde->fde_caps, &newfde->fde_caps); + filecaps_copy(&oldfde->fde_caps, &newfde->fde_caps, true); if ((flags & FDDUP_FLAG_CLOEXEC) != 0) newfde->fde_flags = oldfde->fde_flags | UF_EXCLOSE; else @@ -1433,21 +1433,31 @@ filecaps_init(struct filecaps *fcaps) /* * Copy filecaps structure allocating memory for ioctls array if needed. + * + * The last parameter indicates whether the fdtable is locked. If it is not and + * ioctls are encountered, copying fails and the caller must lock the table. + * + * Note that if the table was not locked, the caller has to check the relevant + * sequence counter to determine whether the operation was successful. */ -void -filecaps_copy(const struct filecaps *src, struct filecaps *dst) +int +filecaps_copy(const struct filecaps *src, struct filecaps *dst, bool locked) { size_t size; *dst = *src; - if (src->fc_ioctls != NULL) { - KASSERT(src->fc_nioctls > 0, - ("fc_ioctls != NULL, but fc_nioctls=%hd", src->fc_nioctls)); - - size = sizeof(src->fc_ioctls[0]) * src->fc_nioctls; - dst->fc_ioctls = malloc(size, M_FILECAPS, M_WAITOK); - bcopy(src->fc_ioctls, dst->fc_ioctls, size); - } + if (src->fc_ioctls == NULL) + return (0); + if (!locked) + return (1); + + KASSERT(src->fc_nioctls > 0, + ("fc_ioctls != NULL, but fc_nioctls=%hd", src->fc_nioctls)); + + size = sizeof(src->fc_ioctls[0]) * src->fc_nioctls; + dst->fc_ioctls = malloc(size, M_FILECAPS, M_WAITOK); + bcopy(src->fc_ioctls, dst->fc_ioctls, size); + return (0); } /* @@ -1956,7 +1966,7 @@ fdcopy(struct filedesc *fdp) } nfde = &newfdp->fd_ofiles[i]; *nfde = *ofde; - filecaps_copy(&ofde->fde_caps, &nfde->fde_caps); + filecaps_copy(&ofde->fde_caps, &nfde->fde_caps, true); fhold(nfde->fde_file); fdused_init(newfdp, i); newfdp->fd_lastfile = i; @@ -2012,7 +2022,7 @@ fdcopy_remapped(struct filedesc *fdp, co } nfde = &newfdp->fd_ofiles[i]; *nfde = *ofde; - filecaps_copy(&ofde->fde_caps, &nfde->fde_caps); + filecaps_copy(&ofde->fde_caps, &nfde->fde_caps, true); fhold(nfde->fde_file); fdused_init(newfdp, i); newfdp->fd_lastfile = i; @@ -2723,7 +2733,7 @@ fgetvp_rights(struct thread *td, int fd, *vpp = fp->f_vnode; vref(*vpp); - filecaps_copy(&fdp->fd_ofiles[fd].fde_caps, havecaps); + filecaps_copy(&fdp->fd_ofiles[fd].fde_caps, havecaps, true); return (0); } @@ -2938,7 +2948,7 @@ dupfdopen(struct thread *td, struct file seq_write_begin(&newfde->fde_seq); #endif memcpy(newfde, oldfde, fde_change_size); - filecaps_copy(&oldfde->fde_caps, &newfde->fde_caps); + filecaps_copy(&oldfde->fde_caps, &newfde->fde_caps, true); #ifdef CAPABILITIES seq_write_end(&newfde->fde_seq); #endif Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Mon Sep 7 17:56:49 2015 (r287538) +++ head/sys/kern/uipc_usrreq.c Mon Sep 7 20:02:56 2015 (r287539) @@ -1972,7 +1972,7 @@ unp_internalize(struct mbuf **controlp, fdep[i] = fdev; fdep[i]->fde_file = fde->fde_file; filecaps_copy(&fde->fde_caps, - &fdep[i]->fde_caps); + &fdep[i]->fde_caps, true); unp_internalize_fp(fdep[i]->fde_file); } FILEDESC_SUNLOCK(fdesc); Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Mon Sep 7 17:56:49 2015 (r287538) +++ head/sys/sys/filedesc.h Mon Sep 7 20:02:56 2015 (r287539) @@ -153,7 +153,8 @@ enum { struct thread; void filecaps_init(struct filecaps *fcaps); -void filecaps_copy(const struct filecaps *src, struct filecaps *dst); +int filecaps_copy(const struct filecaps *src, struct filecaps *dst, + bool locked); void filecaps_move(struct filecaps *src, struct filecaps *dst); void filecaps_free(struct filecaps *fcaps); From owner-svn-src-head@freebsd.org Mon Sep 7 20:05:57 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4F1C9CC099; Mon, 7 Sep 2015 20:05:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A63551A2A; Mon, 7 Sep 2015 20:05:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87K5vqN045626; Mon, 7 Sep 2015 20:05:57 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87K5vOS045625; Mon, 7 Sep 2015 20:05:57 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201509072005.t87K5vOS045625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 7 Sep 2015 20:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287540 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 20:05:57 -0000 Author: mjg Date: Mon Sep 7 20:05:56 2015 New Revision: 287540 URL: https://svnweb.freebsd.org/changeset/base/287540 Log: fd: make rights a mandatory argument to fgetvp_rights The only caller already always passes rights. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Sep 7 20:02:56 2015 (r287539) +++ head/sys/kern/kern_descrip.c Mon Sep 7 20:05:56 2015 (r287540) @@ -2721,11 +2721,9 @@ fgetvp_rights(struct thread *td, int fd, return (EBADF); #ifdef CAPABILITIES - if (needrightsp != NULL) { - error = cap_check(cap_rights(fdp, fd), needrightsp); - if (error != 0) - return (error); - } + error = cap_check(cap_rights(fdp, fd), needrightsp); + if (error != 0) + return (error); #endif if (fp->f_vnode == NULL) From owner-svn-src-head@freebsd.org Mon Sep 7 20:55:15 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 904859CBB3C; Mon, 7 Sep 2015 20:55:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 816331303; Mon, 7 Sep 2015 20:55:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87KtFrt070393; Mon, 7 Sep 2015 20:55:15 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87KtFCU070392; Mon, 7 Sep 2015 20:55:15 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201509072055.t87KtFCU070392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 7 Sep 2015 20:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287541 - head/lib/libz X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 20:55:15 -0000 Author: dim Date: Mon Sep 7 20:55:14 2015 New Revision: 287541 URL: https://svnweb.freebsd.org/changeset/base/287541 Log: In libz's inflateMark(), avoid left-shifting a negative integer, which is undefined. Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D3344 MFC after: 3 days Modified: head/lib/libz/inflate.c Modified: head/lib/libz/inflate.c ============================================================================== --- head/lib/libz/inflate.c Mon Sep 7 20:05:56 2015 (r287540) +++ head/lib/libz/inflate.c Mon Sep 7 20:55:14 2015 (r287541) @@ -1504,7 +1504,7 @@ z_streamp strm; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; + if (strm == Z_NULL || strm->state == Z_NULL) return -(1L << 16); state = (struct inflate_state FAR *)strm->state; return ((long)(state->back) << 16) + (state->mode == COPY ? state->length : From owner-svn-src-head@freebsd.org Mon Sep 7 21:59:12 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24A4C9CD9C0; Mon, 7 Sep 2015 21:59:12 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB7EB1E7D; Mon, 7 Sep 2015 21:59:11 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87LxBIX097288; Mon, 7 Sep 2015 21:59:11 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87LxBsw097287; Mon, 7 Sep 2015 21:59:11 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201509072159.t87LxBsw097287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 7 Sep 2015 21:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287542 - head/sys/dev/rccgpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 21:59:12 -0000 Author: loos Date: Mon Sep 7 21:59:11 2015 New Revision: 287542 URL: https://svnweb.freebsd.org/changeset/base/287542 Log: Fix off-by-one bugs. While here, only set the GPIO pin state for output pins. Pointy hat to: loos Sponsored by: Rubicon Communications (Netgate) Modified: head/sys/dev/rccgpio/rccgpio.c Modified: head/sys/dev/rccgpio/rccgpio.c ============================================================================== --- head/sys/dev/rccgpio/rccgpio.c Mon Sep 7 20:55:14 2015 (r287541) +++ head/sys/dev/rccgpio/rccgpio.c Mon Sep 7 21:59:11 2015 (r287542) @@ -126,7 +126,7 @@ rcc_gpio_pin_getcaps(device_t dev, uint3 struct rcc_gpio_softc *sc; sc = device_get_softc(dev); - if (pin > sc->sc_gpio_npins) + if (pin >= sc->sc_gpio_npins) return (EINVAL); *caps = rcc_pins[pin].caps; @@ -140,7 +140,7 @@ rcc_gpio_pin_getflags(device_t dev, uint struct rcc_gpio_softc *sc; sc = device_get_softc(dev); - if (pin > sc->sc_gpio_npins) + if (pin >= sc->sc_gpio_npins) return (EINVAL); /* Flags cannot be changed. */ @@ -155,7 +155,7 @@ rcc_gpio_pin_getname(device_t dev, uint3 struct rcc_gpio_softc *sc; sc = device_get_softc(dev); - if (pin > sc->sc_gpio_npins) + if (pin >= sc->sc_gpio_npins) return (EINVAL); memcpy(name, rcc_pins[pin].name, GPIOMAXNAME); @@ -169,7 +169,7 @@ rcc_gpio_pin_setflags(device_t dev, uint struct rcc_gpio_softc *sc; sc = device_get_softc(dev); - if (pin > sc->sc_gpio_npins) + if (pin >= sc->sc_gpio_npins) return (EINVAL); /* Flags cannot be changed - risk of short-circuit!!! */ @@ -183,7 +183,10 @@ rcc_gpio_pin_set(device_t dev, uint32_t struct rcc_gpio_softc *sc; sc = device_get_softc(dev); - if (pin > sc->sc_gpio_npins) + if (pin >= sc->sc_gpio_npins) + return (EINVAL); + + if ((rcc_pins[pin].caps & GPIO_PIN_OUTPUT) == 0) return (EINVAL); RCC_GPIO_LOCK(sc); @@ -204,7 +207,7 @@ rcc_gpio_pin_get(device_t dev, uint32_t uint32_t value; sc = device_get_softc(dev); - if (pin > sc->sc_gpio_npins) + if (pin >= sc->sc_gpio_npins) return (EINVAL); RCC_GPIO_LOCK(sc); @@ -224,7 +227,10 @@ rcc_gpio_pin_toggle(device_t dev, uint32 struct rcc_gpio_softc *sc; sc = device_get_softc(dev); - if (pin > sc->sc_gpio_npins) + if (pin >= sc->sc_gpio_npins) + return (EINVAL); + + if ((rcc_pins[pin].caps & GPIO_PIN_OUTPUT) == 0) return (EINVAL); RCC_GPIO_LOCK(sc); From owner-svn-src-head@freebsd.org Mon Sep 7 22:19:49 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9994A9CC30D for ; Mon, 7 Sep 2015 22:19:49 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7EF561974 for ; Mon, 7 Sep 2015 22:19:48 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Mon, 7 Sep 2015 22:18:59 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id t87MIeun056079; Mon, 7 Sep 2015 16:18:40 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1441664320.68284.76.camel@freebsd.org> Subject: Re: svn commit: r287542 - head/sys/dev/rccgpio From: Ian Lepore To: Luiz Otavio O Souza Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 07 Sep 2015 16:18:40 -0600 In-Reply-To: <201509072159.t87LxBsw097287@repo.freebsd.org> References: <201509072159.t87LxBsw097287@repo.freebsd.org> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.12.10 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 22:19:49 -0000 On Mon, 2015-09-07 at 21:59 +0000, Luiz Otavio O Souza wrote: > Author: loos > Date: Mon Sep 7 21:59:11 2015 > New Revision: 287542 > URL: https://svnweb.freebsd.org/changeset/base/287542 > > Log: > Fix off-by-one bugs. > > While here, only set the GPIO pin state for output pins. > It's not a good idea to forbid setting output state on an input pin, because it's a technique that's often used to preset the drive state of a pin before changing it to be an output pin. That way a pin that powers on to a default state of input-pulled-high can be set to drive high before making it output, and you avoid any transitions on the pin (which might be important if the pin is connected to, say, the power-control input of a PMIC). Most hardware allows setting the output-state register bits for a pin even if the pin is currently assigned as input. I guess if the hardware has no way to do that, then returning EINVAL might make sense. -- Ian > Pointy hat to: loos > Sponsored by: Rubicon Communications (Netgate) > > Modified: > head/sys/dev/rccgpio/rccgpio.c > > Modified: head/sys/dev/rccgpio/rccgpio.c > ============================================================================== > --- head/sys/dev/rccgpio/rccgpio.c Mon Sep 7 20:55:14 2015 (r287541) > +++ head/sys/dev/rccgpio/rccgpio.c Mon Sep 7 21:59:11 2015 (r287542) > @@ -126,7 +126,7 @@ rcc_gpio_pin_getcaps(device_t dev, uint3 > struct rcc_gpio_softc *sc; > > sc = device_get_softc(dev); > - if (pin > sc->sc_gpio_npins) > + if (pin >= sc->sc_gpio_npins) > return (EINVAL); > > *caps = rcc_pins[pin].caps; > @@ -140,7 +140,7 @@ rcc_gpio_pin_getflags(device_t dev, uint > struct rcc_gpio_softc *sc; > > sc = device_get_softc(dev); > - if (pin > sc->sc_gpio_npins) > + if (pin >= sc->sc_gpio_npins) > return (EINVAL); > > /* Flags cannot be changed. */ > @@ -155,7 +155,7 @@ rcc_gpio_pin_getname(device_t dev, uint3 > struct rcc_gpio_softc *sc; > > sc = device_get_softc(dev); > - if (pin > sc->sc_gpio_npins) > + if (pin >= sc->sc_gpio_npins) > return (EINVAL); > > memcpy(name, rcc_pins[pin].name, GPIOMAXNAME); > @@ -169,7 +169,7 @@ rcc_gpio_pin_setflags(device_t dev, uint > struct rcc_gpio_softc *sc; > > sc = device_get_softc(dev); > - if (pin > sc->sc_gpio_npins) > + if (pin >= sc->sc_gpio_npins) > return (EINVAL); > > /* Flags cannot be changed - risk of short-circuit!!! */ > @@ -183,7 +183,10 @@ rcc_gpio_pin_set(device_t dev, uint32_t > struct rcc_gpio_softc *sc; > > sc = device_get_softc(dev); > - if (pin > sc->sc_gpio_npins) > + if (pin >= sc->sc_gpio_npins) > + return (EINVAL); > + > + if ((rcc_pins[pin].caps & GPIO_PIN_OUTPUT) == 0) > return (EINVAL); > > RCC_GPIO_LOCK(sc); > @@ -204,7 +207,7 @@ rcc_gpio_pin_get(device_t dev, uint32_t > uint32_t value; > > sc = device_get_softc(dev); > - if (pin > sc->sc_gpio_npins) > + if (pin >= sc->sc_gpio_npins) > return (EINVAL); > > RCC_GPIO_LOCK(sc); > @@ -224,7 +227,10 @@ rcc_gpio_pin_toggle(device_t dev, uint32 > struct rcc_gpio_softc *sc; > > sc = device_get_softc(dev); > - if (pin > sc->sc_gpio_npins) > + if (pin >= sc->sc_gpio_npins) > + return (EINVAL); > + > + if ((rcc_pins[pin].caps & GPIO_PIN_OUTPUT) == 0) > return (EINVAL); > > RCC_GPIO_LOCK(sc); > From owner-svn-src-head@freebsd.org Mon Sep 7 22:37:29 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AA7A9CCC23; Mon, 7 Sep 2015 22:37:29 +0000 (UTC) (envelope-from loos.br@gmail.com) Received: from mail-lb0-x236.google.com (mail-lb0-x236.google.com [IPv6:2a00:1450:4010:c04::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BEA7C10E9; Mon, 7 Sep 2015 22:37:28 +0000 (UTC) (envelope-from loos.br@gmail.com) Received: by lbpo4 with SMTP id o4so44494224lbp.2; Mon, 07 Sep 2015 15:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=s3EdHMoqsL82AsVOeSyRWuSjyV+px7j+joNR5aa5WZs=; b=vL6OjIakPrQd/u2aVPxYLkdbLL60t/zFspULIzdT6MSP8/pmllKl4+TTeYpFcZTUQ9 a5VnMeEMAe3bDMUP81X1roHVsMXEauv2HnvPzgqE4BWJvI230xicIB6rDutwLZrQBqUt GjK7yDA0DhBf59VdtqrOkn985E/jLVkdOYxR75Y07fPMDkyf4KPBVynJSSe3NmASMGSb hof93kSkjBMwKxPnvxUP9qjvvJWCxugWjtYnRQGA31rN46ttcH4q5fpqEw9Y7Wc6LdQp 1FJzk1XPCO7eR3nxz21vgc7zNl2x+hyLyjLGgUJ5nrChA07SkW4DiDEquNLsuSj00dqk sBvw== MIME-Version: 1.0 X-Received: by 10.112.134.197 with SMTP id pm5mr19242415lbb.3.1441665446140; Mon, 07 Sep 2015 15:37:26 -0700 (PDT) Received: by 10.112.12.234 with HTTP; Mon, 7 Sep 2015 15:37:26 -0700 (PDT) In-Reply-To: <1441664320.68284.76.camel@freebsd.org> References: <201509072159.t87LxBsw097287@repo.freebsd.org> <1441664320.68284.76.camel@freebsd.org> Date: Mon, 7 Sep 2015 19:37:26 -0300 Message-ID: Subject: Re: svn commit: r287542 - head/sys/dev/rccgpio From: Luiz Otavio O Souza To: Ian Lepore Cc: Luiz Otavio O Souza , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 22:37:29 -0000 On Mon, Sep 7, 2015 at 7:18 PM, Ian Lepore wrote: > On Mon, 2015-09-07 at 21:59 +0000, Luiz Otavio O Souza wrote: >> Author: loos >> Date: Mon Sep 7 21:59:11 2015 >> New Revision: 287542 >> URL: https://svnweb.freebsd.org/changeset/base/287542 >> >> Log: >> Fix off-by-one bugs. >> >> While here, only set the GPIO pin state for output pins. >> > > It's not a good idea to forbid setting output state on an input pin, > because it's a technique that's often used to preset the drive state of > a pin before changing it to be an output pin. That way a pin that > powers on to a default state of input-pulled-high can be set to drive > high before making it output, and you avoid any transitions on the pin > (which might be important if the pin is connected to, say, the > power-control input of a PMIC). > > Most hardware allows setting the output-state register bits for a pin > even if the pin is currently assigned as input. I guess if the hardware > has no way to do that, then returning EINVAL might make sense. > > -- Ian This driver is 'special', it only give access to 4 user LEDs and a reset switch. All the pins are locked in they intended setting (one input and four outputs) From owner-svn-src-head@freebsd.org Mon Sep 7 23:16:40 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 367DF9CDF26; Mon, 7 Sep 2015 23:16:40 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27B1811D8; Mon, 7 Sep 2015 23:16:40 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t87NGegO033914; Mon, 7 Sep 2015 23:16:40 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t87NGePE033913; Mon, 7 Sep 2015 23:16:40 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509072316.t87NGePE033913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 7 Sep 2015 23:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287543 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 23:16:40 -0000 Author: adrian Date: Mon Sep 7 23:16:39 2015 New Revision: 287543 URL: https://svnweb.freebsd.org/changeset/base/287543 Log: Don't call enable_all_rings if the adapter has been freed. This is a subtle use-after-free race that results in some very undesirable hang behaviour. Reviewed by: pkelsey Obtained from: Kip Macy, NextBSD (https://github.com/NextBSD/NextBSD/commit/91a9bd1dbb33dafb41684d054e59d73976de9654) Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Mon Sep 7 21:59:11 2015 (r287542) +++ head/sys/dev/netmap/netmap.c Mon Sep 7 23:16:39 2015 (r287543) @@ -2841,10 +2841,12 @@ void netmap_detach(struct ifnet *ifp) { struct netmap_adapter *na = NA(ifp); + int skip; if (!na) return; + skip = 0; NMG_LOCK(); netmap_disable_all_rings(ifp); na->ifp = NULL; @@ -2856,10 +2858,11 @@ netmap_detach(struct ifnet *ifp) * the driver is gone. */ if (na->na_flags & NAF_NATIVE) { - netmap_adapter_put(na); + skip = netmap_adapter_put(na); } /* give them a chance to notice */ - netmap_enable_all_rings(ifp); + if (skip == 0) + netmap_enable_all_rings(ifp); NMG_UNLOCK(); } From owner-svn-src-head@freebsd.org Tue Sep 8 00:30:11 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9F899CB7D0; Tue, 8 Sep 2015 00:30:11 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB63F120A; Tue, 8 Sep 2015 00:30:11 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t880UBFL064803; Tue, 8 Sep 2015 00:30:11 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t880UBDL064801; Tue, 8 Sep 2015 00:30:11 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201509080030.t880UBDL064801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Tue, 8 Sep 2015 00:30:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287544 - head/share/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 00:30:12 -0000 Author: gnn Date: Tue Sep 8 00:30:10 2015 New Revision: 287544 URL: https://svnweb.freebsd.org/changeset/base/287544 Log: Update DTrace nfs scripts to track the proper provider names. Submitted by: Alex Burlyga Modified: head/share/dtrace/nfsattrstats head/share/dtrace/nfsclienttime Modified: head/share/dtrace/nfsattrstats ============================================================================== --- head/share/dtrace/nfsattrstats Mon Sep 7 23:16:39 2015 (r287543) +++ head/share/dtrace/nfsattrstats Tue Sep 8 00:30:10 2015 (r287544) @@ -56,7 +56,7 @@ syscall:::return self->syscallname = ""; } -nfsclient::: +nfscl::: /self->syscallname != 0 && self->syscallname != ""/ { @@ -64,7 +64,7 @@ nfsclient::: self->syscallname); } -nfsclient::: +nfscl::: /self->syscallname == 0 || self->syscallname == ""/ { Modified: head/share/dtrace/nfsclienttime ============================================================================== --- head/share/dtrace/nfsclienttime Mon Sep 7 23:16:39 2015 (r287543) +++ head/share/dtrace/nfsclienttime Tue Sep 8 00:30:10 2015 (r287544) @@ -53,13 +53,13 @@ syscall:::entry self->count = 0; } -nfsclient:nfs3::start +nfscl:nfs3::start { self->timestamp = timestamp; } -nfsclient:nfs3::done +nfscl:nfs3::done { self->count += (timestamp - self->timestamp); From owner-svn-src-head@freebsd.org Tue Sep 8 04:18:58 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C16EA00318; Tue, 8 Sep 2015 04:18:58 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7B2A1096; Tue, 8 Sep 2015 04:18:57 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t884IvOB063113; Tue, 8 Sep 2015 04:18:57 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t884IvdM063112; Tue, 8 Sep 2015 04:18:57 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201509080418.t884IvdM063112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Tue, 8 Sep 2015 04:18:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287550 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 04:18:58 -0000 Author: alc Date: Tue Sep 8 04:18:57 2015 New Revision: 287550 URL: https://svnweb.freebsd.org/changeset/base/287550 Log: To simplify upcoming changes to the inactive queue scan, change the code so that there is only one place where pages are freed and only one place where pages are moved to the tail of the queue. Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Tue Sep 8 02:02:08 2015 (r287549) +++ head/sys/vm/vm_pageout.c Tue Sep 8 04:18:57 2015 (r287550) @@ -1178,12 +1178,8 @@ unlock_page: * Invalid pages can be easily freed. They cannot be * mapped, vm_page_free() asserts this. */ - if (m->valid == 0) { - vm_page_free(m); - PCPU_INC(cnt.v_dfree); - --page_shortage; - goto drop_page; - } + if (m->valid == 0) + goto free_page; /* * If the page has been referenced and the object is not dead, @@ -1214,12 +1210,8 @@ unlock_page: */ m->act_count += act_delta + ACT_ADVANCE; goto drop_page; - } else if ((object->flags & OBJ_DEAD) == 0) { - vm_pagequeue_lock(pq); - queues_locked = TRUE; - vm_page_requeue_locked(m); - goto drop_page; - } + } else if ((object->flags & OBJ_DEAD) == 0) + goto requeue_page; } /* @@ -1240,6 +1232,7 @@ unlock_page: /* * Clean pages can be freed. */ +free_page: vm_page_free(m); PCPU_INC(cnt.v_dfree); --page_shortage; @@ -1266,6 +1259,7 @@ unlock_page: * the thrash point for a heavily loaded machine. */ m->flags |= PG_WINATCFLS; +requeue_page: vm_pagequeue_lock(pq); queues_locked = TRUE; vm_page_requeue_locked(m); @@ -1287,12 +1281,8 @@ unlock_page: pageout_ok = vm_page_count_min(); else pageout_ok = TRUE; - if (!pageout_ok) { - vm_pagequeue_lock(pq); - queues_locked = TRUE; - vm_page_requeue_locked(m); - goto drop_page; - } + if (!pageout_ok) + goto requeue_page; error = vm_pageout_clean(m); /* * Decrement page_shortage on success to account for From owner-svn-src-head@freebsd.org Tue Sep 8 07:50:36 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 722669CC9C1; Tue, 8 Sep 2015 07:50:36 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6358E1C5C; Tue, 8 Sep 2015 07:50:36 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t887oa9S058369; Tue, 8 Sep 2015 07:50:36 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t887oZXx058367; Tue, 8 Sep 2015 07:50:35 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201509080750.t887oZXx058367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Tue, 8 Sep 2015 07:50:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287552 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 07:50:36 -0000 Author: kevlo Date: Tue Sep 8 07:50:35 2015 New Revision: 287552 URL: https://svnweb.freebsd.org/changeset/base/287552 Log: - Remove empty key_update_* functions. - Hide "struct ieee80211_node *" -> "struct run_node *" casting behind RUN_NODE() macro. - Simplify IEEE80211_HAS_ADDR4 macro definition - Fix a comment (desn't -> doesn't) Submitted by: Andriy Voskoboinyk Differential Revision: https://reviews.freebsd.org/D3588 Modified: head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_runvar.h Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Tue Sep 8 07:15:10 2015 (r287551) +++ head/sys/dev/usb/wlan/if_run.c Tue Sep 8 07:50:35 2015 (r287552) @@ -88,8 +88,7 @@ SYSCTL_INT(_hw_usb_run, OID_AUTO, debug, "run debug level"); #endif -#define IEEE80211_HAS_ADDR4(wh) \ - (((wh)->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) +#define IEEE80211_HAS_ADDR4(wh) IEEE80211_IS_DSTODS(wh) /* * Because of LOR in run_key_delete(), use atomic instead. @@ -382,8 +381,6 @@ static int run_media_change(struct ifnet static int run_newstate(struct ieee80211vap *, enum ieee80211_state, int); static int run_wme_update(struct ieee80211com *); static void run_wme_update_cb(void *); -static void run_key_update_begin(struct ieee80211vap *); -static void run_key_update_end(struct ieee80211vap *); static void run_key_set_cb(void *); static int run_key_set(struct ieee80211vap *, struct ieee80211_key *, const uint8_t mac[IEEE80211_ADDR_LEN]); @@ -926,8 +923,6 @@ run_vap_create(struct ieee80211com *ic, return (NULL); } - vap->iv_key_update_begin = run_key_update_begin; - vap->iv_key_update_end = run_key_update_end; vap->iv_update_beacon = run_update_beacon; vap->iv_max_aid = RT2870_WCID_MAX; /* @@ -2002,7 +1997,7 @@ run_media_change(struct ifnet *ifp) if (rt2860_rates[ridx].rate == rate) break; ni = ieee80211_ref_node(vap->iv_bss); - rn = (struct run_node *)ni; + rn = RUN_NODE(ni); rn->fix_ridx = ridx; DPRINTF("rate=%d, fix_ridx=%d\n", rate, rn->fix_ridx); ieee80211_free_node(ni); @@ -2227,27 +2222,11 @@ run_wme_update(struct ieee80211com *ic) run_wme_update_cb(ic); RUN_UNLOCK(sc); - /* return whatever, upper layer desn't care anyway */ + /* return whatever, upper layer doesn't care anyway */ return (0); } static void -run_key_update_begin(struct ieee80211vap *vap) -{ - /* - * To avoid out-of-order events, both run_key_set() and - * _delete() are deferred and handled by run_cmdq_cb(). - * So, there is nothing we need to do here. - */ -} - -static void -run_key_update_end(struct ieee80211vap *vap) -{ - /* null */ -} - -static void run_key_set_cb(void *arg) { struct run_cmdq *cmdq = arg; @@ -2576,7 +2555,7 @@ run_iter_func(void *arg, struct ieee8021 { struct run_softc *sc = arg; struct ieee80211vap *vap = ni->ni_vap; - struct run_node *rn = (void *)ni; + struct run_node *rn = RUN_NODE(ni); union run_stats sta[2]; uint16_t (*wstat)[3]; int txcnt, success, retrycnt, error; @@ -2650,7 +2629,7 @@ run_newassoc_cb(void *arg) static void run_newassoc(struct ieee80211_node *ni, int isnew) { - struct run_node *rn = (void *)ni; + struct run_node *rn = RUN_NODE(ni); struct ieee80211_rateset *rs = &ni->ni_rates; struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = vap->iv_ic; @@ -3243,7 +3222,7 @@ run_tx(struct run_softc *sc, struct mbuf struct ieee80211_frame *wh; struct ieee80211_channel *chan; const struct ieee80211_txparam *tp; - struct run_node *rn = (void *)ni; + struct run_node *rn = RUN_NODE(ni); struct run_tx_data *data; struct rt2870_txd *txd; struct rt2860_txwi *txwi; @@ -3407,7 +3386,7 @@ static int run_tx_mgt(struct run_softc *sc, struct mbuf *m, struct ieee80211_node *ni) { struct ieee80211com *ic = &sc->sc_ic; - struct run_node *rn = (void *)ni; + struct run_node *rn = RUN_NODE(ni); struct run_tx_data *data; struct ieee80211_frame *wh; struct rt2870_txd *txd; Modified: head/sys/dev/usb/wlan/if_runvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_runvar.h Tue Sep 8 07:15:10 2015 (r287551) +++ head/sys/dev/usb/wlan/if_runvar.h Tue Sep 8 07:50:35 2015 (r287552) @@ -101,6 +101,7 @@ struct run_node { uint8_t mgt_ridx; uint8_t fix_ridx; }; +#define RUN_NODE(ni) ((struct run_node *)(ni)) struct run_cmdq { void *arg0; From owner-svn-src-head@freebsd.org Tue Sep 8 07:53:11 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7ADA29CCB7A; Tue, 8 Sep 2015 07:53:11 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E2071F7C; Tue, 8 Sep 2015 07:53:11 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t887rBj6061606; Tue, 8 Sep 2015 07:53:11 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t887rBh5061605; Tue, 8 Sep 2015 07:53:11 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201509080753.t887rBh5061605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Tue, 8 Sep 2015 07:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287553 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 07:53:11 -0000 Author: kevlo Date: Tue Sep 8 07:53:10 2015 New Revision: 287553 URL: https://svnweb.freebsd.org/changeset/base/287553 Log: Fix comparison in run_key_set_cb(). Tested on RT5370, sta mode. Submitted by: Andriy Voskoboinyk Differential Revision: https://reviews.freebsd.org/D3589 Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Tue Sep 8 07:50:35 2015 (r287552) +++ head/sys/dev/usb/wlan/if_run.c Tue Sep 8 07:53:10 2015 (r287553) @@ -2235,6 +2235,7 @@ run_key_set_cb(void *arg) struct ieee80211com *ic = vap->iv_ic; struct run_softc *sc = ic->ic_softc; struct ieee80211_node *ni; + u_int cipher = k->wk_cipher->ic_cipher; uint32_t attr; uint16_t base, associd; uint8_t mode, wcid, iv[8]; @@ -2248,7 +2249,7 @@ run_key_set_cb(void *arg) associd = (ni != NULL) ? ni->ni_associd : 0; /* map net80211 cipher to RT2860 security mode */ - switch (k->wk_cipher->ic_cipher) { + switch (cipher) { case IEEE80211_CIPHER_WEP: if(k->wk_keylen < 8) mode = RT2860_MODE_WEP40; @@ -2281,7 +2282,7 @@ run_key_set_cb(void *arg) base = RT2860_PKEY(wcid); } - if (k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP) { + if (cipher == IEEE80211_CIPHER_TKIP) { if(run_write_region_1(sc, base, k->wk_key, 16)) return; if(run_write_region_1(sc, base + 16, &k->wk_key[16], 8)) /* wk_txmic */ @@ -2297,11 +2298,11 @@ run_key_set_cb(void *arg) if (!(k->wk_flags & IEEE80211_KEY_GROUP) || (k->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV))) { /* set initial packet number in IV+EIV */ - if (k->wk_cipher == IEEE80211_CIPHER_WEP) { + if (cipher == IEEE80211_CIPHER_WEP) { memset(iv, 0, sizeof iv); iv[3] = vap->iv_def_txkey << 6; } else { - if (k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP) { + if (cipher == IEEE80211_CIPHER_TKIP) { iv[0] = k->wk_keytsc >> 8; iv[1] = (iv[0] | 0x20) & 0x7f; iv[2] = k->wk_keytsc; From owner-svn-src-head@freebsd.org Tue Sep 8 08:02:16 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAD879CD1E4; Tue, 8 Sep 2015 08:02:15 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC2FB14E8; Tue, 8 Sep 2015 08:02:15 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8882Fip065855; Tue, 8 Sep 2015 08:02:15 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8882Fr1065853; Tue, 8 Sep 2015 08:02:15 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201509080802.t8882Fr1065853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Tue, 8 Sep 2015 08:02:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287554 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 08:02:16 -0000 Author: kevlo Date: Tue Sep 8 08:02:14 2015 New Revision: 287554 URL: https://svnweb.freebsd.org/changeset/base/287554 Log: Add TSF field into TX/RX radiotap headers Tested on RT5370, sta mode. Submitted by: Andriy Voskoboinyk Differential Revision: https://reviews.freebsd.org/D3590 Modified: head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_runvar.h Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Tue Sep 8 07:53:10 2015 (r287553) +++ head/sys/dev/usb/wlan/if_run.c Tue Sep 8 08:02:14 2015 (r287554) @@ -431,6 +431,7 @@ static void run_updateprot_cb(void *); static void run_usb_timeout_cb(void *); static void run_reset_livelock(struct run_softc *); static void run_enable_tsf_sync(struct run_softc *); +static void run_get_tsf(struct run_softc *, uint64_t *); static void run_enable_mrr(struct run_softc *); static void run_set_txpreamble(struct run_softc *); static void run_set_basicrates(struct run_softc *); @@ -2811,6 +2812,7 @@ run_rx_frame(struct run_softc *sc, struc tap->wr_antenna = ant; tap->wr_dbm_antsignal = run_rssi2dbm(sc, rssi, ant); tap->wr_rate = 2; /* in case it can't be found below */ + run_get_tsf(sc, &tap->wr_tsf); phy = le16toh(rxwi->phy); switch (phy & RT2860_PHY_MODE) { case RT2860_PHY_CCK: @@ -3058,6 +3060,7 @@ tr_setup: (struct rt2860_txwi *)(&data->desc + sizeof(struct rt2870_txd)); tap->wt_flags = 0; tap->wt_rate = rt2860_rates[data->ridx].rate; + run_get_tsf(sc, &tap->wt_tsf); tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq); tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags); tap->wt_hwqueue = index; @@ -5047,6 +5050,13 @@ run_enable_tsf_sync(struct run_softc *sc } static void +run_get_tsf(struct run_softc *sc, uint64_t *buf) +{ + run_read_region_1(sc, RT2860_TSF_TIMER_DW0, (uint8_t *)buf, + sizeof(*buf)); +} + +static void run_enable_mrr(struct run_softc *sc) { #define CCK(mcs) (mcs) Modified: head/sys/dev/usb/wlan/if_runvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_runvar.h Tue Sep 8 07:53:10 2015 (r287553) +++ head/sys/dev/usb/wlan/if_runvar.h Tue Sep 8 08:02:14 2015 (r287554) @@ -45,6 +45,7 @@ struct run_rx_radiotap_header { struct ieee80211_radiotap_header wr_ihdr; + uint64_t wr_tsf; uint8_t wr_flags; uint8_t wr_rate; uint16_t wr_chan_freq; @@ -55,7 +56,8 @@ struct run_rx_radiotap_header { } __packed __aligned(8); #define RUN_RX_RADIOTAP_PRESENT \ - (1 << IEEE80211_RADIOTAP_FLAGS | \ + (1 << IEEE80211_RADIOTAP_TSFT | \ + 1 << IEEE80211_RADIOTAP_FLAGS | \ 1 << IEEE80211_RADIOTAP_RATE | \ 1 << IEEE80211_RADIOTAP_CHANNEL | \ 1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL | \ @@ -64,6 +66,7 @@ struct run_rx_radiotap_header { struct run_tx_radiotap_header { struct ieee80211_radiotap_header wt_ihdr; + uint64_t wt_tsf; uint8_t wt_flags; uint8_t wt_rate; uint16_t wt_chan_freq; @@ -74,7 +77,8 @@ struct run_tx_radiotap_header { #define IEEE80211_RADIOTAP_HWQUEUE 15 #define RUN_TX_RADIOTAP_PRESENT \ - (1 << IEEE80211_RADIOTAP_FLAGS | \ + (1 << IEEE80211_RADIOTAP_TSFT | \ + 1 << IEEE80211_RADIOTAP_FLAGS | \ 1 << IEEE80211_RADIOTAP_RATE | \ 1 << IEEE80211_RADIOTAP_CHANNEL | \ 1 << IEEE80211_RADIOTAP_HWQUEUE) From owner-svn-src-head@freebsd.org Tue Sep 8 08:06:21 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 112069CD3AF; Tue, 8 Sep 2015 08:06:21 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 023F91830; Tue, 8 Sep 2015 08:06:21 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8886KNM066118; Tue, 8 Sep 2015 08:06:20 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8886Kkt066117; Tue, 8 Sep 2015 08:06:20 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201509080806.t8886Kkt066117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Tue, 8 Sep 2015 08:06:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287555 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 08:06:21 -0000 Author: kevlo Date: Tue Sep 8 08:06:20 2015 New Revision: 287555 URL: https://svnweb.freebsd.org/changeset/base/287555 Log: Enable TSF timer in monitor mode. Tested on RT5370, sta mode. Submitted by: Andriy Voskoboinyk Differential Revision: https://reviews.freebsd.org/D3591 Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Tue Sep 8 08:02:14 2015 (r287554) +++ head/sys/dev/usb/wlan/if_run.c Tue Sep 8 08:06:20 2015 (r287555) @@ -431,6 +431,7 @@ static void run_updateprot_cb(void *); static void run_usb_timeout_cb(void *); static void run_reset_livelock(struct run_softc *); static void run_enable_tsf_sync(struct run_softc *); +static void run_enable_tsf(struct run_softc *); static void run_get_tsf(struct run_softc *, uint64_t *); static void run_enable_mrr(struct run_softc *); static void run_set_txpreamble(struct run_softc *); @@ -2126,7 +2127,8 @@ run_newstate(struct ieee80211vap *vap, e tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) ratectl |= bid; - } + } else + run_enable_tsf(sc); /* turn link LED on */ run_set_leds(sc, RT2860_LED_RADIO | @@ -5050,6 +5052,18 @@ run_enable_tsf_sync(struct run_softc *sc } static void +run_enable_tsf(struct run_softc *sc) +{ + uint32_t tmp; + + if (run_read(sc, RT2860_BCN_TIME_CFG, &tmp) == 0) { + tmp &= ~(RT2860_BCN_TX_EN | RT2860_TBTT_TIMER_EN); + tmp |= RT2860_TSF_TIMER_EN; + run_write(sc, RT2860_BCN_TIME_CFG, tmp); + } +} + +static void run_get_tsf(struct run_softc *sc, uint64_t *buf) { run_read_region_1(sc, RT2860_TSF_TIMER_DW0, (uint8_t *)buf, From owner-svn-src-head@freebsd.org Tue Sep 8 08:41:08 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B961A00531; Tue, 8 Sep 2015 08:41:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CA2C1E03; Tue, 8 Sep 2015 08:41:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t888f7I1082187; Tue, 8 Sep 2015 08:41:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t888f76o082185; Tue, 8 Sep 2015 08:41:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509080841.t888f76o082185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 8 Sep 2015 08:41:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287556 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 08:41:08 -0000 Author: kib Date: Tue Sep 8 08:41:07 2015 New Revision: 287556 URL: https://svnweb.freebsd.org/changeset/base/287556 Log: In the pthread_once(), if the initializer has already run, then the calling thread is supposed to see accesses issued by the initializer. This means that the read of the once_control->state variable should have an acquire semantic. Use atomic_thread_fence_acq() when the value read is ONCE_DONE, instead of straightforward atomic_load_acq(), to only put a barrier when needed (*). On the other hand, the updates of the once_control->state with the intermediate progress state do not need to synchronize with other state accesses, remove _acq suffix. Reviewed by: alc (previous version) Suggested by: alc (*) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libthr/thread/thr_once.c Modified: head/lib/libthr/thread/thr_once.c ============================================================================== --- head/lib/libthr/thread/thr_once.c Tue Sep 8 08:06:20 2015 (r287555) +++ head/lib/libthr/thread/thr_once.c Tue Sep 8 08:41:07 2015 (r287556) @@ -68,13 +68,15 @@ _pthread_once(pthread_once_t *once_contr for (;;) { state = once_control->state; - if (state == ONCE_DONE) + if (state == ONCE_DONE) { + atomic_thread_fence_acq(); return (0); + } if (state == ONCE_NEVER_DONE) { - if (atomic_cmpset_acq_int(&once_control->state, state, ONCE_IN_PROGRESS)) + if (atomic_cmpset_int(&once_control->state, state, ONCE_IN_PROGRESS)) break; } else if (state == ONCE_IN_PROGRESS) { - if (atomic_cmpset_acq_int(&once_control->state, state, ONCE_WAIT)) + if (atomic_cmpset_int(&once_control->state, state, ONCE_WAIT)) _thr_umtx_wait_uint(&once_control->state, ONCE_WAIT, NULL, 0); } else if (state == ONCE_WAIT) { _thr_umtx_wait_uint(&once_control->state, state, NULL, 0); From owner-svn-src-head@freebsd.org Tue Sep 8 08:48:54 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57AFBA00953; Tue, 8 Sep 2015 08:48:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CC571205; Tue, 8 Sep 2015 08:48:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t888msWV082653; Tue, 8 Sep 2015 08:48:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t888ms8X082652; Tue, 8 Sep 2015 08:48:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509080848.t888ms8X082652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 8 Sep 2015 08:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287557 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 08:48:54 -0000 Author: kib Date: Tue Sep 8 08:48:53 2015 New Revision: 287557 URL: https://svnweb.freebsd.org/changeset/base/287557 Log: Style. Use ANSI definition, wrap long lines, no initialization in declaration for locals. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libthr/thread/thr_once.c Modified: head/lib/libthr/thread/thr_once.c ============================================================================== --- head/lib/libthr/thread/thr_once.c Tue Sep 8 08:41:07 2015 (r287556) +++ head/lib/libthr/thread/thr_once.c Tue Sep 8 08:48:53 2015 (r287557) @@ -50,9 +50,11 @@ __weak_reference(_pthread_once, pthread_ static void once_cancel_handler(void *arg) { - pthread_once_t *once_control = arg; + pthread_once_t *once_control; - if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS, ONCE_NEVER_DONE)) + once_control = arg; + if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS, + ONCE_NEVER_DONE)) return; atomic_store_rel_int(&once_control->state, ONCE_NEVER_DONE); _thr_umtx_wake(&once_control->state, INT_MAX, 0); @@ -73,13 +75,17 @@ _pthread_once(pthread_once_t *once_contr return (0); } if (state == ONCE_NEVER_DONE) { - if (atomic_cmpset_int(&once_control->state, state, ONCE_IN_PROGRESS)) + if (atomic_cmpset_int(&once_control->state, state, + ONCE_IN_PROGRESS)) break; } else if (state == ONCE_IN_PROGRESS) { - if (atomic_cmpset_int(&once_control->state, state, ONCE_WAIT)) - _thr_umtx_wait_uint(&once_control->state, ONCE_WAIT, NULL, 0); + if (atomic_cmpset_int(&once_control->state, state, + ONCE_WAIT)) + _thr_umtx_wait_uint(&once_control->state, + ONCE_WAIT, NULL, 0); } else if (state == ONCE_WAIT) { - _thr_umtx_wait_uint(&once_control->state, state, NULL, 0); + _thr_umtx_wait_uint(&once_control->state, state, + NULL, 0); } else return (EINVAL); } @@ -88,7 +94,8 @@ _pthread_once(pthread_once_t *once_contr THR_CLEANUP_PUSH(curthread, once_cancel_handler, once_control); init_routine(); THR_CLEANUP_POP(curthread, 0); - if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS, ONCE_DONE)) + if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS, + ONCE_DONE)) return (0); atomic_store_rel_int(&once_control->state, ONCE_DONE); _thr_umtx_wake(&once_control->state, INT_MAX, 0); @@ -96,6 +103,6 @@ _pthread_once(pthread_once_t *once_contr } void -_thr_once_init() +_thr_once_init(void) { } From owner-svn-src-head@freebsd.org Tue Sep 8 08:50:29 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC806A00B06; Tue, 8 Sep 2015 08:50:29 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADA7D13BE; Tue, 8 Sep 2015 08:50:29 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t888oT7b083449; Tue, 8 Sep 2015 08:50:29 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t888oT8k083447; Tue, 8 Sep 2015 08:50:29 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509080850.t888oT8k083447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 8 Sep 2015 08:50:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287558 - in head/sys: conf sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 08:50:29 -0000 Author: ngie Date: Tue Sep 8 08:50:28 2015 New Revision: 287558 URL: https://svnweb.freebsd.org/changeset/base/287558 Log: Remove opt_random.h header pollution from sys/random.h by moving RANDOM_LOADABLE and RANDOM_YARROW's definitions from opt_random.h to opt_global.h This unbreaks `make depend` in sys/modules with multiple drivers (tmpfs, etc) after r286839 X-MFC with: r286839 Reviewed by: imp Submitted by: lwhsu Differential Revision: D3486 Modified: head/sys/conf/options head/sys/sys/random.h Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Tue Sep 8 08:48:53 2015 (r287557) +++ head/sys/conf/options Tue Sep 8 08:50:28 2015 (r287558) @@ -947,11 +947,11 @@ RCTL opt_global.h # Random number generator(s) # Which CSPRNG hash we get. # If Yarrow is not chosen, Fortuna is selected. -RANDOM_YARROW opt_random.h +RANDOM_YARROW opt_global.h # With this, no entropy processor is loaded, but the entropy # harvesting infrastructure is present. This means an entropy # processor may be loaded as a module. -RANDOM_LOADABLE opt_random.h +RANDOM_LOADABLE opt_global.h # This turns on high-rate and potentially expensive harvesting in # the uma slab allocator. RANDOM_ENABLE_UMA opt_global.h Modified: head/sys/sys/random.h ============================================================================== --- head/sys/sys/random.h Tue Sep 8 08:48:53 2015 (r287557) +++ head/sys/sys/random.h Tue Sep 8 08:50:28 2015 (r287558) @@ -33,8 +33,6 @@ #include -#include "opt_random.h" - #if !defined(KLD_MODULE) #if defined(RANDOM_LOADABLE) && defined(RANDOM_YARROW) #error "Cannot define both RANDOM_LOADABLE and RANDOM_YARROW" From owner-svn-src-head@freebsd.org Tue Sep 8 08:54:41 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5B4EA00CF6; Tue, 8 Sep 2015 08:54:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6D2F19DC; Tue, 8 Sep 2015 08:54:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t888sfTF086588; Tue, 8 Sep 2015 08:54:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t888sf7J086587; Tue, 8 Sep 2015 08:54:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509080854.t888sf7J086587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 8 Sep 2015 08:54:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287559 - head/sys/modules/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 08:54:41 -0000 Author: ngie Date: Tue Sep 8 08:54:40 2015 New Revision: 287559 URL: https://svnweb.freebsd.org/changeset/base/287559 Log: Revert r286984 (adding opt_random.h to sys/modules/zfs/Makefile) opt_random.h is no longer needed/referenced in the kernel build X-MFC with: r287558 Modified: head/sys/modules/zfs/Makefile Modified: head/sys/modules/zfs/Makefile ============================================================================== --- head/sys/modules/zfs/Makefile Tue Sep 8 08:50:28 2015 (r287558) +++ head/sys/modules/zfs/Makefile Tue Sep 8 08:54:40 2015 (r287559) @@ -4,7 +4,7 @@ SYSDIR?=${.CURDIR}/../.. KMOD= zfs -SRCS= bus_if.h device_if.h vnode_if.h opt_kstack_pages.h opt_random.h +SRCS= bus_if.h device_if.h vnode_if.h opt_kstack_pages.h SUNW= ${SYSDIR}/cddl/contrib/opensolaris From owner-svn-src-head@freebsd.org Tue Sep 8 14:52:15 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4173A00577; Tue, 8 Sep 2015 14:52:15 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 951BB1594; Tue, 8 Sep 2015 14:52:15 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88EqFHS037239; Tue, 8 Sep 2015 14:52:15 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88EqFLs037238; Tue, 8 Sep 2015 14:52:15 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201509081452.t88EqFLs037238@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 8 Sep 2015 14:52:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287562 - head/lib/libc/posix1e X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 14:52:15 -0000 Author: trasz Date: Tue Sep 8 14:52:14 2015 New Revision: 287562 URL: https://svnweb.freebsd.org/changeset/base/287562 Log: Make it possible to use acl_create_entry_np(3) to use first entry to an empty ACL, and to append an entry to an ACL. Submitted by: sef@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/posix1e/acl_entry.c Modified: head/lib/libc/posix1e/acl_entry.c ============================================================================== --- head/lib/libc/posix1e/acl_entry.c Tue Sep 8 12:25:41 2015 (r287561) +++ head/lib/libc/posix1e/acl_entry.c Tue Sep 8 14:52:14 2015 (r287562) @@ -91,7 +91,7 @@ acl_create_entry_np(acl_t *acl_p, acl_en return (-1); } - if (offset < 0 || offset >= acl_int->acl_cnt) { + if (offset < 0 || offset > acl_int->acl_cnt) { errno = EINVAL; return (-1); } From owner-svn-src-head@freebsd.org Tue Sep 8 15:59:56 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 212C3A00842; Tue, 8 Sep 2015 15:59:56 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11CFE11C5; Tue, 8 Sep 2015 15:59:56 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88Fxt9x062915; Tue, 8 Sep 2015 15:59:55 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88FxtRi062914; Tue, 8 Sep 2015 15:59:55 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201509081559.t88FxtRi062914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Tue, 8 Sep 2015 15:59:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287563 - head/sys/dev/isci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 15:59:56 -0000 Author: jimharris Date: Tue Sep 8 15:59:55 2015 New Revision: 287563 URL: https://svnweb.freebsd.org/changeset/base/287563 Log: isci: explicitly enable/disable PCI busmaster BIOS always enables PCI busmaster on the isci device, which effectively worked around this omission. But when passing the isci device through to a guest VM, the hypervisor will disable busmaster and isci will not work without calling pci_enable_busmaster(). MFC after: 3 days Sponsored by: Intel Modified: head/sys/dev/isci/isci.c Modified: head/sys/dev/isci/isci.c ============================================================================== --- head/sys/dev/isci/isci.c Tue Sep 8 14:52:14 2015 (r287562) +++ head/sys/dev/isci/isci.c Tue Sep 8 15:59:55 2015 (r287563) @@ -163,6 +163,7 @@ isci_attach(device_t device) g_isci = isci; isci->device = device; + pci_enable_busmaster(device); isci_allocate_pci_memory(isci); @@ -272,6 +273,7 @@ isci_detach(device_t device) pci_release_msi(device); } + pci_disable_busmaster(device); return (0); } From owner-svn-src-head@freebsd.org Tue Sep 8 16:05:19 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A99FA00B5E; Tue, 8 Sep 2015 16:05:19 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B54C182F; Tue, 8 Sep 2015 16:05:19 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88G5IET066950; Tue, 8 Sep 2015 16:05:18 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88G5IU1066949; Tue, 8 Sep 2015 16:05:18 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201509081605.t88G5IU1066949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Tue, 8 Sep 2015 16:05:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287564 - head/sys/dev/isci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 16:05:19 -0000 Author: jimharris Date: Tue Sep 8 16:05:18 2015 New Revision: 287564 URL: https://svnweb.freebsd.org/changeset/base/287564 Log: isci: check return value of pci_alloc_msix() Certain VM guest types (VMware, Xen) do not support MSI, so pci_alloc_msix() always fails. isci(4) was not properly detecting the allocation failure, and would try to proceed with MSIx resource initialization rather than reverting to INTx. Reported and tested by: Bradley W. Dutton (brad-fbsd-stable@duttonbros.com) MFC after: 3 days Sponsored by: Intel Modified: head/sys/dev/isci/isci_interrupt.c Modified: head/sys/dev/isci/isci_interrupt.c ============================================================================== --- head/sys/dev/isci/isci_interrupt.c Tue Sep 8 15:59:55 2015 (r287563) +++ head/sys/dev/isci/isci_interrupt.c Tue Sep 8 16:05:18 2015 (r287564) @@ -136,8 +136,8 @@ isci_interrupt_setup(struct isci_softc * pci_msix_count(isci->device) >= max_msix_messages) { isci->num_interrupts = max_msix_messages; - pci_alloc_msix(isci->device, &isci->num_interrupts); - if (isci->num_interrupts == max_msix_messages) + if (pci_alloc_msix(isci->device, &isci->num_interrupts) == 0 && + isci->num_interrupts == max_msix_messages) use_msix = TRUE; } From owner-svn-src-head@freebsd.org Tue Sep 8 16:06:05 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 367D6A00BB4; Tue, 8 Sep 2015 16:06:05 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D954198B; Tue, 8 Sep 2015 16:06:05 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88G64gU067030; Tue, 8 Sep 2015 16:06:04 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88G64l5067029; Tue, 8 Sep 2015 16:06:04 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201509081606.t88G64l5067029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 8 Sep 2015 16:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287565 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 16:06:05 -0000 Author: andrew Date: Tue Sep 8 16:06:04 2015 New Revision: 287565 URL: https://svnweb.freebsd.org/changeset/base/287565 Log: Allow us to set the console device tree node. This is needed as not all vendor supplied device trees contain the needed properties for us to select the correct uart to use as the kernel console. An example of this would be to add the following to loader.conf. hw.fdt.console="/smb/uart@f7113000" The intention of this is slightly different than the existing hw.uart.console option. The new option will mean the boot serial configuration will be derived from the device node, while the existing option expects the user to configure all this themselves. Further work is planned to allow the uart configuration to be set based on the stdout-path property devicetree bindings. Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D3559 Modified: head/sys/dev/uart/uart_cpu_fdt.c Modified: head/sys/dev/uart/uart_cpu_fdt.c ============================================================================== --- head/sys/dev/uart/uart_cpu_fdt.c Tue Sep 8 16:05:18 2015 (r287564) +++ head/sys/dev/uart/uart_cpu_fdt.c Tue Sep 8 16:06:04 2015 (r287565) @@ -134,6 +134,7 @@ uart_cpu_getdev(int devtype, struct uart phandle_t node, chosen; pcell_t shift, br, rclk; u_long start, size, pbase, psize; + char *cp; int err; uart_bus_space_mem = fdtbus_bs_tag; @@ -148,18 +149,25 @@ uart_cpu_getdev(int devtype, struct uart if (devtype != UART_DEV_CONSOLE) return (ENXIO); - /* - * Retrieve /chosen/std{in,out}. - */ - node = -1; - if ((chosen = OF_finddevice("/chosen")) != -1) { - for (name = propnames; *name != NULL; name++) { - if (phandle_chosen_propdev(chosen, *name, &node) == 0) - break; + /* Has the user forced a specific device node? */ + cp = kern_getenv("hw.fdt.console"); + if (cp == NULL) { + /* + * Retrieve /chosen/std{in,out}. + */ + node = -1; + if ((chosen = OF_finddevice("/chosen")) != -1) { + for (name = propnames; *name != NULL; name++) { + if (phandle_chosen_propdev(chosen, *name, + &node) == 0) + break; + } } + if (chosen == -1 || *name == NULL) + node = OF_finddevice("serial0"); /* Last ditch */ + } else { + node = OF_finddevice(cp); } - if (chosen == -1 || *name == NULL) - node = OF_finddevice("serial0"); /* Last ditch */ if (node == -1) /* Can't find anything */ return (ENXIO); From owner-svn-src-head@freebsd.org Tue Sep 8 17:10:12 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF9759CC10F; Tue, 8 Sep 2015 17:10:11 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from c.mail.sonic.net (c.mail.sonic.net [64.142.111.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1F461EEB; Tue, 8 Sep 2015 17:10:11 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from zeppelin.tachypleus.net (75-101-50-44.static.sonic.net [75.101.50.44]) (authenticated bits=0) by c.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id t88HA3QZ029782 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 8 Sep 2015 10:10:03 -0700 Subject: Re: svn commit: r287565 - head/sys/dev/uart To: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201509081606.t88G64l5067029@repo.freebsd.org> From: Nathan Whitehorn Message-ID: <55EF166A.40703@freebsd.org> Date: Tue, 8 Sep 2015 10:10:02 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <201509081606.t88G64l5067029@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVYnUe0ilJobPxodrPZF6LneWdVKb3HwsGqzW1fmAFgm6nbR69sfXnq2pI0s0iVnoizsb5zfL/31MrSy9IG6dkrCq1hqj4xboXU= X-Sonic-ID: C;ZJ67cUxW5RGbm70U9jFv0A== M;XrMLckxW5RGbm70U9jFv0A== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 17:10:12 -0000 Nice work! You might want to look at uart_cpu_powerpc.c, which already supports stdout-path and various related things. -Nathan On 09/08/15 09:06, Andrew Turner wrote: > Author: andrew > Date: Tue Sep 8 16:06:04 2015 > New Revision: 287565 > URL: https://svnweb.freebsd.org/changeset/base/287565 > > Log: > Allow us to set the console device tree node. This is needed as not all > vendor supplied device trees contain the needed properties for us to select > the correct uart to use as the kernel console. > > An example of this would be to add the following to loader.conf. > hw.fdt.console="/smb/uart@f7113000" > > The intention of this is slightly different than the existing > hw.uart.console option. The new option will mean the boot serial > configuration will be derived from the device node, while the existing > option expects the user to configure all this themselves. > > Further work is planned to allow the uart configuration to be set based on > the stdout-path property devicetree bindings. > > Sponsored by: ABT Systems Ltd > Differential Revision: https://reviews.freebsd.org/D3559 > > Modified: > head/sys/dev/uart/uart_cpu_fdt.c > > Modified: head/sys/dev/uart/uart_cpu_fdt.c > ============================================================================== > --- head/sys/dev/uart/uart_cpu_fdt.c Tue Sep 8 16:05:18 2015 (r287564) > +++ head/sys/dev/uart/uart_cpu_fdt.c Tue Sep 8 16:06:04 2015 (r287565) > @@ -134,6 +134,7 @@ uart_cpu_getdev(int devtype, struct uart > phandle_t node, chosen; > pcell_t shift, br, rclk; > u_long start, size, pbase, psize; > + char *cp; > int err; > > uart_bus_space_mem = fdtbus_bs_tag; > @@ -148,18 +149,25 @@ uart_cpu_getdev(int devtype, struct uart > if (devtype != UART_DEV_CONSOLE) > return (ENXIO); > > - /* > - * Retrieve /chosen/std{in,out}. > - */ > - node = -1; > - if ((chosen = OF_finddevice("/chosen")) != -1) { > - for (name = propnames; *name != NULL; name++) { > - if (phandle_chosen_propdev(chosen, *name, &node) == 0) > - break; > + /* Has the user forced a specific device node? */ > + cp = kern_getenv("hw.fdt.console"); > + if (cp == NULL) { > + /* > + * Retrieve /chosen/std{in,out}. > + */ > + node = -1; > + if ((chosen = OF_finddevice("/chosen")) != -1) { > + for (name = propnames; *name != NULL; name++) { > + if (phandle_chosen_propdev(chosen, *name, > + &node) == 0) > + break; > + } > } > + if (chosen == -1 || *name == NULL) > + node = OF_finddevice("serial0"); /* Last ditch */ > + } else { > + node = OF_finddevice(cp); > } > - if (chosen == -1 || *name == NULL) > - node = OF_finddevice("serial0"); /* Last ditch */ > > if (node == -1) /* Can't find anything */ > return (ENXIO); > From owner-svn-src-head@freebsd.org Tue Sep 8 17:47:57 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A81DA006BF; Tue, 8 Sep 2015 17:47:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5BCCD1BCE; Tue, 8 Sep 2015 17:47:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88HlvXh010961; Tue, 8 Sep 2015 17:47:57 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88HlvnY010960; Tue, 8 Sep 2015 17:47:57 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201509081747.t88HlvnY010960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 8 Sep 2015 17:47:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287567 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 17:47:57 -0000 Author: imp Date: Tue Sep 8 17:47:56 2015 New Revision: 287567 URL: https://svnweb.freebsd.org/changeset/base/287567 Log: The swap pager is compatible with direct dispatch. It does its own locking and doesn't sleep. Flag the consumer we create as such. In addition, decrement the in flight index when we have an out of memory error after having incremented it previously. This would have prevented swapoff from working if the swap pager ever hit a resource shortage trying to swap out something (the swap in path always waits for a bio, so won't have this issue). Simplify the close logic by abandoning the use of private and initializing the index to 1 and dropping that reference when we previously set private. Also, set sw_id only while sw_dev_mtx is held. This should only affect swapping to a vnode, as opposed to a geom whose close always sets it to NULL with sw_dev_mtx held. Differential Review: https://reviews.freebsd.org/D3547 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Tue Sep 8 17:20:12 2015 (r287566) +++ head/sys/vm/swap_pager.c Tue Sep 8 17:47:56 2015 (r287567) @@ -2345,8 +2345,8 @@ swapoff_one(struct swdevt *sp, struct uc swap_pager_swapoff(sp); sp->sw_close(curthread, sp); - sp->sw_id = NULL; mtx_lock(&sw_dev_mtx); + sp->sw_id = NULL; TAILQ_REMOVE(&swtailq, sp, sw_list); nswapdev--; if (nswapdev == 0) { @@ -2532,6 +2532,33 @@ swapgeom_close_ev(void *arg, int flags) g_destroy_consumer(cp); } +/* + * Add a reference to the g_consumer for an inflight transaction. + */ +static void +swapgeom_acquire(struct g_consumer *cp) +{ + + mtx_assert(&sw_dev_mtx, MA_OWNED); + cp->index++; +} + +/* + * Remove a reference from the g_consumer. Post a close event if + * all referneces go away. + */ +static void +swapgeom_release(struct g_consumer *cp, struct swdevt *sp) +{ + + mtx_assert(&sw_dev_mtx, MA_OWNED); + cp->index--; + if (cp->index == 0) { + if (g_post_event(swapgeom_close_ev, cp, M_NOWAIT, NULL) == 0) + sp->sw_id = NULL; + } +} + static void swapgeom_done(struct bio *bp2) { @@ -2547,13 +2574,9 @@ swapgeom_done(struct bio *bp2) bp->b_resid = bp->b_bcount - bp2->bio_completed; bp->b_error = bp2->bio_error; bufdone(bp); + sp = bp2->bio_caller1; mtx_lock(&sw_dev_mtx); - if ((--cp->index) == 0 && cp->private) { - if (g_post_event(swapgeom_close_ev, cp, M_NOWAIT, NULL) == 0) { - sp = bp2->bio_caller1; - sp->sw_id = NULL; - } - } + swapgeom_release(cp, sp); mtx_unlock(&sw_dev_mtx); g_destroy_bio(bp2); } @@ -2573,13 +2596,16 @@ swapgeom_strategy(struct buf *bp, struct bufdone(bp); return; } - cp->index++; + swapgeom_acquire(cp); mtx_unlock(&sw_dev_mtx); if (bp->b_iocmd == BIO_WRITE) bio = g_new_bio(); else bio = g_alloc_bio(); if (bio == NULL) { + mtx_lock(&sw_dev_mtx); + swapgeom_release(cp, sp); + mtx_unlock(&sw_dev_mtx); bp->b_error = ENOMEM; bp->b_ioflags |= BIO_ERROR; bufdone(bp); @@ -2619,7 +2645,12 @@ swapgeom_orphan(struct g_consumer *cp) break; } } - cp->private = (void *)(uintptr_t)1; + /* + * Drop reference we were created with. Do directly since we're in a + * special context where we don't have to queue the call to + * swapgeom_close_ev(). + */ + cp->index--; destroy = ((sp != NULL) && (cp->index == 0)); if (destroy) sp->sw_id = NULL; @@ -2680,8 +2711,8 @@ swapongeom_ev(void *arg, int flags) if (gp == NULL) gp = g_new_geomf(&g_swap_class, "swap"); cp = g_new_consumer(gp); - cp->index = 0; /* Number of active I/Os. */ - cp->private = NULL; /* Orphanization flag */ + cp->index = 1; /* Number of active I/Os, plus one for being active. */ + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; g_attach(cp, pp); /* * XXX: Everytime you think you can improve the margin for From owner-svn-src-head@freebsd.org Tue Sep 8 18:41:07 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BB52A00644; Tue, 8 Sep 2015 18:41:07 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 234311622; Tue, 8 Sep 2015 18:41:07 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88If7Jd033365; Tue, 8 Sep 2015 18:41:07 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88If7G1033364; Tue, 8 Sep 2015 18:41:07 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201509081841.t88If7G1033364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 8 Sep 2015 18:41:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287570 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 18:41:07 -0000 Author: andrew Date: Tue Sep 8 18:41:06 2015 New Revision: 287570 URL: https://svnweb.freebsd.org/changeset/base/287570 Log: Add support for pmap_mincore on arm64 by walking the page tables to find the details for the requested address. PR: 202307 Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Sep 8 18:37:16 2015 (r287569) +++ head/sys/arm64/arm64/pmap.c Tue Sep 8 18:41:06 2015 (r287570) @@ -3032,8 +3032,74 @@ pmap_page_set_memattr(vm_page_t m, vm_me int pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) { + pd_entry_t *l1p, l1; + pd_entry_t *l2p, l2; + pt_entry_t *l3p, l3; + vm_paddr_t pa; + bool managed; + int val; + + PMAP_LOCK(pmap); +retry: + pa = 0; + val = 0; + managed = false; + + l1p = pmap_l1(pmap, addr); + if (l1p == NULL) /* No l1 */ + goto done; + l1 = pmap_load(l1p); + if ((l1 & ATTR_DESCR_MASK) == L1_BLOCK) { + pa = (l1 & ~ATTR_MASK) | (addr & L1_OFFSET); + managed = (l1 & ATTR_SW_MANAGED) == ATTR_SW_MANAGED; + val = MINCORE_SUPER | MINCORE_INCORE; + if (pmap_page_dirty(l1)) + val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; + if ((l1 & ATTR_AF) == ATTR_AF) + val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; + goto done; + } + + l2p = pmap_l1_to_l2(l1p, addr); + if (l2p == NULL) /* No l2 */ + goto done; + l2 = pmap_load(l2p); + if ((l2 & ATTR_DESCR_MASK) == L2_BLOCK) { + pa = (l2 & ~ATTR_MASK) | (addr & L2_OFFSET); + managed = (l2 & ATTR_SW_MANAGED) == ATTR_SW_MANAGED; + val = MINCORE_SUPER | MINCORE_INCORE; + if (pmap_page_dirty(l2)) + val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; + if ((l2 & ATTR_AF) == ATTR_AF) + val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; + goto done; + } + + l3p = pmap_l2_to_l3(l2p, addr); + if (l3p == NULL) /* No l3 */ + goto done; + l3 = pmap_load(l2p); + if ((l3 & ATTR_DESCR_MASK) == L3_PAGE) { + pa = (l3 & ~ATTR_MASK) | (addr & L3_OFFSET); + managed = (l3 & ATTR_SW_MANAGED) == ATTR_SW_MANAGED; + val = MINCORE_INCORE; + if (pmap_page_dirty(l3)) + val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; + if ((l3 & ATTR_AF) == ATTR_AF) + val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; + } + +done: + if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != + (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && managed) { + /* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */ + if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) + goto retry; + } else + PA_UNLOCK_COND(*locked_pa); + PMAP_UNLOCK(pmap); - panic("ARM64TODO: pmap_mincore"); + return (val); } void From owner-svn-src-head@freebsd.org Tue Sep 8 18:44:13 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47C27A007C9; Tue, 8 Sep 2015 18:44:13 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 390791B96; Tue, 8 Sep 2015 18:44:13 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88IiDSZ036488; Tue, 8 Sep 2015 18:44:13 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88IiDGU036487; Tue, 8 Sep 2015 18:44:13 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201509081844.t88IiDGU036487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 8 Sep 2015 18:44:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287571 - head/lib/libc/tests/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 18:44:13 -0000 Author: andrew Date: Tue Sep 8 18:44:12 2015 New Revision: 287571 URL: https://svnweb.freebsd.org/changeset/base/287571 Log: Enable mincore_test on arm64, we now have a working pmap_mincore. PR: 202307 Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/tests/sys/Makefile Modified: head/lib/libc/tests/sys/Makefile ============================================================================== --- head/lib/libc/tests/sys/Makefile Tue Sep 8 18:41:06 2015 (r287570) +++ head/lib/libc/tests/sys/Makefile Tue Sep 8 18:44:12 2015 (r287571) @@ -25,10 +25,7 @@ NETBSD_ATF_TESTS_C+= kevent_test NETBSD_ATF_TESTS_C+= kill_test NETBSD_ATF_TESTS_C+= link_test NETBSD_ATF_TESTS_C+= listen_test -# On arm64 triggers panic ARM64TODO: pmap_mincore (PR202307). -.if ${MACHINE_CPUARCH} != "aarch64" NETBSD_ATF_TESTS_C+= mincore_test -.endif NETBSD_ATF_TESTS_C+= mkdir_test NETBSD_ATF_TESTS_C+= mkfifo_test NETBSD_ATF_TESTS_C+= mknod_test From owner-svn-src-head@freebsd.org Tue Sep 8 19:25:16 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C16DA00045; Tue, 8 Sep 2015 19:25:16 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D4C01B43; Tue, 8 Sep 2015 19:25:16 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88JPGXa053782; Tue, 8 Sep 2015 19:25:16 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88JPGuX053781; Tue, 8 Sep 2015 19:25:16 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509081925.t88JPGuX053781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 8 Sep 2015 19:25:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287572 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 19:25:16 -0000 Author: bapt Date: Tue Sep 8 19:25:15 2015 New Revision: 287572 URL: https://svnweb.freebsd.org/changeset/base/287572 Log: Fix indentation, no functional changes Modified: head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Tue Sep 8 18:44:12 2015 (r287571) +++ head/usr.sbin/pkg/pkg.c Tue Sep 8 19:25:15 2015 (r287572) @@ -66,15 +66,15 @@ struct sig_cert { }; typedef enum { - HASH_UNKNOWN, - HASH_SHA256, + HASH_UNKNOWN, + HASH_SHA256, } hash_t; struct fingerprint { - hash_t type; - char *name; - char hash[BUFSIZ]; - STAILQ_ENTRY(fingerprint) next; + hash_t type; + char *name; + char hash[BUFSIZ]; + STAILQ_ENTRY(fingerprint) next; }; STAILQ_HEAD(fingerprint_list, fingerprint); From owner-svn-src-head@freebsd.org Tue Sep 8 19:41:20 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 961D5A008DB; Tue, 8 Sep 2015 19:41:20 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 86B021214; Tue, 8 Sep 2015 19:41:20 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88JfKEY061686; Tue, 8 Sep 2015 19:41:20 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88JfKHp061685; Tue, 8 Sep 2015 19:41:20 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201509081941.t88JfKHp061685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Date: Tue, 8 Sep 2015 19:41:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287573 - head/sys/dev/drm2/ttm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 19:41:20 -0000 Author: dumbbell Date: Tue Sep 8 19:41:19 2015 New Revision: 287573 URL: https://svnweb.freebsd.org/changeset/base/287573 Log: drm/ttm: Drain taskqueue if taskqueue_cancel_timeout() returned an error Before, this was done if `pending` was true. This is not what the manpage suggests and not what was done elsewhere in the same file. Modified: head/sys/dev/drm2/ttm/ttm_bo.c Modified: head/sys/dev/drm2/ttm/ttm_bo.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo.c Tue Sep 8 19:25:15 2015 (r287572) +++ head/sys/dev/drm2/ttm/ttm_bo.c Tue Sep 8 19:41:19 2015 (r287573) @@ -789,8 +789,7 @@ int ttm_bo_lock_delayed_workqueue(struct { int pending; - taskqueue_cancel_timeout(taskqueue_thread, &bdev->wq, &pending); - if (pending) + if (taskqueue_cancel_timeout(taskqueue_thread, &bdev->wq, &pending)) taskqueue_drain_timeout(taskqueue_thread, &bdev->wq); return (pending); } From owner-svn-src-head@freebsd.org Tue Sep 8 19:57:02 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EACA49CC1A9; Tue, 8 Sep 2015 19:57:02 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DBD201EBC; Tue, 8 Sep 2015 19:57:02 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88Jv28r066597; Tue, 8 Sep 2015 19:57:02 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88Jv2Xa066596; Tue, 8 Sep 2015 19:57:02 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201509081957.t88Jv2Xa066596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Tue, 8 Sep 2015 19:57:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287574 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 19:57:03 -0000 Author: garga (ports committer) Date: Tue Sep 8 19:57:02 2015 New Revision: 287574 URL: https://svnweb.freebsd.org/changeset/base/287574 Log: - Fix Sierra MC7354 ID from a bad copy/paste, correct ID is 68C0 Approved by: loos Obtained from: pfSense MFC after: 3 days Sponsored by: Rubicon Communications (Netgate) Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Sep 8 19:41:19 2015 (r287573) +++ head/sys/dev/usb/usbdevs Tue Sep 8 19:57:02 2015 (r287574) @@ -4042,7 +4042,7 @@ product SIERRA C22 0x6891 C22 product SIERRA E6892 0x6892 E6892 product SIERRA E6893 0x6893 E6893 product SIERRA MC8700 0x68A3 MC8700 -product SIERRA MC7354 0x6820 MC7354 +product SIERRA MC7354 0x68C0 MC7354 product SIERRA AIRCARD875 0x6820 Aircard 875 HSDPA product SIERRA AC313U 0x68aa Sierra Wireless AirCard 313U product SIERRA TRUINSTALL 0x0fff Aircard Tru Installer From owner-svn-src-head@freebsd.org Tue Sep 8 20:07:34 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2847D9CC7BE; Tue, 8 Sep 2015 20:07:34 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 190FC1532; Tue, 8 Sep 2015 20:07:34 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88K7XiI070764; Tue, 8 Sep 2015 20:07:33 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88K7XWH070762; Tue, 8 Sep 2015 20:07:33 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201509082007.t88K7XWH070762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Tue, 8 Sep 2015 20:07:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287575 - in head/sys/dev/usb: . serial X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 20:07:34 -0000 Author: garga (ports committer) Date: Tue Sep 8 20:07:32 2015 New Revision: 287575 URL: https://svnweb.freebsd.org/changeset/base/287575 Log: Remove duplicate entry for Sierra Wireless Aircard 875 Approved by: loos MFC after: 3 days Sponsored by: Rubicon Communications (Netgate) Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Tue Sep 8 19:57:02 2015 (r287574) +++ head/sys/dev/usb/serial/u3g.c Tue Sep 8 20:07:32 2015 (r287575) @@ -494,6 +494,7 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(SIERRA, AC595U, 0), U3G_DEV(SIERRA, AC313U, 0), U3G_DEV(SIERRA, AC597E, 0), + U3G_DEV(SIERRA, AC875, 0), U3G_DEV(SIERRA, AC875E, 0), U3G_DEV(SIERRA, AC875U, 0), U3G_DEV(SIERRA, AC875U_2, 0), @@ -508,7 +509,6 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(SIERRA, AC885U, 0), U3G_DEV(SIERRA, AIRCARD580, 0), U3G_DEV(SIERRA, AIRCARD595, 0), - U3G_DEV(SIERRA, AIRCARD875, 0), U3G_DEV(SIERRA, C22, 0), U3G_DEV(SIERRA, C597, 0), U3G_DEV(SIERRA, C888, 0), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Sep 8 19:57:02 2015 (r287574) +++ head/sys/dev/usb/usbdevs Tue Sep 8 20:07:32 2015 (r287575) @@ -4043,7 +4043,6 @@ product SIERRA E6892 0x6892 E6892 product SIERRA E6893 0x6893 E6893 product SIERRA MC8700 0x68A3 MC8700 product SIERRA MC7354 0x68C0 MC7354 -product SIERRA AIRCARD875 0x6820 Aircard 875 HSDPA product SIERRA AC313U 0x68aa Sierra Wireless AirCard 313U product SIERRA TRUINSTALL 0x0fff Aircard Tru Installer From owner-svn-src-head@freebsd.org Tue Sep 8 20:22:52 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D149A0011C; Tue, 8 Sep 2015 20:22:52 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DE6810AF; Tue, 8 Sep 2015 20:22:52 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88KMpGv078670; Tue, 8 Sep 2015 20:22:51 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88KMpxR078669; Tue, 8 Sep 2015 20:22:51 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201509082022.t88KMpxR078669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Tue, 8 Sep 2015 20:22:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287576 - head/usr.sbin/service X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 20:22:52 -0000 Author: allanjude Date: Tue Sep 8 20:22:51 2015 New Revision: 287576 URL: https://svnweb.freebsd.org/changeset/base/287576 Log: service(8) -e does not respect /etc/rc.conf.d/* entries PR: 173454 Submitted by: giantlock@gmail.com (original patch) Approved by: bapt (mentor) MFC after: 1 week Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D3600 Modified: head/usr.sbin/service/service.sh Modified: head/usr.sbin/service/service.sh ============================================================================== --- head/usr.sbin/service/service.sh Tue Sep 8 20:07:32 2015 (r287575) +++ head/usr.sbin/service/service.sh Tue Sep 8 20:22:51 2015 (r287576) @@ -71,6 +71,7 @@ if [ -n "$RESTART" ]; then if grep -q ^rcvar $file; then eval `grep ^name= $file` eval `grep ^rcvar $file` + load_rc_config_var ${name} ${rcvar} checkyesno $rcvar 2>/dev/null && run_rc_script ${file} stop fi done @@ -100,6 +101,7 @@ if [ -n "$ENABLED" ]; then if grep -q ^rcvar $file; then eval `grep ^name= $file` eval `grep ^rcvar $file` + load_rc_config_var ${name} ${rcvar} checkyesno $rcvar 2>/dev/null && echo $file fi done From owner-svn-src-head@freebsd.org Tue Sep 8 20:41:49 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37390A00C14; Tue, 8 Sep 2015 20:41:49 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B2141E80; Tue, 8 Sep 2015 20:41:49 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88KfmP3086062; Tue, 8 Sep 2015 20:41:48 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88KfmkV086060; Tue, 8 Sep 2015 20:41:48 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201509082041.t88KfmkV086060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 8 Sep 2015 20:41:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287577 - in head/usr.sbin/wpa: hostapd wpa_supplicant X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 20:41:49 -0000 Author: jkim Date: Tue Sep 8 20:41:47 2015 New Revision: 287577 URL: https://svnweb.freebsd.org/changeset/base/287577 Log: Sort and remove duplicate compiler flags. MFC after: 3 days Modified: head/usr.sbin/wpa/hostapd/Makefile head/usr.sbin/wpa/wpa_supplicant/Makefile Modified: head/usr.sbin/wpa/hostapd/Makefile ============================================================================== --- head/usr.sbin/wpa/hostapd/Makefile Tue Sep 8 20:22:51 2015 (r287576) +++ head/usr.sbin/wpa/hostapd/Makefile Tue Sep 8 20:41:47 2015 (r287577) @@ -35,15 +35,15 @@ FILES= hostapd.conf hostapd.eap_user hos .endif CFLAGS+=-DCONFIG_DRIVER_BSD \ - -DHOSTAPD \ -DCONFIG_DRIVER_RADIUS_ACL \ - -DCONFIG_RSN_PREAUTH \ + -DCONFIG_HS20 \ + -DCONFIG_INTERWORKING \ -DCONFIG_PEERKEY \ + -DCONFIG_RSN_PREAUTH \ -DCONFIG_WPS \ -DCONFIG_WPS2 \ -DCONFIG_WPS_UPNP \ - -DCONFIG_INTERWORKING \ - -DCONFIG_HS20 + -DHOSTAPD .if ${MK_INET6} != "no" CFLAGS+= -DCONFIG_IPV6 .endif @@ -65,8 +65,8 @@ CFLAGS+=-DDPKCS12_FUNCS \ -DEAP_SERVER_PEAP \ -DEAP_SERVER_TLS \ -DEAP_SERVER_TTLS \ - -DEAP_TLS_FUNCS \ - -DEAP_SERVER_WSC + -DEAP_SERVER_WSC \ + -DEAP_TLS_FUNCS SRCS+= eap_server_gtc.c \ eap_server_identity.c \ Modified: head/usr.sbin/wpa/wpa_supplicant/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_supplicant/Makefile Tue Sep 8 20:22:51 2015 (r287576) +++ head/usr.sbin/wpa/wpa_supplicant/Makefile Tue Sep 8 20:41:47 2015 (r287577) @@ -38,18 +38,18 @@ CFLAGS+=-DCONFIG_BACKEND_FILE \ -DCONFIG_DRIVER_BSD \ -DCONFIG_DRIVER_NDIS \ -DCONFIG_DRIVER_WIRED \ + -DCONFIG_GAS \ + -DCONFIG_HS20 \ + -DCONFIG_IEEE80211R \ + -DCONFIG_INTERWORKING \ -DCONFIG_PEERKEY \ + -DCONFIG_PRIVSEP \ -DCONFIG_SMARTCARD \ -DCONFIG_TERMINATE_ONLASTIF \ + -DCONFIG_TLS=openssl \ -DCONFIG_WPS \ -DCONFIG_WPS2 \ -DCONFIG_WPS_UPNP \ - -DCONFIG_TLS=openssl \ - -DCONFIG_IEEE80211R \ - -DCONFIG_INTERWORKING \ - -DCONFIG_PRIVSEP \ - -DCONFIG_HS20 \ - -DCONFIG_GAS \ -DPKCS12_FUNCS #CFLAGS+= -g LIBADD= pcap util @@ -70,9 +70,6 @@ CFLAGS+=-DEAP_GTC \ -DEAP_PSK \ -DEAP_TLS \ -DEAP_TTLS \ - -DEAP_GTC \ - -DEAP_OTP \ - -DEAP_LEAP \ -DIEEE8021X_EAPOL SRCS+= chap.c \ eap.c \ From owner-svn-src-head@freebsd.org Tue Sep 8 21:04:34 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 506319CC8DD; Tue, 8 Sep 2015 21:04:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 275F01F9C; Tue, 8 Sep 2015 21:04:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88L4YjJ095065; Tue, 8 Sep 2015 21:04:34 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88L4XaR095063; Tue, 8 Sep 2015 21:04:33 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201509082104.t88L4XaR095063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 8 Sep 2015 21:04:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287578 - in head/usr.sbin/wpa: hostapd wpa_supplicant X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 21:04:34 -0000 Author: jkim Date: Tue Sep 8 21:04:33 2015 New Revision: 287578 URL: https://svnweb.freebsd.org/changeset/base/287578 Log: Enable 802.11n support. PR: 164102 Modified: head/usr.sbin/wpa/hostapd/Makefile head/usr.sbin/wpa/wpa_supplicant/Makefile Modified: head/usr.sbin/wpa/hostapd/Makefile ============================================================================== --- head/usr.sbin/wpa/hostapd/Makefile Tue Sep 8 20:41:47 2015 (r287577) +++ head/usr.sbin/wpa/hostapd/Makefile Tue Sep 8 21:04:33 2015 (r287578) @@ -15,8 +15,8 @@ SRCS= accounting.c aes-omac1.c ap_config eap_register.c eap_server.c eap_server_methods.c eap_user_db.c \ eapol_auth_dump.c eapol_auth_sm.c eloop.c gas.c gas_serv.c hostapd.c \ hs20.c http_client.c http_server.c httpread.c \ - hw_features_common.c ieee802_11_auth.c \ - ieee802_11_common.c ieee802_11_shared.c ieee802_1x.c ip_addr.c \ + hw_features_common.c ieee802_11_auth.c ieee802_11_common.c \ + ieee802_11_ht.c ieee802_11_shared.c ieee802_1x.c ip_addr.c \ main.c ms_funcs.c os_unix.c peerkey_auth.c pmksa_cache_auth.c \ preauth_auth.c radius.c radius_client.c radius_das.c sta_info.c \ tkip_countermeasures.c upnp_xml.c utils.c uuid.c vlan_init.c \ @@ -37,6 +37,7 @@ FILES= hostapd.conf hostapd.eap_user hos CFLAGS+=-DCONFIG_DRIVER_BSD \ -DCONFIG_DRIVER_RADIUS_ACL \ -DCONFIG_HS20 \ + -DCONFIG_IEEE80211N \ -DCONFIG_INTERWORKING \ -DCONFIG_PEERKEY \ -DCONFIG_RSN_PREAUTH \ Modified: head/usr.sbin/wpa/wpa_supplicant/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_supplicant/Makefile Tue Sep 8 20:41:47 2015 (r287577) +++ head/usr.sbin/wpa/wpa_supplicant/Makefile Tue Sep 8 21:04:33 2015 (r287578) @@ -40,6 +40,7 @@ CFLAGS+=-DCONFIG_BACKEND_FILE \ -DCONFIG_DRIVER_WIRED \ -DCONFIG_GAS \ -DCONFIG_HS20 \ + -DCONFIG_IEEE80211N \ -DCONFIG_IEEE80211R \ -DCONFIG_INTERWORKING \ -DCONFIG_PEERKEY \ From owner-svn-src-head@freebsd.org Tue Sep 8 21:25:38 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00389A00521; Tue, 8 Sep 2015 21:25:38 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7E4A1D86; Tue, 8 Sep 2015 21:25:37 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88LPbQ8003492; Tue, 8 Sep 2015 21:25:37 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88LPaqO003486; Tue, 8 Sep 2015 21:25:36 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509082125.t88LPaqO003486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 8 Sep 2015 21:25:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287579 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 21:25:38 -0000 Author: bapt Date: Tue Sep 8 21:25:36 2015 New Revision: 287579 URL: https://svnweb.freebsd.org/changeset/base/287579 Log: Implement pubkey support for the bootstrap Note that to not interfer with finger print it expects a signature on pkg itself which is named pkg.txz.pubkeysign To genrate it: echo -n "$(sha256 -q pkg.txz)" | openssl dgst -sha256 -sign /thekey \ -binary -out ./pkg.txz.pubkeysig Note the "echo -n" which prevent signing the '\n' one would get otherwise PR: 202622 MFC after: 1 week Modified: head/usr.sbin/pkg/Makefile head/usr.sbin/pkg/config.c head/usr.sbin/pkg/config.h head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/Makefile ============================================================================== --- head/usr.sbin/pkg/Makefile Tue Sep 8 21:04:33 2015 (r287578) +++ head/usr.sbin/pkg/Makefile Tue Sep 8 21:25:36 2015 (r287579) @@ -6,6 +6,6 @@ MAN= pkg.7 CFLAGS+=-I${.CURDIR}/../../contrib/libucl/include .PATH: ${.CURDIR}/../../contrib/libucl/include -LIBADD= archive fetch ucl sbuf crypto +LIBADD= archive fetch ucl sbuf crypto ssl .include Modified: head/usr.sbin/pkg/config.c ============================================================================== --- head/usr.sbin/pkg/config.c Tue Sep 8 21:04:33 2015 (r287578) +++ head/usr.sbin/pkg/config.c Tue Sep 8 21:25:36 2015 (r287579) @@ -131,6 +131,15 @@ static struct config_entry c[] = { false, true, }, + [PUBKEY] = { + PKG_CONFIG_STRING, + "PUBKEY", + NULL, + NULL, + NULL, + false, + false + } }; static int @@ -231,6 +240,8 @@ config_parse(const ucl_object_t *obj, pk sbuf_cpy(buf, "SIGNATURE_TYPE"); else if (strcasecmp(key, "fingerprints") == 0) sbuf_cpy(buf, "FINGERPRINTS"); + else if (strcasecmp(key, "pubkey") == 0) + sbuf_cpy(buf, "PUBKEY"); else if (strcasecmp(key, "enabled") == 0) { if ((cur->type != UCL_BOOLEAN) || !ucl_object_toboolean(cur)) Modified: head/usr.sbin/pkg/config.h ============================================================================== --- head/usr.sbin/pkg/config.h Tue Sep 8 21:04:33 2015 (r287578) +++ head/usr.sbin/pkg/config.h Tue Sep 8 21:25:36 2015 (r287579) @@ -40,6 +40,7 @@ typedef enum { SIGNATURE_TYPE, FINGERPRINTS, REPOS_DIR, + PUBKEY, CONFIG_SIZE } pkg_config_key; Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Tue Sep 8 21:04:33 2015 (r287578) +++ head/usr.sbin/pkg/pkg.c Tue Sep 8 21:25:36 2015 (r287579) @@ -65,6 +65,11 @@ struct sig_cert { bool trusted; }; +struct pubkey { + unsigned char *sig; + int siglen; +}; + typedef enum { HASH_UNKNOWN, HASH_SHA256, @@ -470,6 +475,25 @@ cleanup: } static EVP_PKEY * +load_public_key_file(const char *file) +{ + EVP_PKEY *pkey; + BIO *bp; + char errbuf[1024]; + + bp = BIO_new_file(file, "r"); + if (!bp) + errx(EXIT_FAILURE, "Unable to read %s", file); + + if ((pkey = PEM_read_bio_PUBKEY(bp, NULL, NULL, NULL)) == NULL) + warnx("ici: %s", ERR_error_string(ERR_get_error(), errbuf)); + + BIO_free(bp); + + return (pkey); +} + +static EVP_PKEY * load_public_key_buf(const unsigned char *cert, int certlen) { EVP_PKEY *pkey; @@ -487,8 +511,8 @@ load_public_key_buf(const unsigned char } static bool -rsa_verify_cert(int fd, const unsigned char *key, int keylen, - unsigned char *sig, int siglen) +rsa_verify_cert(int fd, const char *sigfile, const unsigned char *key, + int keylen, unsigned char *sig, int siglen) { EVP_MD_CTX *mdctx; EVP_PKEY *pkey; @@ -500,6 +524,8 @@ rsa_verify_cert(int fd, const unsigned c mdctx = NULL; ret = false; + SSL_load_error_strings(); + /* Compute SHA256 of the package. */ if (lseek(fd, 0, 0) == -1) { warn("lseek"); @@ -510,9 +536,16 @@ rsa_verify_cert(int fd, const unsigned c goto cleanup; } - if ((pkey = load_public_key_buf(key, keylen)) == NULL) { - warnx("Error reading public key"); - goto cleanup; + if (sigfile != NULL) { + if ((pkey = load_public_key_file(sigfile)) == NULL) { + warnx("Error reading public key"); + goto cleanup; + } + } else { + if ((pkey = load_public_key_buf(key, keylen)) == NULL) { + warnx("Error reading public key"); + goto cleanup; + } } /* Verify signature of the SHA256(pkg) is valid. */ @@ -522,16 +555,16 @@ rsa_verify_cert(int fd, const unsigned c } if (EVP_DigestVerifyInit(mdctx, NULL, EVP_sha256(), NULL, pkey) != 1) { - warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); + warnx("la %s", ERR_error_string(ERR_get_error(), errbuf)); goto error; } if (EVP_DigestVerifyUpdate(mdctx, sha256, strlen(sha256)) != 1) { - warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); + warnx("ici: %s", ERR_error_string(ERR_get_error(), errbuf)); goto error; } if (EVP_DigestVerifyFinal(mdctx, sig, siglen) != 1) { - warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); + warnx("merde %s", ERR_error_string(ERR_get_error(), errbuf)); goto error; } @@ -552,6 +585,35 @@ cleanup: return (ret); } +static struct pubkey * +read_pubkey(int fd) +{ + struct pubkey *pk; + struct sbuf *sig; + char buf[4096]; + int r; + + if (lseek(fd, 0, 0) == -1) { + warn("lseek"); + return (NULL); + } + + sig = sbuf_new_auto(); + + while ((r = read(fd, buf, sizeof(buf))) >0) { + sbuf_bcat(sig, buf, r); + } + + sbuf_finish(sig); + pk = calloc(1, sizeof(struct pubkey)); + pk->siglen = sbuf_len(sig); + pk->sig = calloc(1, pk->siglen); + memcpy(pk->sig, sbuf_data(sig), pk->siglen); + sbuf_delete(sig); + + return (pk); +} + static struct sig_cert * parse_cert(int fd) { int my_fd; @@ -625,6 +687,45 @@ parse_cert(int fd) { } static bool +verify_pubsignature(int fd_pkg, int fd_sig) +{ + struct pubkey *pk; + const char *pubkey; + bool ret; + + pk = NULL; + pubkey = NULL; + ret = false; + if (config_string(PUBKEY, &pubkey) != 0) { + warnx("No CONFIG_PUBKEY defined"); + goto cleanup; + } + + if ((pk = read_pubkey(fd_sig)) == NULL) { + warnx("Error reading signature"); + goto cleanup; + } + + /* Verify the signature. */ + printf("Verifying signature with public key %s... ", pubkey); + if (rsa_verify_cert(fd_pkg, pubkey, NULL, 0, pk->sig, + pk->siglen) == false) { + fprintf(stderr, "Signature is not valid\n"); + goto cleanup; + } + + ret = true; + +cleanup: + if (pk) { + free(pk->sig); + free(pk); + } + + return (ret); +} + +static bool verify_signature(int fd_pkg, int fd_sig) { struct fingerprint_list *trusted, *revoked; @@ -702,7 +803,7 @@ verify_signature(int fd_pkg, int fd_sig) /* Verify the signature. */ printf("Verifying signature with trusted certificate %s... ", sc->name); - if (rsa_verify_cert(fd_pkg, sc->cert, sc->certlen, sc->sig, + if (rsa_verify_cert(fd_pkg, NULL, sc->cert, sc->certlen, sc->sig, sc->siglen) == false) { fprintf(stderr, "Signature is not valid\n"); goto cleanup; @@ -768,24 +869,42 @@ bootstrap_pkg(bool force) if (signature_type != NULL && strcasecmp(signature_type, "NONE") != 0) { - if (strcasecmp(signature_type, "FINGERPRINTS") != 0) { - warnx("Signature type %s is not supported for " - "bootstrapping.", signature_type); - goto cleanup; - } + if (strcasecmp(signature_type, "FINGERPRINTS") == 0) { + + snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); + snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig", + packagesite); + + if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto fetchfail; + } - snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig", - packagesite); + if (verify_signature(fd_pkg, fd_sig) == false) + goto cleanup; + } else if (strcasecmp(signature_type, "PUBKEY") == 0) { - if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { - fprintf(stderr, "Signature for pkg not available.\n"); - goto fetchfail; - } + snprintf(tmpsig, MAXPATHLEN, + "%s/pkg.txz.pubkeysig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); + snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.pubkeysig", + packagesite); + + if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto fetchfail; + } - if (verify_signature(fd_pkg, fd_sig) == false) + if (verify_pubsignature(fd_pkg, fd_sig) == false) + goto cleanup; + } else { + warnx("Signature type %s is not supported for " + "bootstrapping.", signature_type); goto cleanup; + } } if ((ret = extract_pkg_static(fd_pkg, pkgstatic, MAXPATHLEN)) == 0) @@ -862,21 +981,37 @@ bootstrap_pkg_local(const char *pkgpath, } if (signature_type != NULL && strcasecmp(signature_type, "NONE") != 0) { - if (strcasecmp(signature_type, "FINGERPRINTS") != 0) { - warnx("Signature type %s is not supported for " - "bootstrapping.", signature_type); - goto cleanup; - } + if (strcasecmp(signature_type, "FINGERPRINTS") == 0) { - snprintf(path, sizeof(path), "%s.sig", pkgpath); + snprintf(path, sizeof(path), "%s.sig", pkgpath); - if ((fd_sig = open(path, O_RDONLY)) == -1) { - fprintf(stderr, "Signature for pkg not available.\n"); - goto cleanup; - } + if ((fd_sig = open(path, O_RDONLY)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto cleanup; + } - if (verify_signature(fd_pkg, fd_sig) == false) + if (verify_signature(fd_pkg, fd_sig) == false) + goto cleanup; + + } else if (strcasecmp(signature_type, "PUBKEY") == 0) { + + snprintf(path, sizeof(path), "%s.pubkeysig", pkgpath); + + if ((fd_sig = open(path, O_RDONLY)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto cleanup; + } + + if (verify_pubsignature(fd_pkg, fd_sig) == false) + goto cleanup; + + } else { + warnx("Signature type %s is not supported for " + "bootstrapping.", signature_type); goto cleanup; + } } if ((ret = extract_pkg_static(fd_pkg, pkgstatic, MAXPATHLEN)) == 0) From owner-svn-src-head@freebsd.org Tue Sep 8 22:24:21 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E088EA00217; Tue, 8 Sep 2015 22:24:21 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1401156D; Tue, 8 Sep 2015 22:24:21 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88MOLoY028184; Tue, 8 Sep 2015 22:24:21 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88MOLGE028183; Tue, 8 Sep 2015 22:24:21 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509082224.t88MOLGE028183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 8 Sep 2015 22:24:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287580 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 22:24:22 -0000 Author: bapt Date: Tue Sep 8 22:24:20 2015 New Revision: 287580 URL: https://svnweb.freebsd.org/changeset/base/287580 Log: Remove extra debug that crept in Modified: head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Tue Sep 8 21:25:36 2015 (r287579) +++ head/usr.sbin/pkg/pkg.c Tue Sep 8 22:24:20 2015 (r287580) @@ -555,16 +555,16 @@ rsa_verify_cert(int fd, const char *sigf } if (EVP_DigestVerifyInit(mdctx, NULL, EVP_sha256(), NULL, pkey) != 1) { - warnx("la %s", ERR_error_string(ERR_get_error(), errbuf)); + warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); goto error; } if (EVP_DigestVerifyUpdate(mdctx, sha256, strlen(sha256)) != 1) { - warnx("ici: %s", ERR_error_string(ERR_get_error(), errbuf)); + warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); goto error; } if (EVP_DigestVerifyFinal(mdctx, sig, siglen) != 1) { - warnx("merde %s", ERR_error_string(ERR_get_error(), errbuf)); + warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); goto error; } From owner-svn-src-head@freebsd.org Tue Sep 8 22:44:39 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85733A00C1B; Tue, 8 Sep 2015 22:44:39 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x22c.google.com (mail-io0-x22c.google.com [IPv6:2607:f8b0:4001:c06::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 526AC112E; Tue, 8 Sep 2015 22:44:39 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by ioiz6 with SMTP id z6so2042766ioi.2; Tue, 08 Sep 2015 15:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=wzommglTxDJ/Y18sRllGgrdU+2ZWS4pj5tV+0wMP8rY=; b=xA3TpxUmiEEos5y+DKIwzMOfEts3RprIpWCoNZpySJmQh9f3jDY9I4/fJa/JWhKKug 5gj93Bcr6tI9TD8HtMGAschqFN87OkroJZ+SZEwlVD6N5RuDJjU7b+HiNB7kqrYQrNHS eqexzHI/u8jPct8SK+kyan5x05QuonXlIDX4IT0pB/HxRh9vS8tI4nhHrQLSay5EkWeU N2MjxiUouqocRV+wp2hYROLEt8UgMbIr23BqrSJd80G793eT/PS/1Ob2EAbgQ9SArFEv uzlLVjJ7JzSniNCJP85BoYYQBkyNlZ4S/t5+TV4a6eflmFJ8SrcyvCl6KHWGJeK/Jax6 ur4Q== MIME-Version: 1.0 X-Received: by 10.107.13.75 with SMTP id 72mr43109200ion.75.1441752278623; Tue, 08 Sep 2015 15:44:38 -0700 (PDT) Received: by 10.36.28.208 with HTTP; Tue, 8 Sep 2015 15:44:38 -0700 (PDT) In-Reply-To: <201509082104.t88L4XaR095063@repo.freebsd.org> References: <201509082104.t88L4XaR095063@repo.freebsd.org> Date: Tue, 8 Sep 2015 15:44:38 -0700 Message-ID: Subject: Re: svn commit: r287578 - in head/usr.sbin/wpa: hostapd wpa_supplicant From: Adrian Chadd To: Jung-uk Kim Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 22:44:39 -0000 Wait a sec, did anyone review and test that this works out correctly? We already have working 802.11n; it's done inside net80211. It also mostly adds 20/40 coexistence and channel width changing on the fly, which is absolutely going to break absolutely everything as we don't /have/ stable support for that in any driver. Not only that, but mwl firmware for freebsd doesn't even fully work with 802.11n out of the box anyway, it has bugs with dealing with aggregation. sigh. So - please back this out and let's get this more thoroughly tested first. I don't want this update causing unpredictable behaviour. Thanks, -adrian On 8 September 2015 at 14:04, Jung-uk Kim wrote: > Author: jkim > Date: Tue Sep 8 21:04:33 2015 > New Revision: 287578 > URL: https://svnweb.freebsd.org/changeset/base/287578 > > Log: > Enable 802.11n support. > > PR: 164102 > > Modified: > head/usr.sbin/wpa/hostapd/Makefile > head/usr.sbin/wpa/wpa_supplicant/Makefile > > Modified: head/usr.sbin/wpa/hostapd/Makefile > ============================================================================== > --- head/usr.sbin/wpa/hostapd/Makefile Tue Sep 8 20:41:47 2015 (r287577) > +++ head/usr.sbin/wpa/hostapd/Makefile Tue Sep 8 21:04:33 2015 (r287578) > @@ -15,8 +15,8 @@ SRCS= accounting.c aes-omac1.c ap_config > eap_register.c eap_server.c eap_server_methods.c eap_user_db.c \ > eapol_auth_dump.c eapol_auth_sm.c eloop.c gas.c gas_serv.c hostapd.c \ > hs20.c http_client.c http_server.c httpread.c \ > - hw_features_common.c ieee802_11_auth.c \ > - ieee802_11_common.c ieee802_11_shared.c ieee802_1x.c ip_addr.c \ > + hw_features_common.c ieee802_11_auth.c ieee802_11_common.c \ > + ieee802_11_ht.c ieee802_11_shared.c ieee802_1x.c ip_addr.c \ > main.c ms_funcs.c os_unix.c peerkey_auth.c pmksa_cache_auth.c \ > preauth_auth.c radius.c radius_client.c radius_das.c sta_info.c \ > tkip_countermeasures.c upnp_xml.c utils.c uuid.c vlan_init.c \ > @@ -37,6 +37,7 @@ FILES= hostapd.conf hostapd.eap_user hos > CFLAGS+=-DCONFIG_DRIVER_BSD \ > -DCONFIG_DRIVER_RADIUS_ACL \ > -DCONFIG_HS20 \ > + -DCONFIG_IEEE80211N \ > -DCONFIG_INTERWORKING \ > -DCONFIG_PEERKEY \ > -DCONFIG_RSN_PREAUTH \ > > Modified: head/usr.sbin/wpa/wpa_supplicant/Makefile > ============================================================================== > --- head/usr.sbin/wpa/wpa_supplicant/Makefile Tue Sep 8 20:41:47 2015 (r287577) > +++ head/usr.sbin/wpa/wpa_supplicant/Makefile Tue Sep 8 21:04:33 2015 (r287578) > @@ -40,6 +40,7 @@ CFLAGS+=-DCONFIG_BACKEND_FILE \ > -DCONFIG_DRIVER_WIRED \ > -DCONFIG_GAS \ > -DCONFIG_HS20 \ > + -DCONFIG_IEEE80211N \ > -DCONFIG_IEEE80211R \ > -DCONFIG_INTERWORKING \ > -DCONFIG_PEERKEY \ > From owner-svn-src-head@freebsd.org Tue Sep 8 22:50:18 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A23C5A00EB1; Tue, 8 Sep 2015 22:50:18 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91F5D1370; Tue, 8 Sep 2015 22:50:18 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88MoIsx036712; Tue, 8 Sep 2015 22:50:18 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88MoIB3036711; Tue, 8 Sep 2015 22:50:18 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201509082250.t88MoIB3036711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Tue, 8 Sep 2015 22:50:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287581 - head/usr.sbin/service X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 22:50:18 -0000 Author: allanjude Date: Tue Sep 8 22:50:17 2015 New Revision: 287581 URL: https://svnweb.freebsd.org/changeset/base/287581 Log: Add an additional check to service(8) -e incase rcvar is blank Approved by: bapt (mentor) X-MFC-With: 287576 Differential Revision: https://reviews.freebsd.org/D3604 Modified: head/usr.sbin/service/service.sh Modified: head/usr.sbin/service/service.sh ============================================================================== --- head/usr.sbin/service/service.sh Tue Sep 8 22:24:20 2015 (r287580) +++ head/usr.sbin/service/service.sh Tue Sep 8 22:50:17 2015 (r287581) @@ -71,7 +71,9 @@ if [ -n "$RESTART" ]; then if grep -q ^rcvar $file; then eval `grep ^name= $file` eval `grep ^rcvar $file` - load_rc_config_var ${name} ${rcvar} + if [ -n "$rcvar" ]; then + load_rc_config_var ${name} ${rcvar} + fi checkyesno $rcvar 2>/dev/null && run_rc_script ${file} stop fi done @@ -101,7 +103,9 @@ if [ -n "$ENABLED" ]; then if grep -q ^rcvar $file; then eval `grep ^name= $file` eval `grep ^rcvar $file` - load_rc_config_var ${name} ${rcvar} + if [ -n "$rcvar" ]; then + load_rc_config_var ${name} ${rcvar} + fi checkyesno $rcvar 2>/dev/null && echo $file fi done From owner-svn-src-head@freebsd.org Tue Sep 8 22:51:11 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B819EA00F1E; Tue, 8 Sep 2015 22:51:11 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A800B15E7; Tue, 8 Sep 2015 22:51:11 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88MpBtA037793; Tue, 8 Sep 2015 22:51:11 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88MpBFa037792; Tue, 8 Sep 2015 22:51:11 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201509082251.t88MpBFa037792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Tue, 8 Sep 2015 22:51:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287582 - head/games/fortune/datfiles X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 22:51:11 -0000 Author: allanjude Date: Tue Sep 8 22:51:10 2015 New Revision: 287582 URL: https://svnweb.freebsd.org/changeset/base/287582 Log: Correctly case FreeBSD in my entry in the tips file Submitted by: feld Approved by: wblock (mentor) Differential Revision: https://reviews.freebsd.org/D3601 Modified: head/games/fortune/datfiles/freebsd-tips Modified: head/games/fortune/datfiles/freebsd-tips ============================================================================== --- head/games/fortune/datfiles/freebsd-tips Tue Sep 8 22:50:17 2015 (r287581) +++ head/games/fortune/datfiles/freebsd-tips Tue Sep 8 22:51:10 2015 (r287582) @@ -234,7 +234,7 @@ To erase a line you've written at the co To find the hostname associated with an IP address, use drill -x IP_address - -- Allan Jude + -- Allan Jude % To obtain a neat PostScript rendering of a manual page, use ``-t'' switch of the man(1) utility: ``man -t ''. For example: From owner-svn-src-head@freebsd.org Tue Sep 8 23:13:15 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91DF09CCB2A; Tue, 8 Sep 2015 23:13:15 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx2.freebsd.org", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F91311AC; Tue, 8 Sep 2015 23:13:15 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from hammer.pct.niksun.com (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx2.freebsd.org (Postfix) with ESMTP id D96F44F70; Tue, 8 Sep 2015 23:13:14 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r287578 - in head/usr.sbin/wpa: hostapd wpa_supplicant To: Adrian Chadd References: <201509082104.t88L4XaR095063@repo.freebsd.org> Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Jung-uk Kim X-Enigmail-Draft-Status: N1110 Message-ID: <55EF6B8A.2050109@FreeBSD.org> Date: Tue, 8 Sep 2015 19:13:14 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 23:13:15 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 09/08/2015 18:44, Adrian Chadd wrote: > Wait a sec, did anyone review and test that this works out > correctly? I tested hostapd(8) with ath(4) myself and it is working flawlessly for me. I didn't get any review because I thought it wouldn't change any default behavior. > We already have working 802.11n; it's done inside net80211. Yes, I know. Basically, this commit let me set 802.11n via hostapd.conf. Previously, I had to manually set it via ifconfig(8). > It also mostly adds 20/40 coexistence and channel width changing > on the fly, which is absolutely going to break absolutely > everything as we don't /have/ stable support for that in any > driver. Hmm... I thought it has very low risk because user has to enable 802.11n for the driver (e.g., ATH_ENABLE_11N) and set it via configuration (e.g., setting 'ieee80211n=1' in /etc/hostapd.conf). > Not only that, but mwl firmware for freebsd doesn't even fully > work with 802.11n out of the box anyway, it has bugs with dealing > with aggregation. sigh. Why don't we disable 802.11n support for mwl(4) by default and let the user decide, just like we do for ath, then? > So - please back this out and let's get this more thoroughly > tested first. I don't want this update causing unpredictable > behaviour. Okay, I'll back it out. Jung-uk Kim > Thanks, > > > > > -adrian > > On 8 September 2015 at 14:04, Jung-uk Kim > wrote: >> Author: jkim Date: Tue Sep 8 21:04:33 2015 New Revision: 287578 >> URL: https://svnweb.freebsd.org/changeset/base/287578 >> >> Log: Enable 802.11n support. >> >> PR: 164102 >> >> Modified: head/usr.sbin/wpa/hostapd/Makefile >> head/usr.sbin/wpa/wpa_supplicant/Makefile >> >> Modified: head/usr.sbin/wpa/hostapd/Makefile >> ===================================================================== ========= >> >> - --- head/usr.sbin/wpa/hostapd/Makefile Tue Sep 8 20:41:47 2015 (r287577) >> +++ head/usr.sbin/wpa/hostapd/Makefile Tue Sep 8 21:04:33 2015 >> (r287578) @@ -15,8 +15,8 @@ SRCS= accounting.c aes-omac1.c >> ap_config eap_register.c eap_server.c eap_server_methods.c >> eap_user_db.c \ eapol_auth_dump.c eapol_auth_sm.c eloop.c gas.c >> gas_serv.c hostapd.c \ hs20.c http_client.c http_server.c >> httpread.c \ - hw_features_common.c ieee802_11_auth.c \ - >> ieee802_11_common.c ieee802_11_shared.c ieee802_1x.c ip_addr.c \ >> + hw_features_common.c ieee802_11_auth.c >> ieee802_11_common.c \ + ieee802_11_ht.c ieee802_11_shared.c >> ieee802_1x.c ip_addr.c \ main.c ms_funcs.c os_unix.c >> peerkey_auth.c pmksa_cache_auth.c \ preauth_auth.c radius.c >> radius_client.c radius_das.c sta_info.c \ tkip_countermeasures.c >> upnp_xml.c utils.c uuid.c vlan_init.c \ @@ -37,6 +37,7 @@ FILES= >> hostapd.conf hostapd.eap_user hos CFLAGS+=-DCONFIG_DRIVER_BSD \ >> -DCONFIG_DRIVER_RADIUS_ACL \ -DCONFIG_HS20 \ + >> -DCONFIG_IEEE80211N \ -DCONFIG_INTERWORKING \ -DCONFIG_PEERKEY \ >> -DCONFIG_RSN_PREAUTH \ >> >> Modified: head/usr.sbin/wpa/wpa_supplicant/Makefile >> ===================================================================== ========= >> >> - --- head/usr.sbin/wpa/wpa_supplicant/Makefile Tue Sep 8 20:41:47 2015 (r287577) >> +++ head/usr.sbin/wpa/wpa_supplicant/Makefile Tue Sep 8 >> 21:04:33 2015 (r287578) @@ -40,6 +40,7 @@ >> CFLAGS+=-DCONFIG_BACKEND_FILE \ -DCONFIG_DRIVER_WIRED \ >> -DCONFIG_GAS \ -DCONFIG_HS20 \ + -DCONFIG_IEEE80211N \ >> -DCONFIG_IEEE80211R \ -DCONFIG_INTERWORKING \ -DCONFIG_PEERKEY \ >> > . > -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJV72uCAAoJEHyflib82/FGxgEH/jDCH6eSN5Go9tTEXgfofLxX 12DDoQjxMh2G5SPzkanYhjjljN2dYPt0+vaKUYELIdIcXblbcsXda81y2NjGX7lt tu+L73cIfjmSvEo+vs/FJ9ERTk8DBTLSq2bU2I43gurhusqkAGnEeLGfrGchD7Dw RDZnU99nLDYemr6NNzA8uIvLReIw8FTyg6Nsj6su9pvNvYh2x5YsNnXOBeGIi9Vj 2wDflU8tJ8WHYyjfHoSG790FiufEsW3A4O++YihzYHPODHsVN7qFCjgpQggti6Wy fmYIOd9uEI/M0HT1CQ6sRgDxIqZr/ttG/1/iOQ8q8RhWrEBqhcBfQyYc1T+YLUc= =UCLu -----END PGP SIGNATURE----- From owner-svn-src-head@freebsd.org Tue Sep 8 23:17:04 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0EE4E9CCD26; Tue, 8 Sep 2015 23:17:04 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D99C4141E; Tue, 8 Sep 2015 23:17:03 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88NH3Uj048787; Tue, 8 Sep 2015 23:17:03 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88NH3Ur048785; Tue, 8 Sep 2015 23:17:03 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201509082317.t88NH3Ur048785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 8 Sep 2015 23:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287583 - in head/usr.sbin/wpa: hostapd wpa_supplicant X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 23:17:04 -0000 Author: jkim Date: Tue Sep 8 23:17:02 2015 New Revision: 287583 URL: https://svnweb.freebsd.org/changeset/base/287583 Log: Revert r287578. This patch requires more review. Requested by: adrian Modified: head/usr.sbin/wpa/hostapd/Makefile head/usr.sbin/wpa/wpa_supplicant/Makefile Modified: head/usr.sbin/wpa/hostapd/Makefile ============================================================================== --- head/usr.sbin/wpa/hostapd/Makefile Tue Sep 8 22:51:10 2015 (r287582) +++ head/usr.sbin/wpa/hostapd/Makefile Tue Sep 8 23:17:02 2015 (r287583) @@ -15,8 +15,8 @@ SRCS= accounting.c aes-omac1.c ap_config eap_register.c eap_server.c eap_server_methods.c eap_user_db.c \ eapol_auth_dump.c eapol_auth_sm.c eloop.c gas.c gas_serv.c hostapd.c \ hs20.c http_client.c http_server.c httpread.c \ - hw_features_common.c ieee802_11_auth.c ieee802_11_common.c \ - ieee802_11_ht.c ieee802_11_shared.c ieee802_1x.c ip_addr.c \ + hw_features_common.c ieee802_11_auth.c \ + ieee802_11_common.c ieee802_11_shared.c ieee802_1x.c ip_addr.c \ main.c ms_funcs.c os_unix.c peerkey_auth.c pmksa_cache_auth.c \ preauth_auth.c radius.c radius_client.c radius_das.c sta_info.c \ tkip_countermeasures.c upnp_xml.c utils.c uuid.c vlan_init.c \ @@ -37,7 +37,6 @@ FILES= hostapd.conf hostapd.eap_user hos CFLAGS+=-DCONFIG_DRIVER_BSD \ -DCONFIG_DRIVER_RADIUS_ACL \ -DCONFIG_HS20 \ - -DCONFIG_IEEE80211N \ -DCONFIG_INTERWORKING \ -DCONFIG_PEERKEY \ -DCONFIG_RSN_PREAUTH \ Modified: head/usr.sbin/wpa/wpa_supplicant/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_supplicant/Makefile Tue Sep 8 22:51:10 2015 (r287582) +++ head/usr.sbin/wpa/wpa_supplicant/Makefile Tue Sep 8 23:17:02 2015 (r287583) @@ -40,7 +40,6 @@ CFLAGS+=-DCONFIG_BACKEND_FILE \ -DCONFIG_DRIVER_WIRED \ -DCONFIG_GAS \ -DCONFIG_HS20 \ - -DCONFIG_IEEE80211N \ -DCONFIG_IEEE80211R \ -DCONFIG_INTERWORKING \ -DCONFIG_PEERKEY \ From owner-svn-src-head@freebsd.org Wed Sep 9 01:30:14 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B8ABA00CF4; Wed, 9 Sep 2015 01:30:14 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x236.google.com (mail-io0-x236.google.com [IPv6:2607:f8b0:4001:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC383187D; Wed, 9 Sep 2015 01:30:13 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by ioii196 with SMTP id i196so5414646ioi.3; Tue, 08 Sep 2015 18:30:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Bug5mIMlQicbXr+1Tvw65AMnzzpGJfNBeEPHC8J7/EA=; b=ut08KCTYKV6JdETsNTCHlOHqu2OriX50EyC3l3B7VpS6jH/OVawuyJ+F/N23rJgYRU iB235j5z76Y5tN/lWYuOY2zV6YeeewdvVjRHj6Z1HYceK8V4+jdHpWnlfdimgrjrMoP/ 7xnsuMJ2vmAYij1P/3eOAfn2oHrjyfb7w28TMyAeOF8ppbKHM/Bcbh8y/8fJBnulTQpS Usai2+Zpws7WISzS7N3bZ9w8KLK2icnkaoLycAqcXTXDC6rUT8zareM4jPazrtIz3mNj VsHdks4TV8LPS4fxP1l8OOgvlCQIVJhop9dGgg1uJyYFThVhjD/rPvdY2Vh6HuwTKTC8 Xykg== MIME-Version: 1.0 X-Received: by 10.107.35.78 with SMTP id j75mr11170038ioj.123.1441762213011; Tue, 08 Sep 2015 18:30:13 -0700 (PDT) Received: by 10.36.28.208 with HTTP; Tue, 8 Sep 2015 18:30:12 -0700 (PDT) In-Reply-To: <55EF6B8A.2050109@FreeBSD.org> References: <201509082104.t88L4XaR095063@repo.freebsd.org> <55EF6B8A.2050109@FreeBSD.org> Date: Tue, 8 Sep 2015 18:30:12 -0700 Message-ID: Subject: Re: svn commit: r287578 - in head/usr.sbin/wpa: hostapd wpa_supplicant From: Adrian Chadd To: Jung-uk Kim Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 01:30:14 -0000 The main annoying thing is any migration that hostapd decides to do between 20 and 2040 and 40-only modes. Right now ath just resets the interface and drops all the packets in-flight, which is a big no-no for 11n (we have to save them and restore them.) It's additionally complicated because to do it correctly, the rate control code has to be reset to the new mode and then all the packets in the queue need new rate control data. :( -a On 8 September 2015 at 16:13, Jung-uk Kim wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 09/08/2015 18:44, Adrian Chadd wrote: >> Wait a sec, did anyone review and test that this works out >> correctly? > > I tested hostapd(8) with ath(4) myself and it is working flawlessly > for me. I didn't get any review because I thought it wouldn't change > any default behavior. > >> We already have working 802.11n; it's done inside net80211. > > Yes, I know. Basically, this commit let me set 802.11n via > hostapd.conf. Previously, I had to manually set it via ifconfig(8). > >> It also mostly adds 20/40 coexistence and channel width changing >> on the fly, which is absolutely going to break absolutely >> everything as we don't /have/ stable support for that in any >> driver. > > Hmm... I thought it has very low risk because user has to enable > 802.11n for the driver (e.g., ATH_ENABLE_11N) and set it via > configuration (e.g., setting 'ieee80211n=1' in /etc/hostapd.conf). > >> Not only that, but mwl firmware for freebsd doesn't even fully >> work with 802.11n out of the box anyway, it has bugs with dealing >> with aggregation. sigh. > > Why don't we disable 802.11n support for mwl(4) by default and let the > user decide, just like we do for ath, then? > >> So - please back this out and let's get this more thoroughly >> tested first. I don't want this update causing unpredictable >> behaviour. > > Okay, I'll back it out. > > Jung-uk Kim > >> Thanks, >> >> >> >> >> -adrian >> >> On 8 September 2015 at 14:04, Jung-uk Kim >> wrote: >>> Author: jkim Date: Tue Sep 8 21:04:33 2015 New Revision: 287578 >>> URL: https://svnweb.freebsd.org/changeset/base/287578 >>> >>> Log: Enable 802.11n support. >>> >>> PR: 164102 >>> >>> Modified: head/usr.sbin/wpa/hostapd/Makefile >>> head/usr.sbin/wpa/wpa_supplicant/Makefile >>> >>> Modified: head/usr.sbin/wpa/hostapd/Makefile >>> ===================================================================== > ========= >>> >>> > - --- head/usr.sbin/wpa/hostapd/Makefile Tue Sep 8 20:41:47 2015 > (r287577) >>> +++ head/usr.sbin/wpa/hostapd/Makefile Tue Sep 8 21:04:33 2015 >>> (r287578) @@ -15,8 +15,8 @@ SRCS= accounting.c aes-omac1.c >>> ap_config eap_register.c eap_server.c eap_server_methods.c >>> eap_user_db.c \ eapol_auth_dump.c eapol_auth_sm.c eloop.c gas.c >>> gas_serv.c hostapd.c \ hs20.c http_client.c http_server.c >>> httpread.c \ - hw_features_common.c ieee802_11_auth.c \ - >>> ieee802_11_common.c ieee802_11_shared.c ieee802_1x.c ip_addr.c \ >>> + hw_features_common.c ieee802_11_auth.c >>> ieee802_11_common.c \ + ieee802_11_ht.c ieee802_11_shared.c >>> ieee802_1x.c ip_addr.c \ main.c ms_funcs.c os_unix.c >>> peerkey_auth.c pmksa_cache_auth.c \ preauth_auth.c radius.c >>> radius_client.c radius_das.c sta_info.c \ tkip_countermeasures.c >>> upnp_xml.c utils.c uuid.c vlan_init.c \ @@ -37,6 +37,7 @@ FILES= >>> hostapd.conf hostapd.eap_user hos CFLAGS+=-DCONFIG_DRIVER_BSD \ >>> -DCONFIG_DRIVER_RADIUS_ACL \ -DCONFIG_HS20 \ + >>> -DCONFIG_IEEE80211N \ -DCONFIG_INTERWORKING \ -DCONFIG_PEERKEY \ >>> -DCONFIG_RSN_PREAUTH \ >>> >>> Modified: head/usr.sbin/wpa/wpa_supplicant/Makefile >>> ===================================================================== > ========= >>> >>> > - --- head/usr.sbin/wpa/wpa_supplicant/Makefile Tue Sep 8 20:41:47 2015 > (r287577) >>> +++ head/usr.sbin/wpa/wpa_supplicant/Makefile Tue Sep 8 >>> 21:04:33 2015 (r287578) @@ -40,6 +40,7 @@ >>> CFLAGS+=-DCONFIG_BACKEND_FILE \ -DCONFIG_DRIVER_WIRED \ >>> -DCONFIG_GAS \ -DCONFIG_HS20 \ + -DCONFIG_IEEE80211N \ >>> -DCONFIG_IEEE80211R \ -DCONFIG_INTERWORKING \ -DCONFIG_PEERKEY \ >>> >> . >> > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2 > > iQEcBAEBCAAGBQJV72uCAAoJEHyflib82/FGxgEH/jDCH6eSN5Go9tTEXgfofLxX > 12DDoQjxMh2G5SPzkanYhjjljN2dYPt0+vaKUYELIdIcXblbcsXda81y2NjGX7lt > tu+L73cIfjmSvEo+vs/FJ9ERTk8DBTLSq2bU2I43gurhusqkAGnEeLGfrGchD7Dw > RDZnU99nLDYemr6NNzA8uIvLReIw8FTyg6Nsj6su9pvNvYh2x5YsNnXOBeGIi9Vj > 2wDflU8tJ8WHYyjfHoSG790FiufEsW3A4O++YihzYHPODHsVN7qFCjgpQggti6Wy > fmYIOd9uEI/M0HT1CQ6sRgDxIqZr/ttG/1/iOQ8q8RhWrEBqhcBfQyYc1T+YLUc= > =UCLu > -----END PGP SIGNATURE----- From owner-svn-src-head@freebsd.org Wed Sep 9 01:51:39 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F8DB9CD87F; Wed, 9 Sep 2015 01:51:39 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 513681283; Wed, 9 Sep 2015 01:51:39 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t891pdO7013673; Wed, 9 Sep 2015 01:51:39 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t891pdMI013672; Wed, 9 Sep 2015 01:51:39 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201509090151.t891pdMI013672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Wed, 9 Sep 2015 01:51:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287584 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 01:51:39 -0000 Author: kevlo Date: Wed Sep 9 01:51:38 2015 New Revision: 287584 URL: https://svnweb.freebsd.org/changeset/base/287584 Log: Correct setting R92C_TDECTRL_BLK_DESC_NUM_M bit. Modified: head/sys/dev/usb/wlan/if_urtwnreg.h Modified: head/sys/dev/usb/wlan/if_urtwnreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_urtwnreg.h Tue Sep 8 23:17:02 2015 (r287583) +++ head/sys/dev/usb/wlan/if_urtwnreg.h Wed Sep 9 01:51:38 2015 (r287584) @@ -451,7 +451,7 @@ #define R92C_RQPN_LD 0x80000000 /* Bits for R92C_TDECTRL. */ -#define R92C_TDECTRL_BLK_DESC_NUM_M 0x0000000f +#define R92C_TDECTRL_BLK_DESC_NUM_M 0x000000f0 #define R92C_TDECTRL_BLK_DESC_NUM_S 4 /* Bits for R92C_FWHW_TXQ_CTRL. */ From owner-svn-src-head@freebsd.org Wed Sep 9 03:15:26 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79BC4A00793; Wed, 9 Sep 2015 03:15:26 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A9401A8E; Wed, 9 Sep 2015 03:15:26 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t893FQKC048187; Wed, 9 Sep 2015 03:15:26 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t893FQZN048186; Wed, 9 Sep 2015 03:15:26 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201509090315.t893FQZN048186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 9 Sep 2015 03:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287586 - head/sys/powerpc/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 03:15:26 -0000 Author: jhibbits Date: Wed Sep 9 03:15:25 2015 New Revision: 287586 URL: https://svnweb.freebsd.org/changeset/base/287586 Log: Add PVR identifier for E6500, from the reference. Modified: head/sys/powerpc/include/spr.h Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Wed Sep 9 03:05:13 2015 (r287585) +++ head/sys/powerpc/include/spr.h Wed Sep 9 03:15:25 2015 (r287586) @@ -190,6 +190,7 @@ #define FSL_E500v2 0x8021 #define FSL_E500mc 0x8023 #define FSL_E5500 0x8024 +#define FSL_E6500 0x8040 #define SPR_IBAT0U 0x210 /* .68 Instruction BAT Reg 0 Upper */ #define SPR_IBAT0U 0x210 /* .6. Instruction BAT Reg 0 Upper */ From owner-svn-src-head@freebsd.org Wed Sep 9 05:17:05 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 591AEA0087A; Wed, 9 Sep 2015 05:17:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FB4C1129; Wed, 9 Sep 2015 05:17:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t895H5wQ097337; Wed, 9 Sep 2015 05:17:05 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t895H4Qh097335; Wed, 9 Sep 2015 05:17:04 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509090517.t895H4Qh097335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 9 Sep 2015 05:17:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287590 - head/usr.bin/w X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 05:17:05 -0000 Author: delphij Date: Wed Sep 9 05:17:04 2015 New Revision: 287590 URL: https://svnweb.freebsd.org/changeset/base/287590 Log: w(1) is not setgid binary since r53279, so remove the setgid() call. Reviewed By: wollman MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D3541 Modified: head/usr.bin/w/Makefile head/usr.bin/w/w.c Modified: head/usr.bin/w/Makefile ============================================================================== --- head/usr.bin/w/Makefile Wed Sep 9 04:34:55 2015 (r287589) +++ head/usr.bin/w/Makefile Wed Sep 9 05:17:04 2015 (r287590) @@ -5,8 +5,6 @@ PROG= w SRCS= fmt.c pr_time.c proc_compare.c w.c MAN= w.1 uptime.1 LIBADD= kvm sbuf xo util -#BINGRP= kmem -#BINMODE=2555 LINKS= ${BINDIR}/w ${BINDIR}/uptime .PATH: ${.CURDIR}/../../bin/ps Modified: head/usr.bin/w/w.c ============================================================================== --- head/usr.bin/w/w.c Wed Sep 9 04:34:55 2015 (r287589) +++ head/usr.bin/w/w.c Wed Sep 9 05:17:04 2015 (r287590) @@ -135,7 +135,7 @@ main(int argc, char *argv[]) struct kinfo_proc *dkp; struct stat *stp; time_t touched; - int ch, i, nentries, nusers, wcmd, longidle, longattime, dropgid; + int ch, i, nentries, nusers, wcmd, longidle, longattime; const char *memf, *nlistf, *p, *save_p; char *x_suffix; char buf[MAXHOSTNAMELEN], errbuf[_POSIX2_LINE_MAX]; @@ -159,7 +159,6 @@ main(int argc, char *argv[]) p = "dhiflM:N:nsuw"; } - dropgid = 0; memf = _PATH_DEVNULL; nlistf = NULL; while ((ch = getopt(argc, argv, p)) != -1) @@ -176,11 +175,9 @@ main(int argc, char *argv[]) case 'M': header = 0; memf = optarg; - dropgid = 1; break; case 'N': nlistf = optarg; - dropgid = 1; break; case 'n': nflag = 1; @@ -200,13 +197,6 @@ main(int argc, char *argv[]) _res.retrans = 2; /* resolver timeout to 2 seconds per try */ _res.retry = 1; /* only try once.. */ - /* - * Discard setgid privileges if not the running kernel so that bad - * guys can't print interesting stuff from kernel memory. - */ - if (dropgid) - setgid(getgid()); - if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf)) == NULL) errx(1, "%s", errbuf); From owner-svn-src-head@freebsd.org Wed Sep 9 06:19:34 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43DEAA008EA; Wed, 9 Sep 2015 06:19:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1ACE21D52; Wed, 9 Sep 2015 06:19:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t896JXSg021956; Wed, 9 Sep 2015 06:19:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t896JX5r021955; Wed, 9 Sep 2015 06:19:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509090619.t896JX5r021955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 9 Sep 2015 06:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287591 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 06:19:34 -0000 Author: kib Date: Wed Sep 9 06:19:33 2015 New Revision: 287591 URL: https://svnweb.freebsd.org/changeset/base/287591 Log: Remove a check which caused spurious SIGSEGV on usermode access to the mapped address without valid pte installed, when parallel wiring of the entry happen. The entry must be copy on write. If entry is COW but was already copied, and parallel wiring set MAP_ENTRY_IN_TRANSITION, vm_fault() would sleep waiting for the MAP_ENTRY_IN_TRANSITION flag to clear. After that, the fault handler is restarted and vm_map_lookup() or vm_map_lookup_locked() trip over the check. Note that this is race, if the address is accessed after the wiring is done, the entry does not fault at all. There is no reason in the current kernel to disallow write access to the COW wired entry if the entry permissions allow it. Initially this was done in r24666, since that kernel did not supported proper copy-on-write for wired text, which was fixed in r199869. The r251901 revision re-introduced the r24666 fix for the current VM. Note that write access must clear MAP_ENTRY_NEEDS_COPY entry flag by performing COW. In reverse, when MAP_ENTRY_NEEDS_COPY is set in vmspace_fork(), the MAP_ENTRY_USER_WIRED flag is cleared. Put the assert stating the invariant, instead of returning the error. Reported and debugging help by: peter Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Wed Sep 9 05:17:04 2015 (r287590) +++ head/sys/vm/vm_map.c Wed Sep 9 06:19:33 2015 (r287591) @@ -3969,12 +3969,10 @@ RetryLookup:; vm_map_unlock_read(map); return (KERN_PROTECTION_FAILURE); } - if ((entry->eflags & MAP_ENTRY_USER_WIRED) && - (entry->eflags & MAP_ENTRY_COW) && - (fault_type & VM_PROT_WRITE)) { - vm_map_unlock_read(map); - return (KERN_PROTECTION_FAILURE); - } + KASSERT((prot & VM_PROT_WRITE) == 0 || (entry->eflags & + (MAP_ENTRY_USER_WIRED | MAP_ENTRY_NEEDS_COPY)) != + (MAP_ENTRY_USER_WIRED | MAP_ENTRY_NEEDS_COPY), + ("entry %p flags %x", entry, entry->eflags)); if ((fault_typea & VM_PROT_COPY) != 0 && (entry->max_protection & VM_PROT_WRITE) == 0 && (entry->eflags & MAP_ENTRY_COW) == 0) { @@ -4128,10 +4126,6 @@ vm_map_lookup_locked(vm_map_t *var_map, fault_type &= VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE; if ((fault_type & prot) != fault_type) return (KERN_PROTECTION_FAILURE); - if ((entry->eflags & MAP_ENTRY_USER_WIRED) && - (entry->eflags & MAP_ENTRY_COW) && - (fault_type & VM_PROT_WRITE)) - return (KERN_PROTECTION_FAILURE); /* * If this page is not pageable, we have to get it for all possible From owner-svn-src-head@freebsd.org Wed Sep 9 07:04:01 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA04EA00326; Wed, 9 Sep 2015 07:04:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97D151F2C; Wed, 9 Sep 2015 07:04:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t89741ni042095; Wed, 9 Sep 2015 07:04:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t89741DU042093; Wed, 9 Sep 2015 07:04:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201509090704.t89741DU042093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 9 Sep 2015 07:04:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287592 - in head/sys/dev/usb: . serial X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 07:04:01 -0000 Author: hselasky Date: Wed Sep 9 07:04:00 2015 New Revision: 287592 URL: https://svnweb.freebsd.org/changeset/base/287592 Log: Add new USB ID. MFC after: 1 month PR: 202968 Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Wed Sep 9 06:19:33 2015 (r287591) +++ head/sys/dev/usb/serial/u3g.c Wed Sep 9 07:04:00 2015 (r287592) @@ -316,6 +316,7 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(HUAWEI, E220, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E392, U3GINIT_HUAWEISCSI), + U3G_DEV(HUAWEI, ME909U, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, MOBILE, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E1752, U3GINIT_HUAWEISCSI), U3G_DEV(HUAWEI, E1820, U3GINIT_HUAWEISCSI), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Wed Sep 9 06:19:33 2015 (r287591) +++ head/sys/dev/usb/usbdevs Wed Sep 9 07:04:00 2015 (r287592) @@ -2390,6 +2390,7 @@ product HUAWEI K3765_INIT 0x1520 K3765 I product HUAWEI K4505_INIT 0x1521 K4505 Initial product HUAWEI K3772_INIT 0x1526 K3772 Initial product HUAWEI E3272_INIT 0x155b LTE modem initial +product HUAWEI ME909U 0x1573 LTE modem product HUAWEI R215_INIT 0x1582 LTE modem initial product HUAWEI R215 0x1588 LTE modem product HUAWEI ETS2055 0x1803 CDMA modem From owner-svn-src-head@freebsd.org Wed Sep 9 09:19:08 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF1499CC8D4; Wed, 9 Sep 2015 09:19:08 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0BBF1B9B; Wed, 9 Sep 2015 09:19:08 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t899J885096092; Wed, 9 Sep 2015 09:19:08 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t899J80b096091; Wed, 9 Sep 2015 09:19:08 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509090919.t899J80b096091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Wed, 9 Sep 2015 09:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287595 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 09:19:08 -0000 Author: hrs Date: Wed Sep 9 09:19:07 2015 New Revision: 287595 URL: https://svnweb.freebsd.org/changeset/base/287595 Log: - Fix SIGSEGV when sa == NULL. NULL check in getnameinfo_inet() did not work as expected. - Simplify afdl table lookup. MFC after: 3 days Modified: head/lib/libc/net/getnameinfo.c Modified: head/lib/libc/net/getnameinfo.c ============================================================================== --- head/lib/libc/net/getnameinfo.c Wed Sep 9 08:52:39 2015 (r287594) +++ head/lib/libc/net/getnameinfo.c Wed Sep 9 09:19:07 2015 (r287595) @@ -78,6 +78,8 @@ getnameinfo(const struct sockaddr *sa, s char *host, size_t hostlen, char *serv, size_t servlen, int flags) { + if (sa == NULL) + return (EAI_FAIL); switch (sa->sa_family) { case AF_INET: @@ -124,25 +126,19 @@ getnameinfo_inet(const struct sockaddr * struct servent *sp; struct hostent *hp; u_short port; - int family, i; const char *addr; u_int32_t v4a; int h_error; char numserv[512]; char numaddr[512]; - if (sa == NULL) - return EAI_FAIL; - - family = sa->sa_family; - for (i = 0; afdl[i].a_af; i++) - if (afdl[i].a_af == family) { - afd = &afdl[i]; - goto found; - } - return EAI_FAMILY; + for (afd = &afdl[0]; afd->a_af > 0; afd++) { + if (afd->a_af == sa->sa_family) + break; + } + if (afd->a_af == 0) + return (EAI_FAMILY); - found: if (salen != afd->a_socklen) return EAI_FAIL; From owner-svn-src-head@freebsd.org Wed Sep 9 11:51:15 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F9269CD77F; Wed, 9 Sep 2015 11:51:15 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9057113C9; Wed, 9 Sep 2015 11:51:15 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t89BpFm1062696; Wed, 9 Sep 2015 11:51:15 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t89BpFaC062695; Wed, 9 Sep 2015 11:51:15 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201509091151.t89BpFaC062695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 9 Sep 2015 11:51:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287596 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 11:51:15 -0000 Author: andrew Date: Wed Sep 9 11:51:14 2015 New Revision: 287596 URL: https://svnweb.freebsd.org/changeset/base/287596 Log: Rework copyinstr to: * Fail when the length passed in is 0 * Remove an unneeded increment of the count on success * Return ENAMETOOLONG when the input pointer is too long Sponsored by: ABT Systems Ltd Modified: head/sys/arm64/arm64/copyinout.S Modified: head/sys/arm64/arm64/copyinout.S ============================================================================== --- head/sys/arm64/arm64/copyinout.S Wed Sep 9 09:19:07 2015 (r287595) +++ head/sys/arm64/arm64/copyinout.S Wed Sep 9 11:51:14 2015 (r287596) @@ -95,6 +95,7 @@ END(copyin) */ ENTRY(copyinstr) mov x5, xzr /* count = 0 */ + mov w4, #1 /* If zero return faulure */ cbz x2, 3f /* If len == 0 then skip loop */ adr x6, copyio_fault /* Get the handler address */ @@ -102,17 +103,18 @@ ENTRY(copyinstr) 1: ldrb w4, [x0], #1 /* Load from uaddr */ strb w4, [x1], #1 /* Store in kaddr */ - cbz w4, 2f /* If == 0 then break */ - sub x2, x2, #1 /* len-- */ add x5, x5, #1 /* count++ */ + cbz w4, 2f /* Break when NUL-terminated */ + sub x2, x2, #1 /* len-- */ cbnz x2, 1b 2: SET_FAULT_HANDLER(xzr, x7) /* Clear the handler */ 3: cbz x3, 4f /* Check if done != NULL */ - add x5, x5, #1 /* count++ */ str x5, [x3] /* done = count */ -4: mov x0, xzr /* return 0 */ +4: mov w1, #ENAMETOOLONG /* Load ENAMETOOLONG to return if failed */ + cmp w4, #0 /* Check if we saved the NUL-terminator */ + csel w0, wzr, w1, eq /* If so return success, else failure */ ret END(copyinstr) From owner-svn-src-head@freebsd.org Wed Sep 9 13:24:40 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A0DD9CCC08; Wed, 9 Sep 2015 13:24:40 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 798E71922; Wed, 9 Sep 2015 13:24:40 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t89DOeA7001083; Wed, 9 Sep 2015 13:24:40 GMT (envelope-from takawata@FreeBSD.org) Received: (from takawata@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t89DOej2001082; Wed, 9 Sep 2015 13:24:40 GMT (envelope-from takawata@FreeBSD.org) Message-Id: <201509091324.t89DOej2001082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: takawata set sender to takawata@FreeBSD.org using -f From: Takanori Watanabe Date: Wed, 9 Sep 2015 13:24:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287597 - head/usr.sbin/bluetooth/hccontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 13:24:40 -0000 Author: takawata Date: Wed Sep 9 13:24:39 2015 New Revision: 287597 URL: https://svnweb.freebsd.org/changeset/base/287597 Log: fix compare argument for address type. Submitted by: issei10193 (via Twitter) Modified: head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/usr.sbin/bluetooth/hccontrol/le.c ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/le.c Wed Sep 9 11:51:14 2015 (r287596) +++ head/usr.sbin/bluetooth/hccontrol/le.c Wed Sep 9 13:24:39 2015 (r287597) @@ -88,7 +88,7 @@ le_set_scan_param(int s, int argc, char if (strcmp(argv[3], "public") == 0) adrtype = 0; - else if (strcmp(argv[0], "random") == 0) + else if (strcmp(argv[3], "random") == 0) adrtype = 1; else return USAGE; From owner-svn-src-head@freebsd.org Wed Sep 9 15:14:44 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBA49A00CDB; Wed, 9 Sep 2015 15:14:44 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A77FF1A9D; Wed, 9 Sep 2015 15:14:44 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1ZZh52-0005ze-0V; Wed, 09 Sep 2015 18:14:36 +0300 Date: Wed, 9 Sep 2015 18:14:35 +0300 From: Slawa Olhovchenkov To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r287099 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <20150909151435.GP3158@zxy.spb.ru> References: <201508240810.t7O8Aq0J096319@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201508240810.t7O8Aq0J096319@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 15:14:45 -0000 On Mon, Aug 24, 2015 at 08:10:52AM +0000, Andriy Gapon wrote: > Author: avg > Date: Mon Aug 24 08:10:52 2015 > New Revision: 287099 > URL: https://svnweb.freebsd.org/changeset/base/287099 > > Log: > account for ashift when gathering buffers to be written to l2arc device > > The change that introduced the L2ARC compression support also introduced > a bug where the on-disk size of the selected buffers could end up larger > than the target size if the ashift is greater than 9. This was because > the buffer selection could did not take into account the fact that > on-disk size could be larger than the in-memory buffer size due to > the alignment requirements. > > At the moment b_asize is a misnomer as it does not always represent the > allocated size: if a buffer is compressed, then the compressed size is > properly rounded (on FreeBSD), but if the compression fails or it is not > applied, then the original size is kept and it could be smaller than what > ashift requires. > > For the same reasons arcstat_l2_asize and the reported used space > on the cache device could be smaller than the actual allocated size > if ashift > 9. That problem is not fixed by this change. > > This change only ensures that l2ad_hand is not advanced by more > than target_sz. Otherwise we would overwrite active (unevicted) > L2ARC buffers. That problem is manifested as growing l2_cksum_bad > and l2_io_error counters. > > This change also changes 'p' prefix to 'a' prefix in a few places > where variables represent allocated rather than physical size. > > The resolved problem could also result in the reported allocated size > being greater than the cache device's capacity, because of the > overwritten buffers (more than one buffer claiming the same disk > space). > > This change is already in ZFS-on-Linux: > zfsonlinux/zfs@ef56b0780c80ebb0b1e637b8b8c79530a8ab3201 > > PR: 198242 > PR: 195746 (possibly related) > Reviewed by: mahrens (https://reviews.csiden.org/r/229/) > Tested by: gkontos@aicom.gr (most recently) > MFC after: 15 days Not ready? From owner-svn-src-head@freebsd.org Wed Sep 9 19:31:09 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71509A01505; Wed, 9 Sep 2015 19:31:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62F4818DF; Wed, 9 Sep 2015 19:31:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t89JV9Ng057070; Wed, 9 Sep 2015 19:31:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t89JV9Vq057069; Wed, 9 Sep 2015 19:31:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509091931.t89JV9Vq057069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 9 Sep 2015 19:31:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287599 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 19:31:09 -0000 Author: kib Date: Wed Sep 9 19:31:08 2015 New Revision: 287599 URL: https://svnweb.freebsd.org/changeset/base/287599 Log: For open("name", O_DIRECTORY | O_CREAT), do not try to create the named node, open(2) cannot create directories. But do allow the flag combination to succeed if the directory already exists. Declare the open("name", O_DIRECTORY | O_CREAT | O_EXCL) always invalid for the same reason, since open(2) cannot create directory. Note that there is an argument that O_DIRECTORY | O_CREAT should be invalid always, regardless of the target directory existence or O_EXCL. The current fix is conservative and allows the call to succeed in the situation where it succeeded before the patch. Reported by: Tom Ridge Reviewed by: rwatson PR: 202892 Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Wed Sep 9 17:15:13 2015 (r287598) +++ head/sys/kern/vfs_vnops.c Wed Sep 9 19:31:08 2015 (r287599) @@ -195,7 +195,10 @@ vn_open_cred(struct nameidata *ndp, int restart: fmode = *flagp; - if (fmode & O_CREAT) { + if ((fmode & (O_CREAT | O_EXCL | O_DIRECTORY)) == (O_CREAT | + O_EXCL | O_DIRECTORY)) + return (EINVAL); + else if ((fmode & (O_CREAT | O_DIRECTORY)) == O_CREAT) { ndp->ni_cnd.cn_nameiop = CREATE; /* * Set NOCACHE to avoid flushing the cache when From owner-svn-src-head@freebsd.org Wed Sep 9 21:18:11 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCC119CCB3A; Wed, 9 Sep 2015 21:18:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A38121BDB; Wed, 9 Sep 2015 21:18:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t89LIB0l000389; Wed, 9 Sep 2015 21:18:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t89LIBNN000388; Wed, 9 Sep 2015 21:18:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509092118.t89LIBNN000388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 9 Sep 2015 21:18:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287600 - head/tests/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 21:18:11 -0000 Author: jhb Date: Wed Sep 9 21:18:10 2015 New Revision: 287600 URL: https://svnweb.freebsd.org/changeset/base/287600 Log: Properly size the children[] arrays in the follow fork tests. Modified: head/tests/sys/kern/ptrace_test.c Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Wed Sep 9 19:31:08 2015 (r287599) +++ head/tests/sys/kern/ptrace_test.c Wed Sep 9 21:18:10 2015 (r287600) @@ -493,7 +493,7 @@ handle_fork_events(pid_t parent) ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_both_attached); ATF_TC_BODY(ptrace__follow_fork_both_attached, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int status; ATF_REQUIRE((fpid = fork()) != -1); @@ -549,7 +549,7 @@ ATF_TC_BODY(ptrace__follow_fork_both_att ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_child_detached); ATF_TC_BODY(ptrace__follow_fork_child_detached, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int status; ATF_REQUIRE((fpid = fork()) != -1); @@ -600,7 +600,7 @@ ATF_TC_BODY(ptrace__follow_fork_child_de ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_parent_detached); ATF_TC_BODY(ptrace__follow_fork_parent_detached, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int status; ATF_REQUIRE((fpid = fork()) != -1); @@ -681,7 +681,7 @@ attach_fork_parent(int cpipe[2]) ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_both_attached_unrelated_debugger); ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelated_debugger, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int cpipe[2], status; ATF_REQUIRE(pipe(cpipe) == 0); @@ -749,7 +749,7 @@ ATF_TC_BODY(ptrace__follow_fork_both_att ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_child_detached_unrelated_debugger); ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelated_debugger, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int cpipe[2], status; ATF_REQUIRE(pipe(cpipe) == 0); @@ -812,7 +812,7 @@ ATF_TC_BODY(ptrace__follow_fork_child_de ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_parent_detached_unrelated_debugger); ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrelated_debugger, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int cpipe[2], status; ATF_REQUIRE(pipe(cpipe) == 0); From owner-svn-src-head@freebsd.org Wed Sep 9 22:42:27 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 526DCA00915; Wed, 9 Sep 2015 22:42:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42ABC1A25; Wed, 9 Sep 2015 22:42:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t89MgRiF037296; Wed, 9 Sep 2015 22:42:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t89MgRNX037295; Wed, 9 Sep 2015 22:42:27 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509092242.t89MgRNX037295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 9 Sep 2015 22:42:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287601 - head/tests/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 22:42:27 -0000 Author: jhb Date: Wed Sep 9 22:42:26 2015 New Revision: 287601 URL: https://svnweb.freebsd.org/changeset/base/287601 Log: Add a test to verify that a traced process sees its original parent via getppid() after a debugger process that is not the parent has attached. Reviewed by: kib (earlier version) Differential Revision: https://reviews.freebsd.org/D3615 Modified: head/tests/sys/kern/ptrace_test.c Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Wed Sep 9 21:18:10 2015 (r287600) +++ head/tests/sys/kern/ptrace_test.c Wed Sep 9 22:42:26 2015 (r287601) @@ -866,6 +866,92 @@ ATF_TC_BODY(ptrace__follow_fork_parent_d ATF_REQUIRE(errno == ECHILD); } +/* + * Verify that a child process does not see an unrelated debugger as its + * parent but sees its original parent process. + */ +ATF_TC_WITHOUT_HEAD(ptrace__getppid); +ATF_TC_BODY(ptrace__getppid, tc) +{ + pid_t child, debugger, ppid, wpid; + int cpipe[2], dpipe[2], status; + char c; + + ATF_REQUIRE(pipe(cpipe) == 0); + ATF_REQUIRE((child = fork()) != -1); + + if (child == 0) { + /* Child process. */ + close(cpipe[0]); + + /* Wait for parent to be ready. */ + CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c)); + + /* Report the parent PID to the parent. */ + ppid = getppid(); + CHILD_REQUIRE(write(cpipe[1], &ppid, sizeof(ppid)) == + sizeof(ppid)); + + _exit(1); + } + close(cpipe[1]); + + ATF_REQUIRE(pipe(dpipe) == 0); + ATF_REQUIRE((debugger = fork()) != -1); + + if (debugger == 0) { + /* Debugger process. */ + close(dpipe[0]); + + CHILD_REQUIRE(ptrace(PT_ATTACH, child, NULL, 0) != -1); + + wpid = waitpid(child, &status, 0); + CHILD_REQUIRE(wpid == child); + CHILD_REQUIRE(WIFSTOPPED(status)); + CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + CHILD_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1); + + /* Signal parent that debugger is attached. */ + CHILD_REQUIRE(write(dpipe[1], &c, sizeof(c)) == sizeof(c)); + + /* Wait for traced child to exit. */ + wpid = waitpid(child, &status, 0); + CHILD_REQUIRE(wpid == child); + CHILD_REQUIRE(WIFEXITED(status)); + CHILD_REQUIRE(WEXITSTATUS(status) == 1); + + _exit(0); + } + close(dpipe[1]); + + /* Parent process. */ + + /* Wait for the debugger to attach to the child. */ + ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == sizeof(c)); + + /* Release the child. */ + ATF_REQUIRE(write(cpipe[0], &c, sizeof(c)) == sizeof(c)); + + /* Read the parent PID from the child. */ + ATF_REQUIRE(read(cpipe[0], &ppid, sizeof(ppid)) == sizeof(ppid)); + close(cpipe[0]); + + ATF_REQUIRE(ppid == getpid()); + + /* Wait for the debugger. */ + wpid = waitpid(debugger, &status, 0); + ATF_REQUIRE(wpid == debugger); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 0); + + /* The child process should now be ready. */ + wpid = waitpid(child, &status, WNOHANG); + ATF_REQUIRE(wpid == child); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); +} + ATF_TP_ADD_TCS(tp) { @@ -881,6 +967,7 @@ ATF_TP_ADD_TCS(tp) ptrace__follow_fork_child_detached_unrelated_debugger); ATF_TP_ADD_TC(tp, ptrace__follow_fork_parent_detached_unrelated_debugger); + ATF_TP_ADD_TC(tp, ptrace__getppid); return (atf_no_error()); } From owner-svn-src-head@freebsd.org Wed Sep 9 22:54:08 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FAA8A00F81; Wed, 9 Sep 2015 22:54:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB5EF1EE7; Wed, 9 Sep 2015 22:54:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t89Ms7QG041555; Wed, 9 Sep 2015 22:54:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t89Ms7Sx041554; Wed, 9 Sep 2015 22:54:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509092254.t89Ms7Sx041554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 9 Sep 2015 22:54:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287602 - head/tests/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 22:54:08 -0000 Author: jhb Date: Wed Sep 9 22:54:07 2015 New Revision: 287602 URL: https://svnweb.freebsd.org/changeset/base/287602 Log: Use _exit() instead of exit() in child processes created during tests. Suggested by: kib Modified: head/tests/sys/kern/ptrace_test.c Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Wed Sep 9 22:42:26 2015 (r287601) +++ head/tests/sys/kern/ptrace_test.c Wed Sep 9 22:54:07 2015 (r287602) @@ -127,7 +127,7 @@ ATF_TC_BODY(ptrace__parent_wait_after_tr /* Child process. */ trace_me(); - exit(1); + _exit(1); } /* Parent process. */ @@ -173,7 +173,7 @@ ATF_TC_BODY(ptrace__parent_wait_after_at /* Wait for the parent to attach. */ CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == 0); - exit(1); + _exit(1); } close(cpipe[1]); @@ -221,7 +221,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_aft /* Wait for parent to be ready. */ CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c)); - exit(1); + _exit(1); } close(cpipe[1]); @@ -252,7 +252,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_aft CHILD_REQUIRE(WIFEXITED(status)); CHILD_REQUIRE(WEXITSTATUS(status) == 1); - exit(0); + _exit(0); } close(dpipe[1]); @@ -315,7 +315,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_aft /* Wait for parent to be ready. */ CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c)); - exit(1); + _exit(1); } close(cpipe[1]); @@ -331,7 +331,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_aft */ CHILD_REQUIRE((fpid = fork()) != -1); if (fpid != 0) - exit(2); + _exit(2); /* Debugger process. */ close(dpipe[0]); @@ -356,7 +356,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_aft CHILD_REQUIRE(WIFEXITED(status)); CHILD_REQUIRE(WEXITSTATUS(status) == 1); - exit(0); + _exit(0); } close(dpipe[1]); @@ -418,14 +418,14 @@ follow_fork_parent(void) if (fpid == 0) /* Child */ - exit(2); + _exit(2); wpid = waitpid(fpid, &status, 0); CHILD_REQUIRE(wpid == fpid); CHILD_REQUIRE(WIFEXITED(status)); CHILD_REQUIRE(WEXITSTATUS(status) == 2); - exit(1); + _exit(1); } /* @@ -662,7 +662,7 @@ attach_fork_parent(int cpipe[2]) /* Double-fork to disassociate from the debugger. */ CHILD_REQUIRE((fpid = fork()) != -1); if (fpid != 0) - exit(3); + _exit(3); /* Send the pid of the disassociated child to the debugger. */ fpid = getpid(); From owner-svn-src-head@freebsd.org Thu Sep 10 04:05:59 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA102A01485; Thu, 10 Sep 2015 04:05:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 913F61F2A; Thu, 10 Sep 2015 04:05:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A45xOa070200; Thu, 10 Sep 2015 04:05:59 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A45xrJ070199; Thu, 10 Sep 2015 04:05:59 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509100405.t8A45xrJ070199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 10 Sep 2015 04:05:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287606 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 04:05:59 -0000 Author: adrian Date: Thu Sep 10 04:05:58 2015 New Revision: 287606 URL: https://svnweb.freebsd.org/changeset/base/287606 Log: Also make kern.maxfilesperproc a boot time tunable. Auto-tuning threshold discussions aside, it turns out that if you want to lower this on say, rather memory-packed machines, you either set maxusers or kern.maxfiles, or you set it in sysctl. The former is a non-exact way to tune this; the latter doesn't actually affect anything in the startup scripts. This first occured because I wondered why the hell screen would take upwards of 10 seconds to spawn a new screen. I then found python doing the same thing during fork/exec of child processes - it calls close() on each FD up to the current openfiles limit. On a 1TB machine this is like, 26 million FDs per process. Ugh. So: * This allows it to be set early in /boot/loader.conf; * It can be used to work around the ridiculous situation of screen, python, etc doing a close() on potentially millions of FDs even though you only have four open. Tested: * 4GB, 32GB, 64GB, 128GB, 384GB, 1TB systems with autotune, ensuring screen and python forking doesn't result in some pretty hilariously bad behaviour. TODO: * Note that the default login.conf sets openfiles-cur to unlimited, effectively obeying kern.maxfilesperproc. Perhaps we should fix this. * .. and even if we do, we need to also ensure that daemons get a soft limit of something reasonable and capped - they can request more FDs themselves. MFC after: 1 week Sponsored by: Norse Corp, Inc. Modified: head/sys/kern/subr_param.c Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Wed Sep 9 23:41:24 2015 (r287605) +++ head/sys/kern/subr_param.c Thu Sep 10 04:05:58 2015 (r287606) @@ -265,7 +265,8 @@ init_param2(long physpages) if (maxfiles > (physpages / 4)) maxfiles = physpages / 4; maxfilesperproc = (maxfiles / 10) * 9; - + TUNABLE_INT_FETCH("kern.maxfilesperproc", &maxfilesperproc); + /* * Cannot be changed after boot. */ From owner-svn-src-head@freebsd.org Thu Sep 10 05:59:41 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AFBEA01178; Thu, 10 Sep 2015 05:59:41 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AF831E98; Thu, 10 Sep 2015 05:59:41 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A5xfjg015516; Thu, 10 Sep 2015 05:59:41 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A5xeKd015512; Thu, 10 Sep 2015 05:59:40 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509100559.t8A5xeKd015512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 10 Sep 2015 05:59:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287607 - in head: sbin/ifconfig share/man/man4 sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 05:59:41 -0000 Author: hrs Date: Thu Sep 10 05:59:39 2015 New Revision: 287607 URL: https://svnweb.freebsd.org/changeset/base/287607 Log: - Remove GIF_{SEND,ACCEPT}_REVETHIP. - Simplify EADDRNOTAVAIL and EAFNOSUPPORT conditions. MFC after: 3 days Modified: head/sbin/ifconfig/ifgif.c head/share/man/man4/gif.4 head/sys/net/if_gif.c head/sys/net/if_gif.h Modified: head/sbin/ifconfig/ifgif.c ============================================================================== --- head/sbin/ifconfig/ifgif.c Thu Sep 10 04:05:58 2015 (r287606) +++ head/sbin/ifconfig/ifgif.c Thu Sep 10 05:59:39 2015 (r287607) @@ -51,7 +51,7 @@ static const char rcsid[] = #include "ifconfig.h" -#define GIFBITS "\020\1ACCEPT_REV_ETHIP_VER\2IGNORE_SOURCE\5SEND_REV_ETHIP_VER" +#define GIFBITS "\020\2IGNORE_SOURCE" static void gif_status(int); @@ -70,8 +70,7 @@ gif_status(int s) } static void -setgifopts(const char *val, - int d, int s, const struct afswtch *afp) +setgifopts(const char *val, int d, int s, const struct afswtch *afp) { int opts; @@ -93,12 +92,8 @@ setgifopts(const char *val, } static struct cmd gif_cmds[] = { - DEF_CMD("accept_rev_ethip_ver", GIF_ACCEPT_REVETHIP, setgifopts), - DEF_CMD("-accept_rev_ethip_ver",-GIF_ACCEPT_REVETHIP, setgifopts), DEF_CMD("ignore_source", GIF_IGNORE_SOURCE, setgifopts), DEF_CMD("-ignore_source", -GIF_IGNORE_SOURCE, setgifopts), - DEF_CMD("send_rev_ethip_ver", GIF_SEND_REVETHIP, setgifopts), - DEF_CMD("-send_rev_ethip_ver", -GIF_SEND_REVETHIP, setgifopts), }; static struct afswtch af_gif = { @@ -110,11 +105,9 @@ static struct afswtch af_gif = { static __constructor void gif_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(gif_cmds); i++) + for (i = 0; i < nitems(gif_cmds); i++) cmd_register(&gif_cmds[i]); af_register(&af_gif); -#undef N } Modified: head/share/man/man4/gif.4 ============================================================================== --- head/share/man/man4/gif.4 Thu Sep 10 04:05:58 2015 (r287606) +++ head/share/man/man4/gif.4 Thu Sep 10 05:59:39 2015 (r287607) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 14, 2014 +.Dd September 10, 2015 .Dt GIF 4 .Os .Sh NAME @@ -246,32 +246,3 @@ had a multi-destination behavior, config .Dv IFF_LINK0 flag. The behavior is obsolete and is no longer supported. -.Pp -On -.Fx -6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 -the -.Nm -sends and receives incorrect EtherIP packets with reversed version -field when -.Xr if_bridge 4 -is used together. As a workaround on this interoperability issue, the -following two -.Xr ifconfig 8 -flags can be used: -.Bl -tag -width "accept_rev_ethip_ver" -offset indent -.It accept_rev_ethip_ver -accepts both correct EtherIP packets and ones with reversed version -field, if enabled. If disabled, the -.Nm -accepts the correct packets only. This flag is enabled by default. -.It send_rev_ethip_ver -sends EtherIP packets with reversed version field intentionally, if -enabled. If disabled, the -.Nm -sends the correct packets only. This flag is disabled by default. -.El -.Pp -If interoperability with the older -.Fx -machines is needed, both of these two flags must be enabled. Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Thu Sep 10 04:05:58 2015 (r287606) +++ head/sys/net/if_gif.c Thu Sep 10 05:59:39 2015 (r287607) @@ -421,13 +421,8 @@ gif_transmit(struct ifnet *ifp, struct m } eth = mtod(m, struct etherip_header *); eth->eip_resvh = 0; - if ((sc->gif_options & GIF_SEND_REVETHIP) != 0) { - eth->eip_ver = 0; - eth->eip_resvl = ETHERIP_VERSION; - } else { - eth->eip_ver = ETHERIP_VERSION; - eth->eip_resvl = 0; - } + eth->eip_ver = ETHERIP_VERSION; + eth->eip_resvl = 0; break; default: error = EAFNOSUPPORT; @@ -635,19 +630,10 @@ gif_input(struct mbuf *m, struct ifnet * if (m == NULL) goto drop; eip = mtod(m, struct etherip_header *); - /* - * GIF_ACCEPT_REVETHIP (enabled by default) intentionally - * accepts an EtherIP packet with revered version field in - * the header. This is a knob for backward compatibility - * with FreeBSD 7.2R or prior. - */ if (eip->eip_ver != ETHERIP_VERSION) { - if ((gif_options & GIF_ACCEPT_REVETHIP) == 0 || - eip->eip_resvl != ETHERIP_VERSION) { - /* discard unknown versions */ - m_freem(m); - goto drop; - } + /* discard unknown versions */ + m_freem(m); + goto drop; } m_adj(m, sizeof(struct etherip_header)); @@ -768,50 +754,32 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, goto bad; /* validate sa_len */ + /* check sa_family looks sane for the cmd */ switch (src->sa_family) { #ifdef INET case AF_INET: if (src->sa_len != sizeof(struct sockaddr_in)) goto bad; - break; -#endif -#ifdef INET6 - case AF_INET6: - if (src->sa_len != sizeof(struct sockaddr_in6)) + if (cmd != SIOCSIFPHYADDR) { + error = EAFNOSUPPORT; goto bad; - break; -#endif - default: - error = EAFNOSUPPORT; - goto bad; - } - /* check sa_family looks sane for the cmd */ - error = EAFNOSUPPORT; - switch (cmd) { -#ifdef INET - case SIOCSIFPHYADDR: - if (src->sa_family == AF_INET) - break; - goto bad; -#endif -#ifdef INET6 - case SIOCSIFPHYADDR_IN6: - if (src->sa_family == AF_INET6) - break; - goto bad; -#endif - } - error = EADDRNOTAVAIL; - switch (src->sa_family) { -#ifdef INET - case AF_INET: + } if (satosin(src)->sin_addr.s_addr == INADDR_ANY || - satosin(dst)->sin_addr.s_addr == INADDR_ANY) + satosin(dst)->sin_addr.s_addr == INADDR_ANY) { + error = EADDRNOTAVAIL; goto bad; + } break; #endif #ifdef INET6 case AF_INET6: + if (src->sa_len != sizeof(struct sockaddr_in6)) + goto bad; + if (cmd != SIOCSIFPHYADDR_IN6) { + error = EAFNOSUPPORT; + goto bad; + } + error = EADDRNOTAVAIL; if (IN6_IS_ADDR_UNSPECIFIED(&satosin6(src)->sin6_addr) || IN6_IS_ADDR_UNSPECIFIED(&satosin6(dst)->sin6_addr)) @@ -827,8 +795,12 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, error = sa6_embedscope(satosin6(dst), 0); if (error != 0) goto bad; + break; #endif - }; + default: + error = EAFNOSUPPORT; + goto bad; + } error = gif_set_tunnel(ifp, src, dst); break; case SIOCDIFPHYADDR: Modified: head/sys/net/if_gif.h ============================================================================== --- head/sys/net/if_gif.h Thu Sep 10 04:05:58 2015 (r287606) +++ head/sys/net/if_gif.h Thu Sep 10 05:59:39 2015 (r287607) @@ -126,10 +126,7 @@ int in6_gif_attach(struct gif_softc *); #define GIFGOPTS _IOWR('i', 150, struct ifreq) #define GIFSOPTS _IOW('i', 151, struct ifreq) -#define GIF_ACCEPT_REVETHIP 0x0001 #define GIF_IGNORE_SOURCE 0x0002 -#define GIF_SEND_REVETHIP 0x0010 -#define GIF_OPTMASK (GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP| \ - GIF_IGNORE_SOURCE) +#define GIF_OPTMASK (GIF_IGNORE_SOURCE) #endif /* _NET_IF_GIF_H_ */ From owner-svn-src-head@freebsd.org Thu Sep 10 06:08:43 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A121A01631; Thu, 10 Sep 2015 06:08:43 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B2D312DA; Thu, 10 Sep 2015 06:08:43 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A68hb0019565; Thu, 10 Sep 2015 06:08:43 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A68gZe019563; Thu, 10 Sep 2015 06:08:43 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509100608.t8A68gZe019563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 10 Sep 2015 06:08:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287608 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 06:08:43 -0000 Author: hrs Date: Thu Sep 10 06:08:42 2015 New Revision: 287608 URL: https://svnweb.freebsd.org/changeset/base/287608 Log: Remove IN6_IFF_NOPFX. This flag was no longer used. MFC after: 3 days Modified: head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_var.h Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Thu Sep 10 05:59:39 2015 (r287607) +++ head/sys/netinet6/in6_ifattach.c Thu Sep 10 06:08:42 2015 (r287608) @@ -566,9 +566,6 @@ in6_ifattach_loopback(struct ifnet *ifp) ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; - /* skip registration to the prefix list. XXX should be temporary. */ - ifra.ifra_flags |= IN6_IFF_NOPFX; - /* * We are sure that this is a newly assigned address, so we can set * NULL to the 3rd arg. Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Thu Sep 10 05:59:39 2015 (r287607) +++ head/sys/netinet6/in6_var.h Thu Sep 10 06:08:42 2015 (r287608) @@ -499,9 +499,6 @@ struct in6_rrenumreq { #define IN6_IFF_AUTOCONF 0x40 /* autoconfigurable address. */ #define IN6_IFF_TEMPORARY 0x80 /* temporary (anonymous) address. */ #define IN6_IFF_PREFER_SOURCE 0x0100 /* preferred address for SAS */ -#define IN6_IFF_NOPFX 0x8000 /* skip kernel prefix management. - * XXX: this should be temporary. - */ /* do not input/output */ #define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED) From owner-svn-src-head@freebsd.org Thu Sep 10 06:10:31 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4ADBA01759; Thu, 10 Sep 2015 06:10:31 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 953CA14ED; Thu, 10 Sep 2015 06:10:31 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A6AVXp019718; Thu, 10 Sep 2015 06:10:31 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A6AVIl019717; Thu, 10 Sep 2015 06:10:31 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509100610.t8A6AVIl019717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 10 Sep 2015 06:10:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287609 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 06:10:31 -0000 Author: hrs Date: Thu Sep 10 06:10:30 2015 New Revision: 287609 URL: https://svnweb.freebsd.org/changeset/base/287609 Log: Do not add IN6_IFF_TENTATIVE when ND6_IFF_NO_DAD. MFC after: 3 days Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Thu Sep 10 06:08:42 2015 (r287608) +++ head/sys/netinet6/in6.c Thu Sep 10 06:10:30 2015 (r287609) @@ -1198,11 +1198,13 @@ in6_update_ifa_internal(struct ifnet *if * source address. */ ia->ia6_flags &= ~IN6_IFF_DUPLICATED; /* safety */ - if (hostIsNew && in6if_do_dad(ifp)) - ia->ia6_flags |= IN6_IFF_TENTATIVE; - /* DAD should be performed after ND6_IFF_IFDISABLED is cleared. */ - if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) + /* + * DAD should be performed for an new address or addresses on + * an interface with ND6_IFF_IFDISABLED. + */ + if (in6if_do_dad(ifp) && + (hostIsNew || (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED))) ia->ia6_flags |= IN6_IFF_TENTATIVE; /* notify other subsystems */ From owner-svn-src-head@freebsd.org Thu Sep 10 06:29:19 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60CFAA01F72; Thu, 10 Sep 2015 06:29:19 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 467AC1D3D; Thu, 10 Sep 2015 06:29:19 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A6TJV1027949; Thu, 10 Sep 2015 06:29:19 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A6TJrs027948; Thu, 10 Sep 2015 06:29:19 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509100629.t8A6TJrs027948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 10 Sep 2015 06:29:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287610 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 06:29:19 -0000 Author: hrs Date: Thu Sep 10 06:29:18 2015 New Revision: 287610 URL: https://svnweb.freebsd.org/changeset/base/287610 Log: - Remove SIOCGDRLST_IN6 and SIOCGPRLST_IN6. These are quite old APIs and there is no consumer now. - Simplify first and duplicate LLA check. MFC after: 3 days Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Thu Sep 10 06:10:30 2015 (r287609) +++ head/sys/netinet6/nd6.c Thu Sep 10 06:29:18 2015 (r287610) @@ -1344,99 +1344,14 @@ nd6_rtrequest(int req, struct rtentry *r int nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) { - struct in6_drlist *drl = (struct in6_drlist *)data; - struct in6_oprlist *oprl = (struct in6_oprlist *)data; struct in6_ndireq *ndi = (struct in6_ndireq *)data; struct in6_nbrinfo *nbi = (struct in6_nbrinfo *)data; struct in6_ndifreq *ndif = (struct in6_ndifreq *)data; - struct nd_defrouter *dr; - struct nd_prefix *pr; - int i = 0, error = 0; + int error = 0; if (ifp->if_afdata[AF_INET6] == NULL) return (EPFNOSUPPORT); switch (cmd) { - case SIOCGDRLST_IN6: - /* - * obsolete API, use sysctl under net.inet6.icmp6 - */ - bzero(drl, sizeof(*drl)); - TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { - if (i >= DRLSTSIZ) - break; - drl->defrouter[i].rtaddr = dr->rtaddr; - in6_clearscope(&drl->defrouter[i].rtaddr); - - drl->defrouter[i].flags = dr->flags; - drl->defrouter[i].rtlifetime = dr->rtlifetime; - drl->defrouter[i].expire = dr->expire + - (time_second - time_uptime); - drl->defrouter[i].if_index = dr->ifp->if_index; - i++; - } - break; - case SIOCGPRLST_IN6: - /* - * obsolete API, use sysctl under net.inet6.icmp6 - * - * XXX the structure in6_prlist was changed in backward- - * incompatible manner. in6_oprlist is used for SIOCGPRLST_IN6, - * in6_prlist is used for nd6_sysctl() - fill_prlist(). - */ - /* - * XXX meaning of fields, especialy "raflags", is very - * differnet between RA prefix list and RR/static prefix list. - * how about separating ioctls into two? - */ - bzero(oprl, sizeof(*oprl)); - LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) { - struct nd_pfxrouter *pfr; - int j; - - if (i >= PRLSTSIZ) - break; - oprl->prefix[i].prefix = pr->ndpr_prefix.sin6_addr; - oprl->prefix[i].raflags = pr->ndpr_raf; - oprl->prefix[i].prefixlen = pr->ndpr_plen; - oprl->prefix[i].vltime = pr->ndpr_vltime; - oprl->prefix[i].pltime = pr->ndpr_pltime; - oprl->prefix[i].if_index = pr->ndpr_ifp->if_index; - if (pr->ndpr_vltime == ND6_INFINITE_LIFETIME) - oprl->prefix[i].expire = 0; - else { - time_t maxexpire; - - /* XXX: we assume time_t is signed. */ - maxexpire = (-1) & - ~((time_t)1 << - ((sizeof(maxexpire) * 8) - 1)); - if (pr->ndpr_vltime < - maxexpire - pr->ndpr_lastupdate) { - oprl->prefix[i].expire = - pr->ndpr_lastupdate + - pr->ndpr_vltime + - (time_second - time_uptime); - } else - oprl->prefix[i].expire = maxexpire; - } - - j = 0; - LIST_FOREACH(pfr, &pr->ndpr_advrtrs, pfr_entry) { - if (j < DRLSTSIZ) { -#define RTRADDR oprl->prefix[i].advrtr[j] - RTRADDR = pfr->router->rtaddr; - in6_clearscope(&RTRADDR); -#undef RTRADDR - } - j++; - } - oprl->prefix[i].advrtrs = j; - oprl->prefix[i].origin = PR_ORIG_RA; - - i++; - } - - break; case OSIOCGIFINFO_IN6: #define ND ndi->ndi /* XXX: old ndp(8) assumes a positive value for linkmtu. */ @@ -1496,22 +1411,19 @@ nd6_ioctl(u_long cmd, caddr_t data, stru * do not clear ND6_IFF_IFDISABLED. * See RFC 4862, Section 5.4.5. */ - int duplicated_linklocal = 0; - IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ia = (struct in6_ifaddr *)ifa; if ((ia->ia6_flags & IN6_IFF_DUPLICATED) && - IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) { - duplicated_linklocal = 1; + IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) break; - } } IF_ADDR_RUNLOCK(ifp); - if (duplicated_linklocal) { + if (ifa != NULL) { + /* LLA is duplicated. */ ND.flags |= ND6_IFF_IFDISABLED; log(LOG_ERR, "Cannot enable an interface" " with a link-local address marked" @@ -1527,14 +1439,18 @@ nd6_ioctl(u_long cmd, caddr_t data, stru /* Mark all IPv6 address as tentative. */ ND_IFINFO(ifp)->flags |= ND6_IFF_IFDISABLED; - IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family != AF_INET6) - continue; - ia = (struct in6_ifaddr *)ifa; - ia->ia6_flags |= IN6_IFF_TENTATIVE; + if ((ND_IFINFO(ifp)->flags & ND6_IFF_NO_DAD) == 0) { + IF_ADDR_RLOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, + ifa_link) { + if (ifa->ifa_addr->sa_family != + AF_INET6) + continue; + ia = (struct in6_ifaddr *)ifa; + ia->ia6_flags |= IN6_IFF_TENTATIVE; + } + IF_ADDR_RUNLOCK(ifp); } - IF_ADDR_RUNLOCK(ifp); } if (ND.flags & ND6_IFF_AUTO_LINKLOCAL) { @@ -1552,20 +1468,19 @@ nd6_ioctl(u_long cmd, caddr_t data, stru * address is assigned, and IFF_UP, try to * assign one. */ - int haslinklocal = 0; - IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family != AF_INET6) + TAILQ_FOREACH(ifa, &ifp->if_addrhead, + ifa_link) { + if (ifa->ifa_addr->sa_family != + AF_INET6) continue; ia = (struct in6_ifaddr *)ifa; - if (IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) { - haslinklocal = 1; + if (IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) break; - } } IF_ADDR_RUNLOCK(ifp); - if (!haslinklocal) + if (ifa != NULL) + /* No LLA is configured. */ in6_ifattach(ifp, NULL); } } From owner-svn-src-head@freebsd.org Thu Sep 10 06:31:25 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D4F1A001C0; Thu, 10 Sep 2015 06:31:25 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E9B31FE2; Thu, 10 Sep 2015 06:31:25 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A6VPEW031209; Thu, 10 Sep 2015 06:31:25 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A6VP6o031208; Thu, 10 Sep 2015 06:31:25 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509100631.t8A6VP6o031208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 10 Sep 2015 06:31:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287611 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 06:31:25 -0000 Author: hrs Date: Thu Sep 10 06:31:24 2015 New Revision: 287611 URL: https://svnweb.freebsd.org/changeset/base/287611 Log: - Remove SIOCGDRLST_IN6 and SIOCGPRLST_IN6. These are quite old APIs and there is no consumer now. MFC after: 3 days Modified: head/sys/netinet6/in6_var.h Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Thu Sep 10 06:29:18 2015 (r287610) +++ head/sys/netinet6/in6_var.h Thu Sep 10 06:31:24 2015 (r287611) @@ -442,11 +442,6 @@ struct in6_rrenumreq { #define SIOCGIFAFLAG_IN6 _IOWR('i', 73, struct in6_ifreq) -#define SIOCGDRLST_IN6 _IOWR('i', 74, struct in6_drlist) -#ifdef _KERNEL -/* XXX: SIOCGPRLST_IN6 is exposed in KAME but in6_oprlist is not. */ -#define SIOCGPRLST_IN6 _IOWR('i', 75, struct in6_oprlist) -#endif #ifdef _KERNEL #define OSIOCGIFINFO_IN6 _IOWR('i', 76, struct in6_ondireq) #endif From owner-svn-src-head@freebsd.org Thu Sep 10 06:40:30 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACD48A0074A; Thu, 10 Sep 2015 06:40:30 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90FD2133D; Thu, 10 Sep 2015 06:40:30 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A6eULY032871; Thu, 10 Sep 2015 06:40:30 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A6eTUV032669; Thu, 10 Sep 2015 06:40:29 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509100640.t8A6eTUV032669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 10 Sep 2015 06:40:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287612 - in head: sbin/rtsol usr.sbin/rtsold X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 06:40:30 -0000 Author: hrs Date: Thu Sep 10 06:40:28 2015 New Revision: 287612 URL: https://svnweb.freebsd.org/changeset/base/287612 Log: - Remove #ifdef HAVE_POLL_H. - Use nitems(). MFC after: 3 days Modified: head/sbin/rtsol/Makefile head/usr.sbin/rtsold/Makefile head/usr.sbin/rtsold/if.c head/usr.sbin/rtsold/rtsold.c Modified: head/sbin/rtsol/Makefile ============================================================================== --- head/sbin/rtsol/Makefile Thu Sep 10 06:31:24 2015 (r287611) +++ head/sbin/rtsol/Makefile Thu Sep 10 06:40:28 2015 (r287612) @@ -14,15 +14,13 @@ # # $FreeBSD$ -SRCDIR= ${.CURDIR}/../../usr.sbin/rtsold - -.PATH: ${SRCDIR} +.PATH: ${.CURDIR}/../../usr.sbin/rtsold PROG= rtsol SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c MAN= WARNS?= 3 -CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DSMALL +CFLAGS+= -DHAVE_ARC4RANDOM -DSMALL .include Modified: head/usr.sbin/rtsold/Makefile ============================================================================== --- head/usr.sbin/rtsold/Makefile Thu Sep 10 06:31:24 2015 (r287611) +++ head/usr.sbin/rtsold/Makefile Thu Sep 10 06:40:28 2015 (r287612) @@ -20,6 +20,6 @@ MLINKS= rtsold.8 rtsol.8 SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c WARNS?= 3 -CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H +CFLAGS+= -DHAVE_ARC4RANDOM .include Modified: head/usr.sbin/rtsold/if.c ============================================================================== --- head/usr.sbin/rtsold/if.c Thu Sep 10 06:31:24 2015 (r287611) +++ head/usr.sbin/rtsold/if.c Thu Sep 10 06:40:28 2015 (r287612) @@ -280,18 +280,18 @@ lladdropt_fill(struct sockaddr_dl *sdl, struct sockaddr_dl * if_nametosdl(char *name) { - int mib[6] = {CTL_NET, AF_ROUTE, 0, 0, NET_RT_IFLIST, 0}; + int mib[] = {CTL_NET, AF_ROUTE, 0, 0, NET_RT_IFLIST, 0}; char *buf, *next, *lim; size_t len; struct if_msghdr *ifm; struct sockaddr *sa, *rti_info[RTAX_MAX]; struct sockaddr_dl *sdl = NULL, *ret_sdl; - if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) + if (sysctl(mib, nitems(mib), NULL, &len, NULL, 0) < 0) return(NULL); if ((buf = malloc(len)) == NULL) return(NULL); - if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), buf, &len, NULL, 0) < 0) { free(buf); return (NULL); } @@ -341,7 +341,7 @@ getinet6sysctl(int code) mib[3] = code; size = sizeof(value); - if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &value, &size, NULL, 0) < 0) + if (sysctl(mib, nitems(mib), &value, &size, NULL, 0) < 0) return (-1); else return (value); @@ -356,7 +356,7 @@ setinet6sysctl(int code, int newval) mib[3] = code; size = sizeof(value); - if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &value, &size, + if (sysctl(mib, nitems(mib), &value, &size, &newval, sizeof(newval)) < 0) return (-1); else Modified: head/usr.sbin/rtsold/rtsold.c ============================================================================== --- head/usr.sbin/rtsold/rtsold.c Thu Sep 10 06:31:24 2015 (r287611) +++ head/usr.sbin/rtsold/rtsold.c Thu Sep 10 06:40:28 2015 (r287612) @@ -57,9 +57,7 @@ #include #include #include -#ifdef HAVE_POLL_H #include -#endif #include "rtsold.h" @@ -116,13 +114,7 @@ main(int argc, char **argv) int s, ch, once = 0; struct timespec *timeout; const char *opts; -#ifdef HAVE_POLL_H struct pollfd set[2]; -#else - fd_set *fdsetp, *selectfdp; - int fdmasks; - int maxfd; -#endif int rtsock; char *argv0; @@ -254,40 +246,16 @@ main(int argc, char **argv) warnmsg(LOG_ERR, __func__, "failed to open a socket"); exit(1); } -#ifdef HAVE_POLL_H set[0].fd = s; set[0].events = POLLIN; -#else - maxfd = s; -#endif - -#ifdef HAVE_POLL_H set[1].fd = -1; -#endif if ((rtsock = rtsock_open()) < 0) { warnmsg(LOG_ERR, __func__, "failed to open a socket"); exit(1); } -#ifdef HAVE_POLL_H set[1].fd = rtsock; set[1].events = POLLIN; -#else - if (rtsock > maxfd) - maxfd = rtsock; -#endif - -#ifndef HAVE_POLL_H - fdmasks = howmany(maxfd + 1, NFDBITS) * sizeof(fd_mask); - if ((fdsetp = malloc(fdmasks)) == NULL) { - warnmsg(LOG_ERR, __func__, "malloc"); - exit(1); - } - if ((selectfdp = malloc(fdmasks)) == NULL) { - warnmsg(LOG_ERR, __func__, "malloc"); - exit(1); - } -#endif /* configuration per interface */ if (ifinit()) { @@ -328,18 +296,8 @@ main(int argc, char **argv) fclose(fp); } } -#ifndef HAVE_POLL_H - memset(fdsetp, 0, fdmasks); - FD_SET(s, fdsetp); - FD_SET(rtsock, fdsetp); -#endif while (1) { /* main loop */ int e; - -#ifndef HAVE_POLL_H - memcpy(selectfdp, fdsetp, fdmasks); -#endif - #ifndef SMALL if (do_dump) { /* SIGUSR1 */ do_dump = 0; @@ -364,11 +322,7 @@ main(int argc, char **argv) if (ifi == NULL) break; } -#ifdef HAVE_POLL_H e = poll(set, 2, timeout ? (timeout->tv_sec * 1000 + timeout->tv_nsec / 1000 / 1000) : INFTIM); -#else - e = select(maxfd + 1, selectfdp, NULL, NULL, timeout); -#endif if (e < 1) { if (e < 0 && errno != EINTR) { warnmsg(LOG_ERR, __func__, "select: %s", @@ -378,17 +332,9 @@ main(int argc, char **argv) } /* packet reception */ -#ifdef HAVE_POLL_H if (set[1].revents & POLLIN) -#else - if (FD_ISSET(rtsock, selectfdp)) -#endif rtsock_input(rtsock); -#ifdef HAVE_POLL_H if (set[0].revents & POLLIN) -#else - if (FD_ISSET(s, selectfdp)) -#endif rtsol_input(s); } /* NOTREACHED */ From owner-svn-src-head@freebsd.org Thu Sep 10 06:47:24 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E885A00A24; Thu, 10 Sep 2015 06:47:24 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 289CA187E; Thu, 10 Sep 2015 06:47:24 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A6lOTU036096; Thu, 10 Sep 2015 06:47:24 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A6lOia036095; Thu, 10 Sep 2015 06:47:24 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509100647.t8A6lOia036095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 10 Sep 2015 06:47:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287613 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 06:47:24 -0000 Author: hrs Date: Thu Sep 10 06:47:23 2015 New Revision: 287613 URL: https://svnweb.freebsd.org/changeset/base/287613 Log: Update only static routes when an interface is specified. This fixed a bad side-effect reported in PR 202144. PR: 202144 MFC after: 3 days Modified: head/etc/rc.d/netif Modified: head/etc/rc.d/netif ============================================================================== --- head/etc/rc.d/netif Thu Sep 10 06:40:28 2015 (r287612) +++ head/etc/rc.d/netif Thu Sep 10 06:47:23 2015 (r287613) @@ -88,7 +88,7 @@ netif_start() fi if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then for _if in $cmdifn; do - /etc/rc.d/routing start any $_if + /etc/rc.d/routing static any $_if done fi } From owner-svn-src-head@freebsd.org Thu Sep 10 06:55:29 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E44AA00E58; Thu, 10 Sep 2015 06:55:29 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F8541CA0; Thu, 10 Sep 2015 06:55:29 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A6tTvt040104; Thu, 10 Sep 2015 06:55:29 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A6tTDw040103; Thu, 10 Sep 2015 06:55:29 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509100655.t8A6tTDw040103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 10 Sep 2015 06:55:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287614 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 06:55:29 -0000 Author: hrs Date: Thu Sep 10 06:55:28 2015 New Revision: 287614 URL: https://svnweb.freebsd.org/changeset/base/287614 Log: - Add uid check. - Report delay<0 as a warning. MFC after: 3 days Modified: head/etc/rc.d/bgfsck Modified: head/etc/rc.d/bgfsck ============================================================================== --- head/etc/rc.d/bgfsck Thu Sep 10 06:47:23 2015 (r287613) +++ head/etc/rc.d/bgfsck Thu Sep 10 06:55:28 2015 (r287614) @@ -12,17 +12,24 @@ name="background_fsck" rcvar="background_fsck" start_cmd="bgfsck_start" +start_precmd="bgfsck_start_precmd" stop_cmd=":" +bgfsck_start_precmd() +{ + if [ $($ID -u) != 0 ]; then + err 1 "Must be root." + fi +} + bgfsck_start() { - if [ -z "${rc_force}" ]; then - background_fsck_delay=${background_fsck_delay:-0} - else + : ${background_fsck_delay=0} + if [ -n "${rc_force}" ]; then background_fsck_delay=0 fi if [ ${background_fsck_delay} -lt 0 ]; then - echo "Background file system checks delayed indefinitely" + warn "Background file system checks delayed indefinitely" return 0 fi From owner-svn-src-head@freebsd.org Thu Sep 10 06:56:57 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7DBDA00F0E; Thu, 10 Sep 2015 06:56:57 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B930D1DF6; Thu, 10 Sep 2015 06:56:57 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A6uvrm040238; Thu, 10 Sep 2015 06:56:57 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A6uvk1040237; Thu, 10 Sep 2015 06:56:57 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509100656.t8A6uvk1040237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 10 Sep 2015 06:56:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287615 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 06:56:57 -0000 Author: hrs Date: Thu Sep 10 06:56:56 2015 New Revision: 287615 URL: https://svnweb.freebsd.org/changeset/base/287615 Log: Use read to parse a line instead of set. MFC after: 3 days Modified: head/etc/rc.d/jail Modified: head/etc/rc.d/jail ============================================================================== --- head/etc/rc.d/jail Thu Sep 10 06:55:28 2015 (r287614) +++ head/etc/rc.d/jail Thu Sep 10 06:56:56 2015 (r287615) @@ -419,7 +419,7 @@ jail_status() jail_start() { - local _j _jid _jl + local _j _jid _jl _id _name if [ $# = 0 ]; then return @@ -432,10 +432,9 @@ jail_start() command_args="-f $jail_conf -c" _tmp=`mktemp -t jail` || exit 3 if $command $rc_flags $command_args >> $_tmp 2>&1; then - $jail_jls jid name | while read IN; do - set -- $IN - echo -n " $2" - echo $1 > /var/run/jail_$2.id + $jail_jls jid name | while read _id _name; do + echo -n " $_name" + echo $_id > /var/run/jail_${_name}.id done else tail -1 $_tmp From owner-svn-src-head@freebsd.org Thu Sep 10 07:36:54 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAE67A001A8; Thu, 10 Sep 2015 07:36:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB6CB1F74; Thu, 10 Sep 2015 07:36:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A7asJG057601; Thu, 10 Sep 2015 07:36:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A7aswH057600; Thu, 10 Sep 2015 07:36:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201509100736.t8A7aswH057600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 10 Sep 2015 07:36:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287616 - head/sys/dev/usb/serial X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 07:36:54 -0000 Author: hselasky Date: Thu Sep 10 07:36:54 2015 New Revision: 287616 URL: https://svnweb.freebsd.org/changeset/base/287616 Log: Update USB quirk. MFC after: 1 month PR: 202968 Modified: head/sys/dev/usb/serial/u3g.c Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Thu Sep 10 06:56:56 2015 (r287615) +++ head/sys/dev/usb/serial/u3g.c Thu Sep 10 07:36:54 2015 (r287616) @@ -316,7 +316,7 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(HUAWEI, E220, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E392, U3GINIT_HUAWEISCSI), - U3G_DEV(HUAWEI, ME909U, U3GINIT_HUAWEI), + U3G_DEV(HUAWEI, ME909U, U3GINIT_HUAWEISCSI2), U3G_DEV(HUAWEI, MOBILE, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E1752, U3GINIT_HUAWEISCSI), U3G_DEV(HUAWEI, E1820, U3GINIT_HUAWEISCSI), From owner-svn-src-head@freebsd.org Thu Sep 10 08:37:04 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06216A008B2; Thu, 10 Sep 2015 08:37:04 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8CA11D4D; Thu, 10 Sep 2015 08:37:03 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A8b3WQ082122; Thu, 10 Sep 2015 08:37:03 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A8b33G082121; Thu, 10 Sep 2015 08:37:03 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509100837.t8A8b33G082121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 10 Sep 2015 08:37:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287617 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 08:37:04 -0000 Author: hrs Date: Thu Sep 10 08:37:03 2015 New Revision: 287617 URL: https://svnweb.freebsd.org/changeset/base/287617 Log: Remove SIOCGDRLST_IN6 and SIOCGPRLST_IN6 forgotten in the previous commit. MFC after: 3 days Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Thu Sep 10 07:36:54 2015 (r287616) +++ head/sys/netinet6/in6.c Thu Sep 10 08:37:03 2015 (r287617) @@ -281,8 +281,6 @@ in6_control(struct socket *so, u_long cm /* FALLTHROUGH */ case OSIOCGIFINFO_IN6: case SIOCGIFINFO_IN6: - case SIOCGDRLST_IN6: - case SIOCGPRLST_IN6: case SIOCGNBRINFO_IN6: case SIOCGDEFIFACE_IN6: return (nd6_ioctl(cmd, data, ifp)); From owner-svn-src-head@freebsd.org Thu Sep 10 09:27:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A36AA007C2; Thu, 10 Sep 2015 09:27:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B03A1988; Thu, 10 Sep 2015 09:27:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8A9RN84002998; Thu, 10 Sep 2015 09:27:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8A9RNuM002996; Thu, 10 Sep 2015 09:27:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509100927.t8A9RNuM002996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 10 Sep 2015 09:27:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287618 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 09:27:23 -0000 Author: mav Date: Thu Sep 10 09:27:22 2015 New Revision: 287618 URL: https://svnweb.freebsd.org/changeset/base/287618 Log: Disable CTL_IO_DELAY feature. It is too developer-oriented to be enabled by default. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_io.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Sep 10 08:37:03 2015 (r287617) +++ head/sys/cam/ctl/ctl.c Thu Sep 10 09:27:22 2015 (r287618) @@ -1188,15 +1188,6 @@ ctl_init(void) SYSCTL_ADD_PROC(&softc->sysctl_ctx,SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "ha_state", CTLTYPE_INT | CTLFLAG_RWTUN, softc, 0, ctl_ha_state_sysctl, "I", "HA state for this head"); - -#ifdef CTL_IO_DELAY - if (sizeof(struct callout) > CTL_TIMER_BYTES) { - printf("sizeof(struct callout) %zd > CTL_TIMER_BYTES %zd\n", - sizeof(struct callout), CTL_TIMER_BYTES); - return (EINVAL); - } -#endif /* CTL_IO_DELAY */ - return (0); } @@ -12198,12 +12189,10 @@ ctl_datamove(union ctl_io *io) lun =(struct ctl_lun *)io->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; if ((lun != NULL) && (lun->delay_info.datamove_delay > 0)) { - struct callout *callout; - callout = (struct callout *)&io->io_hdr.timer_bytes; - callout_init(callout, /*mpsafe*/ 1); + callout_init(&io->io_hdr.delay_callout, /*mpsafe*/ 1); io->io_hdr.flags |= CTL_FLAG_DELAY_DONE; - callout_reset(callout, + callout_reset(&io->io_hdr.delay_callout, lun->delay_info.datamove_delay * hz, ctl_datamove_timer_wakeup, io); if (lun->delay_info.datamove_type == @@ -13448,12 +13437,10 @@ ctl_done(union ctl_io *io) if ((lun != NULL) && (lun->delay_info.done_delay > 0)) { - struct callout *callout; - callout = (struct callout *)&io->io_hdr.timer_bytes; - callout_init(callout, /*mpsafe*/ 1); + callout_init(&io->io_hdr.delay_callout, /*mpsafe*/ 1); io->io_hdr.flags |= CTL_FLAG_DELAY_DONE; - callout_reset(callout, + callout_reset(&io->io_hdr.delay_callout, lun->delay_info.done_delay * hz, ctl_done_timer_wakeup, io); if (lun->delay_info.done_type == CTL_DELAY_TYPE_ONESHOT) Modified: head/sys/cam/ctl/ctl_io.h ============================================================================== --- head/sys/cam/ctl/ctl_io.h Thu Sep 10 08:37:03 2015 (r287617) +++ head/sys/cam/ctl/ctl_io.h Thu Sep 10 09:27:22 2015 (r287618) @@ -58,13 +58,12 @@ EXTERN(int ctl_time_io_secs, CTL_TIME_IO #endif /* - * Uncomment these next two lines to enable the CTL I/O delay feature. You + * Uncomment this next line to enable the CTL I/O delay feature. You * can delay I/O at two different points -- datamove and done. This is * useful for diagnosing abort conditions (for hosts that send an abort on a * timeout), and for determining how long a host's timeout is. */ -#define CTL_IO_DELAY -#define CTL_TIMER_BYTES sizeof(struct callout) +//#define CTL_IO_DELAY typedef enum { CTL_STATUS_NONE, /* No status */ @@ -231,7 +230,7 @@ struct ctl_io_hdr { uint32_t timeout; /* timeout in ms */ uint32_t retries; /* retry count */ #ifdef CTL_IO_DELAY - uint8_t timer_bytes[CTL_TIMER_BYTES]; /* timer kludge */ + struct callout delay_callout; #endif /* CTL_IO_DELAY */ #ifdef CTL_TIME_IO time_t start_time; /* I/O start time */ From owner-svn-src-head@freebsd.org Thu Sep 10 10:23:24 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41723A00817; Thu, 10 Sep 2015 10:23:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 322EA13BA; Thu, 10 Sep 2015 10:23:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8AANOt3027722; Thu, 10 Sep 2015 10:23:24 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8AANOwc027721; Thu, 10 Sep 2015 10:23:24 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201509101023.t8AANOwc027721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 10 Sep 2015 10:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287619 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 10:23:24 -0000 Author: tuexen Date: Thu Sep 10 10:23:23 2015 New Revision: 287619 URL: https://svnweb.freebsd.org/changeset/base/287619 Log: Zero out a local variable also when PURIFY is not defined. This silence a warning brought up by valgrind whenever if_nametoindex is used. This was already discussed in PR 166483, but the code committed in r234329 guards the initilization with #ifdef PURIFY. Therefore, valgrind still complains. Since this code is not performance critical, always zero out the local variable to silence valgrind. PR: 166483 Discussed with: eadler@ MFC after: 4 weeks Modified: head/lib/libc/net/if_nametoindex.c Modified: head/lib/libc/net/if_nametoindex.c ============================================================================== --- head/lib/libc/net/if_nametoindex.c Thu Sep 10 09:27:22 2015 (r287618) +++ head/lib/libc/net/if_nametoindex.c Thu Sep 10 10:23:23 2015 (r287619) @@ -70,9 +70,7 @@ if_nametoindex(const char *ifname) s = _socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); if (s != -1) { -#ifdef PURIFY memset(&ifr, 0, sizeof(ifr)); -#endif strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (_ioctl(s, SIOCGIFINDEX, &ifr) != -1) { _close(s); From owner-svn-src-head@freebsd.org Thu Sep 10 10:46:25 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0168A01498; Thu, 10 Sep 2015 10:46:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEB4D10F2; Thu, 10 Sep 2015 10:46:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8AAkPWJ036091; Thu, 10 Sep 2015 10:46:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8AAkMZP036075; Thu, 10 Sep 2015 10:46:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509101046.t8AAkMZP036075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 10 Sep 2015 10:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287620 - in head: sys/cam/ctl usr.sbin/ctladm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 10:46:25 -0000 Author: mav Date: Thu Sep 10 10:46:21 2015 New Revision: 287620 URL: https://svnweb.freebsd.org/changeset/base/287620 Log: Remove unused target and initiator IDs. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_frontend.h head/sys/cam/ctl/ctl_frontend_cam_sim.c head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_io.h head/sys/cam/ctl/ctl_ioctl.h head/sys/cam/ctl/ctl_scsi_all.c head/sys/cam/ctl/ctl_tpc_local.c head/sys/cam/ctl/ctl_util.c head/sys/cam/ctl/ctl_util.h head/sys/cam/ctl/scsi_ctl.c head/usr.sbin/ctladm/ctladm.8 head/usr.sbin/ctladm/ctladm.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Sep 10 10:23:23 2015 (r287619) +++ head/sys/cam/ctl/ctl.c Thu Sep 10 10:46:21 2015 (r287620) @@ -569,15 +569,14 @@ ctl_isc_handler_finish_ser_only(struct c printf("%s: %p use after free!\n", __func__, ctsio); printf("%s: type %d msg %d cdb %x iptl: " - "%d:%d:%d:%d tag 0x%04x " + "%u:%u:%u tag 0x%04x " "flag %#x status %x\n", __func__, tmp_io->io_hdr.io_type, tmp_io->io_hdr.msg_type, tmp_io->scsiio.cdb[0], - tmp_io->io_hdr.nexus.initid.id, + tmp_io->io_hdr.nexus.initid, tmp_io->io_hdr.nexus.targ_port, - tmp_io->io_hdr.nexus.targ_target.id, tmp_io->io_hdr.nexus.targ_lun, (tmp_io->io_hdr.io_type == CTL_IO_TASK) ? @@ -665,10 +664,9 @@ ctl_isc_event_handler(ctl_ha_channel cha io->io_hdr.flags |= CTL_FLAG_INT_COPY; io->io_hdr.nexus = msg_info.hdr.nexus; #if 0 - printf("targ %d, port %d, iid %d, lun %d\n", - io->io_hdr.nexus.targ_target.id, + printf("port %u, iid %u, lun %u\n", io->io_hdr.nexus.targ_port, - io->io_hdr.nexus.initid.id, + io->io_hdr.nexus.initid, io->io_hdr.nexus.targ_lun); #endif io->scsiio.tag_num = msg_info.scsi.tag_num; @@ -3068,10 +3066,10 @@ uint32_t ctl_get_initindex(struct ctl_nexus *nexus) { if (nexus->targ_port < CTL_MAX_PORTS) - return (nexus->initid.id + + return (nexus->initid + (nexus->targ_port * CTL_MAX_INIT_PER_PORT)); else - return (nexus->initid.id + + return (nexus->initid + ((nexus->targ_port - CTL_MAX_PORTS) * CTL_MAX_INIT_PER_PORT)); } @@ -3079,7 +3077,7 @@ ctl_get_initindex(struct ctl_nexus *nexu uint32_t ctl_get_resindex(struct ctl_nexus *nexus) { - return (nexus->initid.id + (nexus->targ_port * CTL_MAX_INIT_PER_PORT)); + return (nexus->initid + (nexus->targ_port * CTL_MAX_INIT_PER_PORT)); } uint32_t @@ -10432,8 +10430,8 @@ ctl_check_for_blockage(struct ctl_lun *l && (ooa_io->scsiio.tag_type == CTL_TAG_UNTAGGED) && ((pending_io->io_hdr.nexus.targ_port == ooa_io->io_hdr.nexus.targ_port) - && (pending_io->io_hdr.nexus.initid.id == - ooa_io->io_hdr.nexus.initid.id)) + && (pending_io->io_hdr.nexus.initid == + ooa_io->io_hdr.nexus.initid)) && ((ooa_io->io_hdr.flags & (CTL_FLAG_ABORT | CTL_FLAG_STATUS_SENT)) == 0)) return (CTL_ACTION_OVERLAP); @@ -10454,8 +10452,8 @@ ctl_check_for_blockage(struct ctl_lun *l && (pending_io->scsiio.tag_num == ooa_io->scsiio.tag_num) && ((pending_io->io_hdr.nexus.targ_port == ooa_io->io_hdr.nexus.targ_port) - && (pending_io->io_hdr.nexus.initid.id == - ooa_io->io_hdr.nexus.initid.id)) + && (pending_io->io_hdr.nexus.initid == + ooa_io->io_hdr.nexus.initid)) && ((ooa_io->io_hdr.flags & (CTL_FLAG_ABORT | CTL_FLAG_STATUS_SENT)) == 0)) return (CTL_ACTION_OVERLAP_TAG); @@ -11569,9 +11567,9 @@ ctl_abort_tasks_lun(struct ctl_lun *lun, if ((targ_port == UINT32_MAX || targ_port == xio->io_hdr.nexus.targ_port) && (init_id == UINT32_MAX || - init_id == xio->io_hdr.nexus.initid.id)) { + init_id == xio->io_hdr.nexus.initid)) { if (targ_port != xio->io_hdr.nexus.targ_port || - init_id != xio->io_hdr.nexus.initid.id) + init_id != xio->io_hdr.nexus.initid) xio->io_hdr.flags |= CTL_FLAG_ABORT_STATUS; xio->io_hdr.flags |= CTL_FLAG_ABORT; if (!other_sc && !(lun->flags & CTL_LUN_PRIMARY_SC)) { @@ -11614,7 +11612,7 @@ ctl_abort_task_set(union ctl_io *io) mtx_unlock(&softc->ctl_lock); if (io->taskio.task_action == CTL_TASK_ABORT_TASK_SET) { ctl_abort_tasks_lun(lun, io->io_hdr.nexus.targ_port, - io->io_hdr.nexus.initid.id, + io->io_hdr.nexus.initid, (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) != 0); } else { /* CTL_TASK_CLEAR_TASK_SET */ ctl_abort_tasks_lun(lun, UINT32_MAX, UINT32_MAX, @@ -11637,7 +11635,7 @@ ctl_i_t_nexus_reset(union ctl_io *io) STAILQ_FOREACH(lun, &softc->lun_list, links) { mtx_lock(&lun->lun_lock); ctl_abort_tasks_lun(lun, io->io_hdr.nexus.targ_port, - io->io_hdr.nexus.initid.id, + io->io_hdr.nexus.initid, (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) != 0); #ifdef CTL_WITH_CA ctl_clear_mask(lun->have_ca, initidx); @@ -11716,7 +11714,7 @@ ctl_abort_task(union ctl_io *io) #endif if ((xio->io_hdr.nexus.targ_port != io->io_hdr.nexus.targ_port) - || (xio->io_hdr.nexus.initid.id != io->io_hdr.nexus.initid.id) + || (xio->io_hdr.nexus.initid != io->io_hdr.nexus.initid) || (xio->io_hdr.flags & CTL_FLAG_ABORT)) continue; @@ -11778,10 +11776,9 @@ ctl_abort_task(union ctl_io *io) */ #if 0 printf("ctl_abort_task: ABORT sent for nonexistent I/O: " - "%d:%d:%d:%d tag %d type %d\n", - io->io_hdr.nexus.initid.id, + "%u:%u:%u tag %d type %d\n", + io->io_hdr.nexus.initid, io->io_hdr.nexus.targ_port, - io->io_hdr.nexus.targ_target.id, io->io_hdr.nexus.targ_lun, io->taskio.tag_num, io->taskio.tag_type); #endif @@ -12208,10 +12205,9 @@ ctl_datamove(union ctl_io *io) * the data move. */ if (io->io_hdr.flags & CTL_FLAG_ABORT) { - printf("ctl_datamove: tag 0x%04x on (%ju:%d:%ju:%d) aborted\n", - io->scsiio.tag_num,(uintmax_t)io->io_hdr.nexus.initid.id, + printf("ctl_datamove: tag 0x%04x on (%u:%u:%u) aborted\n", + io->scsiio.tag_num, io->io_hdr.nexus.initid, io->io_hdr.nexus.targ_port, - (uintmax_t)io->io_hdr.nexus.targ_target.id, io->io_hdr.nexus.targ_lun); io->io_hdr.port_status = 31337; /* @@ -12979,10 +12975,9 @@ ctl_datamove_remote(union ctl_io *io) * have been done if need be on the other controller. */ if (io->io_hdr.flags & CTL_FLAG_ABORT) { - printf("%s: tag 0x%04x on (%d:%d:%d:%d) aborted\n", __func__, - io->scsiio.tag_num, io->io_hdr.nexus.initid.id, + printf("%s: tag 0x%04x on (%u:%u:%u) aborted\n", __func__, + io->scsiio.tag_num, io->io_hdr.nexus.initid, io->io_hdr.nexus.targ_port, - io->io_hdr.nexus.targ_target.id, io->io_hdr.nexus.targ_lun); io->io_hdr.port_status = 31338; ctl_send_datamove_done(io, /*have_lock*/ 0); @@ -13377,15 +13372,14 @@ ctl_done(union ctl_io *io) #if 0 if (io->io_hdr.flags & CTL_FLAG_ALREADY_DONE) { printf("%s: type %d msg %d cdb %x iptl: " - "%d:%d:%d:%d tag 0x%04x " + "%u:%u:%u tag 0x%04x " "flag %#x status %x\n", __func__, io->io_hdr.io_type, io->io_hdr.msg_type, io->scsiio.cdb[0], - io->io_hdr.nexus.initid.id, + io->io_hdr.nexus.initid, io->io_hdr.nexus.targ_port, - io->io_hdr.nexus.targ_target.id, io->io_hdr.nexus.targ_lun, (io->io_hdr.io_type == CTL_IO_TASK) ? @@ -13649,7 +13643,7 @@ ctl_enqueue_incoming(union ctl_io *io) u_int idx; idx = (io->io_hdr.nexus.targ_port * 127 + - io->io_hdr.nexus.initid.id) % worker_threads; + io->io_hdr.nexus.initid) % worker_threads; thr = &softc->threads[idx]; mtx_lock(&thr->queue_lock); STAILQ_INSERT_TAIL(&thr->incoming_queue, &io->io_hdr, links); Modified: head/sys/cam/ctl/ctl_frontend.h ============================================================================== --- head/sys/cam/ctl/ctl_frontend.h Thu Sep 10 10:23:23 2015 (r287619) +++ head/sys/cam/ctl/ctl_frontend.h Thu Sep 10 10:46:21 2015 (r287620) @@ -125,12 +125,12 @@ struct ctl_wwpn_iid { * port_online(): This function is called, with onoff_arg as its * argument, by the CTL layer when it wants the FETD * to start responding to selections on the specified - * target ID. (targ_target) + * target ID. * * port_offline(): This function is called, with onoff_arg as its * argument, by the CTL layer when it wants the FETD * to stop responding to selection on the specified - * target ID. (targ_target) + * target ID. * * onoff_arg: This is supplied as an argument to port_online() * and port_offline(). This is specified by the Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Sep 10 10:23:23 2015 (r287619) +++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Sep 10 10:46:21 2015 (r287620) @@ -546,12 +546,8 @@ cfcs_action(struct cam_sim *sim, union c * down via the XPT_RESET_BUS/LUN CCBs below. */ io->io_hdr.io_type = CTL_IO_SCSI; - io->io_hdr.nexus.initid.id = 1; + io->io_hdr.nexus.initid = 1; io->io_hdr.nexus.targ_port = softc->port.targ_port; - /* - * XXX KDM how do we handle target IDs? - */ - io->io_hdr.nexus.targ_target.id = ccb->ccb_h.target_id; io->io_hdr.nexus.targ_lun = ccb->ccb_h.target_lun; /* * This tag scheme isn't the best, since we could in theory @@ -639,9 +635,8 @@ cfcs_action(struct cam_sim *sim, union c ccb->ccb_h.io_ptr = io; io->io_hdr.io_type = CTL_IO_TASK; - io->io_hdr.nexus.initid.id = 1; + io->io_hdr.nexus.initid = 1; io->io_hdr.nexus.targ_port = softc->port.targ_port; - io->io_hdr.nexus.targ_target.id = ccb->ccb_h.target_id; io->io_hdr.nexus.targ_lun = ccb->ccb_h.target_lun; io->taskio.task_action = CTL_TASK_ABORT_TASK; io->taskio.tag_num = abort_ccb->csio.tag_id; @@ -735,9 +730,8 @@ cfcs_action(struct cam_sim *sim, union c ccb->ccb_h.io_ptr = io; io->io_hdr.io_type = CTL_IO_TASK; - io->io_hdr.nexus.initid.id = 0; + io->io_hdr.nexus.initid = 1; io->io_hdr.nexus.targ_port = softc->port.targ_port; - io->io_hdr.nexus.targ_target.id = ccb->ccb_h.target_id; io->io_hdr.nexus.targ_lun = ccb->ccb_h.target_lun; if (ccb->ccb_h.func_code == XPT_RESET_BUS) io->taskio.task_action = CTL_TASK_BUS_RESET; Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Thu Sep 10 10:23:23 2015 (r287619) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Thu Sep 10 10:46:21 2015 (r287620) @@ -564,9 +564,8 @@ cfiscsi_pdu_handle_scsi_command(struct i ctl_zero_io(io); io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = request; io->io_hdr.io_type = CTL_IO_SCSI; - io->io_hdr.nexus.initid.id = cs->cs_ctl_initid; + io->io_hdr.nexus.initid = cs->cs_ctl_initid; io->io_hdr.nexus.targ_port = cs->cs_target->ct_port.targ_port; - io->io_hdr.nexus.targ_target.id = 0; io->io_hdr.nexus.targ_lun = cfiscsi_decode_lun(bhssc->bhssc_lun); io->scsiio.tag_num = bhssc->bhssc_initiator_task_tag; switch ((bhssc->bhssc_flags & BHSSC_FLAGS_ATTR)) { @@ -621,9 +620,8 @@ cfiscsi_pdu_handle_task_request(struct i ctl_zero_io(io); io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = request; io->io_hdr.io_type = CTL_IO_TASK; - io->io_hdr.nexus.initid.id = cs->cs_ctl_initid; + io->io_hdr.nexus.initid = cs->cs_ctl_initid; io->io_hdr.nexus.targ_port = cs->cs_target->ct_port.targ_port; - io->io_hdr.nexus.targ_target.id = 0; io->io_hdr.nexus.targ_lun = cfiscsi_decode_lun(bhstmr->bhstmr_lun); io->taskio.tag_type = CTL_TAG_SIMPLE; /* XXX */ @@ -1120,9 +1118,8 @@ cfiscsi_session_terminate_tasks(struct c ctl_zero_io(io); io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = cs; io->io_hdr.io_type = CTL_IO_TASK; - io->io_hdr.nexus.initid.id = cs->cs_ctl_initid; + io->io_hdr.nexus.initid = cs->cs_ctl_initid; io->io_hdr.nexus.targ_port = cs->cs_target->ct_port.targ_port; - io->io_hdr.nexus.targ_target.id = 0; io->io_hdr.nexus.targ_lun = 0; io->taskio.tag_type = CTL_TAG_SIMPLE; /* XXX */ io->taskio.task_action = CTL_TASK_I_T_NEXUS_RESET; Modified: head/sys/cam/ctl/ctl_io.h ============================================================================== --- head/sys/cam/ctl/ctl_io.h Thu Sep 10 10:23:23 2015 (r287619) +++ head/sys/cam/ctl/ctl_io.h Thu Sep 10 10:46:21 2015 (r287620) @@ -183,11 +183,6 @@ struct ctl_sg_entry { size_t len; }; -struct ctl_id { - uint32_t id; - uint64_t wwid[2]; -}; - typedef enum { CTL_IO_NONE, CTL_IO_SCSI, @@ -195,9 +190,8 @@ typedef enum { } ctl_io_type; struct ctl_nexus { - struct ctl_id initid; /* Initiator ID */ + uint32_t initid; /* Initiator ID */ uint32_t targ_port; /* Target port, filled in by PORT */ - struct ctl_id targ_target; /* Destination target */ uint32_t targ_lun; /* Destination lun */ uint32_t targ_mapped_lun; /* Destination lun CTL-wide */ }; Modified: head/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- head/sys/cam/ctl/ctl_ioctl.h Thu Sep 10 10:23:23 2015 (r287619) +++ head/sys/cam/ctl/ctl_ioctl.h Thu Sep 10 10:46:21 2015 (r287620) @@ -86,7 +86,6 @@ typedef enum { } ctl_ooa_status; struct ctl_ooa_info { - uint32_t target_id; /* Passed in to CTL */ uint32_t lun_id; /* Passed in to CTL */ uint32_t num_entries; /* Returned from CTL */ ctl_ooa_status status; /* Returned from CTL */ @@ -114,7 +113,6 @@ typedef enum { } ctl_delay_status; struct ctl_io_delay_info { - uint32_t target_id; uint32_t lun_id; ctl_delay_type delay_type; ctl_delay_location delay_loc; @@ -133,7 +131,6 @@ typedef enum { * means that we will let through every N SYNCHRONIZE CACHE commands. */ struct ctl_sync_info { - uint32_t target_id; /* passed to kernel */ uint32_t lun_id; /* passed to kernel */ int sync_interval; /* depends on whether get/set */ ctl_gs_sync_status status; /* passed from kernel */ @@ -262,7 +259,6 @@ struct ctl_error_desc_cmd { /* * Error injection descriptor. * - * target_id: Target ID to act on. * lun_id LUN to act on. * lun_error: The type of error to inject. See above for descriptions. * error_pattern: What kind of command to act on. See above. @@ -273,7 +269,6 @@ struct ctl_error_desc_cmd { * links: Kernel use only. */ struct ctl_error_desc { - uint32_t target_id; /* To kernel */ uint32_t lun_id; /* To kernel */ ctl_lun_error lun_error; /* To kernel */ ctl_lun_error_pattern error_pattern; /* To kernel */ Modified: head/sys/cam/ctl/ctl_scsi_all.c ============================================================================== --- head/sys/cam/ctl/ctl_scsi_all.c Thu Sep 10 10:23:23 2015 (r287619) +++ head/sys/cam/ctl/ctl_scsi_all.c Thu Sep 10 10:46:21 2015 (r287620) @@ -114,7 +114,7 @@ ctl_scsi_path_string(union ctl_io *io, c { snprintf(path_str, len, "(%u:%u:%u/%u): ", - io->io_hdr.nexus.initid.id, io->io_hdr.nexus.targ_port, + io->io_hdr.nexus.initid, io->io_hdr.nexus.targ_port, io->io_hdr.nexus.targ_lun, io->io_hdr.nexus.targ_mapped_lun); } Modified: head/sys/cam/ctl/ctl_tpc_local.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc_local.c Thu Sep 10 10:23:23 2015 (r287619) +++ head/sys/cam/ctl/ctl_tpc_local.c Thu Sep 10 10:46:21 2015 (r287620) @@ -328,9 +328,8 @@ tpcl_queue(union ctl_io *io, uint64_t lu { struct tpcl_softc *tsoftc = &tpcl_softc; - io->io_hdr.nexus.initid.id = 0; + io->io_hdr.nexus.initid = 0; io->io_hdr.nexus.targ_port = tsoftc->port.targ_port; - io->io_hdr.nexus.targ_target.id = 0; io->io_hdr.nexus.targ_lun = lun; io->scsiio.tag_num = atomic_fetchadd_int(&tsoftc->cur_tag_num, 1); io->scsiio.ext_data_filled = 0; Modified: head/sys/cam/ctl/ctl_util.c ============================================================================== --- head/sys/cam/ctl/ctl_util.c Thu Sep 10 10:23:23 2015 (r287619) +++ head/sys/cam/ctl/ctl_util.c Thu Sep 10 10:46:21 2015 (r287620) @@ -679,7 +679,7 @@ ctl_scsi_maintenance_in(union ctl_io *io #ifndef _KERNEL union ctl_io * -ctl_scsi_alloc_io(struct ctl_id initid) +ctl_scsi_alloc_io(uint32_t initid) { union ctl_io *io; Modified: head/sys/cam/ctl/ctl_util.h ============================================================================== --- head/sys/cam/ctl/ctl_util.h Thu Sep 10 10:23:23 2015 (r287619) +++ head/sys/cam/ctl/ctl_util.h Thu Sep 10 10:46:21 2015 (r287620) @@ -94,7 +94,7 @@ void ctl_scsi_maintenance_in(union ctl_i uint32_t data_len, uint8_t action, ctl_tag_type tag_type, uint8_t control); #ifndef _KERNEL -union ctl_io *ctl_scsi_alloc_io(struct ctl_id initid); +union ctl_io *ctl_scsi_alloc_io(uint32_t initid); void ctl_scsi_free_io(union ctl_io *io); #endif /* !_KERNEL */ void ctl_scsi_zero_io(union ctl_io *io); Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Thu Sep 10 10:23:23 2015 (r287619) +++ head/sys/cam/ctl/scsi_ctl.c Thu Sep 10 10:46:21 2015 (r287620) @@ -1164,9 +1164,8 @@ ctlfedone(struct cam_periph *periph, uni * down the immediate notify path below. */ io->io_hdr.io_type = CTL_IO_SCSI; - io->io_hdr.nexus.initid.id = atio->init_id; + io->io_hdr.nexus.initid = atio->init_id; io->io_hdr.nexus.targ_port = bus_softc->port.targ_port; - io->io_hdr.nexus.targ_target.id = atio->ccb_h.target_id; io->io_hdr.nexus.targ_lun = atio->ccb_h.target_lun; io->scsiio.tag_num = atio->tag_id; switch (atio->tag_action) { @@ -1200,10 +1199,9 @@ ctlfedone(struct cam_periph *periph, uni io->scsiio.cdb_len); #ifdef CTLFEDEBUG - printf("%s: %ju:%d:%ju:%d: tag %04x CDB %02x\n", __func__, - (uintmax_t)io->io_hdr.nexus.initid.id, + printf("%s: %u:%u:%u: tag %04x CDB %02x\n", __func__, + io->io_hdr.nexus.initid, io->io_hdr.nexus.targ_port, - (uintmax_t)io->io_hdr.nexus.targ_target.id, io->io_hdr.nexus.targ_lun, io->scsiio.tag_num, io->scsiio.cdb[0]); #endif @@ -1440,9 +1438,8 @@ ctlfedone(struct cam_periph *periph, uni io->io_hdr.io_type = CTL_IO_TASK; io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr =done_ccb; inot->ccb_h.io_ptr = io; - io->io_hdr.nexus.initid.id = inot->initiator_id; + io->io_hdr.nexus.initid = inot->initiator_id; io->io_hdr.nexus.targ_port = bus_softc->port.targ_port; - io->io_hdr.nexus.targ_target.id = inot->ccb_h.target_id; io->io_hdr.nexus.targ_lun = inot->ccb_h.target_lun; /* XXX KDM should this be the tag_id? */ io->taskio.tag_num = inot->seq_id; Modified: head/usr.sbin/ctladm/ctladm.8 ============================================================================== --- head/usr.sbin/ctladm/ctladm.8 Thu Sep 10 10:23:23 2015 (r287619) +++ head/usr.sbin/ctladm/ctladm.8 Thu Sep 10 10:46:21 2015 (r287620) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd September 6, 2015 +.Dd September 10, 2015 .Dt CTLADM 8 .Os .Sh NAME @@ -43,28 +43,28 @@ .Sh SYNOPSIS .Nm .Aq Ar command -.Op target:lun +.Op lun .Op generic args .Op command args .Nm .Ic tur -.Aq target:lun +.Aq lun .Op general options .Nm .Ic inquiry -.Aq target:lun +.Aq lun .Op general options .Nm .Ic reqsense -.Aq target:lun +.Aq lun .Op general options .Nm .Ic reportluns -.Aq target:lun +.Aq lun .Op general options .Nm .Ic read -.Aq target:lun +.Aq lun .Op general options .Aq Fl l Ar lba .Aq Fl d Ar datalen @@ -74,7 +74,7 @@ .Op Fl N .Nm .Ic write -.Aq target:lun +.Aq lun .Op general options .Aq Fl l Ar lba .Aq Fl d Ar datalen @@ -84,12 +84,12 @@ .Op Fl N .Nm .Ic readcap -.Aq target:lun +.Aq lun .Op general options .Op Fl c Ar cdbsize .Nm .Ic modesense -.Aq target:lun +.Aq lun .Aq Fl m Ar page | Fl l .Op Fl P Ar pc .Op Fl d @@ -97,19 +97,19 @@ .Op Fl c Ar size .Nm .Ic start -.Aq target:lun +.Aq lun .Op general options .Op Fl i .Op Fl o .Nm .Ic stop -.Aq target:lun +.Aq lun .Op general options .Op Fl i .Op Fl o .Nm .Ic synccache -.Aq target:lun +.Aq lun .Op general options .Op Fl l Ar lba .Op Fl b Ar blockcount @@ -126,7 +126,7 @@ .Ic lunlist .Nm .Ic delay -.Aq target:lun +.Aq lun .Aq Fl l Ar datamove|done .Aq Fl t Ar secs .Op Fl T Ar oneshot|cont @@ -134,11 +134,11 @@ .Ic realsync Aq on|off|query .Nm .Ic setsync interval -.Aq target:lun +.Aq lun .Aq Fl i Ar interval .Nm .Ic getsync -.Aq target:lun +.Aq lun .Nm .Ic inject .Aq Fl i Ar action @@ -236,8 +236,8 @@ utility has a number of primary function identifier. The device identifier takes the following form: .Bl -tag -width 14n -.It target:lun -Specify the target (almost always 0) and LUN number to operate on. +.It lun +Specify the LUN number to operate on. .El Many of the primary functions of the .Nm @@ -570,7 +570,7 @@ sending SYNCHRONIZE cache commands. An will be flushed for this LUN every time a SYNCHRONIZE CACHE command is received. .Pp -You must specify the target and LUN you want to modify. +You must specify the LUN you want to modify. .It Ic getsync Get the interval at which we actually service the SYNCHRONIZE CACHE command, as set by the @@ -580,7 +580,7 @@ The reported number means that we will a Nth SYNCHRONIZE CACHE command. A value of 0 means that we will flush the cache every time. .Pp -You must specify the target and LUN you want to query. +You must specify the LUN you want to query. .It Ic inject Inject the specified type of error for the LUN specified, when a command that matches the given pattern is seen. @@ -1024,34 +1024,34 @@ Specifies file or device name to use for Specifies number of backend threads to use for this LUN. .El .Sh EXAMPLES -.Dl ctladm tur 0:1 +.Dl ctladm tur 1 .Pp Send a .Tn SCSI TEST UNIT READY command to LUN 1. .Pp -.Dl ctladm modesense 0:1 -l +.Dl ctladm modesense 1 -l .Pp Display the list of mode pages supported by LUN 1. .Pp -.Dl ctladm modesense 0:0 -m 10 -P 3 -d -c 10 +.Dl ctladm modesense 0 -m 10 -P 3 -d -c 10 .Pp Display the saved version of the Control mode page (page 10) on LUN 0. Disable fetching block descriptors, and use a 10 byte MODE SENSE command instead of the default 6 byte command. .Bd -literal -ctladm read 0:2 -l 0 -d 1 -b 512 -f - > foo +ctladm read 2 -l 0 -d 1 -b 512 -f - > foo .Ed .Pp Read the first 512 byte block from LUN 2 and dump it to the file .Pa foo . .Bd -literal -ctladm write 0:3 -l 0xff432140 -d 20 -b 512 -f /tmp/bar +ctladm write 3 -l 0xff432140 -d 20 -b 512 -f /tmp/bar .Ed .Pp Read 10240 bytes from the file .Pa /tmp/bar -and write it to target 0, LUN 3. +and write it to LUN 3. starting at LBA 0xff432140. .Pp .Dl ctladm create -b ramdisk -s 10485760000000000 @@ -1095,12 +1095,12 @@ List all LUNs in the system, along with This only works when the FETDs are enabled, since the commands go through the ioctl port. .Pp -.Dl ctladm inject 0:6 -i mediumerr -p read -r 0,512 -c +.Dl ctladm inject 6 -i mediumerr -p read -r 0,512 -c .Pp Inject a medium error on LUN 6 for every read that covers the first 512 blocks of the LUN. .Bd -literal -offset indent -ctladm inject 0:6 -i custom -p tur -s 18 "f0 0 02 s12 04 02" +ctladm inject 6 -i custom -p tur -s 18 "f0 0 02 s12 04 02" .Ed .Pp Inject a custom error on LUN 6 for the next TEST UNIT READY command only. Modified: head/usr.sbin/ctladm/ctladm.c ============================================================================== --- head/usr.sbin/ctladm/ctladm.c Thu Sep 10 10:23:23 2015 (r287619) +++ head/usr.sbin/ctladm/ctladm.c Thu Sep 10 10:46:21 2015 (r287620) @@ -211,49 +211,47 @@ static struct ctladm_opts option_table[] ctladm_optret getoption(struct ctladm_opts *table, char *arg, uint32_t *cmdnum, ctladm_cmdargs *argnum, const char **subopt); -static int cctl_parse_tl(char *str, int *target, int *lun); static int cctl_dump_ooa(int fd, int argc, char **argv); static int cctl_port_dump(int fd, int quiet, int xml, int32_t fe_num, ctl_port_type port_type); static int cctl_port(int fd, int argc, char **argv, char *combinedopt); static int cctl_do_io(int fd, int retries, union ctl_io *io, const char *func); -static int cctl_delay(int fd, int target, int lun, int argc, char **argv, +static int cctl_delay(int fd, int lun, int argc, char **argv, char *combinedopt); static int cctl_lunlist(int fd); -static int cctl_startup_shutdown(int fd, int target, int lun, int iid, +static int cctl_startup_shutdown(int fd, int lun, int iid, ctladm_cmdfunction command); -static int cctl_sync_cache(int fd, int target, int lun, int iid, int retries, +static int cctl_sync_cache(int fd, int lun, int iid, int retries, int argc, char **argv, char *combinedopt); -static int cctl_start_stop(int fd, int target, int lun, int iid, int retries, +static int cctl_start_stop(int fd, int lun, int iid, int retries, int start, int argc, char **argv, char *combinedopt); -static int cctl_mode_sense(int fd, int target, int lun, int iid, int retries, +static int cctl_mode_sense(int fd, int lun, int iid, int retries, int argc, char **argv, char *combinedopt); -static int cctl_read_capacity(int fd, int target, int lun, int iid, +static int cctl_read_capacity(int fd, int lun, int iid, int retries, int argc, char **argv, char *combinedopt); -static int cctl_read_write(int fd, int target, int lun, int iid, int retries, +static int cctl_read_write(int fd, int lun, int iid, int retries, int argc, char **argv, char *combinedopt, ctladm_cmdfunction command); -static int cctl_get_luns(int fd, int target, int lun, int iid, int retries, +static int cctl_get_luns(int fd, int lun, int iid, int retries, struct scsi_report_luns_data **lun_data, uint32_t *num_luns); -static int cctl_report_luns(int fd, int target, int lun, int iid, int retries); -static int cctl_tur(int fd, int target, int lun, int iid, int retries); -static int cctl_get_inquiry(int fd, int target, int lun, int iid, int retries, +static int cctl_report_luns(int fd, int lun, int iid, int retries); +static int cctl_tur(int fd, int lun, int iid, int retries); +static int cctl_get_inquiry(int fd, int lun, int iid, int retries, char *path_str, int path_len, struct scsi_inquiry_data *inq_data); -static int cctl_inquiry(int fd, int target, int lun, int iid, int retries); -static int cctl_req_sense(int fd, int target, int lun, int iid, int retries); -static int cctl_persistent_reserve_in(int fd, int target, int lun, +static int cctl_inquiry(int fd, int lun, int iid, int retries); +static int cctl_req_sense(int fd, int lun, int iid, int retries); +static int cctl_persistent_reserve_in(int fd, int lun, int initiator, int argc, char **argv, char *combinedopt, int retry_count); -static int cctl_persistent_reserve_out(int fd, int target, int lun, +static int cctl_persistent_reserve_out(int fd, int lun, int initiator, int argc, char **argv, char *combinedopt, int retry_count); static int cctl_create_lun(int fd, int argc, char **argv, char *combinedopt); -static int cctl_inquiry_vpd_devid(int fd, int target, int lun, int initiator); -static int cctl_report_target_port_group(int fd, int target, int lun, - int initiator); +static int cctl_inquiry_vpd_devid(int fd, int lun, int initiator); +static int cctl_report_target_port_group(int fd, int lun, int initiator); static int cctl_modify_lun(int fd, int argc, char **argv, char *combinedopt); ctladm_optret @@ -284,50 +282,20 @@ getoption(struct ctladm_opts *table, cha return(CC_OR_NOT_FOUND); } - -static int -cctl_parse_tl(char *str, int *target, int *lun) -{ - char *tmpstr; - int retval; - - retval = 0; - - while (isspace(*str) && (*str != '\0')) - str++; - - tmpstr = (char *)strtok(str, ":"); - if ((tmpstr != NULL) && (*tmpstr != '\0')) { - *target = strtol(tmpstr, NULL, 0); - tmpstr = (char *)strtok(NULL, ":"); - if ((tmpstr != NULL) && (*tmpstr != '\0')) { - *lun = strtol(tmpstr, NULL, 0); - } else - retval = -1; - } else - retval = -1; - - return (retval); -} - static int cctl_dump_ooa(int fd, int argc, char **argv) { struct ctl_ooa ooa; long double cmd_latency; int num_entries, len; - int target = -1, lun = -1; + int lun = -1; int retval; unsigned int i; num_entries = 104; - if ((argc > 2) - && (isdigit(argv[2][0]))) { - retval = cctl_parse_tl(argv[2], &target, &lun); - if (retval != 0) - warnx("invalid target:lun argument %s", argv[2]); - } + if ((argc > 2) && (isdigit(argv[2][0]))) + lun = strtol(argv[2], NULL, 0); retry: len = num_entries * sizeof(struct ctl_ooa_entry); @@ -776,7 +744,7 @@ cctl_do_io(int fd, int retries, union ct } static int -cctl_delay(int fd, int target, int lun, int argc, char **argv, +cctl_delay(int fd, int lun, int argc, char **argv, char *combinedopt) { struct ctl_io_delay_info delay_info; @@ -831,7 +799,6 @@ cctl_delay(int fd, int target, int lun, goto bailout; } - delay_info.target_id = target; delay_info.lun_id = lun; delay_info.delay_secs = delaytime; @@ -938,7 +905,7 @@ bailout: } static int -cctl_getsetsync(int fd, int target, int lun, ctladm_cmdfunction command, +cctl_getsetsync(int fd, int lun, ctladm_cmdfunction command, int argc, char **argv, char *combinedopt) { struct ctl_sync_info sync_info; @@ -950,7 +917,6 @@ cctl_getsetsync(int fd, int target, int retval = 0; memset(&sync_info, 0, sizeof(sync_info)); - sync_info.target_id = target; sync_info.lun_id = lun; while ((c = getopt(argc, argv, combinedopt)) != -1) { @@ -986,12 +952,12 @@ cctl_getsetsync(int fd, int target, int switch (sync_info.status) { case CTL_GS_SYNC_OK: if (command == CTLADM_CMD_GETSYNC) { - fprintf(stdout, "%d:%d: sync interval: %d\n", - target, lun, sync_info.sync_interval); + fprintf(stdout, "%d: sync interval: %d\n", + lun, sync_info.sync_interval); } break; case CTL_GS_SYNC_NO_LUN: - warnx("%s: unknown target:LUN %d:%d", __func__, target, lun); + warnx("%s: unknown LUN %d", __func__, lun); retval = 1; break; case CTL_GS_SYNC_NONE: @@ -1030,7 +996,7 @@ static struct ctladm_opts cctl_err_patte }; static int -cctl_error_inject(int fd, uint32_t target, uint32_t lun, int argc, char **argv, +cctl_error_inject(int fd, uint32_t lun, int argc, char **argv, char *combinedopt) { int retval = 0; @@ -1045,7 +1011,6 @@ cctl_error_inject(int fd, uint32_t targe int c; bzero(&err_desc, sizeof(err_desc)); - err_desc.target_id = target; err_desc.lun_id = lun; while ((c = getopt(argc, argv, combinedopt)) != -1) { @@ -1256,7 +1221,6 @@ cctl_lunlist(int fd) struct scsi_report_luns_data *lun_data; struct scsi_inquiry_data *inq_data; uint32_t num_luns; - int target; int initid; unsigned int i; int retval; @@ -1264,14 +1228,13 @@ cctl_lunlist(int fd) retval = 0; inq_data = NULL; - target = 6; initid = 7; /* * XXX KDM assuming LUN 0 is fine, but we may need to change this * if we ever acquire the ability to have multiple targets. */ - if ((retval = cctl_get_luns(fd, target, /*lun*/ 0, initid, + if ((retval = cctl_get_luns(fd, /*lun*/ 0, initid, /*retries*/ 2, &lun_data, &num_luns)) != 0) goto bailout; @@ -1308,7 +1271,7 @@ cctl_lunlist(int fd) if (lun_val == -1) continue; - if ((retval = cctl_get_inquiry(fd, target, lun_val, initid, + if ((retval = cctl_get_inquiry(fd, lun_val, initid, /*retries*/ 2, scsi_path, sizeof(scsi_path), inq_data)) != 0) { @@ -1329,11 +1292,10 @@ bailout: } static int -cctl_startup_shutdown(int fd, int target, int lun, int iid, +cctl_startup_shutdown(int fd, int lun, int iid, ctladm_cmdfunction command) { union ctl_io *io; - struct ctl_id id; struct scsi_report_luns_data *lun_data; struct scsi_inquiry_data *inq_data; uint32_t num_luns; @@ -1353,15 +1315,13 @@ cctl_startup_shutdown(int fd, int target * and reissue the stop with the offline bit set */ - id.id = iid; - - io = ctl_scsi_alloc_io(id); + io = ctl_scsi_alloc_io(iid); if (io == NULL) { warnx("%s: can't allocate memory", __func__); return (1); } - if ((retval = cctl_get_luns(fd, target, lun, iid, /*retries*/ 2, + if ((retval = cctl_get_luns(fd, lun, iid, /*retries*/ 2, &lun_data, &num_luns)) != 0) goto bailout; @@ -1402,7 +1362,7 @@ cctl_startup_shutdown(int fd, int target if (lun_val == -1) continue; - if ((retval = cctl_get_inquiry(fd, target, lun_val, iid, + if ((retval = cctl_get_inquiry(fd, lun_val, iid, /*retries*/ 2, scsi_path, sizeof(scsi_path), inq_data)) != 0) { @@ -1422,7 +1382,6 @@ cctl_startup_shutdown(int fd, int target if (command == CTLADM_CMD_SHUTDOWN) { struct ctl_ooa_info ooa_info; - ooa_info.target_id = target; ooa_info.lun_id = lun_val; if (ioctl(fd, CTL_CHECK_OOA, &ooa_info) == -1) { @@ -1457,9 +1416,8 @@ cctl_startup_shutdown(int fd, int target CTL_TAG_SIMPLE :CTL_TAG_ORDERED, /*control*/ 0); - io->io_hdr.nexus.targ_target.id = target; io->io_hdr.nexus.targ_lun = lun_val; - io->io_hdr.nexus.initid = id; + io->io_hdr.nexus.initid = iid; if (cctl_do_io(fd, /*retries*/ 3, io, __func__) != 0) { retval = 1; @@ -1488,11 +1446,10 @@ bailout: } static int -cctl_sync_cache(int fd, int target, int lun, int iid, int retries, +cctl_sync_cache(int fd, int lun, int iid, int retries, int argc, char **argv, char *combinedopt) { union ctl_io *io; - struct ctl_id id; int cdb_size = -1; int retval; uint64_t our_lba = 0; @@ -1500,10 +1457,9 @@ cctl_sync_cache(int fd, int target, int int reladr = 0, immed = 0; int c; - id.id = iid; retval = 0; - io = ctl_scsi_alloc_io(id); + io = ctl_scsi_alloc_io(iid); if (io == NULL) { warnx("%s: can't allocate memory", __func__); return (1); @@ -1555,9 +1511,8 @@ cctl_sync_cache(int fd, int target, int /*tag_type*/ CTL_TAG_SIMPLE, /*control*/ 0); - io->io_hdr.nexus.targ_target.id = target; io->io_hdr.nexus.targ_lun = lun; - io->io_hdr.nexus.initid = id; + io->io_hdr.nexus.initid = iid; if (cctl_do_io(fd, retries, io, __func__) != 0) { retval = 1; @@ -1575,19 +1530,17 @@ bailout: } static int -cctl_start_stop(int fd, int target, int lun, int iid, int retries, int start, +cctl_start_stop(int fd, int lun, int iid, int retries, int start, int argc, char **argv, char *combinedopt) { union ctl_io *io; - struct ctl_id id; char scsi_path[40]; int immed = 0, onoffline = 0; int retval, c; - id.id = iid; retval = 0; - io = ctl_scsi_alloc_io(id); + io = ctl_scsi_alloc_io(iid); if (io == NULL) { warnx("%s: can't allocate memory", __func__); return (1); @@ -1622,9 +1575,8 @@ cctl_start_stop(int fd, int target, int CTL_TAG_ORDERED, /*control*/ 0); - io->io_hdr.nexus.targ_target.id = target; io->io_hdr.nexus.targ_lun = lun; - io->io_hdr.nexus.initid = id; + io->io_hdr.nexus.initid = iid; if (cctl_do_io(fd, retries, io, __func__) != 0) { retval = 1; @@ -1645,11 +1597,10 @@ bailout: } static int -cctl_mode_sense(int fd, int target, int lun, int iid, int retries, +cctl_mode_sense(int fd, int lun, int iid, int retries, int argc, char **argv, char *combinedopt) { union ctl_io *io; - struct ctl_id id; uint32_t datalen; uint8_t *dataptr; int pc = -1, cdbsize, retval, dbd = 0, subpage = -1; @@ -1657,12 +1608,11 @@ cctl_mode_sense(int fd, int target, int int page_code = -1; int c; - id.id = iid; cdbsize = 0; retval = 0; dataptr = NULL; - io = ctl_scsi_alloc_io(id); + io = ctl_scsi_alloc_io(iid); if (io == NULL) { warn("%s: can't allocate memory", __func__); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Sep 10 12:40:33 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25935A00E2B; Thu, 10 Sep 2015 12:40:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 152161C47; Thu, 10 Sep 2015 12:40:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8ACeXXJ082002; Thu, 10 Sep 2015 12:40:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8ACeWgq081999; Thu, 10 Sep 2015 12:40:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509101240.t8ACeWgq081999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 10 Sep 2015 12:40:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287621 - in head/sys: cam/ctl conf modules/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 12:40:33 -0000 Author: mav Date: Thu Sep 10 12:40:31 2015 New Revision: 287621 URL: https://svnweb.freebsd.org/changeset/base/287621 Log: Reimplement CTL High Availability. CTL HA functionality was originally implemented by Copan many years ago, but large part of the sources was never published. This change includes clean room implementation of the missing code and fixes for many bugs. This code supports dual-node HA with ALUA in four modes: - Active/Unavailable without interlink between nodes; - Active/Standby with second node handling only basic LUN discovery and reservation, synchronizing with the first node through the interlink; - Active/Active with both nodes processing commands and accessing the backing storage, synchronizing with the first node through the interlink; - Active/Active with second node working as proxy, transfering all commands to the first node for execution through the interlink. Unlike original Copan's implementation, depending on specific hardware, this code uses simple custom TCP-based protocol for interlink. It has no authentication, so it should never be enabled on public interfaces. The code may still need some polishing, but generally it is functional. Relnotes: yes Sponsored by: iXsystems, Inc. Added: head/sys/cam/ctl/ctl_ha.c (contents, props changed) Modified: head/sys/cam/ctl/README.ctl.txt head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl.h head/sys/cam/ctl/ctl_backend.h head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/ctl/ctl_error.c head/sys/cam/ctl/ctl_error.h head/sys/cam/ctl/ctl_frontend.c head/sys/cam/ctl/ctl_frontend_cam_sim.c head/sys/cam/ctl/ctl_frontend_ioctl.c head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_ha.h head/sys/cam/ctl/ctl_io.h head/sys/cam/ctl/ctl_private.h head/sys/cam/ctl/ctl_tpc.c head/sys/cam/ctl/ctl_tpc_local.c head/sys/cam/ctl/scsi_ctl.c head/sys/conf/files head/sys/modules/ctl/Makefile Modified: head/sys/cam/ctl/README.ctl.txt ============================================================================== --- head/sys/cam/ctl/README.ctl.txt Thu Sep 10 10:46:21 2015 (r287620) +++ head/sys/cam/ctl/README.ctl.txt Thu Sep 10 12:40:31 2015 (r287621) @@ -43,12 +43,9 @@ Features: - Persistent reservation support - Mode sense/select support - Error injection support - - High Availability support (1) + - High Availability support - All I/O handled in-kernel, no userland context switch overhead. -(1) HA Support is just an API stub, and needs much more to be fully - functional. See the to-do list below. - Configuring and Running CTL: =========================== @@ -245,27 +242,6 @@ To Do List: another data structure in the stack, more memory allocations, etc. This will also require changes to the CAM CCB structure to support CTL. - - Full-featured High Availability support. The HA API that is in ctl_ha.h - is essentially a renamed version of Copan's HA API. There is no - substance to it, but it remains in CTL to show what needs to be done to - implement active/active HA from a CTL standpoint. The things that would - need to be done include: - - A kernel level software API for message passing as well as DMA - between at least two nodes. - - Hardware support and drivers for inter-node communication. This - could be as simples as ethernet hardware and drivers. - - A "supervisor", or startup framework to control and coordinate - HA startup, failover (going from active/active to single mode), - and failback (going from single mode to active/active). - - HA support in other components of the stack. The goal behind HA - is that one node can fail and another node can seamlessly take - over handling I/O requests. This requires support from pretty - much every component in the storage stack, from top to bottom. - CTL is one piece of it, but you also need support in the RAID - stack/filesystem/backing store. You also need full configuration - mirroring, and all peer nodes need to be able to talk to the - underlying storage hardware. - Code Roadmap: ============ @@ -365,11 +341,11 @@ This is a CTL frontend port that is also frontend allows for using CTL without any target-capable hardware. So any LUNs you create in CTL are visible via this port. +ctl_ha.c: ctl_ha.h: -------- -This is a stubbed-out High Availability API. See the comments in the -header and the description of what is needed as far as HA support above. +This is a High Availability API and TCP-based interlink implementation. ctl_io.h: -------- Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Sep 10 10:46:21 2015 (r287620) +++ head/sys/cam/ctl/ctl.c Thu Sep 10 12:40:31 2015 (r287621) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2003-2009 Silicon Graphics International Corp. * Copyright (c) 2012 The FreeBSD Foundation + * Copyright (c) 2015 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -84,25 +85,6 @@ __FBSDID("$FreeBSD$"); struct ctl_softc *control_softc = NULL; /* - * Size and alignment macros needed for Copan-specific HA hardware. These - * can go away when the HA code is re-written, and uses busdma for any - * hardware. - */ -#define CTL_ALIGN_8B(target, source, type) \ - if (((uint32_t)source & 0x7) != 0) \ - target = (type)(source + (0x8 - ((uint32_t)source & 0x7)));\ - else \ - target = (type)source; - -#define CTL_SIZE_8B(target, size) \ - if ((size & 0x7) != 0) \ - target = size + (0x8 - (size & 0x7)); \ - else \ - target = size; - -#define CTL_ALIGN_8B_MARGIN 16 - -/* * Template mode pages. */ @@ -351,12 +333,6 @@ const static struct ctl_logical_block_pr } }; -/* - * XXX KDM move these into the softc. - */ -static int rcv_sync_msg; -static uint8_t ctl_pause_rtr; - SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer"); static int worker_threads = -1; SYSCTL_INT(_kern_cam_ctl, OID_AUTO, worker_threads, CTLFLAG_RDTUN, @@ -373,11 +349,10 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, debu */ #define SCSI_EVPD_NUM_SUPPORTED_PAGES 10 -#ifdef notyet static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event, int param); static void ctl_copy_sense_data(union ctl_ha_msg *src, union ctl_io *dest); -#endif +static void ctl_copy_sense_data_back(union ctl_io *src, union ctl_ha_msg *dest); static int ctl_init(void); void ctl_shutdown(void); static int ctl_open(struct cdev *dev, int flags, int fmt, struct thread *td); @@ -393,10 +368,6 @@ static int ctl_alloc_lun(struct ctl_soft static int ctl_free_lun(struct ctl_lun *lun); static void ctl_create_lun(struct ctl_be_lun *be_lun); static struct ctl_port * ctl_io_port(struct ctl_io_hdr *io_hdr); -/** -static void ctl_failover_change_pages(struct ctl_softc *softc, - struct ctl_scsiio *ctsio, int master); -**/ static int ctl_do_mode_select(union ctl_io *io); static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, @@ -433,10 +404,11 @@ static int ctl_check_blocked(struct ctl_ static int ctl_scsiio_lun_check(struct ctl_lun *lun, const struct ctl_cmd_entry *entry, struct ctl_scsiio *ctsio); -//static int ctl_check_rtr(union ctl_io *pending_io, struct ctl_softc *softc); -#ifdef notyet -static void ctl_failover(void); -#endif +static void ctl_failover_lun(struct ctl_lun *lun); +static void ctl_est_ua(struct ctl_lun *lun, uint32_t initidx, ctl_ua_type ua); +static void ctl_est_ua_all(struct ctl_lun *lun, uint32_t except, ctl_ua_type ua); +static void ctl_clr_ua(struct ctl_lun *lun, uint32_t initidx, ctl_ua_type ua); +static void ctl_clr_ua_all(struct ctl_lun *lun, uint32_t except, ctl_ua_type ua); static void ctl_clr_ua_allluns(struct ctl_softc *ctl_softc, uint32_t initidx, ctl_ua_type ua_type); static int ctl_scsiio_precheck(struct ctl_softc *ctl_softc, @@ -475,9 +447,7 @@ static void ctl_work_thread(void *arg); static void ctl_enqueue_incoming(union ctl_io *io); static void ctl_enqueue_rtr(union ctl_io *io); static void ctl_enqueue_done(union ctl_io *io); -#ifdef notyet static void ctl_enqueue_isc(union ctl_io *io); -#endif static const struct ctl_cmd_entry * ctl_get_cmd_entry(struct ctl_scsiio *ctsio, int *sa); static const struct ctl_cmd_entry * @@ -485,6 +455,11 @@ static const struct ctl_cmd_entry * static int ctl_cmd_applicable(uint8_t lun_type, const struct ctl_cmd_entry *entry); +static uint64_t ctl_get_prkey(struct ctl_lun *lun, uint32_t residx); +static void ctl_clr_prkey(struct ctl_lun *lun, uint32_t residx); +static void ctl_alloc_prkey(struct ctl_lun *lun, uint32_t residx); +static void ctl_set_prkey(struct ctl_lun *lun, uint32_t residx, uint64_t key); + /* * Load the serialization table. This isn't very pretty, but is probably * the easiest way to do it. @@ -517,7 +492,11 @@ static moduledata_t ctl_moduledata = { DECLARE_MODULE(ctl, ctl_moduledata, SI_SUB_CONFIGURE, SI_ORDER_THIRD); MODULE_VERSION(ctl, 1); -#ifdef notyet +static struct ctl_frontend ha_frontend = +{ + .name = "ha", +}; + static void ctl_isc_handler_finish_xfer(struct ctl_softc *ctl_softc, union ctl_ha_msg *msg_info) @@ -539,7 +518,7 @@ ctl_isc_handler_finish_xfer(struct ctl_s ctsio->sense_residual = msg_info->scsi.sense_residual; ctsio->residual = msg_info->scsi.residual; memcpy(&ctsio->sense_data, &msg_info->scsi.sense_data, - sizeof(ctsio->sense_data)); + msg_info->scsi.sense_len); memcpy(&ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, &msg_info->scsi.lbalen, sizeof(msg_info->scsi.lbalen)); ctl_enqueue_isc((union ctl_io *)ctsio); @@ -558,38 +537,327 @@ ctl_isc_handler_finish_ser_only(struct c } ctsio = &msg_info->hdr.serializing_sc->scsiio; -#if 0 - /* - * Attempt to catch the situation where an I/O has - * been freed, and we're using it again. - */ - if (ctsio->io_hdr.io_type == 0xff) { - union ctl_io *tmp_io; - tmp_io = (union ctl_io *)ctsio; - printf("%s: %p use after free!\n", __func__, - ctsio); - printf("%s: type %d msg %d cdb %x iptl: " - "%u:%u:%u tag 0x%04x " - "flag %#x status %x\n", - __func__, - tmp_io->io_hdr.io_type, - tmp_io->io_hdr.msg_type, - tmp_io->scsiio.cdb[0], - tmp_io->io_hdr.nexus.initid, - tmp_io->io_hdr.nexus.targ_port, - tmp_io->io_hdr.nexus.targ_lun, - (tmp_io->io_hdr.io_type == - CTL_IO_TASK) ? - tmp_io->taskio.tag_num : - tmp_io->scsiio.tag_num, - tmp_io->io_hdr.flags, - tmp_io->io_hdr.status); - } -#endif ctsio->io_hdr.msg_type = CTL_MSG_FINISH_IO; ctl_enqueue_isc((union ctl_io *)ctsio); } +void +ctl_isc_announce_lun(struct ctl_lun *lun) +{ + struct ctl_softc *softc = lun->ctl_softc; + union ctl_ha_msg *msg; + struct ctl_ha_msg_lun_pr_key pr_key; + int i, k; + + if (softc->ha_link != CTL_HA_LINK_ONLINE) + return; + mtx_lock(&lun->lun_lock); + i = sizeof(msg->lun); + if (lun->lun_devid) + i += lun->lun_devid->len; + i += sizeof(pr_key) * lun->pr_key_count; +alloc: + mtx_unlock(&lun->lun_lock); + msg = malloc(i, M_CTL, M_WAITOK); + mtx_lock(&lun->lun_lock); + k = sizeof(msg->lun); + if (lun->lun_devid) + k += lun->lun_devid->len; + k += sizeof(pr_key) * lun->pr_key_count; + if (i < k) { + free(msg, M_CTL); + i = k; + goto alloc; + } + bzero(&msg->lun, sizeof(msg->lun)); + msg->hdr.msg_type = CTL_MSG_LUN_SYNC; + msg->hdr.nexus.targ_lun = lun->lun; + msg->hdr.nexus.targ_mapped_lun = lun->lun; + msg->lun.flags = lun->flags; + msg->lun.pr_generation = lun->PRGeneration; + msg->lun.pr_res_idx = lun->pr_res_idx; + msg->lun.pr_res_type = lun->res_type; + msg->lun.pr_key_count = lun->pr_key_count; + i = 0; + if (lun->lun_devid) { + msg->lun.lun_devid_len = lun->lun_devid->len; + memcpy(&msg->lun.data[i], lun->lun_devid->data, + msg->lun.lun_devid_len); + i += msg->lun.lun_devid_len; + } + for (k = 0; k < CTL_MAX_INITIATORS; k++) { + if ((pr_key.pr_key = ctl_get_prkey(lun, k)) == 0) + continue; + pr_key.pr_iid = k; + memcpy(&msg->lun.data[i], &pr_key, sizeof(pr_key)); + i += sizeof(pr_key); + } + mtx_unlock(&lun->lun_lock); + ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg->port, sizeof(msg->port) + i, + M_WAITOK); + free(msg, M_CTL); +} + +void +ctl_isc_announce_port(struct ctl_port *port) +{ + struct ctl_softc *softc = control_softc; + union ctl_ha_msg *msg; + int i; + + if (port->targ_port < softc->port_min || + port->targ_port >= softc->port_max || + softc->ha_link != CTL_HA_LINK_ONLINE) + return; + i = sizeof(msg->port) + strlen(port->port_name) + 1; + if (port->lun_map) + i += sizeof(uint32_t) * CTL_MAX_LUNS; + if (port->port_devid) + i += port->port_devid->len; + if (port->target_devid) + i += port->target_devid->len; + msg = malloc(i, M_CTL, M_WAITOK); + bzero(&msg->port, sizeof(msg->port)); + msg->hdr.msg_type = CTL_MSG_PORT_SYNC; + msg->hdr.nexus.targ_port = port->targ_port; + msg->port.port_type = port->port_type; + msg->port.physical_port = port->physical_port; + msg->port.virtual_port = port->virtual_port; + msg->port.status = port->status; + i = 0; + msg->port.name_len = sprintf(&msg->port.data[i], + "%d:%s", softc->ha_id, port->port_name) + 1; + i += msg->port.name_len; + if (port->lun_map) { + msg->port.lun_map_len = sizeof(uint32_t) * CTL_MAX_LUNS; + memcpy(&msg->port.data[i], port->lun_map, + msg->port.lun_map_len); + i += msg->port.lun_map_len; + } + if (port->port_devid) { + msg->port.port_devid_len = port->port_devid->len; + memcpy(&msg->port.data[i], port->port_devid->data, + msg->port.port_devid_len); + i += msg->port.port_devid_len; + } + if (port->target_devid) { + msg->port.target_devid_len = port->target_devid->len; + memcpy(&msg->port.data[i], port->target_devid->data, + msg->port.target_devid_len); + i += msg->port.target_devid_len; + } + ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg->port, sizeof(msg->port) + i, + M_WAITOK); + free(msg, M_CTL); +} + +static void +ctl_isc_ha_link_up(struct ctl_softc *softc) +{ + struct ctl_port *port; + struct ctl_lun *lun; + + STAILQ_FOREACH(port, &softc->port_list, links) + ctl_isc_announce_port(port); + STAILQ_FOREACH(lun, &softc->lun_list, links) + ctl_isc_announce_lun(lun); +} + +static void +ctl_isc_ha_link_down(struct ctl_softc *softc) +{ + struct ctl_port *port; + struct ctl_lun *lun; + union ctl_io *io; + + mtx_lock(&softc->ctl_lock); + STAILQ_FOREACH(lun, &softc->lun_list, links) { + mtx_lock(&lun->lun_lock); + lun->flags &= ~CTL_LUN_PEER_SC_PRIMARY; + mtx_unlock(&lun->lun_lock); + + mtx_unlock(&softc->ctl_lock); + io = ctl_alloc_io(softc->othersc_pool); + mtx_lock(&softc->ctl_lock); + ctl_zero_io(io); + io->io_hdr.msg_type = CTL_MSG_FAILOVER; + io->io_hdr.nexus.targ_mapped_lun = lun->lun; + ctl_enqueue_isc(io); + } + + STAILQ_FOREACH(port, &softc->port_list, links) { + if (port->targ_port >= softc->port_min && + port->targ_port < softc->port_max) + continue; + port->status &= ~CTL_PORT_STATUS_ONLINE; + } + mtx_unlock(&softc->ctl_lock); +} + +static void +ctl_isc_ua(struct ctl_softc *softc, union ctl_ha_msg *msg, int len) +{ + struct ctl_lun *lun; + uint32_t iid = ctl_get_initindex(&msg->hdr.nexus); + + if (msg->hdr.nexus.targ_lun < CTL_MAX_LUNS && + (lun = softc->ctl_luns[msg->hdr.nexus.targ_lun]) != NULL) { + if (msg->ua.ua_all) { + if (msg->ua.ua_set) + ctl_est_ua_all(lun, iid, msg->ua.ua_type); + else + ctl_clr_ua_all(lun, iid, msg->ua.ua_type); + } else { + if (msg->ua.ua_set) + ctl_est_ua(lun, iid, msg->ua.ua_type); + else + ctl_clr_ua(lun, iid, msg->ua.ua_type); + } + } +} + +static void +ctl_isc_lun_sync(struct ctl_softc *softc, union ctl_ha_msg *msg, int len) +{ + struct ctl_lun *lun; + struct ctl_ha_msg_lun_pr_key pr_key; + int i, k; + + lun = softc->ctl_luns[msg->hdr.nexus.targ_lun]; + if (lun == NULL) { + CTL_DEBUG_PRINT(("%s: Unknown LUN %d\n", __func__, + msg->hdr.nexus.targ_lun)); + } else { + mtx_lock(&lun->lun_lock); + i = (lun->lun_devid != NULL) ? lun->lun_devid->len : 0; + if (msg->lun.lun_devid_len != i || (i > 0 && + memcmp(&msg->lun.data[0], lun->lun_devid->data, i) != 0)) { + mtx_unlock(&lun->lun_lock); + printf("%s: Received conflicting HA LUN %d\n", + __func__, msg->hdr.nexus.targ_lun); + return; + } else { + /* Record whether peer is primary. */ + if ((msg->lun.flags & CTL_LUN_PRIMARY_SC) && + (msg->lun.flags & CTL_LUN_DISABLED) == 0) + lun->flags |= CTL_LUN_PEER_SC_PRIMARY; + else + lun->flags &= ~CTL_LUN_PEER_SC_PRIMARY; + + /* If peer is primary and we are not -- use data */ + if ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 && + (lun->flags & CTL_LUN_PEER_SC_PRIMARY)) { + lun->PRGeneration = msg->lun.pr_generation; + lun->pr_res_idx = msg->lun.pr_res_idx; + lun->res_type = msg->lun.pr_res_type; + lun->pr_key_count = msg->lun.pr_key_count; + for (k = 0; k < CTL_MAX_INITIATORS; k++) + ctl_clr_prkey(lun, k); + for (k = 0; k < msg->lun.pr_key_count; k++) { + memcpy(&pr_key, &msg->lun.data[i], + sizeof(pr_key)); + ctl_alloc_prkey(lun, pr_key.pr_iid); + ctl_set_prkey(lun, pr_key.pr_iid, + pr_key.pr_key); + i += sizeof(pr_key); + } + } + + mtx_unlock(&lun->lun_lock); + CTL_DEBUG_PRINT(("%s: Known LUN %d, peer is %s\n", + __func__, msg->hdr.nexus.targ_lun, + (msg->lun.flags & CTL_LUN_PRIMARY_SC) ? + "primary" : "secondary")); + + /* If we are primary but peer doesn't know -- notify */ + if ((lun->flags & CTL_LUN_PRIMARY_SC) && + (msg->lun.flags & CTL_LUN_PEER_SC_PRIMARY) == 0) + ctl_isc_announce_lun(lun); + } + } +} + +static void +ctl_isc_port_sync(struct ctl_softc *softc, union ctl_ha_msg *msg, int len) +{ + struct ctl_port *port; + int i, new; + + port = softc->ctl_ports[msg->hdr.nexus.targ_port]; + if (port == NULL) { + CTL_DEBUG_PRINT(("%s: New port %d\n", __func__, + msg->hdr.nexus.targ_port)); + new = 1; + port = malloc(sizeof(*port), M_CTL, M_WAITOK | M_ZERO); + port->frontend = &ha_frontend; + port->targ_port = msg->hdr.nexus.targ_port; + } else if (port->frontend == &ha_frontend) { + CTL_DEBUG_PRINT(("%s: Updated port %d\n", __func__, + msg->hdr.nexus.targ_port)); + new = 0; + } else { + printf("%s: Received conflicting HA port %d\n", + __func__, msg->hdr.nexus.targ_port); + return; + } + port->port_type = msg->port.port_type; + port->physical_port = msg->port.physical_port; + port->virtual_port = msg->port.virtual_port; + port->status = msg->port.status; + i = 0; + free(port->port_name, M_CTL); + port->port_name = strndup(&msg->port.data[i], msg->port.name_len, + M_CTL); + i += msg->port.name_len; + if (msg->port.lun_map_len != 0) { + if (port->lun_map == NULL) + port->lun_map = malloc(sizeof(uint32_t) * CTL_MAX_LUNS, + M_CTL, M_WAITOK); + memcpy(port->lun_map, &msg->port.data[i], + sizeof(uint32_t) * CTL_MAX_LUNS); + i += msg->port.lun_map_len; + } else { + free(port->lun_map, M_CTL); + port->lun_map = NULL; + } + if (msg->port.port_devid_len != 0) { + if (port->port_devid == NULL || + port->port_devid->len != msg->port.port_devid_len) { + free(port->port_devid, M_CTL); + port->port_devid = malloc(sizeof(struct ctl_devid) + + msg->port.port_devid_len, M_CTL, M_WAITOK); + } + memcpy(port->port_devid->data, &msg->port.data[i], + msg->port.port_devid_len); + port->port_devid->len = msg->port.port_devid_len; + i += msg->port.port_devid_len; + } else { + free(port->port_devid, M_CTL); + port->port_devid = NULL; + } + if (msg->port.target_devid_len != 0) { + if (port->target_devid == NULL || + port->target_devid->len != msg->port.target_devid_len) { + free(port->target_devid, M_CTL); + port->target_devid = malloc(sizeof(struct ctl_devid) + + msg->port.target_devid_len, M_CTL, M_WAITOK); + } + memcpy(port->target_devid->data, &msg->port.data[i], + msg->port.target_devid_len); + port->target_devid->len = msg->port.target_devid_len; + i += msg->port.target_devid_len; + } else { + free(port->port_devid, M_CTL); + port->port_devid = NULL; + } + if (new) { + if (ctl_port_register(port) != 0) { + printf("%s: ctl_port_register() failed with error\n", + __func__); + } + } +} + /* * ISC (Inter Shelf Communication) event handler. Events from the HA * subsystem come in here. @@ -603,54 +871,33 @@ ctl_isc_event_handler(ctl_ha_channel cha ctl_ha_status isc_status; softc = control_softc; - io = NULL; - - -#if 0 - printf("CTL: Isc Msg event %d\n", event); -#endif + CTL_DEBUG_PRINT(("CTL: Isc Msg event %d\n", event)); if (event == CTL_HA_EVT_MSG_RECV) { - union ctl_ha_msg msg_info; + union ctl_ha_msg *msg, msgbuf; - isc_status = ctl_ha_msg_recv(CTL_HA_CHAN_CTL, &msg_info, - sizeof(msg_info), /*wait*/ 0); -#if 0 - printf("CTL: msg_type %d\n", msg_info.msg_type); -#endif - if (isc_status != 0) { - printf("Error receiving message, status = %d\n", - isc_status); + if (param > sizeof(msgbuf)) + msg = malloc(param, M_CTL, M_WAITOK); + else + msg = &msgbuf; + isc_status = ctl_ha_msg_recv(CTL_HA_CHAN_CTL, msg, param, + M_WAITOK); + if (isc_status != CTL_HA_STATUS_SUCCESS) { + printf("%s: Error receiving message: %d\n", + __func__, isc_status); + if (msg != &msgbuf) + free(msg, M_CTL); return; } - switch (msg_info.hdr.msg_type) { + CTL_DEBUG_PRINT(("CTL: msg_type %d\n", msg->msg_type)); + switch (msg->hdr.msg_type) { case CTL_MSG_SERIALIZE: -#if 0 - printf("Serialize\n"); -#endif - io = ctl_alloc_io_nowait(softc->othersc_pool); - if (io == NULL) { - printf("ctl_isc_event_handler: can't allocate " - "ctl_io!\n"); - /* Bad Juju */ - /* Need to set busy and send msg back */ - msg_info.hdr.msg_type = CTL_MSG_BAD_JUJU; - msg_info.hdr.status = CTL_SCSI_ERROR; - msg_info.scsi.scsi_status = SCSI_STATUS_BUSY; - msg_info.scsi.sense_len = 0; - if (ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg_info, - sizeof(msg_info), 0) > CTL_HA_STATUS_SUCCESS){ - } - goto bailout; - } + io = ctl_alloc_io(softc->othersc_pool); ctl_zero_io(io); - // populate ctsio from msg_info + // populate ctsio from msg io->io_hdr.io_type = CTL_IO_SCSI; io->io_hdr.msg_type = CTL_MSG_SERIALIZE; - io->io_hdr.original_sc = msg_info.hdr.original_sc; -#if 0 - printf("pOrig %x\n", (int)msg_info.original_sc); -#endif + io->io_hdr.original_sc = msg->hdr.original_sc; io->io_hdr.flags |= CTL_FLAG_FROM_OTHER_SC | CTL_FLAG_IO_ACTIVE; /* @@ -660,18 +907,23 @@ ctl_isc_event_handler(ctl_ha_channel cha * * XXX KDM add another flag that is more specific. */ - if (softc->ha_mode == CTL_HA_MODE_SER_ONLY) + if (softc->ha_mode != CTL_HA_MODE_XFER) io->io_hdr.flags |= CTL_FLAG_INT_COPY; - io->io_hdr.nexus = msg_info.hdr.nexus; + io->io_hdr.nexus = msg->hdr.nexus; #if 0 printf("port %u, iid %u, lun %u\n", io->io_hdr.nexus.targ_port, io->io_hdr.nexus.initid, io->io_hdr.nexus.targ_lun); #endif - io->scsiio.tag_num = msg_info.scsi.tag_num; - io->scsiio.tag_type = msg_info.scsi.tag_type; - memcpy(io->scsiio.cdb, msg_info.scsi.cdb, + io->scsiio.tag_num = msg->scsi.tag_num; + io->scsiio.tag_type = msg->scsi.tag_type; +#ifdef CTL_TIME_IO + io->io_hdr.start_time = time_uptime; + getbintime(&io->io_hdr.start_bt); +#endif /* CTL_TIME_IO */ + io->scsiio.cdb_len = msg->scsi.cdb_len; + memcpy(io->scsiio.cdb, msg->scsi.cdb, CTL_MAX_CDBLEN); if (softc->ha_mode == CTL_HA_MODE_XFER) { const struct ctl_cmd_entry *entry; @@ -689,7 +941,7 @@ ctl_isc_event_handler(ctl_ha_channel cha struct ctl_sg_entry *sgl; int i, j; - io = msg_info.hdr.original_sc; + io = msg->hdr.original_sc; if (io == NULL) { printf("%s: original_sc == NULL!\n", __func__); /* XXX KDM do something here */ @@ -701,97 +953,66 @@ ctl_isc_event_handler(ctl_ha_channel cha * Keep track of this, we need to send it back over * when the datamove is complete. */ - io->io_hdr.serializing_sc = msg_info.hdr.serializing_sc; + io->io_hdr.serializing_sc = msg->hdr.serializing_sc; - if (msg_info.dt.sg_sequence == 0) { - /* - * XXX KDM we use the preallocated S/G list - * here, but we'll need to change this to - * dynamic allocation if we need larger S/G - * lists. - */ - if (msg_info.dt.kern_sg_entries > - sizeof(io->io_hdr.remote_sglist) / - sizeof(io->io_hdr.remote_sglist[0])) { - printf("%s: number of S/G entries " - "needed %u > allocated num %zd\n", - __func__, - msg_info.dt.kern_sg_entries, - sizeof(io->io_hdr.remote_sglist)/ - sizeof(io->io_hdr.remote_sglist[0])); - - /* - * XXX KDM send a message back to - * the other side to shut down the - * DMA. The error will come back - * through via the normal channel. - */ - break; - } - sgl = io->io_hdr.remote_sglist; - memset(sgl, 0, - sizeof(io->io_hdr.remote_sglist)); + if (msg->dt.sg_sequence == 0) { + i = msg->dt.kern_sg_entries + + io->scsiio.kern_data_len / + CTL_HA_DATAMOVE_SEGMENT + 1; + sgl = malloc(sizeof(*sgl) * i, M_CTL, + M_WAITOK | M_ZERO); + io->io_hdr.remote_sglist = sgl; + io->io_hdr.local_sglist = + &sgl[msg->dt.kern_sg_entries]; io->scsiio.kern_data_ptr = (uint8_t *)sgl; io->scsiio.kern_sg_entries = - msg_info.dt.kern_sg_entries; + msg->dt.kern_sg_entries; io->scsiio.rem_sg_entries = - msg_info.dt.kern_sg_entries; + msg->dt.kern_sg_entries; io->scsiio.kern_data_len = - msg_info.dt.kern_data_len; + msg->dt.kern_data_len; io->scsiio.kern_total_len = - msg_info.dt.kern_total_len; + msg->dt.kern_total_len; io->scsiio.kern_data_resid = - msg_info.dt.kern_data_resid; + msg->dt.kern_data_resid; io->scsiio.kern_rel_offset = - msg_info.dt.kern_rel_offset; - /* - * Clear out per-DMA flags. - */ - io->io_hdr.flags &= ~CTL_FLAG_RDMA_MASK; - /* - * Add per-DMA flags that are set for this - * particular DMA request. - */ - io->io_hdr.flags |= msg_info.dt.flags & - CTL_FLAG_RDMA_MASK; + msg->dt.kern_rel_offset; + io->io_hdr.flags &= ~CTL_FLAG_BUS_ADDR; + io->io_hdr.flags |= msg->dt.flags & + CTL_FLAG_BUS_ADDR; } else sgl = (struct ctl_sg_entry *) io->scsiio.kern_data_ptr; - for (i = msg_info.dt.sent_sg_entries, j = 0; - i < (msg_info.dt.sent_sg_entries + - msg_info.dt.cur_sg_entries); i++, j++) { - sgl[i].addr = msg_info.dt.sg_list[j].addr; - sgl[i].len = msg_info.dt.sg_list[j].len; + for (i = msg->dt.sent_sg_entries, j = 0; + i < (msg->dt.sent_sg_entries + + msg->dt.cur_sg_entries); i++, j++) { + sgl[i].addr = msg->dt.sg_list[j].addr; + sgl[i].len = msg->dt.sg_list[j].len; #if 0 printf("%s: L: %p,%d -> %p,%d j=%d, i=%d\n", __func__, - msg_info.dt.sg_list[j].addr, - msg_info.dt.sg_list[j].len, + msg->dt.sg_list[j].addr, + msg->dt.sg_list[j].len, sgl[i].addr, sgl[i].len, j, i); #endif } -#if 0 - memcpy(&sgl[msg_info.dt.sent_sg_entries], - msg_info.dt.sg_list, - sizeof(*sgl) * msg_info.dt.cur_sg_entries); -#endif /* * If this is the last piece of the I/O, we've got * the full S/G list. Queue processing in the thread. * Otherwise wait for the next piece. */ - if (msg_info.dt.sg_last != 0) + if (msg->dt.sg_last != 0) ctl_enqueue_isc(io); break; } /* Performed on the Serializing (primary) SC, XFER mode only */ case CTL_MSG_DATAMOVE_DONE: { - if (msg_info.hdr.serializing_sc == NULL) { + if (msg->hdr.serializing_sc == NULL) { printf("%s: serializing_sc == NULL!\n", __func__); /* XXX KDM now what? */ @@ -802,33 +1023,35 @@ ctl_isc_event_handler(ctl_ha_channel cha * there was a failure, so we can return status * back to the initiator. */ - io = msg_info.hdr.serializing_sc; + io = msg->hdr.serializing_sc; io->io_hdr.msg_type = CTL_MSG_DATAMOVE_DONE; - io->io_hdr.status = msg_info.hdr.status; - io->scsiio.scsi_status = msg_info.scsi.scsi_status; - io->scsiio.sense_len = msg_info.scsi.sense_len; - io->scsiio.sense_residual =msg_info.scsi.sense_residual; - io->io_hdr.port_status = msg_info.scsi.fetd_status; - io->scsiio.residual = msg_info.scsi.residual; - memcpy(&io->scsiio.sense_data,&msg_info.scsi.sense_data, - sizeof(io->scsiio.sense_data)); + io->io_hdr.flags |= CTL_FLAG_IO_ACTIVE; + io->io_hdr.port_status = msg->scsi.fetd_status; + io->scsiio.residual = msg->scsi.residual; + if (msg->hdr.status != CTL_STATUS_NONE) { + io->io_hdr.status = msg->hdr.status; + io->scsiio.scsi_status = msg->scsi.scsi_status; + io->scsiio.sense_len = msg->scsi.sense_len; + io->scsiio.sense_residual =msg->scsi.sense_residual; + memcpy(&io->scsiio.sense_data, + &msg->scsi.sense_data, + msg->scsi.sense_len); + } ctl_enqueue_isc(io); break; } /* Preformed on Originating SC, SER_ONLY mode */ case CTL_MSG_R2R: - io = msg_info.hdr.original_sc; + io = msg->hdr.original_sc; if (io == NULL) { - printf("%s: Major Bummer\n", __func__); - return; - } else { -#if 0 - printf("pOrig %x\n",(int) ctsio); -#endif + printf("%s: original_sc == NULL!\n", + __func__); + break; } + io->io_hdr.flags |= CTL_FLAG_IO_ACTIVE; io->io_hdr.msg_type = CTL_MSG_R2R; - io->io_hdr.serializing_sc = msg_info.hdr.serializing_sc; + io->io_hdr.serializing_sc = msg->hdr.serializing_sc; ctl_enqueue_isc(io); break; @@ -840,22 +1063,20 @@ ctl_isc_event_handler(ctl_ha_channel cha */ case CTL_MSG_FINISH_IO: if (softc->ha_mode == CTL_HA_MODE_XFER) - ctl_isc_handler_finish_xfer(softc, - &msg_info); + ctl_isc_handler_finish_xfer(softc, msg); else - ctl_isc_handler_finish_ser_only(softc, - &msg_info); + ctl_isc_handler_finish_ser_only(softc, msg); break; /* Preformed on Originating SC */ case CTL_MSG_BAD_JUJU: - io = msg_info.hdr.original_sc; + io = msg->hdr.original_sc; if (io == NULL) { printf("%s: Bad JUJU!, original_sc is NULL!\n", __func__); break; } - ctl_copy_sense_data(&msg_info, io); + ctl_copy_sense_data(msg, io); /* * IO should have already been cleaned up on other * SC so clear this flag so we won't send a message @@ -864,7 +1085,7 @@ ctl_isc_event_handler(ctl_ha_channel cha io->io_hdr.flags &= ~CTL_FLAG_SENT_2OTHER_SC; io->io_hdr.flags |= CTL_FLAG_IO_ACTIVE; - /* io = msg_info.hdr.serializing_sc; */ + /* io = msg->hdr.serializing_sc; */ io->io_hdr.msg_type = CTL_MSG_BAD_JUJU; ctl_enqueue_isc(io); break; @@ -872,91 +1093,99 @@ ctl_isc_event_handler(ctl_ha_channel cha /* Handle resets sent from the other side */ case CTL_MSG_MANAGE_TASKS: { struct ctl_taskio *taskio; - taskio = (struct ctl_taskio *)ctl_alloc_io_nowait( + taskio = (struct ctl_taskio *)ctl_alloc_io( softc->othersc_pool); - if (taskio == NULL) { - printf("ctl_isc_event_handler: can't allocate " - "ctl_io!\n"); - /* Bad Juju */ - /* should I just call the proper reset func - here??? */ - goto bailout; - } ctl_zero_io((union ctl_io *)taskio); taskio->io_hdr.io_type = CTL_IO_TASK; taskio->io_hdr.flags |= CTL_FLAG_FROM_OTHER_SC; - taskio->io_hdr.nexus = msg_info.hdr.nexus; - taskio->task_action = msg_info.task.task_action; - taskio->tag_num = msg_info.task.tag_num; - taskio->tag_type = msg_info.task.tag_type; + taskio->io_hdr.nexus = msg->hdr.nexus; + taskio->task_action = msg->task.task_action; + taskio->tag_num = msg->task.tag_num; + taskio->tag_type = msg->task.tag_type; #ifdef CTL_TIME_IO taskio->io_hdr.start_time = time_uptime; getbintime(&taskio->io_hdr.start_bt); -#if 0 - cs_prof_gettime(&taskio->io_hdr.start_ticks); -#endif #endif /* CTL_TIME_IO */ ctl_run_task((union ctl_io *)taskio); break; } /* Persistent Reserve action which needs attention */ case CTL_MSG_PERS_ACTION: - presio = (struct ctl_prio *)ctl_alloc_io_nowait( + presio = (struct ctl_prio *)ctl_alloc_io( softc->othersc_pool); - if (presio == NULL) { - printf("ctl_isc_event_handler: can't allocate " - "ctl_io!\n"); - /* Bad Juju */ - /* Need to set busy and send msg back */ - goto bailout; - } ctl_zero_io((union ctl_io *)presio); presio->io_hdr.msg_type = CTL_MSG_PERS_ACTION; - presio->pr_msg = msg_info.pr; + presio->io_hdr.flags |= CTL_FLAG_FROM_OTHER_SC; + presio->io_hdr.nexus = msg->hdr.nexus; + presio->pr_msg = msg->pr; ctl_enqueue_isc((union ctl_io *)presio); break; - case CTL_MSG_SYNC_FE: - rcv_sync_msg = 1; + case CTL_MSG_UA: + ctl_isc_ua(softc, msg, param); + break; + case CTL_MSG_PORT_SYNC: + ctl_isc_port_sync(softc, msg, param); + break; + case CTL_MSG_LUN_SYNC: + ctl_isc_lun_sync(softc, msg, param); break; default: - printf("How did I get here?\n"); + printf("Received HA message of unknown type %d\n", + msg->hdr.msg_type); + break; } - } else if (event == CTL_HA_EVT_MSG_SENT) { - if (param != CTL_HA_STATUS_SUCCESS) { - printf("Bad status from ctl_ha_msg_send status %d\n", - param); + if (msg != &msgbuf) + free(msg, M_CTL); + } else if (event == CTL_HA_EVT_LINK_CHANGE) { + printf("CTL: HA link status changed from %d to %d\n", + softc->ha_link, param); + if (param == softc->ha_link) + return; + if (softc->ha_link == CTL_HA_LINK_ONLINE) { + softc->ha_link = param; + ctl_isc_ha_link_down(softc); + } else { + softc->ha_link = param; + if (softc->ha_link == CTL_HA_LINK_ONLINE) + ctl_isc_ha_link_up(softc); } return; - } else if (event == CTL_HA_EVT_DISCONNECT) { - printf("CTL: Got a disconnect from Isc\n"); - return; } else { printf("ctl_isc_event_handler: Unknown event %d\n", event); return; } - -bailout: - return; } static void ctl_copy_sense_data(union ctl_ha_msg *src, union ctl_io *dest) { - struct scsi_sense_data *sense; - sense = &dest->scsiio.sense_data; - bcopy(&src->scsi.sense_data, sense, sizeof(*sense)); + memcpy(&dest->scsiio.sense_data, &src->scsi.sense_data, + src->scsi.sense_len); dest->scsiio.scsi_status = src->scsi.scsi_status; dest->scsiio.sense_len = src->scsi.sense_len; dest->io_hdr.status = src->hdr.status; } -#endif + +static void +ctl_copy_sense_data_back(union ctl_io *src, union ctl_ha_msg *dest) +{ + + memcpy(&dest->scsi.sense_data, &src->scsiio.sense_data, + src->scsiio.sense_len); + dest->scsi.scsi_status = src->scsiio.scsi_status; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Sep 10 15:53:48 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2D6BA015D0; Thu, 10 Sep 2015 15:53:48 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x235.google.com (mail-io0-x235.google.com [IPv6:2607:f8b0:4001:c06::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F9671932; Thu, 10 Sep 2015 15:53:48 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by iofh134 with SMTP id h134so66080912iof.0; Thu, 10 Sep 2015 08:53:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=0wN/6WTrryTj4g06VL+7syRVkRtIs3tZfm8jP/hxUgk=; b=b0fPQ8NQSIfvYePzE6DUPnQOUEEstAkl99zRS1WrKEKl1Gkac7EqN8w/tQtAtxfCpZ ugR7ob1nDZFCSbbOdlKQuuEqeZci+mvDfIynt7ZyRakpfobGWaidnLs0VVUyRe+X9QTQ tn3rx72kkHlj+NBHC9lhOEvdmYGUl+sLurIZvlkywzubILPpbTNN5IpPk/cMUHh8OT+4 +J+PRplKX7PCespO1wCKAO+Krh3ei7imT24iPvqCwOjDZ32pLd4/NQdDUhHV9UG5VNev f2BnUM7niL1Kpj814GIiuQzUa1gB6ntvNMU8/ZMfouoXVaqERFwOQYlKxHf45wvSsFay oTlA== X-Received: by 10.107.157.1 with SMTP id g1mr59572452ioe.38.1441900427822; Thu, 10 Sep 2015 08:53:47 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.158.75 with HTTP; Thu, 10 Sep 2015 08:53:28 -0700 (PDT) In-Reply-To: <201509100405.t8A45xrJ070199@repo.freebsd.org> References: <201509100405.t8A45xrJ070199@repo.freebsd.org> From: Ed Maste Date: Thu, 10 Sep 2015 15:53:28 +0000 X-Google-Sender-Auth: w3yl2hp32JgbEeFyuR5uS9a4Ko0 Message-ID: Subject: Re: svn commit: r287606 - head/sys/kern To: Adrian Chadd Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 15:53:48 -0000 On 10 September 2015 at 04:05, Adrian Chadd wrote: > Author: adrian > Date: Thu Sep 10 04:05:58 2015 > New Revision: 287606 > URL: https://svnweb.freebsd.org/changeset/base/287606 > > Log: > Also make kern.maxfilesperproc a boot time tunable. > ... > TODO: Also "we" should * Submit patches upstream or to the ports tree to use closefrom. From owner-svn-src-head@freebsd.org Thu Sep 10 16:04:51 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F9CEA01ACA for ; Thu, 10 Sep 2015 16:04:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qg0-f42.google.com (mail-qg0-f42.google.com [209.85.192.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0EE6B114A for ; Thu, 10 Sep 2015 16:04:50 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by qgez77 with SMTP id z77so39424524qge.1 for ; Thu, 10 Sep 2015 09:04:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=lv89s+sbnuCXwac5dQD0APQ6csNdar4QttbyCb1D8GU=; b=YzKl0fufd4VIIvqJ7W+sdY/tzHYofKGgXBX81U5uj0CteHNsW7EoH+1ZxQsOicaCKg Npa9DGaKOmBawOwgiFa3BkbZU3l8uxUD78KnYQ9hGOQHbMMcLez1sXWS63z0gBdHbpn9 anI/3QM0a5+C9qTREdCQX33URADqx3EDJCh5GSfpQN434TzK72gYTy8q60TTCE/Ph1NU W/u6YFS/n1ZBmZoJx7NzBBBUWgj9hEHB1nD0AUEqptb4bzyD9Az0Xm5SU5SiYy4Ebyi4 Lccqml3DVaG2nEMo9zym0Kk3SwUjsbN7nd3sQfx7L4iQc3UaX8pb/aUBLL9FMFZwev1/ G1WQ== X-Gm-Message-State: ALoCoQnX4jgC0Kz6o58kerRhwKsvbF9dHxtNHGGbLr0T6vIb4Rb7NuEIa9pye268Y5yZoFfaQNn3 MIME-Version: 1.0 X-Received: by 10.140.29.3 with SMTP id a3mr54140600qga.97.1441901084324; Thu, 10 Sep 2015 09:04:44 -0700 (PDT) Sender: wlosh@bsdimp.com Received: by 10.140.80.164 with HTTP; Thu, 10 Sep 2015 09:04:44 -0700 (PDT) X-Originating-IP: [69.53.245.108] In-Reply-To: References: <201509100405.t8A45xrJ070199@repo.freebsd.org> Date: Thu, 10 Sep 2015 10:04:44 -0600 X-Google-Sender-Auth: fQz8VQKkOdqg_irk8Q9SNCOjQLY Message-ID: Subject: Re: svn commit: r287606 - head/sys/kern From: Warner Losh To: Ed Maste Cc: Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 16:04:51 -0000 On Thu, Sep 10, 2015 at 9:53 AM, Ed Maste wrote: > On 10 September 2015 at 04:05, Adrian Chadd wrote: > > Author: adrian > > Date: Thu Sep 10 04:05:58 2015 > > New Revision: 287606 > > URL: https://svnweb.freebsd.org/changeset/base/287606 > > > > Log: > > Also make kern.maxfilesperproc a boot time tunable. > > ... > > TODO: > > Also "we" should > * Submit patches upstream or to the ports tree to use closefrom > I thought the consensus was that we'd fix things to have fewer FDs by default, but instead allow individual processes to raise it via the usual methods. Warner From owner-svn-src-head@freebsd.org Thu Sep 10 16:18:11 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82FDFA0104E; Thu, 10 Sep 2015 16:18:11 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x233.google.com (mail-ig0-x233.google.com [IPv6:2607:f8b0:4001:c05::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D3DE18CD; Thu, 10 Sep 2015 16:18:11 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by igxx6 with SMTP id x6so19272165igx.1; Thu, 10 Sep 2015 09:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=UUvT2aDQ+8aw/dxkqMU/2JtVWPa/gcas7837miCAJnw=; b=j+tnRyRu4dL5MnR9IWsLIHOwPjVfixe3Aa3UO9i47y4CoBCKSELpH7Cnt8VbShOMC8 lE+2M4DCi9M2aR6tfk+VlRUiWlnbmiFxAfw8c67aEE7vl9Jt4wDaUhdcouJBIBuiNVqP GG/GWR+4ZIbE7weKpbkQpPYqyIesv1Lq3d8ACEoaBq7SLIfemlULQ4XNQB6KG90zv6Kh cDs2mjJU8isy1lLnoUDoXXg1nMH00uACo1MDWjiBiTv00Byz9q267LF0z2N3wYiuhCZR OZCTNi1AcfM85EayyqBNpkjKnHc7Jb0v3ZqRq68zvwEvepRMbRMUO1PTRQBge+WT6Hlw dyrA== MIME-Version: 1.0 X-Received: by 10.50.43.227 with SMTP id z3mr7599303igl.22.1441901890736; Thu, 10 Sep 2015 09:18:10 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.28.208 with HTTP; Thu, 10 Sep 2015 09:18:10 -0700 (PDT) In-Reply-To: References: <201509100405.t8A45xrJ070199@repo.freebsd.org> Date: Thu, 10 Sep 2015 09:18:10 -0700 X-Google-Sender-Auth: nGVRgWmFaUNvzuRsoJwpFzOTDU0 Message-ID: Subject: Re: svn commit: r287606 - head/sys/kern From: Adrian Chadd To: Warner Losh Cc: Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 16:18:11 -0000 On 10 September 2015 at 09:04, Warner Losh wrote: > > > On Thu, Sep 10, 2015 at 9:53 AM, Ed Maste wrote: >> >> On 10 September 2015 at 04:05, Adrian Chadd wrote: >> > Author: adrian >> > Date: Thu Sep 10 04:05:58 2015 >> > New Revision: 287606 >> > URL: https://svnweb.freebsd.org/changeset/base/287606 >> > >> > Log: >> > Also make kern.maxfilesperproc a boot time tunable. >> > ... >> > TODO: >> >> Also "we" should >> * Submit patches upstream or to the ports tree to use closefrom > > > I thought the consensus was that we'd fix things to have fewer FDs > by default, but instead allow individual processes to raise it via the > usual methods. I'm looking at how to do this in a somewhat sensible fashion. Right now we just have openfiles=unlimited; in /etc/login.conf which seems a little odd. I don't know yet if that affects the default set that services started via /etc/rc get - init gets the whole default maxfilesperproc and stuff seems to inherit from that unless told otherwise. I think the more sensible default would be: * set /etc/login.conf to some much lower values - say, 4k soft, 64k hard; * root can always override its settings up to kern.maxfilesperproc; * modify /etc/rc to set some default rlimits as appropriate; * introduce configuration options ({daemon_rlimit_XXX}?) in /etc/rc.conf that lets someone override what the default rlimits should be for a given process,, as (and I'm not making this up) if you run 'service XXX restart' from a root login you get the rlimits from the shell, which may differ from the system startup. That way we can setup various services to have higher openfile limits via /etc/rc.conf entries for those services rather than having to hack each startup script. It also means that no matter what is running 'service XXX YYY' as root, you'll get the 'correct'(er) rlimits. Thoughts? -adrian From owner-svn-src-head@freebsd.org Thu Sep 10 17:46:52 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A3FCA00D4C; Thu, 10 Sep 2015 17:46:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E1EEC1ED8; Thu, 10 Sep 2015 17:46:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8AHkpOT012086; Thu, 10 Sep 2015 17:46:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8AHknft012076; Thu, 10 Sep 2015 17:46:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509101746.t8AHknft012076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 10 Sep 2015 17:46:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287625 - in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 mips/mips powerpc/powerpc sparc64/sparc64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 17:46:52 -0000 Author: kib Date: Thu Sep 10 17:46:48 2015 New Revision: 287625 URL: https://svnweb.freebsd.org/changeset/base/287625 Log: Do not hold the process around the vm_fault() call from the trap()s. The only operation which is prevented by the hold is the kernel stack swapout for the faulted thread, which should be fine to allow. Remove useless checks for NULL curproc or curproc->p_vmspace from the trap_pfault() wrappers on x86 and powerpc. Reviewed by: alc (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/amd64/amd64/trap.c head/sys/arm/arm/trap-v6.c head/sys/arm/arm/trap.c head/sys/arm64/arm64/trap.c head/sys/i386/i386/trap.c head/sys/mips/mips/trap.c head/sys/powerpc/powerpc/trap.c head/sys/sparc64/sparc64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Thu Sep 10 16:13:44 2015 (r287624) +++ head/sys/amd64/amd64/trap.c Thu Sep 10 17:46:48 2015 (r287625) @@ -625,7 +625,6 @@ trap_pfault(frame, usermode) int usermode; { vm_offset_t va; - struct vmspace *vm; vm_map_t map; int rv = 0; vm_prot_t ftype; @@ -687,14 +686,7 @@ trap_pfault(frame, usermode) map = kernel_map; } else { - /* - * This is a fault on non-kernel virtual memory. If either - * p or p->p_vmspace is NULL, then the fault is fatal. - */ - if (p == NULL || (vm = p->p_vmspace) == NULL) - goto nogo; - - map = &vm->vm_map; + map = &p->p_vmspace->vm_map; /* * When accessing a usermode address, kernel must be @@ -729,28 +721,8 @@ trap_pfault(frame, usermode) else ftype = VM_PROT_READ; - if (map != kernel_map) { - /* - * Keep swapout from messing with us during this - * critical time. - */ - PROC_LOCK(p); - ++p->p_lock; - PROC_UNLOCK(p); - - /* Fault in the user page: */ - rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); - } else { - /* - * Don't have to worry about process locking or stacks in the - * kernel. - */ - rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - } + /* Fault in the page. */ + rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); if (rv == KERN_SUCCESS) { #ifdef HWPMC_HOOKS if (ftype == VM_PROT_READ || ftype == VM_PROT_WRITE) { Modified: head/sys/arm/arm/trap-v6.c ============================================================================== --- head/sys/arm/arm/trap-v6.c Thu Sep 10 16:13:44 2015 (r287624) +++ head/sys/arm/arm/trap-v6.c Thu Sep 10 17:46:48 2015 (r287625) @@ -500,28 +500,9 @@ abort_handler(struct trapframe *tf, int onfault = pcb->pcb_onfault; pcb->pcb_onfault = NULL; #endif - if (map != kernel_map) { - /* - * Keep swapout from messing with us during this - * critical time. - */ - PROC_LOCK(p); - ++p->p_lock; - PROC_UNLOCK(p); - - /* Fault in the user page: */ - rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); - } else { - /* - * Don't have to worry about process locking or stacks in the - * kernel. - */ - rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - } + + /* Fault in the page. */ + rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); #ifdef INVARIANTS pcb->pcb_onfault = onfault; Modified: head/sys/arm/arm/trap.c ============================================================================== --- head/sys/arm/arm/trap.c Thu Sep 10 16:13:44 2015 (r287624) +++ head/sys/arm/arm/trap.c Thu Sep 10 17:46:48 2015 (r287625) @@ -365,19 +365,8 @@ abort_handler(struct trapframe *tf, int onfault = pcb->pcb_onfault; pcb->pcb_onfault = NULL; - if (map != kernel_map) { - PROC_LOCK(p); - p->p_lock++; - PROC_UNLOCK(p); - } error = vm_fault(map, va, ftype, VM_FAULT_NORMAL); pcb->pcb_onfault = onfault; - - if (map != kernel_map) { - PROC_LOCK(p); - p->p_lock--; - PROC_UNLOCK(p); - } if (__predict_true(error == 0)) goto out; fatal_pagefault: @@ -682,20 +671,8 @@ prefetch_abort_handler(struct trapframe if (pmap_fault_fixup(map->pmap, va, VM_PROT_READ, 1)) goto out; - if (map != kernel_map) { - PROC_LOCK(p); - p->p_lock++; - PROC_UNLOCK(p); - } - error = vm_fault(map, va, VM_PROT_READ | VM_PROT_EXECUTE, VM_FAULT_NORMAL); - if (map != kernel_map) { - PROC_LOCK(p); - p->p_lock--; - PROC_UNLOCK(p); - } - if (__predict_true(error == 0)) goto out; Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Thu Sep 10 16:13:44 2015 (r287624) +++ head/sys/arm64/arm64/trap.c Thu Sep 10 17:46:48 2015 (r287625) @@ -190,29 +190,8 @@ data_abort(struct trapframe *frame, uint va = trunc_page(far); ftype = ((esr >> 6) & 1) ? VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ; - if (map != kernel_map) { - /* - * Keep swapout from messing with us during this - * critical time. - */ - PROC_LOCK(p); - ++p->p_lock; - PROC_UNLOCK(p); - - /* Fault in the user page: */ - error = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); - } else { - /* - * Don't have to worry about process locking or stacks in the - * kernel. - */ - error = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - } - + /* Fault in the page. */ + error = vm_fault(map, va, ftype, VM_FAULT_NORMAL); if (error != KERN_SUCCESS) { if (lower) { sig = SIGSEGV; Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Thu Sep 10 16:13:44 2015 (r287624) +++ head/sys/i386/i386/trap.c Thu Sep 10 17:46:48 2015 (r287625) @@ -782,7 +782,6 @@ trap_pfault(frame, usermode, eva) vm_offset_t eva; { vm_offset_t va; - struct vmspace *vm; vm_map_t map; int rv = 0; vm_prot_t ftype; @@ -852,14 +851,7 @@ trap_pfault(frame, usermode, eva) map = kernel_map; } else { - /* - * This is a fault on non-kernel virtual memory. If either - * p or p->p_vmspace is NULL, then the fault is fatal. - */ - if (p == NULL || (vm = p->p_vmspace) == NULL) - goto nogo; - - map = &vm->vm_map; + map = &p->p_vmspace->vm_map; /* * When accessing a user-space address, kernel must be @@ -888,28 +880,8 @@ trap_pfault(frame, usermode, eva) else ftype = VM_PROT_READ; - if (map != kernel_map) { - /* - * Keep swapout from messing with us during this - * critical time. - */ - PROC_LOCK(p); - ++p->p_lock; - PROC_UNLOCK(p); - - /* Fault in the user page: */ - rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); - } else { - /* - * Don't have to worry about process locking or stacks in the - * kernel. - */ - rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - } + /* Fault in the page. */ + rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); if (rv == KERN_SUCCESS) { #ifdef HWPMC_HOOKS if (ftype == VM_PROT_READ || ftype == VM_PROT_WRITE) { Modified: head/sys/mips/mips/trap.c ============================================================================== --- head/sys/mips/mips/trap.c Thu Sep 10 16:13:44 2015 (r287624) +++ head/sys/mips/mips/trap.c Thu Sep 10 17:46:48 2015 (r287625) @@ -714,19 +714,7 @@ dofault: goto nogo; } - /* - * Keep swapout from messing with us during this - * critical time. - */ - PROC_LOCK(p); - ++p->p_lock; - PROC_UNLOCK(p); - rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); /* * XXXDTRACE: add dtrace_doubletrap_func here? */ Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Thu Sep 10 16:13:44 2015 (r287624) +++ head/sys/powerpc/powerpc/trap.c Thu Sep 10 17:46:48 2015 (r287625) @@ -704,9 +704,6 @@ trap_pfault(struct trapframe *frame, int #else if ((eva >> ADDR_SR_SHFT) == (USER_ADDR >> ADDR_SR_SHFT)) { #endif - if (p->p_vmspace == NULL) - return (SIGSEGV); - map = &p->p_vmspace->vm_map; #ifdef AIM @@ -720,31 +717,11 @@ trap_pfault(struct trapframe *frame, int } va = trunc_page(eva); - if (map != kernel_map) { - /* - * Keep swapout from messing with us during this - * critical time. - */ - PROC_LOCK(p); - ++p->p_lock; - PROC_UNLOCK(p); - - /* Fault in the user page: */ - rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); - /* - * XXXDTRACE: add dtrace_doubletrap_func here? - */ - } else { - /* - * Don't have to worry about process locking or stacks in the - * kernel. - */ - rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - } + /* Fault in the page. */ + rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); + /* + * XXXDTRACE: add dtrace_doubletrap_func here? + */ if (rv == KERN_SUCCESS) return (0); Modified: head/sys/sparc64/sparc64/trap.c ============================================================================== --- head/sys/sparc64/sparc64/trap.c Thu Sep 10 16:13:44 2015 (r287624) +++ head/sys/sparc64/sparc64/trap.c Thu Sep 10 17:46:48 2015 (r287625) @@ -441,7 +441,7 @@ trap_cecc(void) static int trap_pfault(struct thread *td, struct trapframe *tf) { - struct vmspace *vm; + vm_map_t map; struct proc *p; vm_offset_t va; vm_prot_t prot; @@ -484,28 +484,8 @@ trap_pfault(struct thread *td, struct tr return (0); } - /* - * This is a fault on non-kernel virtual memory. - */ - vm = p->p_vmspace; - - /* - * Keep swapout from messing with us during this - * critical time. - */ - PROC_LOCK(p); - ++p->p_lock; - PROC_UNLOCK(p); - - /* Fault in the user page. */ - rv = vm_fault(&vm->vm_map, va, prot, VM_FAULT_NORMAL); - - /* - * Now the process can be swapped again. - */ - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); + /* This is a fault on non-kernel virtual memory. */ + map = &p->p_vmspace->vm_map; } else { /* * This is a fault on kernel virtual memory. Attempts to @@ -527,14 +507,12 @@ trap_pfault(struct thread *td, struct tr } vm_map_unlock_read(kernel_map); } - - /* - * We don't have to worry about process locking or stacks in - * the kernel. - */ - rv = vm_fault(kernel_map, va, prot, VM_FAULT_NORMAL); + map = kernel_map; } + /* Fault in the page. */ + rv = vm_fault(map, va, prot, VM_FAULT_NORMAL); + CTR3(KTR_TRAP, "trap_pfault: return td=%p va=%#lx rv=%d", td, va, rv); if (rv == KERN_SUCCESS) From owner-svn-src-head@freebsd.org Thu Sep 10 17:53:28 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01599A01133; Thu, 10 Sep 2015 17:53:28 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D3E34131A; Thu, 10 Sep 2015 17:53:27 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t8AHrPiR009748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 10 Sep 2015 10:53:25 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t8AHrOGI009747; Thu, 10 Sep 2015 10:53:24 -0700 (PDT) (envelope-from jmg) Date: Thu, 10 Sep 2015 10:53:24 -0700 From: John-Mark Gurney To: Adrian Chadd Cc: Warner Losh , Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r287606 - head/sys/kern Message-ID: <20150910175324.GW33167@funkthat.com> References: <201509100405.t8A45xrJ070199@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Thu, 10 Sep 2015 10:53:25 -0700 (PDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 17:53:28 -0000 Adrian Chadd wrote this message on Thu, Sep 10, 2015 at 09:18 -0700: > On 10 September 2015 at 09:04, Warner Losh wrote: > > > > > > On Thu, Sep 10, 2015 at 9:53 AM, Ed Maste wrote: > >> > >> On 10 September 2015 at 04:05, Adrian Chadd wrote: > >> > Author: adrian > >> > Date: Thu Sep 10 04:05:58 2015 > >> > New Revision: 287606 > >> > URL: https://svnweb.freebsd.org/changeset/base/287606 > >> > > >> > Log: > >> > Also make kern.maxfilesperproc a boot time tunable. > >> > ... > >> > TODO: > >> > >> Also "we" should > >> * Submit patches upstream or to the ports tree to use closefrom > > > > > > I thought the consensus was that we'd fix things to have fewer FDs > > by default, but instead allow individual processes to raise it via the > > usual methods. > > I'm looking at how to do this in a somewhat sensible fashion. Right > now we just have openfiles=unlimited; in /etc/login.conf which seems a > little odd. I don't know yet if that affects the default set that > services started via /etc/rc get - init gets the whole default > maxfilesperproc and stuff seems to inherit from that unless told > otherwise. > > I think the more sensible default would be: > > * set /etc/login.conf to some much lower values - say, 4k soft, 64k hard; > * root can always override its settings up to kern.maxfilesperproc; > * modify /etc/rc to set some default rlimits as appropriate; We should probably just use the daemon class from login.conf... Do we have a program that will set the current limits to a specified class? > * introduce configuration options ({daemon_rlimit_XXX}?) in > /etc/rc.conf that lets someone override what the default rlimits > should be for a given process,, as (and I'm not making this up) if you > run 'service XXX restart' from a root login you get the rlimits from > the shell, which may differ from the system startup. Why not daemon_login_class w/ the above? > That way we can setup various services to have higher openfile limits > via /etc/rc.conf entries for those services rather than having to hack > each startup script. It also means that no matter what is running > 'service XXX YYY' as root, you'll get the 'correct'(er) rlimits. Then service would just use the above program to get sane defaults... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@freebsd.org Thu Sep 10 17:59:01 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11C5CA0136D; Thu, 10 Sep 2015 17:59:01 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) by mx1.freebsd.org (Postfix) with ESMTP id DBA4215F9; Thu, 10 Sep 2015 17:59:00 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (unknown [10.1.1.2]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id 4518197C0; Thu, 10 Sep 2015 17:58:59 +0000 (UTC) Subject: Re: svn commit: r287606 - head/sys/kern To: John-Mark Gurney , Adrian Chadd References: <201509100405.t8A45xrJ070199@repo.freebsd.org> <20150910175324.GW33167@funkthat.com> Cc: Warner Losh , Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Allan Jude X-Enigmail-Draft-Status: N1110 Message-ID: <55F1C533.6010302@freebsd.org> Date: Thu, 10 Sep 2015 14:00:19 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20150910175324.GW33167@funkthat.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OVsK20f3VAnQKkeHUaUV8MLduGhJaTxrC" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 17:59:01 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --OVsK20f3VAnQKkeHUaUV8MLduGhJaTxrC Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 2015-09-10 13:53, John-Mark Gurney wrote: > Adrian Chadd wrote this message on Thu, Sep 10, 2015 at 09:18 -0700: >> On 10 September 2015 at 09:04, Warner Losh wrote: >>> >>> >>> On Thu, Sep 10, 2015 at 9:53 AM, Ed Maste wrote:= >>>> >>>> On 10 September 2015 at 04:05, Adrian Chadd wro= te: >>>>> Author: adrian >>>>> Date: Thu Sep 10 04:05:58 2015 >>>>> New Revision: 287606 >>>>> URL: https://svnweb.freebsd.org/changeset/base/287606 >>>>> >>>>> Log: >>>>> Also make kern.maxfilesperproc a boot time tunable. >>>>> ... >>>>> TODO: >>>> >>>> Also "we" should >>>> * Submit patches upstream or to the ports tree to use closefrom >>> >>> >>> I thought the consensus was that we'd fix things to have fewer FDs >>> by default, but instead allow individual processes to raise it via th= e >>> usual methods. >> >> I'm looking at how to do this in a somewhat sensible fashion. Right >> now we just have openfiles=3Dunlimited; in /etc/login.conf which seems= a >> little odd. I don't know yet if that affects the default set that >> services started via /etc/rc get - init gets the whole default >> maxfilesperproc and stuff seems to inherit from that unless told >> otherwise. >> >> I think the more sensible default would be: >> >> * set /etc/login.conf to some much lower values - say, 4k soft, 64k h= ard; >> * root can always override its settings up to kern.maxfilesperproc; >> * modify /etc/rc to set some default rlimits as appropriate; >=20 > We should probably just use the daemon class from login.conf... Do we > have a program that will set the current limits to a specified class? >=20 /sbin/init applies the 'daemon' class to /etc/rc when it starts it And so all rc.d scripts inherit it. the issue is that it does not apply to services started manually, or via the service(8) command. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D161401 (reported in 2011, working on getting this in this weekend) >> * introduce configuration options ({daemon_rlimit_XXX}?) in >> /etc/rc.conf that lets someone override what the default rlimits >> should be for a given process,, as (and I'm not making this up) if you= >> run 'service XXX restart' from a root login you get the rlimits from >> the shell, which may differ from the system startup. >=20 > Why not daemon_login_class w/ the above? This is what I was thinking, as it also jives with my work to convert login.conf to UCL and improve it overall. This would allow services to install their own login class as part of the package, into /usr/local/etc/login.conf.d/pkgname and use that by default, but the user can always specify pkgname_login_class (or just _class maybe?) as some other value. >=20 >> That way we can setup various services to have higher openfile limits >> via /etc/rc.conf entries for those services rather than having to hack= >> each startup script. It also means that no matter what is running >> 'service XXX YYY' as root, you'll get the 'correct'(er) rlimits. >=20 > Then service would just use the above program to get sane defaults... >=20 --=20 Allan Jude --OVsK20f3VAnQKkeHUaUV8MLduGhJaTxrC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (MingW32) iQIcBAEBAgAGBQJV8cU2AAoJEBmVNT4SmAt+0c4QAMCqjdFBWLI99VOFz67q/UNy 72w4Yvw2vmbuTT5Q5EIX8kKUyWJx09/2ONsgKXbwryHMubp6fAEDPeJzm1HWraVr MNyD8MChJo/e7hKwAFd83KZywXeFjMyzGqPMCmUvTeXwSFPwhlsS1UEtDn5Ilvkk WGbZKc2LhjGVdmO1n5T46mJKW30HKBdlCJbxLguxsEqfscdDmsoLF//62J8Iqzet 46gQne1rnWXtLbw5XOBFASlSjBXcozqtzuXtFiuZiWyXHl9i+32aeIIf+sc0O8o7 AXnO2GHssrRQd52TPxvQ6iOQnKfwEcUCdoBg7pUecCO8LGFRcLTQzrLlIb5pm9+R fE4A2Zw21nw+5sxGRjd7oWgRshQ7hlpw76Ql63emcv/iOd13mMKcaoGzZs1o9C4I ElihRBNUgvgjiz/4wwQFIqyTm0aOqgyg05AQNOEz7Hg5kH9UnaFVdbfCIF7i0qOz MuHQCSNTBByBo9toSB+BNUofpgaNMe3olPcrxirIMMs/Y1+gbbm/yt6rsDKmdwYR gqnPm2xsBlj6qMZNbU+AoCezEQlCFkYVNUMuoKE3ZFnaMTKQwVk2HWx/APmO3p1u bVr/AF/2lrdjsl5mkUp2h5CNWA8SeZcUpdpd57asxFVzl9PR0uhzeRHXpsp0wSjS 8/3pHO3qULatBPMSrL46 =El1I -----END PGP SIGNATURE----- --OVsK20f3VAnQKkeHUaUV8MLduGhJaTxrC-- From owner-svn-src-head@freebsd.org Thu Sep 10 19:56:34 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25093A0114D; Thu, 10 Sep 2015 19:56:34 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id 083D715EA; Thu, 10 Sep 2015 19:56:34 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from marvin.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id C965356483; Thu, 10 Sep 2015 14:56:32 -0500 (CDT) Subject: Re: svn commit: r287606 - head/sys/kern To: John-Mark Gurney , Adrian Chadd References: <201509100405.t8A45xrJ070199@repo.freebsd.org> <20150910175324.GW33167@funkthat.com> Cc: Warner Losh , Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Eric van Gyzen Message-ID: <55F1E06F.7000008@FreeBSD.org> Date: Thu, 10 Sep 2015 14:56:31 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20150910175324.GW33167@funkthat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 19:56:34 -0000 On 09/10/2015 12:53, John-Mark Gurney wrote: > Adrian Chadd wrote this message on Thu, Sep 10, 2015 at 09:18 -0700: >> On 10 September 2015 at 09:04, Warner Losh wrote: >>> >>> >>> On Thu, Sep 10, 2015 at 9:53 AM, Ed Maste wrote: >>>> >>>> On 10 September 2015 at 04:05, Adrian Chadd wrote: >>>>> Author: adrian >>>>> Date: Thu Sep 10 04:05:58 2015 >>>>> New Revision: 287606 >>>>> URL: https://svnweb.freebsd.org/changeset/base/287606 >>>>> >>>>> Log: >>>>> Also make kern.maxfilesperproc a boot time tunable. >>>>> ... >>>>> TODO: >>>> >>>> Also "we" should >>>> * Submit patches upstream or to the ports tree to use closefrom >>> >>> >>> I thought the consensus was that we'd fix things to have fewer FDs >>> by default, but instead allow individual processes to raise it via the >>> usual methods. We could--and should--do both, because they're both good ideas. >> I'm looking at how to do this in a somewhat sensible fashion. Right >> now we just have openfiles=unlimited; in /etc/login.conf which seems a >> little odd. I don't know yet if that affects the default set that >> services started via /etc/rc get - init gets the whole default >> maxfilesperproc and stuff seems to inherit from that unless told >> otherwise. >> >> I think the more sensible default would be: >> >> * set /etc/login.conf to some much lower values - say, 4k soft, 64k hard; >> * root can always override its settings up to kern.maxfilesperproc; >> * modify /etc/rc to set some default rlimits as appropriate; > > We should probably just use the daemon class from login.conf... Do we > have a program that will set the current limits to a specified class? See limits(1). The apache rc.d script uses it, along with some related rc.conf variables. >> * introduce configuration options ({daemon_rlimit_XXX}?) in >> /etc/rc.conf that lets someone override what the default rlimits >> should be for a given process,, as (and I'm not making this up) if you >> run 'service XXX restart' from a root login you get the rlimits from >> the shell, which may differ from the system startup. > > Why not daemon_login_class w/ the above? > >> That way we can setup various services to have higher openfile limits >> via /etc/rc.conf entries for those services rather than having to hack >> each startup script. It also means that no matter what is running >> 'service XXX YYY' as root, you'll get the 'correct'(er) rlimits. > > Then service would just use the above program to get sane defaults... > From owner-svn-src-head@freebsd.org Thu Sep 10 21:14:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C576FA017B8; Thu, 10 Sep 2015 21:14:23 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id A2DD81061; Thu, 10 Sep 2015 21:14:23 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t8ALEHoY014117 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 10 Sep 2015 14:14:17 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t8ALEHtc014116; Thu, 10 Sep 2015 14:14:17 -0700 (PDT) (envelope-from jmg) Date: Thu, 10 Sep 2015 14:14:17 -0700 From: John-Mark Gurney To: Eric van Gyzen Cc: Adrian Chadd , Warner Losh , Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r287606 - head/sys/kern Message-ID: <20150910211417.GY33167@funkthat.com> References: <201509100405.t8A45xrJ070199@repo.freebsd.org> <20150910175324.GW33167@funkthat.com> <55F1E06F.7000008@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55F1E06F.7000008@FreeBSD.org> X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Thu, 10 Sep 2015 14:14:17 -0700 (PDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 21:14:23 -0000 Eric van Gyzen wrote this message on Thu, Sep 10, 2015 at 14:56 -0500: > On 09/10/2015 12:53, John-Mark Gurney wrote: > > Adrian Chadd wrote this message on Thu, Sep 10, 2015 at 09:18 -0700: > >> On 10 September 2015 at 09:04, Warner Losh wrote: > >>> > >>> > >>> On Thu, Sep 10, 2015 at 9:53 AM, Ed Maste wrote: > >>>> > >>>> On 10 September 2015 at 04:05, Adrian Chadd wrote: > >>>>> Author: adrian > >>>>> Date: Thu Sep 10 04:05:58 2015 > >>>>> New Revision: 287606 > >>>>> URL: https://svnweb.freebsd.org/changeset/base/287606 > >>>>> > >>>>> Log: > >>>>> Also make kern.maxfilesperproc a boot time tunable. > >>>>> ... > >>>>> TODO: > >>>> > >>>> Also "we" should > >>>> * Submit patches upstream or to the ports tree to use closefrom > >>> > >>> > >>> I thought the consensus was that we'd fix things to have fewer FDs > >>> by default, but instead allow individual processes to raise it via the > >>> usual methods. > > We could--and should--do both, because they're both good ideas. > > >> I'm looking at how to do this in a somewhat sensible fashion. Right > >> now we just have openfiles=unlimited; in /etc/login.conf which seems a > >> little odd. I don't know yet if that affects the default set that > >> services started via /etc/rc get - init gets the whole default > >> maxfilesperproc and stuff seems to inherit from that unless told > >> otherwise. > >> > >> I think the more sensible default would be: > >> > >> * set /etc/login.conf to some much lower values - say, 4k soft, 64k hard; > >> * root can always override its settings up to kern.maxfilesperproc; > >> * modify /etc/rc to set some default rlimits as appropriate; > > > > We should probably just use the daemon class from login.conf... Do we > > have a program that will set the current limits to a specified class? > > See limits(1). The apache rc.d script uses it, along with some related > rc.conf variables. So, one issue w/ limits is that it only does the limits side of things, not environment or cpusets... see: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=161401 limits doesn't address PATH and other environment variables... We should have rc.subr setup the environment completely when executing the daemon/scripts instead of depending upon any of this.. It turns out that init doesn't setup the environment vars provided by login.config either... > >> * introduce configuration options ({daemon_rlimit_XXX}?) in > >> /etc/rc.conf that lets someone override what the default rlimits > >> should be for a given process,, as (and I'm not making this up) if you > >> run 'service XXX restart' from a root login you get the rlimits from > >> the shell, which may differ from the system startup. > > > > Why not daemon_login_class w/ the above? > > > >> That way we can setup various services to have higher openfile limits > >> via /etc/rc.conf entries for those services rather than having to hack > >> each startup script. It also means that no matter what is running > >> 'service XXX YYY' as root, you'll get the 'correct'(er) rlimits. > > > > Then service would just use the above program to get sane defaults... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@freebsd.org Thu Sep 10 21:41:12 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52B8BA02364; Thu, 10 Sep 2015 21:41:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4194A1BF1; Thu, 10 Sep 2015 21:41:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8ALfCFb010510; Thu, 10 Sep 2015 21:41:12 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8ALfC82010509; Thu, 10 Sep 2015 21:41:12 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509102141.t8ALfC82010509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 10 Sep 2015 21:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287631 - head/sys/dev/cxgbe/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 21:41:12 -0000 Author: jhb Date: Thu Sep 10 21:41:11 2015 New Revision: 287631 URL: https://svnweb.freebsd.org/changeset/base/287631 Log: Add a comment that to clarify how to determine the amount of received DDP data. Reviewed by: np Differential Revision: https://reviews.freebsd.org/D3619 Modified: head/sys/dev/cxgbe/tom/t4_ddp.c Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Thu Sep 10 21:08:54 2015 (r287630) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Thu Sep 10 21:41:11 2015 (r287631) @@ -405,6 +405,19 @@ handle_ddp_data(struct toepcb *toep, __b } tp = intotcpcb(inp); + + /* + * For RX_DDP_COMPLETE, len will be zero and rcv_nxt is the + * sequence number of the next byte to receive. The length of + * the data received for this message must be computed by + * comparing the new and old values of rcv_nxt. + * + * For RX_DATA_DDP, len might be non-zero, but it is only the + * length of the most recent DMA. It does not include the + * total length of the data received since the previous update + * for this DDP buffer. rcv_nxt is the sequence number of the + * first received byte from the most recent DMA. + */ len += be32toh(rcv_nxt) - tp->rcv_nxt; tp->rcv_nxt += len; tp->t_rcvtime = ticks; From owner-svn-src-head@freebsd.org Thu Sep 10 22:02:47 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99E5EA02A76; Thu, 10 Sep 2015 22:02:47 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x22a.google.com (mail-ig0-x22a.google.com [IPv6:2607:f8b0:4001:c05::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BAD914EF; Thu, 10 Sep 2015 22:02:47 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by igbni9 with SMTP id ni9so26370275igb.0; Thu, 10 Sep 2015 15:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=leeGlz1KgTj5ZKHNGypchLs9EYOPH3DtAV9xY1q2O8o=; b=L/FjgyYgUG7bGKm1OvbXygC9YR7YEqprL9Ujgiux71hsiaEmSWImMOGMqvUgYFUFjy lTi2A78CTuZ0iZdUh4pFILl43Q5Knl0F9G7cp37kII295WMUJi3ACM/ubEjCEeSy8EPY IS98ktu449ZlItQrccKgDIB090kBrECPi26299s+khyxM2Dk0doN7oxCzv4RhVVQC/Xd YDaRUuRmBPS37MpfXPLrGQgBX/erZFa6ebtfL3DXLiLnW49zY3Zo8frFuYvUliJqKgq+ rRo5k+714jEOz/euM379IegLs804CX5XN7zftXvk/jvAdVj5jmB5P5M3DIsBTQlV0+8a Ck8A== MIME-Version: 1.0 X-Received: by 10.51.17.37 with SMTP id gb5mr541643igd.37.1441922566227; Thu, 10 Sep 2015 15:02:46 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.28.208 with HTTP; Thu, 10 Sep 2015 15:02:46 -0700 (PDT) In-Reply-To: <20150910211417.GY33167@funkthat.com> References: <201509100405.t8A45xrJ070199@repo.freebsd.org> <20150910175324.GW33167@funkthat.com> <55F1E06F.7000008@FreeBSD.org> <20150910211417.GY33167@funkthat.com> Date: Thu, 10 Sep 2015 15:02:46 -0700 X-Google-Sender-Auth: uH5QCqxTFErRcOBfpimIB2HqwJI Message-ID: Subject: Re: svn commit: r287606 - head/sys/kern From: Adrian Chadd To: John-Mark Gurney Cc: Eric van Gyzen , Warner Losh , Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 22:02:47 -0000 I'd love for rc.subr to grow the ability to set per-daemon cpuset, class, environment, etc. We have some of that in the rc script already. What I have so far for local hacking is this, which at least gets the default login class bits and runs things as user daemon. Yes, there are issues with inheriting the environment and other things from the callee - I think that's a separate issue to solve. Thanks, -a adrian@hulk:~/work/freebsd/head/src % svn diff etc Index: etc/login.conf =================================================================== --- etc/login.conf (revision 28758) +++ etc/login.conf (working copy) @@ -36,7 +36,8 @@ :memoryuse=unlimited:\ :filesize=unlimited:\ :coredumpsize=unlimited:\ - :openfiles=unlimited:\ + :openfiles-cur=4096:\ + :openfiles-max=65536:\ :maxproc=unlimited:\ :sbsize=unlimited:\ :vmemoryuse=unlimited:\ @@ -61,6 +62,8 @@ :tc=default: daemon:\ :memorylocked=128M:\ + :openfiles-cur=32768:\ + :openfiles-max=65536:\ :tc=default: news:\ :tc=default: Index: etc/rc.subr =================================================================== --- etc/rc.subr (revision 287580) +++ etc/rc.subr (working copy) @@ -768,6 +768,8 @@ # # ${name}_prepend n Command added before ${command}. # +# ${name}_login_class n Login class to use, else "daemon". +# # ${rc_arg}_cmd n If set, use this as the method when invoked; # Otherwise, use default command (see below) # @@ -942,8 +944,13 @@ _nice=\$${name}_nice _user=\$${name}_user \ _group=\$${name}_group _groups=\$${name}_groups \ _fib=\$${name}_fib _env=\$${name}_env \ - _prepend=\$${name}_prepend + _prepend=\$${name}_prepend _login_class=\$${name}_login_class + # Default to 'daemon' if no login class is provided + if [ -n "$_login_class" ]; then + _login_class="daemon" + fi + if [ -n "$_user" ]; then # unset $_user if running as that user if [ "$_user" = "$(eval $IDCMD)" ]; then unset _user @@ -1050,6 +1057,9 @@ fi fi + # Prepend default limits + _doit="limits -C $_login_class $_doit" + # run the full command # if ! _run_rc_doit "$_doit"; then On 10 September 2015 at 14:14, John-Mark Gurney wrote: > Eric van Gyzen wrote this message on Thu, Sep 10, 2015 at 14:56 -0500: >> On 09/10/2015 12:53, John-Mark Gurney wrote: >> > Adrian Chadd wrote this message on Thu, Sep 10, 2015 at 09:18 -0700: >> >> On 10 September 2015 at 09:04, Warner Losh wrote: >> >>> >> >>> >> >>> On Thu, Sep 10, 2015 at 9:53 AM, Ed Maste wrote: >> >>>> >> >>>> On 10 September 2015 at 04:05, Adrian Chadd wrote: >> >>>>> Author: adrian >> >>>>> Date: Thu Sep 10 04:05:58 2015 >> >>>>> New Revision: 287606 >> >>>>> URL: https://svnweb.freebsd.org/changeset/base/287606 >> >>>>> >> >>>>> Log: >> >>>>> Also make kern.maxfilesperproc a boot time tunable. >> >>>>> ... >> >>>>> TODO: >> >>>> >> >>>> Also "we" should >> >>>> * Submit patches upstream or to the ports tree to use closefrom >> >>> >> >>> >> >>> I thought the consensus was that we'd fix things to have fewer FDs >> >>> by default, but instead allow individual processes to raise it via the >> >>> usual methods. >> >> We could--and should--do both, because they're both good ideas. >> >> >> I'm looking at how to do this in a somewhat sensible fashion. Right >> >> now we just have openfiles=unlimited; in /etc/login.conf which seems a >> >> little odd. I don't know yet if that affects the default set that >> >> services started via /etc/rc get - init gets the whole default >> >> maxfilesperproc and stuff seems to inherit from that unless told >> >> otherwise. >> >> >> >> I think the more sensible default would be: >> >> >> >> * set /etc/login.conf to some much lower values - say, 4k soft, 64k hard; >> >> * root can always override its settings up to kern.maxfilesperproc; >> >> * modify /etc/rc to set some default rlimits as appropriate; >> > >> > We should probably just use the daemon class from login.conf... Do we >> > have a program that will set the current limits to a specified class? >> >> See limits(1). The apache rc.d script uses it, along with some related >> rc.conf variables. > > So, one issue w/ limits is that it only does the limits side of > things, not environment or cpusets... see: > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=161401 > > limits doesn't address PATH and other environment variables... > > We should have rc.subr setup the environment completely when executing > the daemon/scripts instead of depending upon any of this.. > > It turns out that init doesn't setup the environment vars provided by > login.config either... > >> >> * introduce configuration options ({daemon_rlimit_XXX}?) in >> >> /etc/rc.conf that lets someone override what the default rlimits >> >> should be for a given process,, as (and I'm not making this up) if you >> >> run 'service XXX restart' from a root login you get the rlimits from >> >> the shell, which may differ from the system startup. >> > >> > Why not daemon_login_class w/ the above? >> > >> >> That way we can setup various services to have higher openfile limits >> >> via /etc/rc.conf entries for those services rather than having to hack >> >> each startup script. It also means that no matter what is running >> >> 'service XXX YYY' as root, you'll get the 'correct'(er) rlimits. >> > >> > Then service would just use the above program to get sane defaults... > > -- > John-Mark Gurney Voice: +1 415 225 5579 > > "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@freebsd.org Thu Sep 10 22:07:54 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 464A3A02C60; Thu, 10 Sep 2015 22:07:54 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2AD3B1987; Thu, 10 Sep 2015 22:07:54 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8AM7s4P020946; Thu, 10 Sep 2015 22:07:54 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8AM7rrb020941; Thu, 10 Sep 2015 22:07:53 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509102207.t8AM7rrb020941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 10 Sep 2015 22:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287633 - head/usr.bin/systat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 22:07:54 -0000 Author: delphij Date: Thu Sep 10 22:07:52 2015 New Revision: 287633 URL: https://svnweb.freebsd.org/changeset/base/287633 Log: - Avoid accessing window properties directly, instead, use accessors. This should be no-op for now, but allows the code to work if we move to NCURSES_OPAQUE. - Use calloc() instead of malloc+bzero. MFC after: 2 weeks Modified: head/usr.bin/systat/iostat.c head/usr.bin/systat/netstat.c head/usr.bin/systat/pigs.c head/usr.bin/systat/vmstat.c Modified: head/usr.bin/systat/iostat.c ============================================================================== --- head/usr.bin/systat/iostat.c Thu Sep 10 22:07:38 2015 (r287632) +++ head/usr.bin/systat/iostat.c Thu Sep 10 22:07:52 2015 (r287633) @@ -112,10 +112,8 @@ initiostat(void) if ((num_devices = devstat_getnumdevs(NULL)) < 0) return(0); - cur.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); - last.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); - bzero(cur.dinfo, sizeof(struct devinfo)); - bzero(last.dinfo, sizeof(struct devinfo)); + cur.dinfo = calloc(1, sizeof(struct devinfo)); + last.dinfo = calloc(1, sizeof(struct devinfo)); /* * This value for maxshowdevs (100) is bogus. I'm not sure exactly @@ -196,7 +194,7 @@ numlabels(int row) char tmpstr[10]; #define COLWIDTH 17 -#define DRIVESPERLINE ((wnd->_maxx - INSET) / COLWIDTH) +#define DRIVESPERLINE ((getmaxx(wnd) - 1 - INSET) / COLWIDTH) for (ndrives = 0, i = 0; i < num_devices; i++) if (dev_select[i].selected) ndrives++; @@ -204,7 +202,7 @@ numlabels(int row) /* * Deduct -regions for blank line after each scrolling region. */ - linesperregion = (wnd->_maxy - row - regions) / regions; + linesperregion = (getmaxy(wnd) - 1 - row - regions) / regions; /* * Minimum region contains space for two * label lines and one line of statistics. @@ -214,9 +212,9 @@ numlabels(int row) _col = INSET; for (i = 0; i < num_devices; i++) if (dev_select[i].selected) { - if (_col + COLWIDTH >= wnd->_maxx - INSET) { + if (_col + COLWIDTH >= getmaxx(wnd) - 1 - INSET) { _col = INSET, row += linesperregion + 1; - if (row > wnd->_maxy - (linesperregion + 1)) + if (row > getmaxy(wnd) - 1 - (linesperregion + 1)) break; } sprintf(tmpstr, "%s%d", dev_select[i].device_name, @@ -241,7 +239,7 @@ barlabels(int row) linesperregion = 2 + kbpt; for (i = 0; i < num_devices; i++) if (dev_select[i].selected) { - if (row > wnd->_maxy - linesperregion) + if (row > getmaxy(wnd) - 1 - linesperregion) break; sprintf(tmpstr, "%s%d", dev_select[i].device_name, dev_select[i].unit_number); @@ -276,7 +274,7 @@ showiostat(void) row += 2; for (i = 0; i < num_devices; i++) if (dev_select[i].selected) { - if (row > wnd->_maxy - linesperregion) + if (row > getmaxy(wnd) - linesperregion) break; row = devstats(row, INSET, i); } @@ -289,9 +287,9 @@ showiostat(void) winsertln(wnd); for (i = 0; i < num_devices; i++) if (dev_select[i].selected) { - if (_col + COLWIDTH >= wnd->_maxx - INSET) { + if (_col + COLWIDTH >= getmaxx(wnd) - 1 - INSET) { _col = INSET, row += linesperregion + 1; - if (row > wnd->_maxy - (linesperregion + 1)) + if (row > getmaxy(wnd) - 1 - (linesperregion + 1)) break; wmove(wnd, row + linesperregion, 0); wdeleteln(wnd); Modified: head/usr.bin/systat/netstat.c ============================================================================== --- head/usr.bin/systat/netstat.c Thu Sep 10 22:07:38 2015 (r287632) +++ head/usr.bin/systat/netstat.c Thu Sep 10 22:07:52 2015 (r287633) @@ -85,7 +85,7 @@ static char *inetname(struct sockaddr *) static void inetprint(struct sockaddr *, const char *); #define streq(a,b) (strcmp(a,b)==0) -#define YMAX(w) ((w)->_maxy-1) +#define YMAX(w) (getmaxy(w)-2) WINDOW * opennetstat(void) Modified: head/usr.bin/systat/pigs.c ============================================================================== --- head/usr.bin/systat/pigs.c Thu Sep 10 22:07:38 2015 (r287632) +++ head/usr.bin/systat/pigs.c Thu Sep 10 22:07:52 2015 (r287633) @@ -94,8 +94,8 @@ showpigs(void) qsort(pt, nproc, sizeof (struct p_times), compar); y = 1; i = nproc; - if (i > wnd->_maxy-1) - i = wnd->_maxy-1; + if (i > getmaxy(wnd)-2) + i = getmaxy(wnd)-2; for (k = 0; i > 0 && pt[k].pt_pctcpu > 0.01; i--, y++, k++) { uname = user_from_uid(pt[k].pt_kp->ki_uid, 0); pname = pt[k].pt_kp->ki_comm; Modified: head/usr.bin/systat/vmstat.c ============================================================================== --- head/usr.bin/systat/vmstat.c Thu Sep 10 22:07:38 2015 (r287632) +++ head/usr.bin/systat/vmstat.c Thu Sep 10 22:07:52 2015 (r287633) @@ -205,12 +205,9 @@ initkre(void) return(0); } - cur.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); - last.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); - run.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); - bzero(cur.dinfo, sizeof(struct devinfo)); - bzero(last.dinfo, sizeof(struct devinfo)); - bzero(run.dinfo, sizeof(struct devinfo)); + cur.dinfo = calloc(1, sizeof(struct devinfo)); + last.dinfo = calloc(1, sizeof(struct devinfo)); + run.dinfo = calloc(1, sizeof(struct devinfo)); if (dsinit(MAXDRIVES, &cur, &last, &run) != 1) return(0); From owner-svn-src-head@freebsd.org Thu Sep 10 22:11:40 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 015AEA02E3E; Thu, 10 Sep 2015 22:11:40 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x22e.google.com (mail-ig0-x22e.google.com [IPv6:2607:f8b0:4001:c05::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BBD2A1EAE; Thu, 10 Sep 2015 22:11:39 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by igcrk20 with SMTP id rk20so28145610igc.1; Thu, 10 Sep 2015 15:11:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=fLFZtDspTOOAAR/s/e7lsvqUUj9LF9+kTS5U+zyz4Yg=; b=N2Jea8nNd7B3/1kP6dv26Pnswjlh74aKHUeXBe6NIpBt7P6D0+me9/rdwMt09ikDTs d2EwvSuyvPZaPm1Er+DHNV8aMbhg0VTFyhtNP47EvCxPxQNW/HMLLwRyhIxS4ZUL2h1S 5MOBK9LrtNAtmSArmDyl7osErFC2EZtriAcIdD/t2r6fpm2omqKIM1AdcpVd6OMnvJVv OQJQDVBYx4Dj9Ey0b9ktoTNPrKzO0o/m/a4hUd/MoS7Bq+s7T3sGGcVkaQHP3g5jXtqI uNb1Kt9sqrH/cAZsILbtsG0gKQsJk5qHooAX0f20Xy7tiRfgyv+IgeJ1kB4F+IGmtIrL IvvQ== MIME-Version: 1.0 X-Received: by 10.50.1.44 with SMTP id 12mr9960472igj.61.1441923099142; Thu, 10 Sep 2015 15:11:39 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.28.208 with HTTP; Thu, 10 Sep 2015 15:11:39 -0700 (PDT) In-Reply-To: References: <201509100405.t8A45xrJ070199@repo.freebsd.org> <20150910175324.GW33167@funkthat.com> <55F1E06F.7000008@FreeBSD.org> <20150910211417.GY33167@funkthat.com> Date: Thu, 10 Sep 2015 15:11:39 -0700 X-Google-Sender-Auth: oANXy7Lc_hfJIYaNqJAaUD2BCZw Message-ID: Subject: Re: svn commit: r287606 - head/sys/kern From: Adrian Chadd To: John-Mark Gurney Cc: Eric van Gyzen , Warner Losh , Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 22:11:40 -0000 Hi, Fixed a couple of bugs, and: https://reviews.freebsd.org/D3630 -adrian On 10 September 2015 at 15:02, Adrian Chadd wrote: > I'd love for rc.subr to grow the ability to set per-daemon cpuset, > class, environment, etc. We have some of that in the rc script > already. > > What I have so far for local hacking is this, which at least gets the > default login class bits and runs things as user daemon. > Yes, there are issues with inheriting the environment and other things > from the callee - I think that's a separate issue to solve. > > Thanks, > > > -a > > adrian@hulk:~/work/freebsd/head/src % svn diff etc > > Index: etc/login.conf > =================================================================== > --- etc/login.conf (revision 28758) > +++ etc/login.conf (working copy) > @@ -36,7 +36,8 @@ > :memoryuse=unlimited:\ > :filesize=unlimited:\ > :coredumpsize=unlimited:\ > - :openfiles=unlimited:\ > + :openfiles-cur=4096:\ > + :openfiles-max=65536:\ > :maxproc=unlimited:\ > :sbsize=unlimited:\ > :vmemoryuse=unlimited:\ > @@ -61,6 +62,8 @@ > :tc=default: > daemon:\ > :memorylocked=128M:\ > + :openfiles-cur=32768:\ > + :openfiles-max=65536:\ > :tc=default: > news:\ > :tc=default: > Index: etc/rc.subr > =================================================================== > --- etc/rc.subr (revision 287580) > +++ etc/rc.subr (working copy) > @@ -768,6 +768,8 @@ > # > # ${name}_prepend n Command added before ${command}. > # > +# ${name}_login_class n Login class to use, else "daemon". > +# > # ${rc_arg}_cmd n If set, use this as the method when invoked; > # Otherwise, use default command (see below) > # > > @@ -942,8 +944,13 @@ > _nice=\$${name}_nice _user=\$${name}_user \ > _group=\$${name}_group _groups=\$${name}_groups \ > _fib=\$${name}_fib _env=\$${name}_env \ > - _prepend=\$${name}_prepend > + _prepend=\$${name}_prepend _login_class=\$${name}_login_class > > + # Default to 'daemon' if no login class is provided > + if [ -n "$_login_class" ]; then > + _login_class="daemon" > + fi > + > if [ -n "$_user" ]; then # unset $_user if running as that user > if [ "$_user" = "$(eval $IDCMD)" ]; then > unset _user > @@ -1050,6 +1057,9 @@ > fi > fi > > + # Prepend default limits > + _doit="limits -C $_login_class $_doit" > + > # run the full command > # > if ! _run_rc_doit "$_doit"; then > > On 10 September 2015 at 14:14, John-Mark Gurney wrote: >> Eric van Gyzen wrote this message on Thu, Sep 10, 2015 at 14:56 -0500: >>> On 09/10/2015 12:53, John-Mark Gurney wrote: >>> > Adrian Chadd wrote this message on Thu, Sep 10, 2015 at 09:18 -0700: >>> >> On 10 September 2015 at 09:04, Warner Losh wrote: >>> >>> >>> >>> >>> >>> On Thu, Sep 10, 2015 at 9:53 AM, Ed Maste wrote: >>> >>>> >>> >>>> On 10 September 2015 at 04:05, Adrian Chadd wrote: >>> >>>>> Author: adrian >>> >>>>> Date: Thu Sep 10 04:05:58 2015 >>> >>>>> New Revision: 287606 >>> >>>>> URL: https://svnweb.freebsd.org/changeset/base/287606 >>> >>>>> >>> >>>>> Log: >>> >>>>> Also make kern.maxfilesperproc a boot time tunable. >>> >>>>> ... >>> >>>>> TODO: >>> >>>> >>> >>>> Also "we" should >>> >>>> * Submit patches upstream or to the ports tree to use closefrom >>> >>> >>> >>> >>> >>> I thought the consensus was that we'd fix things to have fewer FDs >>> >>> by default, but instead allow individual processes to raise it via the >>> >>> usual methods. >>> >>> We could--and should--do both, because they're both good ideas. >>> >>> >> I'm looking at how to do this in a somewhat sensible fashion. Right >>> >> now we just have openfiles=unlimited; in /etc/login.conf which seems a >>> >> little odd. I don't know yet if that affects the default set that >>> >> services started via /etc/rc get - init gets the whole default >>> >> maxfilesperproc and stuff seems to inherit from that unless told >>> >> otherwise. >>> >> >>> >> I think the more sensible default would be: >>> >> >>> >> * set /etc/login.conf to some much lower values - say, 4k soft, 64k hard; >>> >> * root can always override its settings up to kern.maxfilesperproc; >>> >> * modify /etc/rc to set some default rlimits as appropriate; >>> > >>> > We should probably just use the daemon class from login.conf... Do we >>> > have a program that will set the current limits to a specified class? >>> >>> See limits(1). The apache rc.d script uses it, along with some related >>> rc.conf variables. >> >> So, one issue w/ limits is that it only does the limits side of >> things, not environment or cpusets... see: >> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=161401 >> >> limits doesn't address PATH and other environment variables... >> >> We should have rc.subr setup the environment completely when executing >> the daemon/scripts instead of depending upon any of this.. >> >> It turns out that init doesn't setup the environment vars provided by >> login.config either... >> >>> >> * introduce configuration options ({daemon_rlimit_XXX}?) in >>> >> /etc/rc.conf that lets someone override what the default rlimits >>> >> should be for a given process,, as (and I'm not making this up) if you >>> >> run 'service XXX restart' from a root login you get the rlimits from >>> >> the shell, which may differ from the system startup. >>> > >>> > Why not daemon_login_class w/ the above? >>> > >>> >> That way we can setup various services to have higher openfile limits >>> >> via /etc/rc.conf entries for those services rather than having to hack >>> >> each startup script. It also means that no matter what is running >>> >> 'service XXX YYY' as root, you'll get the 'correct'(er) rlimits. >>> > >>> > Then service would just use the above program to get sane defaults... >> >> -- >> John-Mark Gurney Voice: +1 415 225 5579 >> >> "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@freebsd.org Thu Sep 10 22:25:41 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE107A01461; Thu, 10 Sep 2015 22:25:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF3541532; Thu, 10 Sep 2015 22:25:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8AMPffo029038; Thu, 10 Sep 2015 22:25:41 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8AMPfiK029036; Thu, 10 Sep 2015 22:25:41 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509102225.t8AMPfiK029036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 10 Sep 2015 22:25:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287634 - head/usr.bin/login X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 22:25:41 -0000 Author: delphij Date: Thu Sep 10 22:25:40 2015 New Revision: 287634 URL: https://svnweb.freebsd.org/changeset/base/287634 Log: login.c doesn't really need libutil.h, don't include it. login_fbtab.c includes paths.h and pathnames.h, and pathnames.h includes paths.h. Eliminate the paths.h inclusion in login_fbtab.c. MFC after: 2 weeks Modified: head/usr.bin/login/login.c head/usr.bin/login/login_fbtab.c Modified: head/usr.bin/login/login.c ============================================================================== --- head/usr.bin/login/login.c Thu Sep 10 22:07:52 2015 (r287633) +++ head/usr.bin/login/login.c Thu Sep 10 22:25:40 2015 (r287634) @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/usr.bin/login/login_fbtab.c ============================================================================== --- head/usr.bin/login/login_fbtab.c Thu Sep 10 22:07:52 2015 (r287633) +++ head/usr.bin/login/login_fbtab.c Thu Sep 10 22:25:40 2015 (r287634) @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -120,7 +119,7 @@ login_fbtab(char *tty, uid_t uid, gid_t /* login_protect - protect one device entry */ -void +static void login_protect(const char *table, char *pattern, int mask, uid_t uid, gid_t gid) { glob_t gl; From owner-svn-src-head@freebsd.org Thu Sep 10 22:47:28 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C42E2A00053; Thu, 10 Sep 2015 22:47:28 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B43321A71; Thu, 10 Sep 2015 22:47:28 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8AMlSUU039180; Thu, 10 Sep 2015 22:47:28 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8AMlRA5039170; Thu, 10 Sep 2015 22:47:27 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509102247.t8AMlRA5039170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Thu, 10 Sep 2015 22:47:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287635 - in head/release: amd64 i386 pc98 powerpc sparc64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 22:47:28 -0000 Author: dteske Date: Thu Sep 10 22:47:26 2015 New Revision: 287635 URL: https://svnweb.freebsd.org/changeset/base/287635 Log: Fix argument quoting and remove unnecessary braces MFC after: 3 weeks X-MFC-to: stable/10 Modified: head/release/amd64/mkisoimages.sh head/release/i386/mkisoimages.sh head/release/pc98/mkisoimages.sh head/release/powerpc/mkisoimages.sh head/release/sparc64/mkisoimages.sh Modified: head/release/amd64/mkisoimages.sh ============================================================================== --- head/release/amd64/mkisoimages.sh Thu Sep 10 22:25:40 2015 (r287634) +++ head/release/amd64/mkisoimages.sh Thu Sep 10 22:47:26 2015 (r287635) @@ -34,7 +34,7 @@ if [ "x$1" = "x-b" ]; then mkdir efi mount -t msdosfs /dev/$device efi mkdir -p efi/efi/boot - cp ${4}/boot/loader.efi efi/efi/boot/bootx64.efi + cp "$4/boot/loader.efi" efi/efi/boot/bootx64.efi umount efi rmdir efi mdconfig -d -u $device @@ -46,15 +46,15 @@ else fi if [ $# -lt 3 ]; then - echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' + echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" exit 1 fi -LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift -NAME=$1; shift +LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift +NAME="$1"; shift publisher="The FreeBSD Project. http://www.FreeBSD.org/" -echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab -makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $* -rm $1/etc/fstab +echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab" +makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@" +rm "$1/etc/fstab" rm -f efiboot.img Modified: head/release/i386/mkisoimages.sh ============================================================================== --- head/release/i386/mkisoimages.sh Thu Sep 10 22:25:40 2015 (r287634) +++ head/release/i386/mkisoimages.sh Thu Sep 10 22:47:26 2015 (r287635) @@ -32,14 +32,14 @@ else fi if [ $# -lt 3 ]; then - echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' + echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" exit 1 fi -LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift -NAME=$1; shift +LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift +NAME="$1"; shift publisher="The FreeBSD Project. http://www.FreeBSD.org/" -echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab -makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $* -rm $1/etc/fstab +echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab" +makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@" +rm "$1/etc/fstab" Modified: head/release/pc98/mkisoimages.sh ============================================================================== --- head/release/pc98/mkisoimages.sh Thu Sep 10 22:25:40 2015 (r287634) +++ head/release/pc98/mkisoimages.sh Thu Sep 10 22:47:26 2015 (r287635) @@ -32,14 +32,14 @@ else fi if [ $# -lt 3 ]; then - echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' + echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" exit 1 fi -LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift -NAME=$1; shift +LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift +NAME="$1"; shift publisher="The FreeBSD Project. http://www.FreeBSD.org/" -echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab -makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $* -rm $1/etc/fstab +echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab" +makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@" +rm "$1/etc/fstab" Modified: head/release/powerpc/mkisoimages.sh ============================================================================== --- head/release/powerpc/mkisoimages.sh Thu Sep 10 22:25:40 2015 (r287634) +++ head/release/powerpc/mkisoimages.sh Thu Sep 10 22:47:26 2015 (r287635) @@ -25,18 +25,18 @@ if [ "x$1" = "x-b" ]; then # Apple boot code - uudecode -o /tmp/hfs-boot-block.bz2 `dirname $0`/hfs-boot.bz2.uu + uudecode -o /tmp/hfs-boot-block.bz2 "`dirname "$0"`/hfs-boot.bz2.uu" bzip2 -d /tmp/hfs-boot-block.bz2 OFFSET=$(hd /tmp/hfs-boot-block | grep 'Loader START' | cut -f 1 -d ' ') OFFSET=0x$(echo 0x$OFFSET | awk '{printf("%x\n",$1/512);}') - dd if=$4/boot/loader of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc + dd if="$4/boot/loader" of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc bootable="-o bootimage=macppc;/tmp/hfs-boot-block -o no-emul-boot" # pSeries/PAPR boot code - mkdir -p $4/ppc/chrp - cp $4/boot/loader $4/ppc/chrp - cat > $4/ppc/bootinfo.txt << EOF + mkdir -p "$4/ppc/chrp" + cp "$4/boot/loader" "$4/ppc/chrp" + cat > "$4/ppc/bootinfo.txt" << EOF FreeBSD Install FreeBSD @@ -46,7 +46,7 @@ EOF bootable="$bootable -o chrp-boot" # Playstation 3 boot code - echo "FreeBSD Install='/boot/loader.ps3'" > $4/etc/kboot.conf + echo "FreeBSD Install='/boot/loader.ps3'" > "$4/etc/kboot.conf" shift else @@ -54,16 +54,16 @@ else fi if [ $# -lt 3 ]; then - echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' + echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" exit 1 fi -LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift -NAME=$1; shift +LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift +NAME="$1"; shift publisher="The FreeBSD Project. http://www.FreeBSD.org/" -echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab -makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $* -rm $1/etc/fstab +echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab" +makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@" +rm "$1/etc/fstab" rm /tmp/hfs-boot-block -rm -rf $1/ppc +rm -rf "$1/ppc" Modified: head/release/sparc64/mkisoimages.sh ============================================================================== --- head/release/sparc64/mkisoimages.sh Thu Sep 10 22:25:40 2015 (r287634) +++ head/release/sparc64/mkisoimages.sh Thu Sep 10 22:47:26 2015 (r287635) @@ -23,62 +23,62 @@ # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. if [ $# -lt 3 ]; then - echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' > /dev/stderr + echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" > /dev/stderr exit 1 fi -case $1 in --b) BOPT=$1; shift ;; +case "$1" in +-b) BOPT="$1"; shift ;; esac -LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift -NAME=$1; shift -BASEBITSDIR=$1 +LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift +NAME="$1"; shift +BASEBITSDIR="$1" # Create an ISO image publisher="The FreeBSD Project. http://www.FreeBSD.org/" -echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "${BASEBITSDIR}/etc/fstab" -makefs -t cd9660 -o rockridge -o label="$LABEL" -o publisher="$publisher" ${NAME}.tmp $* -rm "${BASEBITSDIR}/etc/fstab" +echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab" +makefs -t cd9660 -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME.tmp" "$@" +rm "$BASEBITSDIR/etc/fstab" if [ "x$BOPT" != "x-b" ]; then - mv ${NAME}.tmp ${NAME} + mv "$NAME.tmp" "$NAME" exit 0 fi TMPIMGDIR=`mktemp -d /tmp/bootfs.XXXXXXXX` || exit 1 -BOOTFSDIR="${TMPIMGDIR}/bootfs" -BOOTFSIMG="${TMPIMGDIR}/bootfs.img" +BOOTFSDIR="$TMPIMGDIR/bootfs" +BOOTFSIMG="$TMPIMGDIR/bootfs.img" # Create a boot filesystem -mkdir -p "${BOOTFSDIR}/boot" -cp -p "${BASEBITSDIR}/boot/loader" "${BOOTFSDIR}/boot" -makefs -t ffs -B be -M 512k "${BOOTFSIMG}" "${BOOTFSDIR}" -dd if="${BASEBITSDIR}/boot/boot1" of="${BOOTFSIMG}" bs=512 conv=notrunc,sync +mkdir -p "$BOOTFSDIR/boot" +cp -p "$BASEBITSDIR/boot/loader" "$BOOTFSDIR/boot" +makefs -t ffs -B be -M 512k "$BOOTFSIMG" "$BOOTFSDIR" +dd if="$BASEBITSDIR/boot/boot1" of="$BOOTFSIMG" bs=512 conv=notrunc,sync # Create a boot ISO image : ${CYLSIZE:=640} -ISOSIZE=$(stat -f %z ${NAME}.tmp) -ISOBLKS=$(((${ISOSIZE} + 511) / 512)) -ISOCYLS=$(((${ISOBLKS} + (${CYLSIZE} - 1)) / ${CYLSIZE})) - -BOOTFSSIZE=$(stat -f %z "${BOOTFSIMG}") -BOOTFSBLKS=$(((${BOOTFSSIZE} + 511) / 512)) -BOOTFSCYLS=$(((${BOOTFSBLKS} + (${CYLSIZE} - 1)) / ${CYLSIZE})) +ISOSIZE=$(stat -f %z "$NAME.tmp") +ISOBLKS=$((($ISOSIZE + 511) / 512)) +ISOCYLS=$((($ISOBLKS + ($CYLSIZE - 1)) / $CYLSIZE)) + +BOOTFSSIZE=$(stat -f %z "$BOOTFSIMG") +BOOTFSBLKS=$((($BOOTFSSIZE + 511) / 512)) +BOOTFSCYLS=$((($BOOTFSBLKS + ($CYLSIZE - 1)) / $CYLSIZE)) -ENDCYL=$((${ISOCYLS} + ${BOOTFSCYLS})) -NSECTS=$((${ENDCYL} * 1 * ${CYLSIZE})) +ENDCYL=$(($ISOCYLS + $BOOTFSCYLS)) +NSECTS=$(($ENDCYL * 1 * $CYLSIZE)) -dd if=${NAME}.tmp of=${NAME} bs=${CYLSIZE}b conv=notrunc,sync -dd if=${BOOTFSIMG} of=${NAME} bs=${CYLSIZE}b seek=${ISOCYLS} conv=notrunc,sync +dd if="$NAME.tmp" of="$NAME" bs="${CYLSIZE}b" conv=notrunc,sync +dd if="$BOOTFSIMG" of="$NAME" bs="${CYLSIZE}b" seek=$ISOCYLS conv=notrunc,sync # The number of alternative cylinders is always 2. -dd if=/dev/zero of=${NAME} bs=${CYLSIZE}b seek=${ENDCYL} count=2 conv=notrunc,sync -rm -rf ${NAME}.tmp ${TMPIMGDIR} +dd if=/dev/zero of="$NAME" bs="${CYLSIZE}b" seek=$ENDCYL count=2 conv=notrunc,sync +rm -rf "$NAME.tmp" "$TMPIMGDIR" # Write VTOC8 label to boot ISO image -MD=`mdconfig -a -t vnode -S 512 -y 1 -x ${CYLSIZE} -f ${NAME}` -gpart create -s VTOC8 ${MD} +MD=`mdconfig -a -t vnode -S 512 -y 1 -x "$CYLSIZE" -f "$NAME"` +gpart create -s VTOC8 $MD # !4: usr, for ISO image part -gpart add -i 1 -s $((${ISOCYLS} * ${CYLSIZE} * 512))b -t \!4 ${MD} +gpart add -i 1 -s "$(($ISOCYLS * $CYLSIZE * 512))b" -t \!4 $MD # !2: root, for bootfs part. -gpart add -i 6 -s $((${BOOTFSCYLS} * ${CYLSIZE} * 512))b -t \!2 ${MD} +gpart add -i 6 -s "$(($BOOTFSCYLS * $CYLSIZE * 512))b" -t \!2 $MD mdconfig -d -u ${MD#md} From owner-svn-src-head@freebsd.org Fri Sep 11 00:19:50 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91BF9A01349; Fri, 11 Sep 2015 00:19:50 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 827521840; Fri, 11 Sep 2015 00:19:50 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B0JoWL082577; Fri, 11 Sep 2015 00:19:50 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B0JocS082576; Fri, 11 Sep 2015 00:19:50 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201509110019.t8B0JocS082576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 11 Sep 2015 00:19:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287636 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 00:19:50 -0000 Author: sjg Date: Fri Sep 11 00:19:49 2015 New Revision: 287636 URL: https://svnweb.freebsd.org/changeset/base/287636 Log: Handle default MAKEOBJDIR for META_MODE. If MAKEOBJDIRPREFIX is set, use it for default OBJROOT. If MAKEOBJDIR is empty or not a suitable value (no '/') set a default that works. Reviewed by: bdrewery Modified: head/share/mk/local.meta.sys.mk Modified: head/share/mk/local.meta.sys.mk ============================================================================== --- head/share/mk/local.meta.sys.mk Thu Sep 10 22:47:26 2015 (r287635) +++ head/share/mk/local.meta.sys.mk Fri Sep 11 00:19:49 2015 (r287636) @@ -13,11 +13,14 @@ MK_INSTALL_AS_USER= yes .warning MAKEOBJDIRPREFIX not supported; setting MAKEOBJDIR... # put things approximately where they want OBJROOT:=${MAKEOBJDIRPREFIX}${SRCTOP:S,/src,,}/ +MAKEOBJDIRPREFIX= +.export MAKEOBJDIRPREFIX +.endif +.if empty(MAKEOBJDIR) || ${MAKEOBJDIR:M*/*} == "" # OBJTOP set below MAKEOBJDIR=$${.CURDIR:S,$${SRCTOP},$${OBJTOP},} -MAKEOBJDIRPREFIX= # export but do not track -.export-env MAKEOBJDIRPREFIX MAKEOBJDIR +.export-env MAKEOBJDIR # now for our own use MAKEOBJDIR= ${.CURDIR:S,${SRCTOP},${OBJTOP},} .endif From owner-svn-src-head@freebsd.org Fri Sep 11 00:38:59 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8A18A01CE7; Fri, 11 Sep 2015 00:38:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF2581317; Fri, 11 Sep 2015 00:38:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B0cxPD091655; Fri, 11 Sep 2015 00:38:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B0cxiq091653; Fri, 11 Sep 2015 00:38:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201509110038.t8B0cxiq091653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 11 Sep 2015 00:38:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287638 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 00:38:59 -0000 Author: imp Date: Fri Sep 11 00:38:58 2015 New Revision: 287638 URL: https://svnweb.freebsd.org/changeset/base/287638 Log: dev_strategy and dev_strategy_csw are unused since r281825. Remove them. Differential Revision: https://reviews.freebsd.org/D3620 Modified: head/sys/kern/vfs_bio.c head/sys/sys/conf.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Fri Sep 11 00:20:15 2015 (r287637) +++ head/sys/kern/vfs_bio.c Fri Sep 11 00:38:58 2015 (r287638) @@ -3786,56 +3786,6 @@ bufdonebio(struct bio *bip) g_destroy_bio(bip); } -void -dev_strategy(struct cdev *dev, struct buf *bp) -{ - struct cdevsw *csw; - int ref; - - KASSERT(dev->si_refcount > 0, - ("dev_strategy on un-referenced struct cdev *(%s) %p", - devtoname(dev), dev)); - - csw = dev_refthread(dev, &ref); - dev_strategy_csw(dev, csw, bp); - dev_relthread(dev, ref); -} - -void -dev_strategy_csw(struct cdev *dev, struct cdevsw *csw, struct buf *bp) -{ - struct bio *bip; - - KASSERT(bp->b_iocmd == BIO_READ || bp->b_iocmd == BIO_WRITE, - ("b_iocmd botch")); - KASSERT(((dev->si_flags & SI_ETERNAL) != 0 && csw != NULL) || - dev->si_threadcount > 0, - ("dev_strategy_csw threadcount cdev *(%s) %p", devtoname(dev), - dev)); - if (csw == NULL) { - bp->b_error = ENXIO; - bp->b_ioflags = BIO_ERROR; - bufdone(bp); - return; - } - for (;;) { - bip = g_new_bio(); - if (bip != NULL) - break; - /* Try again later */ - tsleep(&bp, PRIBIO, "dev_strat", hz/10); - } - bip->bio_cmd = bp->b_iocmd; - bip->bio_offset = bp->b_iooffset; - bip->bio_length = bp->b_bcount; - bip->bio_bcount = bp->b_bcount; /* XXX: remove */ - bdata2bio(bp, bip); - bip->bio_done = bufdonebio; - bip->bio_caller2 = bp; - bip->bio_dev = dev; - (*csw->d_strategy)(bip); -} - /* * bufdone: * Modified: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Fri Sep 11 00:20:15 2015 (r287637) +++ head/sys/sys/conf.h Fri Sep 11 00:38:58 2015 (r287638) @@ -240,8 +240,6 @@ void dev_depends(struct cdev *_pdev, str void dev_ref(struct cdev *dev); void dev_refl(struct cdev *dev); void dev_rel(struct cdev *dev); -void dev_strategy(struct cdev *dev, struct buf *bp); -void dev_strategy_csw(struct cdev *dev, struct cdevsw *csw, struct buf *bp); struct cdev *make_dev(struct cdevsw *_devsw, int _unit, uid_t _uid, gid_t _gid, int _perms, const char *_fmt, ...) __printflike(6, 7); struct cdev *make_dev_cred(struct cdevsw *_devsw, int _unit, From owner-svn-src-head@freebsd.org Fri Sep 11 01:05:33 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8721BA02A3A; Fri, 11 Sep 2015 01:05:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 6F61A1278; Fri, 11 Sep 2015 01:05:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 6903E1B81; Fri, 11 Sep 2015 01:05:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 041DD10932; Fri, 11 Sep 2015 01:05:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id 5krSDtvVgYjp; Fri, 11 Sep 2015 01:05:30 +0000 (UTC) Subject: Re: svn commit: r287636 - head/share/mk DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com B41391092B To: "Simon J. Gerraty" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201509110019.t8B0JocS082576@repo.freebsd.org> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <55F228CE.3010102@FreeBSD.org> Date: Thu, 10 Sep 2015 18:05:18 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <201509110019.t8B0JocS082576@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mN2avNtpeFh6NLt24WAw82LPowd3tDtjP" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 01:05:33 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --mN2avNtpeFh6NLt24WAw82LPowd3tDtjP Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 9/10/2015 5:19 PM, Simon J. Gerraty wrote: > Author: sjg > Date: Fri Sep 11 00:19:49 2015 > New Revision: 287636 > URL: https://svnweb.freebsd.org/changeset/base/287636 >=20 > Log: > Handle default MAKEOBJDIR for META_MODE. > If MAKEOBJDIRPREFIX is set, use it for default OBJROOT. > If MAKEOBJDIR is empty or not a suitable value (no '/') > set a default that works. > =20 > Reviewed by: bdrewery >=20 > Modified: > head/share/mk/local.meta.sys.mk Thanks! --=20 Regards, Bryan Drewery --mN2avNtpeFh6NLt24WAw82LPowd3tDtjP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJV8ijOAAoJEDXXcbtuRpfPaeoIAIXszkr/JUD6dC3N9OmlsHKt kQWGwptOKwVZw0Ntpa3vwbDWGTf45b2zw3GC58mcVv3CIlw7pOs1NnkFUerAH0BH 1gWK0GsdrMO+Ipux1QuPZOdSwyJ2M6pisH4GgymlgqKQwbqPoAWRoqFnuCpyqkfC ZcYzXgVGhjAj2DGOtdUotxd9E44W6mDP36FMUvGIx+aULEQGwsU5Mg1N7AuMgRa1 N2bR6dHgHLtvTy8ygyEzuTh3GzMUZp4gq9LrJ8TIESme3qf86GxerRjjcEoU1Ky2 Q5ShyeGnHm4dD6ZAdG3ye7dq2gfn5XMmMQ6l1/JldQ8RdHKYXReTLeOUzsBIyxc= =a/Ji -----END PGP SIGNATURE----- --mN2avNtpeFh6NLt24WAw82LPowd3tDtjP-- From owner-svn-src-head@freebsd.org Fri Sep 11 03:00:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04123A02460; Fri, 11 Sep 2015 03:00:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E82DA15D7; Fri, 11 Sep 2015 03:00:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B30MDd055763; Fri, 11 Sep 2015 03:00:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B30LCW055755; Fri, 11 Sep 2015 03:00:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509110300.t8B30LCW055755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Sep 2015 03:00:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287640 - in head: lib/libc/gen sys/sys sys/vm usr.bin/vmstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 03:00:23 -0000 Author: markj Date: Fri Sep 11 03:00:20 2015 New Revision: 287640 URL: https://svnweb.freebsd.org/changeset/base/287640 Log: Remove the v_cache_min and v_cache_max sysctls. They are unused and have no effect. Reviewed by: alc Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/gen/sysctl.3 head/sys/sys/vmmeter.h head/sys/vm/vm_meter.c head/sys/vm/vm_page.c head/sys/vm/vm_param.h head/usr.bin/vmstat/vmstat.c Modified: head/lib/libc/gen/sysctl.3 ============================================================================== --- head/lib/libc/gen/sysctl.3 Fri Sep 11 02:53:22 2015 (r287639) +++ head/lib/libc/gen/sysctl.3 Fri Sep 11 03:00:20 2015 (r287640) @@ -28,7 +28,7 @@ .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd May 17, 2013 +.Dd September 10, 2015 .Dt SYSCTL 3 .Os .Sh NAME @@ -736,8 +736,6 @@ privilege may change the value. .It "VM_LOADAVG struct loadavg no" .It "VM_TOTAL struct vmtotal no" .It "VM_SWAPPING_ENABLED integer maybe" -.It "VM_V_CACHE_MAX integer yes" -.It "VM_V_CACHE_MIN integer yes" .It "VM_V_FREE_MIN integer yes" .It "VM_V_FREE_RESERVED integer yes" .It "VM_V_FREE_TARGET integer yes" @@ -757,12 +755,6 @@ The returned data consists of a 1 if process swapping is enabled or 0 if disabled. This variable is permanently set to 0 if the kernel was built with swapping disabled. -.It Li VM_V_CACHE_MAX -Maximum desired size of the cache queue. -.It Li VM_V_CACHE_MIN -Minimum desired size of the cache queue. -If the cache queue size -falls very far below this value, the pageout daemon is awakened. .It Li VM_V_FREE_MIN Minimum amount of memory (cache memory plus free memory) required to be available before a process waiting on memory will be Modified: head/sys/sys/vmmeter.h ============================================================================== --- head/sys/sys/vmmeter.h Fri Sep 11 02:53:22 2015 (r287639) +++ head/sys/sys/vmmeter.h Fri Sep 11 03:00:20 2015 (r287640) @@ -97,8 +97,6 @@ struct vmmeter { u_int v_inactive_target; /* (c) pages desired inactive */ u_int v_inactive_count; /* (q) pages inactive */ u_int v_cache_count; /* (f) pages on cache queue */ - u_int v_cache_min; /* (c) min pages desired on cache queue */ - u_int v_cache_max; /* (c) max pages in cached obj (unused) */ u_int v_pageout_free_min; /* (c) min pages reserved for kernel */ u_int v_interrupt_free_min; /* (c) reserved pages for int code */ u_int v_free_severe; /* (c) severe page depletion point */ @@ -113,6 +111,7 @@ struct vmmeter { u_int v_vforkpages; /* (p) VM pages affected by vfork() */ u_int v_rforkpages; /* (p) VM pages affected by rfork() */ u_int v_kthreadpages; /* (p) VM pages affected by fork() by kernel */ + u_int v_spare[2]; }; #ifdef _KERNEL Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Fri Sep 11 02:53:22 2015 (r287639) +++ head/sys/vm/vm_meter.c Fri Sep 11 03:00:20 2015 (r287640) @@ -63,10 +63,6 @@ SYSCTL_UINT(_vm, VM_V_FREE_RESERVED, v_f CTLFLAG_RW, &vm_cnt.v_free_reserved, 0, "Pages reserved for deadlock"); SYSCTL_UINT(_vm, VM_V_INACTIVE_TARGET, v_inactive_target, CTLFLAG_RW, &vm_cnt.v_inactive_target, 0, "Pages desired inactive"); -SYSCTL_UINT(_vm, VM_V_CACHE_MIN, v_cache_min, - CTLFLAG_RW, &vm_cnt.v_cache_min, 0, "Min pages on cache queue"); -SYSCTL_UINT(_vm, VM_V_CACHE_MAX, v_cache_max, - CTLFLAG_RW, &vm_cnt.v_cache_max, 0, "Max pages on cache queue"); SYSCTL_UINT(_vm, VM_V_PAGEOUT_FREE_MIN, v_pageout_free_min, CTLFLAG_RW, &vm_cnt.v_pageout_free_min, 0, "Min pages reserved for kernel"); SYSCTL_UINT(_vm, OID_AUTO, v_free_severe, @@ -308,8 +304,6 @@ VM_STATS_VM(v_active_count, "Active page VM_STATS_VM(v_inactive_target, "Desired inactive pages"); VM_STATS_VM(v_inactive_count, "Inactive pages"); VM_STATS_VM(v_cache_count, "Pages on cache queue"); -VM_STATS_VM(v_cache_min, "Min pages on cache queue"); -VM_STATS_VM(v_cache_max, "Max pages on cached queue"); VM_STATS_VM(v_pageout_free_min, "Min pages reserved for kernel"); VM_STATS_VM(v_interrupt_free_min, "Reserved pages for interrupt code"); VM_STATS_VM(v_forks, "Number of fork() calls"); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Sep 11 02:53:22 2015 (r287639) +++ head/sys/vm/vm_page.c Fri Sep 11 03:00:20 2015 (r287640) @@ -3290,7 +3290,6 @@ DB_SHOW_COMMAND(page, vm_page_print_page db_printf("vm_cnt.v_free_reserved: %d\n", vm_cnt.v_free_reserved); db_printf("vm_cnt.v_free_min: %d\n", vm_cnt.v_free_min); db_printf("vm_cnt.v_free_target: %d\n", vm_cnt.v_free_target); - db_printf("vm_cnt.v_cache_min: %d\n", vm_cnt.v_cache_min); db_printf("vm_cnt.v_inactive_target: %d\n", vm_cnt.v_inactive_target); } Modified: head/sys/vm/vm_param.h ============================================================================== --- head/sys/vm/vm_param.h Fri Sep 11 02:53:22 2015 (r287639) +++ head/sys/vm/vm_param.h Fri Sep 11 03:00:20 2015 (r287640) @@ -79,8 +79,8 @@ #define VM_V_FREE_TARGET 4 /* vm_cnt.v_free_target */ #define VM_V_FREE_RESERVED 5 /* vm_cnt.v_free_reserved */ #define VM_V_INACTIVE_TARGET 6 /* vm_cnt.v_inactive_target */ -#define VM_V_CACHE_MIN 7 /* vm_cnt.v_cache_min */ -#define VM_V_CACHE_MAX 8 /* vm_cnt.v_cache_max */ +#define VM_OBSOLETE_7 7 /* unused, formerly v_cache_min */ +#define VM_OBSOLETE_8 8 /* unused, formerly v_cache_max */ #define VM_V_PAGEOUT_FREE_MIN 9 /* vm_cnt.v_pageout_free_min */ #define VM_OBSOLETE_10 10 /* pageout algorithm */ #define VM_SWAPPING_ENABLED 11 /* swapping enabled */ Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Fri Sep 11 02:53:22 2015 (r287639) +++ head/usr.bin/vmstat/vmstat.c Fri Sep 11 03:00:20 2015 (r287640) @@ -556,8 +556,6 @@ fill_vmmeter(struct vmmeter *vmmp) GET_VM_STATS(vm, v_inactive_target); GET_VM_STATS(vm, v_inactive_count); GET_VM_STATS(vm, v_cache_count); - GET_VM_STATS(vm, v_cache_min); - GET_VM_STATS(vm, v_cache_max); GET_VM_STATS(vm, v_pageout_free_min); GET_VM_STATS(vm, v_interrupt_free_min); /*GET_VM_STATS(vm, v_free_severe);*/ From owner-svn-src-head@freebsd.org Fri Sep 11 03:04:25 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CF46A026E5; Fri, 11 Sep 2015 03:04:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6530A1E94; Fri, 11 Sep 2015 03:04:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B34Pu4060795; Fri, 11 Sep 2015 03:04:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B34PV4060794; Fri, 11 Sep 2015 03:04:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509110304.t8B34PV4060794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Sep 2015 03:04:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287641 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 03:04:25 -0000 Author: markj Date: Fri Sep 11 03:04:24 2015 New Revision: 287641 URL: https://svnweb.freebsd.org/changeset/base/287641 Log: MFV r283512: 3599 dtrace_dynvar tail calls can blow stack Reviewed by: Adam Leventhal Reviewed by: Gordon Ross Approved by: Richard Lowe Author: Bryan Cantrill illumos/illumos-gate@d47448f09aae3aa1a87fc450a0c44638e7ce7b51 Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Fri Sep 11 03:00:20 2015 (r287640) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Fri Sep 11 03:04:24 2015 (r287641) @@ -23,7 +23,7 @@ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright (c) 2015, Joyent, Inc. All rights reserved. * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ @@ -2146,7 +2146,7 @@ retry: * this hash chain, or another CPU is deleting an element from this * hash chain. The simplest way to deal with both of these cases * (though not necessarily the most efficient) is to free our - * allocated block and tail-call ourselves. Note that the free is + * allocated block and re-attempt it all. Note that the free is * to the dirty list and _not_ to the free list. This is to prevent * races with allocators, above. */ @@ -2159,7 +2159,7 @@ retry: dvar->dtdv_next = free; } while (dtrace_casptr(&dcpu->dtdsc_dirty, free, dvar) != free); - return (dtrace_dynvar(dstate, nkeys, key, dsize, op, mstate, vstate)); + goto top; } /*ARGSUSED*/ From owner-svn-src-head@freebsd.org Fri Sep 11 03:06:35 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4570A027B3; Fri, 11 Sep 2015 03:06:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4F991042; Fri, 11 Sep 2015 03:06:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B36Zsp061042; Fri, 11 Sep 2015 03:06:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B36ZTw061041; Fri, 11 Sep 2015 03:06:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509110306.t8B36ZTw061041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Sep 2015 03:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287642 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 03:06:35 -0000 Author: markj Date: Fri Sep 11 03:06:34 2015 New Revision: 287642 URL: https://svnweb.freebsd.org/changeset/base/287642 Log: MFV r283513: 5930 fasttrap_pid_enable() panics when prfind() fails in forking process Reviewed by: Adam Leventhal Reviewed by: Gordon Ross Approved by: Richard Lowe Author: Bryan Cantrill illumos/illumos-gate@9df7e4e12eb093557252d3bec029b5c382613e36 Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Fri Sep 11 03:04:24 2015 (r287641) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Fri Sep 11 03:06:34 2015 (r287642) @@ -29,7 +29,7 @@ */ /* - * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright (c) 2015, Joyent, Inc. All rights reserved. */ #include @@ -1190,11 +1190,21 @@ fasttrap_pid_enable(void *arg, dtrace_id mutex_enter(&pidlock); p = prfind(probe->ftp_pid); + if (p == NULL) { + /* + * So it's not that the target process is being born, + * it's that it isn't there at all (and we simply + * happen to be forking). Anyway, we know that the + * target is definitely gone, so bail out. + */ + mutex_exit(&pidlock); + return (0); + } + /* * Confirm that curproc is indeed forking the process in which * we're trying to enable probes. */ - ASSERT(p != NULL); ASSERT(p->p_parent == curproc); ASSERT(p->p_stat == SIDL); From owner-svn-src-head@freebsd.org Fri Sep 11 03:24:10 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47B79A02ED3; Fri, 11 Sep 2015 03:24:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C1501948; Fri, 11 Sep 2015 03:24:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B3OA5u069792; Fri, 11 Sep 2015 03:24:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B3O8Go069783; Fri, 11 Sep 2015 03:24:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509110324.t8B3O8Go069783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Sep 2015 03:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287643 - in head/sys: amd64/amd64 amd64/include conf i386/i386 i386/include x86/include x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 03:24:10 -0000 Author: markj Date: Fri Sep 11 03:24:07 2015 New Revision: 287643 URL: https://svnweb.freebsd.org/changeset/base/287643 Log: Merge stack(9) implementations for i386 and amd64 under x86/. Reviewed by: jhb, kib Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3255 Added: head/sys/x86/include/stack.h (contents, props changed) head/sys/x86/x86/stack_machdep.c (contents, props changed) Deleted: head/sys/amd64/amd64/stack_machdep.c head/sys/i386/i386/stack_machdep.c Modified: head/sys/amd64/include/stack.h head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/files.pc98 head/sys/i386/include/stack.h Modified: head/sys/amd64/include/stack.h ============================================================================== --- head/sys/amd64/include/stack.h Fri Sep 11 03:06:34 2015 (r287642) +++ head/sys/amd64/include/stack.h Fri Sep 11 03:24:07 2015 (r287643) @@ -1,42 +1,6 @@ -/*- - * Mach Operating System - * Copyright (c) 1991,1990 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_STACK_H_ -#define _MACHINE_STACK_H_ - /* - * Stack trace. + * This file is in the public domain. */ +/* $FreeBSD$ */ -struct amd64_frame { - struct amd64_frame *f_frame; - long f_retaddr; - long f_arg0; -}; - -#endif /* !_MACHINE_STACK_H_ */ +#include Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Fri Sep 11 03:06:34 2015 (r287642) +++ head/sys/conf/files.amd64 Fri Sep 11 03:24:07 2015 (r287643) @@ -130,7 +130,6 @@ amd64/amd64/pmap.c standard amd64/amd64/prof_machdep.c optional profiling-routine amd64/amd64/ptrace_machdep.c standard amd64/amd64/sigtramp.S standard -amd64/amd64/stack_machdep.c optional ddb | stack amd64/amd64/support.S standard amd64/amd64/sys_machdep.c standard amd64/amd64/trap.c standard @@ -612,6 +611,7 @@ x86/x86/mp_x86.c optional smp x86/x86/msi.c optional pci x86/x86/nexus.c standard x86/x86/pvclock.c standard +x86/x86/stack_machdep.c optional ddb | stack x86/x86/tsc.c standard x86/x86/delay.c standard x86/xen/hvm.c optional xenhvm Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Fri Sep 11 03:06:34 2015 (r287642) +++ head/sys/conf/files.i386 Fri Sep 11 03:24:07 2015 (r287643) @@ -476,7 +476,6 @@ i386/i386/mpboot.s optional smp i386/i386/perfmon.c optional perfmon i386/i386/pmap.c standard i386/i386/ptrace_machdep.c standard -i386/i386/stack_machdep.c optional ddb | stack i386/i386/support.s standard i386/i386/swtch.s standard i386/i386/sys_machdep.c standard @@ -603,6 +602,7 @@ x86/x86/mptable_pci.c optional apic pci x86/x86/mp_x86.c optional smp x86/x86/msi.c optional apic pci x86/x86/nexus.c standard +x86/x86/stack_machdep.c optional ddb | stack x86/x86/tsc.c standard x86/x86/pvclock.c standard x86/x86/delay.c standard Modified: head/sys/conf/files.pc98 ============================================================================== --- head/sys/conf/files.pc98 Fri Sep 11 03:06:34 2015 (r287642) +++ head/sys/conf/files.pc98 Fri Sep 11 03:24:07 2015 (r287643) @@ -174,7 +174,6 @@ i386/i386/mpboot.s optional smp i386/i386/perfmon.c optional perfmon i386/i386/pmap.c standard i386/i386/ptrace_machdep.c standard -i386/i386/stack_machdep.c optional ddb | stack i386/i386/support.s standard i386/i386/swtch.s standard i386/i386/sys_machdep.c standard @@ -274,5 +273,6 @@ x86/x86/mptable.c optional apic x86/x86/mptable_pci.c optional apic pci x86/x86/msi.c optional apic pci x86/x86/nexus.c standard +x86/x86/stack_machdep.c optional ddb | stack x86/x86/tsc.c standard x86/x86/delay.c standard Modified: head/sys/i386/include/stack.h ============================================================================== --- head/sys/i386/include/stack.h Fri Sep 11 03:06:34 2015 (r287642) +++ head/sys/i386/include/stack.h Fri Sep 11 03:24:07 2015 (r287643) @@ -1,42 +1,6 @@ -/*- - * Mach Operating System - * Copyright (c) 1991,1990 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_STACK_H_ -#define _MACHINE_STACK_H_ - /* - * Stack trace. + * This file is in the public domain. */ +/* $FreeBSD$ */ -struct i386_frame { - struct i386_frame *f_frame; - int f_retaddr; - int f_arg0; -}; - -#endif /* !_MACHINE_STACK_H_ */ +#include Added: head/sys/x86/include/stack.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/x86/include/stack.h Fri Sep 11 03:24:07 2015 (r287643) @@ -0,0 +1,58 @@ +/*- + * Mach Operating System + * Copyright (c) 1991,1990 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + * + * $FreeBSD$ + */ + +#ifndef _X86_STACK_H +#define _X86_STACK_H + +/* + * Stack trace. + */ + +#ifdef __i386__ +struct i386_frame { + struct i386_frame *f_frame; + u_int f_retaddr; + u_int f_arg0; +}; +#endif + +#ifdef __amd64__ +struct amd64_frame { + struct amd64_frame *f_frame; + u_long f_retaddr; + u_long f_arg0; +}; + +struct i386_frame { + uint32_t f_frame; + uint32_t f_retaddr; + uint32_t f_arg0; +}; +#endif /* __amd64__ */ + +#endif /* !_X86_STACK_H */ Added: head/sys/x86/x86/stack_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/x86/x86/stack_machdep.c Fri Sep 11 03:24:07 2015 (r287643) @@ -0,0 +1,104 @@ +/*- + * Copyright (c) 2005 Antoine Brodin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include + +#ifdef __i386__ +#define PCB_FP(pcb) ((pcb)->pcb_ebp) +#define TF_FP(tf) ((tf)->tf_ebp) +#define TF_PC(tf) ((tf)->tf_eip) + +typedef struct i386_frame *x86_frame_t; +#else +#define PCB_FP(pcb) ((pcb)->pcb_rbp) +#define TF_FP(tf) ((tf)->tf_rbp) +#define TF_PC(tf) ((tf)->tf_rip) + +typedef struct amd64_frame *x86_frame_t; +#endif + +static void +stack_capture(struct thread *td, struct stack *st, register_t fp) +{ + x86_frame_t frame; + vm_offset_t callpc; + + stack_zero(st); + frame = (x86_frame_t)fp; + while (1) { + if (!INKERNEL((long)frame)) + break; + callpc = frame->f_retaddr; + if (!INKERNEL(callpc)) + break; + if (stack_put(st, callpc) == -1) + break; + if (frame->f_frame <= frame || + (vm_offset_t)frame->f_frame >= td->td_kstack + + td->td_kstack_pages * PAGE_SIZE) + break; + frame = frame->f_frame; + } +} + +void +stack_save_td(struct stack *st, struct thread *td) +{ + + if (TD_IS_SWAPPED(td)) + panic("stack_save_td: swapped"); + if (TD_IS_RUNNING(td)) + panic("stack_save_td: running"); + + stack_capture(td, st, PCB_FP(td->td_pcb)); +} + +void +stack_save(struct stack *st) +{ + register_t fp; + +#ifdef __i386__ + __asm __volatile("movl %%ebp,%0" : "=g" (fp)); +#else + __asm __volatile("movq %%rbp,%0" : "=g" (fp)); +#endif + stack_capture(curthread, st, fp); +} From owner-svn-src-head@freebsd.org Fri Sep 11 03:31:24 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1483E9CC1BF; Fri, 11 Sep 2015 03:31:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0514B1D97; Fri, 11 Sep 2015 03:31:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B3VNUK073492; Fri, 11 Sep 2015 03:31:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B3VN2f073490; Fri, 11 Sep 2015 03:31:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509110331.t8B3VN2f073490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Sep 2015 03:31:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287644 - in head/sys: cddl/dev/dtrace/amd64 x86/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 03:31:24 -0000 Author: markj Date: Fri Sep 11 03:31:22 2015 New Revision: 287644 URL: https://svnweb.freebsd.org/changeset/base/287644 Log: Remove the arg0 field from struct amd64_frame. Its existence was a bug, since on amd64 the first argument to a function is generally not on the stack. Revert an old DTrace bug fix to some code that assumed that sizeof(struct amd64_frame) == 16. Reviewed by: jhb, kib Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3255 Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c head/sys/x86/include/stack.h Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Fri Sep 11 03:24:07 2015 (r287643) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Fri Sep 11 03:31:22 2015 (r287644) @@ -440,7 +440,7 @@ dtrace_getarg(int arg, int aframes) } arg -= (inreg + 1); - stack = (uintptr_t *)fp + 2; + stack = (uintptr_t *)&fp[1]; load: DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); Modified: head/sys/x86/include/stack.h ============================================================================== --- head/sys/x86/include/stack.h Fri Sep 11 03:24:07 2015 (r287643) +++ head/sys/x86/include/stack.h Fri Sep 11 03:31:22 2015 (r287644) @@ -45,7 +45,6 @@ struct i386_frame { struct amd64_frame { struct amd64_frame *f_frame; u_long f_retaddr; - u_long f_arg0; }; struct i386_frame { From owner-svn-src-head@freebsd.org Fri Sep 11 03:54:42 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52B169CCE8D; Fri, 11 Sep 2015 03:54:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4129D1A06; Fri, 11 Sep 2015 03:54:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B3sgmL083676; Fri, 11 Sep 2015 03:54:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B3scxL083655; Fri, 11 Sep 2015 03:54:38 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509110354.t8B3scxL083655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Sep 2015 03:54:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287645 - in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 kern mips/mips powerpc/powerpc sparc64/sparc64 sys x86/include x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 03:54:42 -0000 Author: markj Date: Fri Sep 11 03:54:37 2015 New Revision: 287645 URL: https://svnweb.freebsd.org/changeset/base/287645 Log: Add stack_save_td_running(), a function to trace the kernel stack of a running thread. It is currently implemented only on amd64 and i386; on these architectures, it is implemented by raising an NMI on the CPU on which the target thread is currently running. Unlike stack_save_td(), it may fail, for example if the thread is running in user mode. This change also modifies the kern.proc.kstack sysctl to use this function, so that stacks of running threads are shown in the output of "procstat -kk". This is handy for debugging threads that are stuck in a busy loop. Reviewed by: bdrewery, jhb, kib Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3256 Modified: head/sys/amd64/amd64/trap.c head/sys/arm/arm/stack_machdep.c head/sys/arm64/arm64/stack_machdep.c head/sys/i386/i386/trap.c head/sys/kern/kern_proc.c head/sys/mips/mips/stack_machdep.c head/sys/powerpc/powerpc/stack_machdep.c head/sys/sparc64/sparc64/stack_machdep.c head/sys/sys/stack.h head/sys/x86/include/apicvar.h head/sys/x86/include/stack.h head/sys/x86/x86/local_apic.c head/sys/x86/x86/mp_x86.c head/sys/x86/x86/stack_machdep.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/amd64/amd64/trap.c Fri Sep 11 03:54:37 2015 (r287645) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include "opt_hwpmc_hooks.h" #include "opt_isa.h" #include "opt_kdb.h" +#include "opt_stack.h" #include #include @@ -91,6 +92,7 @@ PMC_SOFT_DEFINE( , , page_fault, write); #ifdef SMP #include #endif +#include #include #ifdef KDTRACE_HOOKS @@ -202,17 +204,24 @@ trap(struct trapframe *frame) goto out; } -#ifdef HWPMC_HOOKS - /* - * CPU PMCs interrupt using an NMI. If the PMC module is - * active, pass the 'rip' value to the PMC module's interrupt - * handler. A return value of '1' from the handler means that - * the NMI was handled by it and we can return immediately. - */ - if (type == T_NMI && pmc_intr && - (*pmc_intr)(PCPU_GET(cpuid), frame)) - goto out; + if (type == T_NMI) { +#ifdef HWPMC_HOOKS + /* + * CPU PMCs interrupt using an NMI. If the PMC module is + * active, pass the 'rip' value to the PMC module's interrupt + * handler. A non-zero return value from the handler means that + * the NMI was consumed by it and we can return immediately. + */ + if (pmc_intr != NULL && + (*pmc_intr)(PCPU_GET(cpuid), frame) != 0) + goto out; +#endif + +#ifdef STACK + if (stack_nmi_handler(frame) != 0) + goto out; #endif + } if (type == T_MCHK) { mca_intr(); Modified: head/sys/arm/arm/stack_machdep.c ============================================================================== --- head/sys/arm/arm/stack_machdep.c Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/arm/arm/stack_machdep.c Fri Sep 11 03:54:37 2015 (r287645) @@ -71,6 +71,13 @@ stack_save_td(struct stack *st, struct t stack_capture(st, frame); } +int +stack_save_td_running(struct stack *st, struct thread *td) +{ + + return (EOPNOTSUPP); +} + void stack_save(struct stack *st) { Modified: head/sys/arm64/arm64/stack_machdep.c ============================================================================== --- head/sys/arm64/arm64/stack_machdep.c Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/arm64/arm64/stack_machdep.c Fri Sep 11 03:54:37 2015 (r287645) @@ -72,6 +72,13 @@ stack_save_td(struct stack *st, struct t stack_capture(st, &frame); } +int +stack_save_td_running(struct stack *st, struct thread *td) +{ + + return (EOPNOTSUPP); +} + void stack_save(struct stack *st) { Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/i386/i386/trap.c Fri Sep 11 03:54:37 2015 (r287645) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include "opt_isa.h" #include "opt_kdb.h" #include "opt_npx.h" +#include "opt_stack.h" #include "opt_trap.h" #include @@ -94,6 +95,7 @@ PMC_SOFT_DEFINE( , , page_fault, write); #ifdef SMP #include #endif +#include #include #include @@ -219,19 +221,26 @@ trap(struct trapframe *frame) goto out; } -#ifdef HWPMC_HOOKS - /* - * CPU PMCs interrupt using an NMI so we check for that first. - * If the HWPMC module is active, 'pmc_hook' will point to - * the function to be called. A return value of '1' from the - * hook means that the NMI was handled by it and that we can - * return immediately. - */ - if (type == T_NMI && pmc_intr && - (*pmc_intr)(PCPU_GET(cpuid), frame)) - goto out; + if (type == T_NMI) { +#ifdef HWPMC_HOOKS + /* + * CPU PMCs interrupt using an NMI so we check for that first. + * If the HWPMC module is active, 'pmc_hook' will point to + * the function to be called. A non-zero return value from the + * hook means that the NMI was consumed by it and that we can + * return immediately. + */ + if (pmc_intr != NULL && + (*pmc_intr)(PCPU_GET(cpuid), frame) != 0) + goto out; #endif +#ifdef STACK + if (stack_nmi_handler(frame) != 0) + goto out; +#endif + } + if (type == T_MCHK) { mca_intr(); goto out; Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/kern/kern_proc.c Fri Sep 11 03:54:37 2015 (r287645) @@ -2517,11 +2517,14 @@ repeat: sizeof(kkstp->kkst_trace), SBUF_FIXEDLEN); thread_lock(td); kkstp->kkst_tid = td->td_tid; - if (TD_IS_SWAPPED(td)) + if (TD_IS_SWAPPED(td)) { kkstp->kkst_state = KKST_STATE_SWAPPED; - else if (TD_IS_RUNNING(td)) - kkstp->kkst_state = KKST_STATE_RUNNING; - else { + } else if (TD_IS_RUNNING(td)) { + if (stack_save_td_running(st, td) == 0) + kkstp->kkst_state = KKST_STATE_STACKOK; + else + kkstp->kkst_state = KKST_STATE_RUNNING; + } else { kkstp->kkst_state = KKST_STATE_STACKOK; stack_save_td(st, td); } Modified: head/sys/mips/mips/stack_machdep.c ============================================================================== --- head/sys/mips/mips/stack_machdep.c Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/mips/mips/stack_machdep.c Fri Sep 11 03:54:37 2015 (r287645) @@ -142,6 +142,13 @@ stack_save_td(struct stack *st, struct t stack_capture(st, pc, sp); } +int +stack_save_td_running(struct stack *st, struct thread *td) +{ + + return (EOPNOTSUPP); +} + void stack_save(struct stack *st) { Modified: head/sys/powerpc/powerpc/stack_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/stack_machdep.c Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/powerpc/powerpc/stack_machdep.c Fri Sep 11 03:54:37 2015 (r287645) @@ -98,6 +98,13 @@ stack_save_td(struct stack *st, struct t stack_capture(st, frame); } +int +stack_save_td_running(struct stack *st, struct thread *td) +{ + + return (EOPNOTSUPP); +} + void stack_save(struct stack *st) { Modified: head/sys/sparc64/sparc64/stack_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/stack_machdep.c Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/sparc64/sparc64/stack_machdep.c Fri Sep 11 03:54:37 2015 (r287645) @@ -82,6 +82,13 @@ stack_save_td(struct stack *st, struct t stack_capture(st, (struct frame *)(td->td_pcb->pcb_sp + SPOFF)); } +int +stack_save_td_running(struct stack *st, struct thread *td) +{ + + return (EOPNOTSUPP); +} + void stack_save(struct stack *st) { Modified: head/sys/sys/stack.h ============================================================================== --- head/sys/sys/stack.h Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/sys/stack.h Fri Sep 11 03:54:37 2015 (r287645) @@ -56,9 +56,10 @@ void stack_ktr(u_int, const char *, in #define CTRSTACK(m, st, depth, cheap) #endif -/* MD Routine. */ +/* MD Routines. */ struct thread; void stack_save(struct stack *); void stack_save_td(struct stack *, struct thread *); +int stack_save_td_running(struct stack *, struct thread *); #endif Modified: head/sys/x86/include/apicvar.h ============================================================================== --- head/sys/x86/include/apicvar.h Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/x86/include/apicvar.h Fri Sep 11 03:54:37 2015 (r287645) @@ -129,12 +129,14 @@ #else #define IPI_DYN_FIRST (APIC_IPI_INTS + 8) #endif -#define IPI_DYN_LAST (254) /* IPIs allocated at runtime */ +#define IPI_DYN_LAST (253) /* IPIs allocated at runtime */ /* * IPI_STOP_HARD does not need to occupy a slot in the IPI vector space since * it is delivered using an NMI anyways. */ +#define IPI_NMI_FIRST 254 +#define IPI_TRACE 254 /* Interrupt for tracing. */ #define IPI_STOP_HARD 255 /* Stop CPU with a NMI. */ /* Modified: head/sys/x86/include/stack.h ============================================================================== --- head/sys/x86/include/stack.h Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/x86/include/stack.h Fri Sep 11 03:54:37 2015 (r287645) @@ -54,4 +54,8 @@ struct i386_frame { }; #endif /* __amd64__ */ +#ifdef _KERNEL +int stack_nmi_handler(struct trapframe *); +#endif + #endif /* !_X86_STACK_H */ Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/x86/x86/local_apic.c Fri Sep 11 03:54:37 2015 (r287645) @@ -1703,11 +1703,10 @@ native_lapic_ipi_vectored(u_int vector, icrlo = APIC_DESTMODE_PHY | APIC_TRIGMOD_EDGE | APIC_LEVEL_ASSERT; /* - * IPI_STOP_HARD is just a "fake" vector used to send a NMI. - * Use special rules regard NMI if passed, otherwise specify - * the vector. + * NMI IPIs are just fake vectors used to send a NMI. Use special rules + * regarding NMIs if passed, otherwise specify the vector. */ - if (vector == IPI_STOP_HARD) + if (vector >= IPI_NMI_FIRST) icrlo |= APIC_DELMODE_NMI; else icrlo |= vector | APIC_DELMODE_FIXED; Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/x86/x86/mp_x86.c Fri Sep 11 03:54:37 2015 (r287645) @@ -120,7 +120,7 @@ struct cpu_ops cpu_ops; * Local data and functions. */ -static volatile cpuset_t ipi_nmi_pending; +static volatile cpuset_t ipi_stop_nmi_pending; /* used to hold the AP's until we are ready to release them */ struct mtx ap_boot_mtx; @@ -894,7 +894,7 @@ ipi_selected(cpuset_t cpus, u_int ipi) * Set the mask of receiving CPUs for this purpose. */ if (ipi == IPI_STOP_HARD) - CPU_OR_ATOMIC(&ipi_nmi_pending, &cpus); + CPU_OR_ATOMIC(&ipi_stop_nmi_pending, &cpus); while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; @@ -917,7 +917,7 @@ ipi_cpu(int cpu, u_int ipi) * Set the mask of receiving CPUs for this purpose. */ if (ipi == IPI_STOP_HARD) - CPU_SET_ATOMIC(cpu, &ipi_nmi_pending); + CPU_SET_ATOMIC(cpu, &ipi_stop_nmi_pending); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); ipi_send_cpu(cpu, ipi); @@ -944,7 +944,7 @@ ipi_all_but_self(u_int ipi) * Set the mask of receiving CPUs for this purpose. */ if (ipi == IPI_STOP_HARD) - CPU_OR_ATOMIC(&ipi_nmi_pending, &other_cpus); + CPU_OR_ATOMIC(&ipi_stop_nmi_pending, &other_cpus); CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi); lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS); @@ -962,10 +962,10 @@ ipi_nmi_handler() * and should be handled. */ cpuid = PCPU_GET(cpuid); - if (!CPU_ISSET(cpuid, &ipi_nmi_pending)) + if (!CPU_ISSET(cpuid, &ipi_stop_nmi_pending)) return (1); - CPU_CLR_ATOMIC(cpuid, &ipi_nmi_pending); + CPU_CLR_ATOMIC(cpuid, &ipi_stop_nmi_pending); cpustop_handler(); return (0); } Modified: head/sys/x86/x86/stack_machdep.c ============================================================================== --- head/sys/x86/x86/stack_machdep.c Fri Sep 11 03:31:22 2015 (r287644) +++ head/sys/x86/x86/stack_machdep.c Fri Sep 11 03:54:37 2015 (r287645) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2015 EMC Corporation * Copyright (c) 2005 Antoine Brodin * All rights reserved. * @@ -29,17 +30,21 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include #include #include -#include - #include +#include #include #include #include +#include + #ifdef __i386__ #define PCB_FP(pcb) ((pcb)->pcb_ebp) #define TF_FP(tf) ((tf)->tf_ebp) @@ -54,6 +59,14 @@ typedef struct i386_frame *x86_frame_t; typedef struct amd64_frame *x86_frame_t; #endif +static struct stack *nmi_stack; +static volatile struct thread *nmi_pending; + +#ifdef SMP +static struct mtx nmi_lock; +MTX_SYSINIT(nmi_lock, &nmi_lock, "stack_nmi", MTX_SPIN); +#endif + static void stack_capture(struct thread *td, struct stack *st, register_t fp) { @@ -78,6 +91,24 @@ stack_capture(struct thread *td, struct } } +int +stack_nmi_handler(struct trapframe *tf) +{ + + /* Don't consume an NMI that wasn't meant for us. */ + if (nmi_stack == NULL || curthread != nmi_pending) + return (0); + + if (INKERNEL(TF_PC(tf))) + stack_capture(curthread, nmi_stack, TF_FP(tf)); + else + /* We interrupted a thread in user mode. */ + nmi_stack->depth = 0; + + atomic_store_rel_ptr((long *)&nmi_pending, (long)NULL); + return (1); +} + void stack_save_td(struct stack *st, struct thread *td) { @@ -90,6 +121,39 @@ stack_save_td(struct stack *st, struct t stack_capture(td, st, PCB_FP(td->td_pcb)); } +int +stack_save_td_running(struct stack *st, struct thread *td) +{ + + THREAD_LOCK_ASSERT(td, MA_OWNED); + MPASS(TD_IS_RUNNING(td)); + + if (td == curthread) { + stack_save(st); + return (0); + } + +#ifdef SMP + mtx_lock_spin(&nmi_lock); + + nmi_stack = st; + nmi_pending = td; + ipi_cpu(td->td_oncpu, IPI_TRACE); + while ((void *)atomic_load_acq_ptr((long *)&nmi_pending) != NULL) + cpu_spinwait(); + nmi_stack = NULL; + + mtx_unlock_spin(&nmi_lock); + + if (st->depth == 0) + /* We interrupted a thread in user mode. */ + return (EAGAIN); +#else + KASSERT(0, ("curthread isn't running")); +#endif + return (0); +} + void stack_save(struct stack *st) { From owner-svn-src-head@freebsd.org Fri Sep 11 03:56:05 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62E8B9CCFBE; Fri, 11 Sep 2015 03:56:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A0AA1C4A; Fri, 11 Sep 2015 03:56:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B3u53t083865; Fri, 11 Sep 2015 03:56:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B3u5pQ083864; Fri, 11 Sep 2015 03:56:05 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509110356.t8B3u5pQ083864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Sep 2015 03:56:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287646 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 03:56:05 -0000 Author: markj Date: Fri Sep 11 03:56:04 2015 New Revision: 287646 URL: https://svnweb.freebsd.org/changeset/base/287646 Log: Document stack_save_td(9) and stack_save_td_running(9). Reviewed by: wblock Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3243 Modified: head/share/man/man9/stack.9 Modified: head/share/man/man9/stack.9 ============================================================================== --- head/share/man/man9/stack.9 Fri Sep 11 03:54:37 2015 (r287645) +++ head/share/man/man9/stack.9 Fri Sep 11 03:56:04 2015 (r287646) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 16, 2011 +.Dd September 10, 2015 .Dt STACK 9 .Os .Sh NAME @@ -36,9 +36,11 @@ .Sh SYNOPSIS .In sys/param.h .In sys/stack.h +.Pp In the kernel configuration file: .Cd "options DDB" .Cd "options STACK" +.Pp .Ft struct stack * .Fn stack_create "void" .Ft void @@ -63,6 +65,10 @@ In the kernel configuration file: .Fn stack_sbuf_print_ddb "struct sbuf sb*" "const struct stack *st" .Ft void .Fn stack_save "struct stack *st" +.Ft void +.Fn stack_save_td "struct stack *st" "struct thread *td" +.Ft int +.Fn stack_save_td_running "struct stack *st" "struct thread *td" .Sh DESCRIPTION The .Nm @@ -86,6 +92,16 @@ Memory associated with a trace is freed .Pp A trace of the current kernel thread's call stack may be captured using .Fn stack_save . +.Fn stack_save_td +and +.Fn stack_save_td_running +can also be used to capture the stack of a caller-specified thread. +Callers of these functions must own the thread lock of the specified thread. +.Fn stack_save_td +can capture the stack of a kernel thread that is not running or +swapped out at the time of the call. +.Fn stack_save_td_running +can capture the stack of a running kernel thread. .Pp .Fn stack_print and @@ -130,6 +146,23 @@ The utility functions and .Nm stack_put may be used to manipulate stack data structures directly. +.Sh RETURN VALUES +.Fn stack_put +returns 0 on success. +Otherwise the +.Dv struct stack +does not contain space to record additional frames, and a non-zero value is +returned. +.Pp +.Fn stack_save_td_running +returns 0 when the stack capture was successful and a non-zero error number +otherwise. +In particular, +.Er EAGAIN +is returned if the thread was running in user mode at the time that the +capture was attempted, and +.Er EOPNOTSUPP +is returned if the operation is not implemented. .Sh SEE ALSO .Xr ddb 4 , .Xr printf 9 , From owner-svn-src-head@freebsd.org Fri Sep 11 04:02:06 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF5DAA00354; Fri, 11 Sep 2015 04:02:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B085F105B; Fri, 11 Sep 2015 04:02:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B426vM088050; Fri, 11 Sep 2015 04:02:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B426wk088049; Fri, 11 Sep 2015 04:02:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509110402.t8B426wk088049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Sep 2015 04:02:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287647 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 04:02:06 -0000 Author: markj Date: Fri Sep 11 04:02:05 2015 New Revision: 287647 URL: https://svnweb.freebsd.org/changeset/base/287647 Log: Remove prototypes for undefined functions from netstat.h. Modified: head/usr.bin/netstat/netstat.h Modified: head/usr.bin/netstat/netstat.h ============================================================================== --- head/usr.bin/netstat/netstat.h Fri Sep 11 03:56:04 2015 (r287646) +++ head/usr.bin/netstat/netstat.h Fri Sep 11 04:02:05 2015 (r287647) @@ -131,29 +131,14 @@ void flowtable_stats(void); char *routename(struct sockaddr *, int); const char *netname(struct sockaddr *, struct sockaddr *); -char *ns_print(struct sockaddr *); void routepr(int, int); -void nsprotopr(u_long, const char *, int, int); -void spp_stats(u_long, const char *, int, int); -void idp_stats(u_long, const char *, int, int); -void nserr_stats(u_long, const char *, int, int); - #ifdef NETGRAPH void netgraphprotopr(u_long, const char *, int, int); #endif void unixpr(u_long, u_long, u_long, u_long, u_long, bool *); -void esis_stats(u_long, const char *, int, int); -void clnp_stats(u_long, const char *, int, int); -void cltp_stats(u_long, const char *, int, int); -void iso_protopr(u_long, const char *, int, int); -void iso_protopr1(u_long, int); -void tp_protopr(u_long, const char *, int, int); -void tp_inproto(u_long); -void tp_stats(caddr_t, caddr_t); - void mroutepr(void); void mrt_stats(void); void bpf_stats(char *); From owner-svn-src-head@freebsd.org Fri Sep 11 04:03:59 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98FD3A00449; Fri, 11 Sep 2015 04:03:59 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73AAC11C3; Fri, 11 Sep 2015 04:03:59 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-254-50.lns20.per4.internode.on.net [121.45.254.50]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id t8B43mA1040853 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 10 Sep 2015 21:03:51 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r287636 - head/share/mk To: "Simon J. Gerraty" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201509110019.t8B0JocS082576@repo.freebsd.org> From: Julian Elischer Message-ID: <55F2529E.5080105@freebsd.org> Date: Fri, 11 Sep 2015 12:03:42 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <201509110019.t8B0JocS082576@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 04:03:59 -0000 On 9/11/15 8:19 AM, Simon J. Gerraty wrote: > Author: sjg > Date: Fri Sep 11 00:19:49 2015 > New Revision: 287636 > URL: https://svnweb.freebsd.org/changeset/base/287636 > > Log: > Handle default MAKEOBJDIR for META_MODE. > If MAKEOBJDIRPREFIX is set, use it for default OBJROOT. > If MAKEOBJDIR is empty or not a suitable value (no '/') > set a default that works. if not suitable.. it should error (with a really explicit error message), not do something else.. > > Reviewed by: bdrewery > > Modified: > head/share/mk/local.meta.sys.mk > > Modified: head/share/mk/local.meta.sys.mk > ============================================================================== > --- head/share/mk/local.meta.sys.mk Thu Sep 10 22:47:26 2015 (r287635) > +++ head/share/mk/local.meta.sys.mk Fri Sep 11 00:19:49 2015 (r287636) > @@ -13,11 +13,14 @@ MK_INSTALL_AS_USER= yes > .warning MAKEOBJDIRPREFIX not supported; setting MAKEOBJDIR... > # put things approximately where they want > OBJROOT:=${MAKEOBJDIRPREFIX}${SRCTOP:S,/src,,}/ > +MAKEOBJDIRPREFIX= > +.export MAKEOBJDIRPREFIX > +.endif > +.if empty(MAKEOBJDIR) || ${MAKEOBJDIR:M*/*} == "" > # OBJTOP set below > MAKEOBJDIR=$${.CURDIR:S,$${SRCTOP},$${OBJTOP},} > -MAKEOBJDIRPREFIX= > # export but do not track > -.export-env MAKEOBJDIRPREFIX MAKEOBJDIR > +.export-env MAKEOBJDIR > # now for our own use > MAKEOBJDIR= ${.CURDIR:S,${SRCTOP},${OBJTOP},} > .endif > > From owner-svn-src-head@freebsd.org Fri Sep 11 04:20:05 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFE9BA00D46; Fri, 11 Sep 2015 04:20:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A16EE181C; Fri, 11 Sep 2015 04:20:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B4K5W9093355; Fri, 11 Sep 2015 04:20:05 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B4K5Cu093354; Fri, 11 Sep 2015 04:20:05 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201509110420.t8B4K5Cu093354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 11 Sep 2015 04:20:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287648 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 04:20:05 -0000 Author: imp Date: Fri Sep 11 04:20:04 2015 New Revision: 287648 URL: https://svnweb.freebsd.org/changeset/base/287648 Log: bufdonebio is now unused. Retire it too. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Fri Sep 11 04:02:05 2015 (r287647) +++ head/sys/kern/vfs_bio.c Fri Sep 11 04:20:04 2015 (r287648) @@ -3768,24 +3768,6 @@ bufwait(struct buf *bp) } } - /* - * Call back function from struct bio back up to struct buf. - */ -static void -bufdonebio(struct bio *bip) -{ - struct buf *bp; - - bp = bip->bio_caller2; - bp->b_resid = bip->bio_resid; - bp->b_ioflags = bip->bio_flags; - bp->b_error = bip->bio_error; - if (bp->b_error) - bp->b_ioflags |= BIO_ERROR; - bufdone(bp); - g_destroy_bio(bip); -} - /* * bufdone: * From owner-svn-src-head@freebsd.org Fri Sep 11 04:37:05 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19482A01524; Fri, 11 Sep 2015 04:37:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06FE21EDB; Fri, 11 Sep 2015 04:37:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B4b4Bn002232; Fri, 11 Sep 2015 04:37:04 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B4b2O3002215; Fri, 11 Sep 2015 04:37:02 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509110437.t8B4b2O3002215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Sep 2015 04:37:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287649 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 04:37:05 -0000 Author: markj Date: Fri Sep 11 04:37:01 2015 New Revision: 287649 URL: https://svnweb.freebsd.org/changeset/base/287649 Log: Use a common subroutine to fetch and zero protocol stats instead of duplicating roughly similar code for each protocol. MFC after: 2 weeks Modified: head/usr.bin/netstat/flowtable.c head/usr.bin/netstat/if.c head/usr.bin/netstat/inet.c head/usr.bin/netstat/inet6.c head/usr.bin/netstat/main.c head/usr.bin/netstat/mbuf.c head/usr.bin/netstat/mroute.c head/usr.bin/netstat/mroute6.c head/usr.bin/netstat/netstat.h head/usr.bin/netstat/sctp.c Modified: head/usr.bin/netstat/flowtable.c ============================================================================== --- head/usr.bin/netstat/flowtable.c Fri Sep 11 04:20:04 2015 (r287648) +++ head/usr.bin/netstat/flowtable.c Fri Sep 11 04:37:01 2015 (r287649) @@ -28,13 +28,15 @@ #include __FBSDID("$FreeBSD$"); + #include -#include + #include -#include + #include #include #include + #include "netstat.h" /* @@ -68,17 +70,18 @@ void flowtable_stats(void) { struct flowtable_stat stat; - size_t len = sizeof(stat); if (!live) return; - if (sysctlbyname("net.flowtable.ip4.stat", &stat, &len, NULL, 0) == 0) { + if (fetch_stats("net.flowtable.ip4.stat", 0, &stat, + sizeof(stat), NULL) == 0) { printf("flowtable for IPv4:\n"); print_stats(&stat); } - if (sysctlbyname("net.flowtable.ip6.stat", &stat, &len, NULL, 0) == 0) { + if (fetch_stats("net.flowtable.ip6.stat", 0, &stat, + sizeof(stat), NULL) == 0) { printf("flowtable for IPv6:\n"); print_stats(&stat); } Modified: head/usr.bin/netstat/if.c ============================================================================== --- head/usr.bin/netstat/if.c Fri Sep 11 04:20:04 2015 (r287648) +++ head/usr.bin/netstat/if.c Fri Sep 11 04:37:01 2015 (r287649) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -134,20 +133,11 @@ pfsync_acts_stats(const char *list, cons void pfsync_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct pfsyncstats pfsyncstat, zerostat; - size_t len = sizeof(struct pfsyncstats); + struct pfsyncstats pfsyncstat; - if (live) { - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.pfsync.stats", &pfsyncstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - if (errno != ENOENT) - warn("sysctl: net.pfsync.stats"); - return; - } - } else - kread(off, &pfsyncstat, len); + if (fetch_stats("net.pfsync.stats", off, &pfsyncstat, + sizeof(pfsyncstat), kread) != 0) + return; xo_emit("{T:/%s}:\n", name); xo_open_container(name); Modified: head/usr.bin/netstat/inet.c ============================================================================== --- head/usr.bin/netstat/inet.c Fri Sep 11 04:20:04 2015 (r287648) +++ head/usr.bin/netstat/inet.c Fri Sep 11 04:37:01 2015 (r287649) @@ -627,8 +627,7 @@ protopr(u_long off, const char *name, in void tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct tcpstat tcpstat, zerostat; - size_t len = sizeof tcpstat; + struct tcpstat tcpstat; #ifdef INET6 if (tcp_done != 0) @@ -637,16 +636,9 @@ tcp_stats(u_long off, const char *name, tcp_done = 1; #endif - if (live) { - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet.tcp.stats", &tcpstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - xo_warn("sysctl: net.inet.tcp.stats"); - return; - } - } else - kread_counters(off, &tcpstat, len); + if (fetch_stats("net.inet.tcp.stats", off, &tcpstat, + sizeof(tcpstat), kread_counters) != 0) + return; xo_open_container("tcp"); xo_emit("{T:/%s}:\n", name); @@ -860,8 +852,7 @@ tcp_stats(u_long off, const char *name, void udp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct udpstat udpstat, zerostat; - size_t len = sizeof udpstat; + struct udpstat udpstat; uint64_t delivered; #ifdef INET6 @@ -871,16 +862,9 @@ udp_stats(u_long off, const char *name, udp_done = 1; #endif - if (live) { - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet.udp.stats", &udpstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - xo_warn("sysctl: net.inet.udp.stats"); - return; - } - } else - kread_counters(off, &udpstat, len); + if (fetch_stats("net.inet.udp.stats", off, &udpstat, + sizeof(udpstat), kread_counters) != 0) + return; xo_open_container("udp"); xo_emit("{T:/%s}:\n", name); @@ -933,23 +917,11 @@ udp_stats(u_long off, const char *name, void carp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct carpstats carpstat, zerostat; - size_t len = sizeof(struct carpstats); + struct carpstats carpstat; - if (live) { - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet.carp.stats", &carpstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - if (errno != ENOENT) - xo_warn("sysctl: net.inet.carp.stats"); - return; - } - } else { - if (off == 0) - return; - kread_counters(off, &carpstat, len); - } + if (fetch_stats("net.inet.carp.stats", off, &carpstat, + sizeof(carpstat), kread_counters) != 0) + return; xo_open_container(name); xo_emit("{T:/%s}:\n", name); @@ -1000,19 +972,11 @@ carp_stats(u_long off, const char *name, void ip_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct ipstat ipstat, zerostat; - size_t len = sizeof ipstat; + struct ipstat ipstat; - if (live) { - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet.ip.stats", &ipstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - xo_warn("sysctl: net.inet.ip.stats"); - return; - } - } else - kread_counters(off, &ipstat, len); + if (fetch_stats("net.inet.ip.stats", off, &ipstat, + sizeof(ipstat), kread_counters) != 0) + return; xo_open_container(name); xo_emit("{T:/%s}:\n", name); @@ -1093,19 +1057,11 @@ ip_stats(u_long off, const char *name, i void arp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct arpstat arpstat, zerostat; - size_t len = sizeof(arpstat); + struct arpstat arpstat; - if (live) { - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.link.ether.arp.stats", &arpstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - xo_warn("sysctl: net.link.ether.arp.stats"); - return; - } - } else - kread_counters(off, &arpstat, len); + if (fetch_stats("net.link.ether.arp.stats", off, &arpstat, + sizeof(arpstat), kread_counters) != 0) + return; xo_open_container(name); xo_emit("{T:/%s}:\n", name); @@ -1186,21 +1142,13 @@ static const char *icmpnames[ICMP_MAXTYP void icmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct icmpstat icmpstat, zerostat; - int i, first; + struct icmpstat icmpstat; size_t len; + int i, first; - len = sizeof icmpstat; - if (live) { - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet.icmp.stats", &icmpstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - xo_warn("sysctl: net.inet.icmp.stats"); - return; - } - } else - kread_counters(off, &icmpstat, len); + if (fetch_stats("net.inet.icmp.stats", off, &icmpstat, + sizeof(icmpstat), kread_counters) != 0) + return; xo_open_container(name); xo_emit("{T:/%s}:\n", name); @@ -1300,22 +1248,11 @@ icmp_stats(u_long off, const char *name, void igmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct igmpstat igmpstat, zerostat; - size_t len; + struct igmpstat igmpstat; - len = sizeof(igmpstat); - if (live) { - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet.igmp.stats", &igmpstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - xo_warn("sysctl: net.inet.igmp.stats"); - return; - } - } else { - len = sizeof(igmpstat); - kread(off, &igmpstat, len); - } + if (fetch_stats("net.inet.igmp.stats", 0, &igmpstat, + sizeof(igmpstat), kread) != 0) + return; if (igmpstat.igps_version != IGPS_VERSION_3) { xo_warnx("%s: version mismatch (%d != %d)", __func__, @@ -1380,23 +1317,11 @@ void pim_stats(u_long off __unused, const char *name, int af1 __unused, int proto __unused) { - struct pimstat pimstat, zerostat; - size_t len = sizeof pimstat; + struct pimstat pimstat; - if (live) { - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet.pim.stats", &pimstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - if (errno != ENOENT) - xo_warn("sysctl: net.inet.pim.stats"); - return; - } - } else { - if (off == 0) - return; - kread_counters(off, &pimstat, len); - } + if (fetch_stats("net.inet.pim.stats", off, &pimstat, + sizeof(pimstat), kread_counters) != 0) + return; xo_open_container(name); xo_emit("{T:/%s}:\n", name); Modified: head/usr.bin/netstat/inet6.c ============================================================================== --- head/usr.bin/netstat/inet6.c Fri Sep 11 04:20:04 2015 (r287648) +++ head/usr.bin/netstat/inet6.c Fri Sep 11 04:37:01 2015 (r287649) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -359,23 +358,13 @@ static const char *srcrule_str[] = { void ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct ip6stat ip6stat, zerostat; + struct ip6stat ip6stat; int first, i; - size_t len; - len = sizeof ip6stat; - if (live) { - memset(&ip6stat, 0, len); - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet6.ip6.stats", &ip6stat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - if (errno != ENOENT) - xo_warn("sysctl: net.inet6.ip6.stats"); - return; - } - } else - kread_counters(off, &ip6stat, len); + if (fetch_stats("net.inet6.ip6.stats", off, &ip6stat, + sizeof(ip6stat), kread_counters) != 0) + return; + xo_open_container(name); xo_emit("{T:/%s}:\n", name); @@ -956,23 +945,12 @@ static const char *icmp6names[] = { void icmp6_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct icmp6stat icmp6stat, zerostat; + struct icmp6stat icmp6stat; int i, first; - size_t len; - len = sizeof icmp6stat; - if (live) { - memset(&icmp6stat, 0, len); - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet6.icmp6.stats", &icmp6stat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - if (errno != ENOENT) - xo_warn("sysctl: net.inet6.icmp6.stats"); - return; - } - } else - kread_counters(off, &icmp6stat, len); + if (fetch_stats("net.inet6.icmp6.stats", off, &icmp6stat, + sizeof(icmp6stat), kread_counters) != 0) + return; xo_emit("{T:/%s}:\n", name); xo_open_container(name); @@ -1196,23 +1174,11 @@ end: void pim6_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct pim6stat pim6stat, zerostat; - size_t len = sizeof pim6stat; + struct pim6stat pim6stat; - if (live) { - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet6.pim.stats", &pim6stat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - if (errno != ENOENT) - xo_warn("sysctl: net.inet6.pim.stats"); - return; - } - } else { - if (off == 0) - return; - kread(off, &pim6stat, len); - } + if (fetch_stats("net.inet6.pim.stats", off, &pim6stat, + sizeof(pim6stat), kread) != 0) + return; xo_emit("{T:/%s}:\n", name); xo_open_container(name); @@ -1244,22 +1210,12 @@ pim6_stats(u_long off, const char *name, void rip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct rip6stat rip6stat, zerostat; + struct rip6stat rip6stat; u_quad_t delivered; - size_t len; - len = sizeof(rip6stat); - if (live) { - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet6.ip6.rip6stats", &rip6stat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - if (errno != ENOENT) - xo_warn("sysctl: net.inet6.ip6.rip6stats"); - return; - } - } else - kread_counters(off, &rip6stat, len); + if (fetch_stats("net.inet6.ip6.rip6stats", off, &rip6stat, + sizeof(rip6stat), kread_counters) != 0) + return; xo_emit("{T:/%s}:\n", name); xo_open_container(name); Modified: head/usr.bin/netstat/main.c ============================================================================== --- head/usr.bin/netstat/main.c Fri Sep 11 04:20:04 2015 (r287648) +++ head/usr.bin/netstat/main.c Fri Sep 11 04:37:01 2015 (r287649) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -548,6 +549,29 @@ main(int argc, char *argv[]) exit(0); } +int +fetch_stats(const char *sysctlname, u_long off, void *stats, size_t len, + int (*kreadfn)(u_long, void *, size_t)) +{ + int error; + + if (live) { + memset(stats, 0, len); + if (zflag) + error = sysctlbyname(sysctlname, NULL, NULL, stats, + len); + else + error = sysctlbyname(sysctlname, stats, &len, NULL, 0); + if (error == -1 && errno != ENOENT) + xo_warn("sysctl %s", sysctlname); + } else { + if (off == 0) + return (1); + error = kreadfn(off, stats, len); + } + return (error); +} + /* * Print out protocol statistics or control blocks (per sflag). * If the interface was not specifically requested, and the symbol Modified: head/usr.bin/netstat/mbuf.c ============================================================================== --- head/usr.bin/netstat/mbuf.c Fri Sep 11 04:20:04 2015 (r287648) +++ head/usr.bin/netstat/mbuf.c Fri Sep 11 04:37:01 2015 (r287649) @@ -310,27 +310,22 @@ mbpr(void *kvmd, u_long mbaddr) jumbop_failures, jumbo9_failures, jumbo16_failures, jumbop_size / 1024); - if (live) { - mlen = sizeof(nsfbufs); - if (!sysctlbyname("kern.ipc.nsfbufs", &nsfbufs, &mlen, NULL, - 0) && - !sysctlbyname("kern.ipc.nsfbufsused", &nsfbufsused, - &mlen, NULL, 0) && - !sysctlbyname("kern.ipc.nsfbufspeak", &nsfbufspeak, - &mlen, NULL, 0)) - xo_emit("{:nsfbufs-current/%d}/{:nsfbufs-peak/%d}/" - "{:nsfbufs/%d} " - "{N:sfbufs in use (current\\/peak\\/max)}\n", - nsfbufsused, nsfbufspeak, nsfbufs); - mlen = sizeof(sfstat); - if (sysctlbyname("kern.ipc.sfstat", &sfstat, &mlen, NULL, 0)) { - xo_warn("kern.ipc.sfstat"); - goto out; - } - } else { - if (kread_counters(mbaddr, (char *)&sfstat, sizeof sfstat) != 0) - goto out; - } + mlen = sizeof(nsfbufs); + if (live && + sysctlbyname("kern.ipc.nsfbufs", &nsfbufs, &mlen, NULL, 0) == 0 && + sysctlbyname("kern.ipc.nsfbufsused", &nsfbufsused, &mlen, + NULL, 0) == 0 && + sysctlbyname("kern.ipc.nsfbufspeak", &nsfbufspeak, &mlen, + NULL, 0) == 0) + xo_emit("{:nsfbufs-current/%d}/{:nsfbufs-peak/%d}/" + "{:nsfbufs/%d} " + "{N:sfbufs in use (current\\/peak\\/max)}\n", + nsfbufsused, nsfbufspeak, nsfbufs); + + if (fetch_stats("kern.ipc.sfstat", mbaddr, &sfstat, sizeof(sfstat), + kread_counters) != 0) + goto out; + xo_emit("{:sfbufs-alloc-failed/%ju} {N:requests for sfbufs denied}\n", (uintmax_t)sfstat.sf_allocfail); xo_emit("{:sfbufs-alloc-wait/%ju} {N:requests for sfbufs delayed}\n", Modified: head/usr.bin/netstat/mroute.c ============================================================================== --- head/usr.bin/netstat/mroute.c Fri Sep 11 04:20:04 2015 (r287648) +++ head/usr.bin/netstat/mroute.c Fri Sep 11 04:37:01 2015 (r287649) @@ -400,7 +400,6 @@ mrt_stats() { struct mrtstat mrtstat; u_long mstaddr; - size_t len = sizeof(mrtstat); mstaddr = nl[N_MRTSTAT].n_value; @@ -409,14 +408,9 @@ mrt_stats() return; } - if (live) { - if (sysctlbyname("net.inet.ip.mrtstat", &mrtstat, &len, NULL, - 0) < 0) { - xo_warn("sysctl: net.inet.ip.mrtstat failed."); - return; - } - } else - kread_counters(mstaddr, &mrtstat, len); + if (fetch_stats("net.inet.ip.mrtstat", mstaddr, &mrtstat, + sizeof(mrtstat), kread_counters) != 0) + return; xo_emit("{T:IPv4 multicast forwarding}:\n"); Modified: head/usr.bin/netstat/mroute6.c ============================================================================== --- head/usr.bin/netstat/mroute6.c Fri Sep 11 04:20:04 2015 (r287648) +++ head/usr.bin/netstat/mroute6.c Fri Sep 11 04:37:01 2015 (r287649) @@ -231,13 +231,10 @@ void mrt6_stats() { struct mrt6stat mrtstat; - size_t len = sizeof mrtstat; - if (sysctlbyname("net.inet6.ip6.mrt6stat", &mrtstat, &len, NULL, 0) < - 0) { - xo_warn("sysctl: net.inet6.ip6.mrt6stat"); + if (fetch_stats("net.inet6.ip6.mrt6stat", 0, &mrtstat, + sizeof(mrtstat), kread_counters) != 0) return; - } xo_open_container("multicast-statistics"); xo_emit("{T:IPv6 multicast forwarding}:\n"); Modified: head/usr.bin/netstat/netstat.h ============================================================================== --- head/usr.bin/netstat/netstat.h Fri Sep 11 04:20:04 2015 (r287648) +++ head/usr.bin/netstat/netstat.h Fri Sep 11 04:37:01 2015 (r287649) @@ -63,6 +63,8 @@ extern int unit; /* unit number for abov extern int live; /* true if we are examining a live system */ +int fetch_stats(const char *sysctlname, u_long addr, void *stats, + size_t len, int (*kreadfn)(u_long, void *, size_t)); int kread(u_long addr, void *buf, size_t size); uint64_t kread_counter(u_long addr); int kread_counters(u_long addr, void *buf, size_t size); Modified: head/usr.bin/netstat/sctp.c ============================================================================== --- head/usr.bin/netstat/sctp.c Fri Sep 11 04:20:04 2015 (r287648) +++ head/usr.bin/netstat/sctp.c Fri Sep 11 04:37:01 2015 (r287649) @@ -658,20 +658,11 @@ sctp_statesprint(uint32_t state) void sctp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct sctpstat sctpstat, zerostat; - size_t len = sizeof(sctpstat); + struct sctpstat sctpstat; - if (live) { - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet.sctp.stats", &sctpstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - if (errno != ENOENT) - xo_warn("sysctl: net.inet.sctp.stats"); - return; - } - } else - kread(off, &sctpstat, len); + if (fetch_stats("net.inet.sctp.stats", off, &sctpstat, + sizeof(sctpstat), kread) != 0) + return; xo_open_container(name); xo_emit("{T:/%s}:\n", name); From owner-svn-src-head@freebsd.org Fri Sep 11 05:42:03 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1056A013F6; Fri, 11 Sep 2015 05:42:03 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id C50D51B76; Fri, 11 Sep 2015 05:42:03 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id C3A60106C; Fri, 11 Sep 2015 05:42:03 +0000 (UTC) Date: Fri, 11 Sep 2015 05:42:03 +0000 From: Alexey Dokuchaev To: Devin Teske Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r287635 - in head/release: amd64 i386 pc98 powerpc sparc64 Message-ID: <20150911054203.GA92046@FreeBSD.org> References: <201509102247.t8AMlRA5039170@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201509102247.t8AMlRA5039170@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 05:42:03 -0000 On Thu, Sep 10, 2015 at 10:47:27PM +0000, Devin Teske wrote: > New Revision: 287635 > URL: https://svnweb.freebsd.org/changeset/base/287635 > > Log: > Fix argument quoting and remove unnecessary braces > [...] > > if [ $# -lt 3 ]; then > - echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' > + echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" usage() output typically should be sent to stderr, i.e." echo "usage: $0 bla-bla-bla" >&2 (this bug exists in all those scripts). ./danfe From owner-svn-src-head@freebsd.org Fri Sep 11 06:52:58 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A49F9CC44D; Fri, 11 Sep 2015 06:52:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 711701DF8; Fri, 11 Sep 2015 06:52:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B6qwOn067962; Fri, 11 Sep 2015 06:52:58 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B6qwO1067960; Fri, 11 Sep 2015 06:52:58 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509110652.t8B6qwO1067960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 11 Sep 2015 06:52:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287650 - head/usr.sbin/gstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 06:52:58 -0000 Author: delphij Date: Fri Sep 11 06:52:57 2015 New Revision: 287650 URL: https://svnweb.freebsd.org/changeset/base/287650 Log: Use strlcpy() in favor of strncpy() as it's defined to have a nul character at the end of string buffer, and the code context do expects this to behave correctly (e.g. strchr). Note that we do not believe there is real-world impact for gstat(8)'s usage because the strings are length checked, and the on-stack buffer belongs to main() and we can expect to have zeros in them. MFC after: 2 weeks Modified: head/usr.sbin/gstat/gstat.c Modified: head/usr.sbin/gstat/gstat.c ============================================================================== --- head/usr.sbin/gstat/gstat.c Fri Sep 11 04:37:01 2015 (r287649) +++ head/usr.sbin/gstat/gstat.c Fri Sep 11 06:52:57 2015 (r287650) @@ -124,7 +124,7 @@ main(int argc, char **argv) if (regcomp(&f_re, optarg, REG_EXTENDED) != 0) errx(EX_USAGE, "Invalid filter - see re_format(7)"); - strncpy(f_s, optarg, sizeof(f_s)); + strlcpy(f_s, optarg, sizeof(f_s)); break; case 'o': flag_o = 1; @@ -216,7 +216,7 @@ main(int argc, char **argv) getyx(stdscr, cury, curx); getmaxyx(stdscr, maxy, maxx); } - strncpy(pf_s, f_s, sizeof(pf_s)); + strlcpy(pf_s, f_s, sizeof(pf_s)); max_flen = maxx - curx - 1; if ((int)strlen(f_s) > max_flen && max_flen >= 0) { if (max_flen > 3) @@ -406,7 +406,7 @@ main(int argc, char **argv) err(1, "el_gets"); if (line_len > 1) history(hist, &hist_ev, H_ENTER, line); - strncpy(tmp_f_s, line, sizeof(f_s)); + strlcpy(tmp_f_s, line, sizeof(f_s)); if ((p = strchr(tmp_f_s, '\n')) != NULL) *p = '\0'; /* @@ -423,7 +423,7 @@ main(int argc, char **argv) refresh(); sleep(1); } else { - strncpy(f_s, tmp_f_s, sizeof(f_s)); + strlcpy(f_s, tmp_f_s, sizeof(f_s)); f_re = tmp_f_re; } break; From owner-svn-src-head@freebsd.org Fri Sep 11 08:27:33 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3FE69BF5F1; Fri, 11 Sep 2015 08:27:33 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AD531219; Fri, 11 Sep 2015 08:27:33 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B8RXjc012510; Fri, 11 Sep 2015 08:27:33 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B8RX1k012509; Fri, 11 Sep 2015 08:27:33 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201509110827.t8B8RX1k012509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 11 Sep 2015 08:27:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287651 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 08:27:33 -0000 Author: cy Date: Fri Sep 11 08:27:32 2015 New Revision: 287651 URL: https://svnweb.freebsd.org/changeset/base/287651 Log: Fixup typos in comments. Obtained from: NetBSD r1.4. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/ip_state.c Modified: head/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_state.c Fri Sep 11 06:52:57 2015 (r287650) +++ head/sys/contrib/ipfilter/netinet/ip_state.c Fri Sep 11 08:27:32 2015 (r287651) @@ -1,4 +1,4 @@ -/* $FreeBSD$ */ +/* $NetBSD: ip_state.c,v 1.4 2012/12/20 21:42:28 christos Exp $ */ /* * Copyright (C) 2012 by Darren Reed. @@ -1054,7 +1054,7 @@ ipf_state_putent(softc, softs, data) /* to pointers and adjusts running stats for the hash table as appropriate. */ /* */ /* This function can fail if the filter rule has had a population policy of */ -/* IP addresses used with stateful filteirng assigned to it. */ +/* IP addresses used with stateful filtering assigned to it. */ /* */ /* Locking: it is assumed that some kind of lock on ipf_state is held. */ /* Exits with is_lock initialised and held - *EVEN IF ERROR*. */ @@ -1081,7 +1081,7 @@ ipf_state_insert(softc, is, rev) } /* - * If we could trust is_hv, then the modulous would not be needed, + * If we could trust is_hv, then the modulus would not be needed, * but when running with IPFILTER_SYNC, this stops bad values. */ hv = is->is_hv % softs->ipf_state_size; @@ -1672,6 +1672,10 @@ ipf_state_add(softc, fin, stsave, flags) SBUMPD(ipf_state_stats, iss_bucket_full); return 4; } + + /* + * No existing state; create new + */ KMALLOC(is, ipstate_t *); if (is == NULL) { SBUMPD(ipf_state_stats, iss_nomem); @@ -1683,7 +1687,7 @@ ipf_state_add(softc, fin, stsave, flags) is->is_rule = fr; /* - * Do not do the modulous here, it is done in ipf_state_insert(). + * Do not do the modulus here, it is done in ipf_state_insert(). */ if (fr != NULL) { ipftq_t *tq; @@ -1711,7 +1715,7 @@ ipf_state_add(softc, fin, stsave, flags) /* * It may seem strange to set is_ref to 2, but if stsave is not NULL * then a copy of the pointer is being stored somewhere else and in - * the end, it will expect to be able to do osmething with it. + * the end, it will expect to be able to do something with it. */ is->is_me = stsave; if (stsave != NULL) { From owner-svn-src-head@freebsd.org Fri Sep 11 08:35:54 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B7F39BFB65; Fri, 11 Sep 2015 08:35:54 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C0751A68; Fri, 11 Sep 2015 08:35:54 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B8ZsPO017157; Fri, 11 Sep 2015 08:35:54 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B8ZsYW017156; Fri, 11 Sep 2015 08:35:54 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201509110835.t8B8ZsYW017156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 11 Sep 2015 08:35:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287652 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 08:35:54 -0000 Author: cy Date: Fri Sep 11 08:35:53 2015 New Revision: 287652 URL: https://svnweb.freebsd.org/changeset/base/287652 Log: Fix mutex errors. Obtained from: NetBSD r1.4. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/ip_state.c Modified: head/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_state.c Fri Sep 11 08:27:32 2015 (r287651) +++ head/sys/contrib/ipfilter/netinet/ip_state.c Fri Sep 11 08:35:53 2015 (r287652) @@ -3656,7 +3656,6 @@ ipf_state_del(softc, is, why) softs->ipf_state_stats.iss_orphan++; return refs; } - MUTEX_EXIT(&is->is_lock); fr = is->is_rule; is->is_rule = NULL; @@ -3668,6 +3667,7 @@ ipf_state_del(softc, is, why) } is->is_ref = 0; + MUTEX_EXIT(&is->is_lock); if (is->is_tqehead[0] != NULL) { if (ipf_deletetimeoutqueue(is->is_tqehead[0]) == 0) From owner-svn-src-head@freebsd.org Fri Sep 11 08:48:17 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D964A01385; Fri, 11 Sep 2015 08:48:17 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E4E81112; Fri, 11 Sep 2015 08:48:17 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B8mHc4022243; Fri, 11 Sep 2015 08:48:17 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B8mHRf022242; Fri, 11 Sep 2015 08:48:17 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201509110848.t8B8mHRf022242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 11 Sep 2015 08:48:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287653 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 08:48:17 -0000 Author: cy Date: Fri Sep 11 08:48:16 2015 New Revision: 287653 URL: https://svnweb.freebsd.org/changeset/base/287653 Log: Revert $FreeBSD$. Modified: head/sys/contrib/ipfilter/netinet/ip_state.c Modified: head/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_state.c Fri Sep 11 08:35:53 2015 (r287652) +++ head/sys/contrib/ipfilter/netinet/ip_state.c Fri Sep 11 08:48:16 2015 (r287653) @@ -1,4 +1,4 @@ -/* $NetBSD: ip_state.c,v 1.4 2012/12/20 21:42:28 christos Exp $ */ +/* $FreeBSD$ */ /* * Copyright (C) 2012 by Darren Reed. From owner-svn-src-head@freebsd.org Fri Sep 11 09:12:22 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB3F7A003DB; Fri, 11 Sep 2015 09:12:22 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id DF26D1D28; Fri, 11 Sep 2015 09:12:22 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id DE516140D; Fri, 11 Sep 2015 09:12:22 +0000 (UTC) Date: Fri, 11 Sep 2015 09:12:22 +0000 From: Alexey Dokuchaev To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r287653 - head/sys/contrib/ipfilter/netinet Message-ID: <20150911091222.GA61521@FreeBSD.org> References: <201509110848.t8B8mHRf022242@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201509110848.t8B8mHRf022242@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 09:12:23 -0000 On Fri, Sep 11, 2015 at 08:48:17AM +0000, Cy Schubert wrote: > New Revision: 287653 > URL: https://svnweb.freebsd.org/changeset/base/287653 > > Log: > Revert $FreeBSD$. > > [...] > @@ -1,4 +1,4 @@ > -/* $NetBSD: ip_state.c,v 1.4 2012/12/20 21:42:28 christos Exp $ */ > +/* $FreeBSD$ */ > > /* > * Copyright (C) 2012 by Darren Reed. If this file is part of the contrib sources, don't we usually keep both ident strings (helps to keep track of future NetBSD revisions, etc.)? ./danfe From owner-svn-src-head@freebsd.org Fri Sep 11 09:15:28 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8694CA005DA; Fri, 11 Sep 2015 09:15:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 771FE1024; Fri, 11 Sep 2015 09:15:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8B9FS2Z036346; Fri, 11 Sep 2015 09:15:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8B9FSMJ036344; Fri, 11 Sep 2015 09:15:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509110915.t8B9FSMJ036344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 11 Sep 2015 09:15:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287654 - head/sys/netgraph X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 09:15:28 -0000 Author: mav Date: Fri Sep 11 09:15:27 2015 New Revision: 287654 URL: https://svnweb.freebsd.org/changeset/base/287654 Log: Add support for PPP-Max-Payload PPPoE tag (RFC4638). Submitted by: Dmitry Luhtionov MFC after: 2 weeks Modified: head/sys/netgraph/ng_pppoe.c head/sys/netgraph/ng_pppoe.h Modified: head/sys/netgraph/ng_pppoe.c ============================================================================== --- head/sys/netgraph/ng_pppoe.c Fri Sep 11 08:48:16 2015 (r287653) +++ head/sys/netgraph/ng_pppoe.c Fri Sep 11 09:15:27 2015 (r287654) @@ -168,6 +168,13 @@ static const struct ng_cmdlist ng_pppoe_ &ng_parse_enaddr_type, NULL }, + { + NGM_PPPOE_COOKIE, + NGM_PPPOE_SETMAXP, + "setmaxp", + &ng_parse_uint16_type, + NULL + }, { 0 } }; @@ -262,6 +269,7 @@ struct PPPoE { struct ether_header eh; LIST_HEAD(, sess_con) listeners; struct sess_hash_entry sesshash[SESSHASHSIZE]; + struct maxptag max_payload; /* PPP-Max-Payload (RFC4638) */ }; typedef struct PPPoE *priv_p; @@ -1004,6 +1012,13 @@ ng_pppoe_rcvmsg(node_p node, item_p item bcopy(msg->data, &privp->eh.ether_shost, ETHER_ADDR_LEN); break; + case NGM_PPPOE_SETMAXP: + if (msg->header.arglen != sizeof(uint16_t)) + LEAVE(EINVAL); + privp->max_payload.hdr.tag_type = PTT_MAX_PAYL; + privp->max_payload.hdr.tag_len = htons(sizeof(uint16_t)); + privp->max_payload.data = htons(*((uint16_t *)msg->data)); + break; default: LEAVE(EINVAL); } @@ -1071,6 +1086,8 @@ pppoe_start(sessp sp) init_tags(sp); insert_tag(sp, &uniqtag.hdr); insert_tag(sp, &neg->service.hdr); + if (privp->max_payload.data != 0) + insert_tag(sp, &privp->max_payload.hdr); make_packet(sp); /* * Send packet and prepare to retransmit it after timeout. @@ -1124,6 +1141,28 @@ send_sessionid(sessp sp) return (error); } +static int +send_maxp(sessp sp, const struct pppoe_tag *tag) +{ + int error; + struct ng_mesg *msg; + struct ngpppoe_maxp *maxp; + + CTR2(KTR_NET, "%20s: called %d", __func__, sp->Session_ID); + + NG_MKMESSAGE(msg, NGM_PPPOE_COOKIE, NGM_PPPOE_SETMAXP, + sizeof(struct ngpppoe_maxp), M_NOWAIT); + if (msg == NULL) + return (ENOMEM); + + maxp = (struct ngpppoe_maxp *)msg->data; + strncpy(maxp->hook, NG_HOOK_NAME(sp->hook), NG_HOOKSIZ); + maxp->data = ntohs(((const struct maxptag *)tag)->data); + NG_SEND_MSG_ID(error, NG_HOOK_NODE(sp->hook), msg, sp->creator, 0); + + return (error); +} + /* * Receive data from session hook and do something with it. */ @@ -1464,6 +1503,9 @@ ng_pppoe_rcvdata_ether(hook_p hook, item insert_tag(sp, tag); /* return it */ send_acname(sp, tag); } + if ((tag = get_tag(ph, PTT_MAX_PAYL)) && + (privp->max_payload.data != 0)) + insert_tag(sp, tag); /* return it */ insert_tag(sp, &neg->service.hdr); /* Service */ scan_tags(sp, ph); make_packet(sp); @@ -1602,6 +1644,9 @@ ng_pppoe_rcvdata_ether(hook_p hook, item m_freem(neg->m); free(sp->neg, M_NETGRAPH_PPPOE); sp->neg = NULL; + if ((tag = get_tag(ph, PTT_MAX_PAYL)) && + (privp->max_payload.data != 0)) + send_maxp(sp, tag); pppoe_send_event(sp, NGM_PPPOE_SUCCESS); break; case PADT_CODE: Modified: head/sys/netgraph/ng_pppoe.h ============================================================================== --- head/sys/netgraph/ng_pppoe.h Fri Sep 11 08:48:16 2015 (r287653) +++ head/sys/netgraph/ng_pppoe.h Fri Sep 11 09:15:27 2015 (r287654) @@ -51,6 +51,7 @@ #define NG_PPPOE_NODE_TYPE "pppoe" #define NGM_PPPOE_COOKIE 1089893072 +#define NGM_PPPOE_SETMAXP_COOKIE 1441624322 #define PPPOE_SERVICE_NAME_SIZE 64 /* for now */ @@ -83,6 +84,7 @@ enum cmd { NGM_PPPOE_SETMODE = 12, /* set to standard or compat modes */ NGM_PPPOE_GETMODE = 13, /* see current mode */ NGM_PPPOE_SETENADDR = 14, /* set Ethernet address */ + NGM_PPPOE_SETMAXP = 15 /* Set PPP-Max-Payload value */ }; /*********************** @@ -147,6 +149,13 @@ struct ngpppoe_sts { { NULL } \ } +/* + * This structure is used to send PPP-Max-Payload value from server to client. + */ +struct ngpppoe_maxp { + char hook[NG_HOOKSIZ]; /* hook associated with event session */ + uint16_t data; +}; /******************************************************************** * Constants and definitions specific to pppoe @@ -229,6 +238,10 @@ struct datatag { u_int8_t data[PPPOE_SERVICE_NAME_SIZE]; }; +struct maxptag { + struct pppoe_tag hdr; + uint16_t data; +}; /* * Define the order in which we will place tags in packets From owner-svn-src-head@freebsd.org Fri Sep 11 12:50:52 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5EECA01D40; Fri, 11 Sep 2015 12:50:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 965E41F4A; Fri, 11 Sep 2015 12:50:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BCoqoK035527; Fri, 11 Sep 2015 12:50:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BCoqai035526; Fri, 11 Sep 2015 12:50:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509111250.t8BCoqai035526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 11 Sep 2015 12:50:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287664 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 12:50:52 -0000 Author: mav Date: Fri Sep 11 12:50:52 2015 New Revision: 287664 URL: https://svnweb.freebsd.org/changeset/base/287664 Log: Reference/release devices on every I/O, rather on open/close. While this may be slower, it allows device destruction to complete, rather then block waiting for indefinitely long time. Modified: head/sys/cam/ctl/ctl_backend_block.c Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Fri Sep 11 12:45:56 2015 (r287663) +++ head/sys/cam/ctl/ctl_backend_block.c Fri Sep 11 12:50:52 2015 (r287664) @@ -126,18 +126,11 @@ typedef enum { CTL_BE_BLOCK_FILE } ctl_be_block_type; -struct ctl_be_block_devdata { - struct cdev *cdev; - struct cdevsw *csw; - int dev_ref; -}; - struct ctl_be_block_filedata { struct ucred *cred; }; union ctl_be_block_bedata { - struct ctl_be_block_devdata dev; struct ctl_be_block_filedata file; }; @@ -823,16 +816,15 @@ static void ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio) { - struct ctl_be_block_devdata *dev_data; union ctl_io *io; + struct cdevsw *csw; + struct cdev *dev; struct uio xuio; struct iovec *xiovec; - int flags; - int error, i; + int error, flags, i, ref; DPRINTF("entered\n"); - dev_data = &be_lun->backend.dev; io = beio->io; flags = 0; if (ARGS(io)->flags & CTL_LLF_DPO) @@ -865,13 +857,20 @@ ctl_be_block_dispatch_zvol(struct ctl_be devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); mtx_unlock(&be_lun->io_lock); - if (beio->bio_cmd == BIO_READ) { - error = (*dev_data->csw->d_read)(dev_data->cdev, &xuio, flags); + csw = devvn_refthread(be_lun->vn, &dev, &ref); + if (csw) { + if (beio->bio_cmd == BIO_READ) + error = csw->d_read(dev, &xuio, flags); + else + error = csw->d_write(dev, &xuio, flags); + dev_relthread(dev, ref); + } else + error = ENXIO; + + if (beio->bio_cmd == BIO_READ) SDT_PROBE(cbb, kernel, read, file_done, 0, 0, 0, 0, 0); - } else { - error = (*dev_data->csw->d_write)(dev_data->cdev, &xuio, flags); + else SDT_PROBE(cbb, kernel, write, file_done, 0, 0, 0, 0, 0); - } mtx_lock(&be_lun->io_lock); devstat_end_transaction(beio->lun->disk_stats, beio->io_len, @@ -915,23 +914,30 @@ static void ctl_be_block_gls_zvol(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio) { - struct ctl_be_block_devdata *dev_data = &be_lun->backend.dev; union ctl_io *io = beio->io; + struct cdevsw *csw; + struct cdev *dev; struct ctl_lba_len_flags *lbalen = ARGS(io); struct scsi_get_lba_status_data *data; off_t roff, off; - int error, status; + int error, ref, status; DPRINTF("entered\n"); + csw = devvn_refthread(be_lun->vn, &dev, &ref); + if (csw == NULL) { + status = 0; /* unknown up to the end */ + off = be_lun->size_bytes; + goto done; + } off = roff = ((off_t)lbalen->lba) * be_lun->cbe_lun.blocksize; - error = (*dev_data->csw->d_ioctl)(dev_data->cdev, FIOSEEKHOLE, - (caddr_t)&off, FREAD, curthread); + error = csw->d_ioctl(dev, FIOSEEKHOLE, (caddr_t)&off, FREAD, + curthread); if (error == 0 && off > roff) status = 0; /* mapped up to off */ else { - error = (*dev_data->csw->d_ioctl)(dev_data->cdev, FIOSEEKDATA, - (caddr_t)&off, FREAD, curthread); + error = csw->d_ioctl(dev, FIOSEEKDATA, (caddr_t)&off, FREAD, + curthread); if (error == 0 && off > roff) status = 1; /* deallocated up to off */ else { @@ -939,7 +945,9 @@ ctl_be_block_gls_zvol(struct ctl_be_bloc off = be_lun->size_bytes; } } + dev_relthread(dev, ref); +done: data = (struct scsi_get_lba_status_data *)io->scsiio.kern_data_ptr; scsi_u64to8b(lbalen->lba, data->descr[0].addr); scsi_ulto4b(MIN(UINT32_MAX, off / be_lun->cbe_lun.blocksize - @@ -955,9 +963,10 @@ ctl_be_block_flush_dev(struct ctl_be_blo { struct bio *bio; union ctl_io *io; - struct ctl_be_block_devdata *dev_data; + struct cdevsw *csw; + struct cdev *dev; + int ref; - dev_data = &be_lun->backend.dev; io = beio->io; DPRINTF("entered\n"); @@ -966,7 +975,6 @@ ctl_be_block_flush_dev(struct ctl_be_blo bio = g_alloc_bio(); bio->bio_cmd = BIO_FLUSH; - bio->bio_dev = dev_data->cdev; bio->bio_offset = 0; bio->bio_data = 0; bio->bio_done = ctl_be_block_biodone; @@ -986,7 +994,15 @@ ctl_be_block_flush_dev(struct ctl_be_blo devstat_start_transaction(be_lun->disk_stats, &beio->ds_t0); mtx_unlock(&be_lun->io_lock); - (*dev_data->csw->d_strategy)(bio); + csw = devvn_refthread(be_lun->vn, &dev, &ref); + if (csw) { + bio->bio_dev = dev; + csw->d_strategy(bio); + dev_relthread(dev, ref); + } else { + bio->bio_error = ENXIO; + ctl_be_block_biodone(bio); + } } static void @@ -995,15 +1011,17 @@ ctl_be_block_unmap_dev_range(struct ctl_ uint64_t off, uint64_t len, int last) { struct bio *bio; - struct ctl_be_block_devdata *dev_data; uint64_t maxlen; + struct cdevsw *csw; + struct cdev *dev; + int ref; - dev_data = &be_lun->backend.dev; + csw = devvn_refthread(be_lun->vn, &dev, &ref); maxlen = LONG_MAX - (LONG_MAX % be_lun->cbe_lun.blocksize); while (len > 0) { bio = g_alloc_bio(); bio->bio_cmd = BIO_DELETE; - bio->bio_dev = dev_data->cdev; + bio->bio_dev = dev; bio->bio_offset = off; bio->bio_length = MIN(len, maxlen); bio->bio_data = 0; @@ -1020,8 +1038,15 @@ ctl_be_block_unmap_dev_range(struct ctl_ beio->send_complete = 1; mtx_unlock(&be_lun->io_lock); - (*dev_data->csw->d_strategy)(bio); + if (csw) { + csw->d_strategy(bio); + } else { + bio->bio_error = ENXIO; + ctl_be_block_biodone(bio); + } } + if (csw) + dev_relthread(dev, ref); } static void @@ -1029,12 +1054,10 @@ ctl_be_block_unmap_dev(struct ctl_be_blo struct ctl_be_block_io *beio) { union ctl_io *io; - struct ctl_be_block_devdata *dev_data; struct ctl_ptr_len_flags *ptrlen; struct scsi_unmap_desc *buf, *end; uint64_t len; - dev_data = &be_lun->backend.dev; io = beio->io; DPRINTF("entered\n"); @@ -1067,23 +1090,25 @@ ctl_be_block_dispatch_dev(struct ctl_be_ struct ctl_be_block_io *beio) { TAILQ_HEAD(, bio) queue = TAILQ_HEAD_INITIALIZER(queue); - int i; struct bio *bio; - struct ctl_be_block_devdata *dev_data; + struct cdevsw *csw; + struct cdev *dev; off_t cur_offset; - int max_iosize; + int i, max_iosize, ref; DPRINTF("entered\n"); - - dev_data = &be_lun->backend.dev; + csw = devvn_refthread(be_lun->vn, &dev, &ref); /* * We have to limit our I/O size to the maximum supported by the * backend device. Hopefully it is MAXPHYS. If the driver doesn't * set it properly, use DFLTPHYS. */ - max_iosize = dev_data->cdev->si_iosize_max; - if (max_iosize < PAGE_SIZE) + if (csw) { + max_iosize = dev->si_iosize_max; + if (max_iosize < PAGE_SIZE) + max_iosize = DFLTPHYS; + } else max_iosize = DFLTPHYS; cur_offset = beio->io_offset; @@ -1101,7 +1126,7 @@ ctl_be_block_dispatch_dev(struct ctl_be_ KASSERT(bio != NULL, ("g_alloc_bio() failed!\n")); bio->bio_cmd = beio->bio_cmd; - bio->bio_dev = dev_data->cdev; + bio->bio_dev = dev; bio->bio_caller1 = beio; bio->bio_length = min(cur_size, max_iosize); bio->bio_offset = cur_offset; @@ -1128,23 +1153,36 @@ ctl_be_block_dispatch_dev(struct ctl_be_ */ while ((bio = TAILQ_FIRST(&queue)) != NULL) { TAILQ_REMOVE(&queue, bio, bio_queue); - (*dev_data->csw->d_strategy)(bio); + if (csw) + csw->d_strategy(bio); + else { + bio->bio_error = ENXIO; + ctl_be_block_biodone(bio); + } } + if (csw) + dev_relthread(dev, ref); } static uint64_t ctl_be_block_getattr_dev(struct ctl_be_block_lun *be_lun, const char *attrname) { - struct ctl_be_block_devdata *dev_data = &be_lun->backend.dev; struct diocgattr_arg arg; - int error; + struct cdevsw *csw; + struct cdev *dev; + int error, ref; - if (dev_data->csw == NULL || dev_data->csw->d_ioctl == NULL) + csw = devvn_refthread(be_lun->vn, &dev, &ref); + if (csw == NULL) return (UINT64_MAX); strlcpy(arg.name, attrname, sizeof(arg.name)); arg.len = sizeof(arg.value.off); - error = dev_data->csw->d_ioctl(dev_data->cdev, - DIOCGATTR, (caddr_t)&arg, FREAD, curthread); + if (csw->d_ioctl) { + error = csw->d_ioctl(dev, DIOCGATTR, (caddr_t)&arg, FREAD, + curthread); + } else + error = ENODEV; + dev_relthread(dev, ref); if (error != 0) return (UINT64_MAX); return (arg.value.off); @@ -1853,22 +1891,19 @@ ctl_be_block_open_dev(struct ctl_be_bloc { struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; struct ctl_lun_create_params *params; - struct vattr vattr; + struct cdevsw *csw; struct cdev *dev; - struct cdevsw *devsw; char *value; - int error, atomic, maxio, unmap, tmp; + int error, atomic, maxio, ref, unmap, tmp; off_t ps, pss, po, pos, us, uss, uo, uos, otmp; params = &be_lun->params; be_lun->dev_type = CTL_BE_BLOCK_DEV; - be_lun->backend.dev.cdev = be_lun->vn->v_rdev; - be_lun->backend.dev.csw = dev_refthread(be_lun->backend.dev.cdev, - &be_lun->backend.dev.dev_ref); - if (be_lun->backend.dev.csw == NULL) - panic("Unable to retrieve device switch"); - if (strcmp(be_lun->backend.dev.csw->d_name, "zvol") == 0) { + csw = devvn_refthread(be_lun->vn, &dev, &ref); + if (csw == NULL) + return (ENXIO); + if (strcmp(csw->d_name, "zvol") == 0) { be_lun->dispatch = ctl_be_block_dispatch_zvol; be_lun->get_lba_status = ctl_be_block_gls_zvol; atomic = maxio = CTLBLK_MAX_IO_SIZE; @@ -1876,7 +1911,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc be_lun->dispatch = ctl_be_block_dispatch_dev; be_lun->get_lba_status = NULL; atomic = 0; - maxio = be_lun->backend.dev.cdev->si_iosize_max; + maxio = dev->si_iosize_max; if (maxio <= 0) maxio = DFLTPHYS; if (maxio > CTLBLK_MAX_IO_SIZE) @@ -1886,26 +1921,17 @@ ctl_be_block_open_dev(struct ctl_be_bloc be_lun->getattr = ctl_be_block_getattr_dev; be_lun->unmap = ctl_be_block_unmap_dev; - error = VOP_GETATTR(be_lun->vn, &vattr, NOCRED); - if (error) { + if (!csw->d_ioctl) { + dev_relthread(dev, ref); snprintf(req->error_str, sizeof(req->error_str), - "error getting vnode attributes for device %s", - be_lun->dev_path); - return (error); - } - - dev = be_lun->vn->v_rdev; - devsw = dev->si_devsw; - if (!devsw->d_ioctl) { - snprintf(req->error_str, sizeof(req->error_str), - "no d_ioctl for device %s!", - be_lun->dev_path); + "no d_ioctl for device %s!", be_lun->dev_path); return (ENODEV); } - error = devsw->d_ioctl(dev, DIOCGSECTORSIZE, (caddr_t)&tmp, FREAD, + error = csw->d_ioctl(dev, DIOCGSECTORSIZE, (caddr_t)&tmp, FREAD, curthread); if (error) { + dev_relthread(dev, ref); snprintf(req->error_str, sizeof(req->error_str), "error %d returned for DIOCGSECTORSIZE ioctl " "on %s!", error, be_lun->dev_path); @@ -1923,14 +1949,15 @@ ctl_be_block_open_dev(struct ctl_be_bloc if (params->blocksize_bytes % tmp == 0) { cbe_lun->blocksize = params->blocksize_bytes; } else { + dev_relthread(dev, ref); snprintf(req->error_str, sizeof(req->error_str), "requested blocksize %u is not an even " "multiple of backing device blocksize %u", params->blocksize_bytes, tmp); return (EINVAL); - } } else if (params->blocksize_bytes != 0) { + dev_relthread(dev, ref); snprintf(req->error_str, sizeof(req->error_str), "requested blocksize %u < backing device " "blocksize %u", params->blocksize_bytes, tmp); @@ -1938,9 +1965,10 @@ ctl_be_block_open_dev(struct ctl_be_bloc } else cbe_lun->blocksize = tmp; - error = devsw->d_ioctl(dev, DIOCGMEDIASIZE, (caddr_t)&otmp, FREAD, - curthread); + error = csw->d_ioctl(dev, DIOCGMEDIASIZE, (caddr_t)&otmp, FREAD, + curthread); if (error) { + dev_relthread(dev, ref); snprintf(req->error_str, sizeof(req->error_str), "error %d returned for DIOCGMEDIASIZE " " ioctl on %s!", error, @@ -1950,6 +1978,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc if (params->lun_size_bytes != 0) { if (params->lun_size_bytes > otmp) { + dev_relthread(dev, ref); snprintf(req->error_str, sizeof(req->error_str), "requested LUN size %ju > backing device " "size %ju", @@ -1965,13 +1994,13 @@ ctl_be_block_open_dev(struct ctl_be_bloc cbe_lun->maxlba = (be_lun->size_blocks == 0) ? 0 : (be_lun->size_blocks - 1); - error = devsw->d_ioctl(dev, DIOCGSTRIPESIZE, - (caddr_t)&ps, FREAD, curthread); + error = csw->d_ioctl(dev, DIOCGSTRIPESIZE, (caddr_t)&ps, FREAD, + curthread); if (error) ps = po = 0; else { - error = devsw->d_ioctl(dev, DIOCGSTRIPEOFFSET, - (caddr_t)&po, FREAD, curthread); + error = csw->d_ioctl(dev, DIOCGSTRIPEOFFSET, (caddr_t)&po, + FREAD, curthread); if (error) po = 0; } @@ -2016,8 +2045,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc strlcpy(arg.name, "GEOM::candelete", sizeof(arg.name)); arg.len = sizeof(arg.value.i); - error = devsw->d_ioctl(dev, DIOCGATTR, - (caddr_t)&arg, FREAD, curthread); + error = csw->d_ioctl(dev, DIOCGATTR, (caddr_t)&arg, FREAD, + curthread); unmap = (error == 0) ? arg.value.i : 0; } value = ctl_get_opt(&cbe_lun->options, "unmap"); @@ -2028,6 +2057,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc else cbe_lun->flags &= ~CTL_LUN_FLAG_UNMAP; + dev_relthread(dev, ref); return (0); } @@ -2038,24 +2068,6 @@ ctl_be_block_close(struct ctl_be_block_l int flags; if (be_lun->vn) { - switch (be_lun->dev_type) { - case CTL_BE_BLOCK_DEV: - if (be_lun->backend.dev.csw) { - dev_relthread(be_lun->backend.dev.cdev, - be_lun->backend.dev.dev_ref); - be_lun->backend.dev.csw = NULL; - be_lun->backend.dev.cdev = NULL; - } - break; - case CTL_BE_BLOCK_FILE: - break; - case CTL_BE_BLOCK_NONE: - break; - default: - panic("Unexpected backend type."); - break; - } - flags = FREAD; if ((cbe_lun->flags & CTL_LUN_FLAG_READONLY) == 0) flags |= FWRITE; @@ -2553,21 +2565,25 @@ ctl_be_block_modify_dev(struct ctl_be_bl struct ctl_lun_req *req) { struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; - struct ctl_be_block_devdata *dev_data; - int error; struct ctl_lun_create_params *params = &be_lun->params; + struct cdevsw *csw; + struct cdev *dev; uint64_t size_bytes; + int error, ref; - dev_data = &be_lun->backend.dev; - if (!dev_data->csw->d_ioctl) { + csw = devvn_refthread(be_lun->vn, &dev, &ref); + if (csw == NULL) + return (ENXIO); + if (csw->d_ioctl == NULL) { + dev_relthread(dev, ref); snprintf(req->error_str, sizeof(req->error_str), "no d_ioctl for device %s!", be_lun->dev_path); return (ENODEV); } - error = dev_data->csw->d_ioctl(dev_data->cdev, DIOCGMEDIASIZE, - (caddr_t)&size_bytes, FREAD, - curthread); + error = csw->d_ioctl(dev, DIOCGMEDIASIZE, (caddr_t)&size_bytes, FREAD, + curthread); + dev_relthread(dev, ref); if (error) { snprintf(req->error_str, sizeof(req->error_str), "error %d returned for DIOCGMEDIASIZE ioctl " From owner-svn-src-head@freebsd.org Fri Sep 11 12:56:47 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A34B3A01F5C; Fri, 11 Sep 2015 12:56:47 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) by mx1.freebsd.org (Postfix) with ESMTP id 471A612FC; Fri, 11 Sep 2015 12:56:46 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from cwfw.cwsent.com ([96.50.22.10]) by shaw.ca with SMTP id aNshZZLJqcaY3aNsiZ2lPW; Fri, 11 Sep 2015 06:56:45 -0600 X-Authority-Analysis: v=2.1 cv=CanCnufl c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=VxmjJ2MpAAAA:8 a=BWvPGDcYAAAA:8 a=kj9zAlcOel0A:10 a=ff-B7xzCdYMA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=GVM5b0tdj-vQaSZbB0YA:9 a=wLsZ31Jw6K7f5yoZ:21 a=vbYjiWSPCuKEszTw:21 a=CjuIK1q_8ugA:10 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by cwfw.cwsent.com (Postfix) with ESMTP id 4B9B09BF7; Fri, 11 Sep 2015 05:56:43 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id t8BBEXDa098190; Fri, 11 Sep 2015 04:14:33 -0700 (PDT) (envelope-from Cy.Schubert@komquats.com) Message-Id: <201509111114.t8BBEXDa098190@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.komquats.com/ To: Alexey Dokuchaev cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r287653 - head/sys/contrib/ipfilter/netinet In-Reply-To: Message from Alexey Dokuchaev of "Fri, 11 Sep 2015 09:12:22 -0000." <20150911091222.GA61521@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 11 Sep 2015 04:14:33 -0700 X-CMAE-Envelope: MS4wfP+ZEvqtK/KzLsVo0prXqqlrSLMObKtiYkUpblzZkgfdQFG2zU/wkmKLlF/sIy7g04YiLBy7D5YZxpz/YcMTEFU2xlidIsIAGTQqiLr8Fb78clhvhKYpgIbGrw6CEjYa+Nl8C5TbJzWJgGrIGWA7ez0GjEKGgo4TgrVAvJTa7Fs6/+UzplpIWiV3L/Mj5VADoWywasJWJnr40wrJ/hauAECMKiXJAuHos492OdWVofIk6wayINI8xaEJNvTPBzOQlm7MTwrii9rNJnRz+R7GuAYc8o814WfuVeARA0DpnUDHJvXyA/5+u1Nj/3LhYfRYNA== X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 12:56:47 -0000 In message <20150911091222.GA61521@FreeBSD.org>, Alexey Dokuchaev writes: > On Fri, Sep 11, 2015 at 08:48:17AM +0000, Cy Schubert wrote: > > New Revision: 287653 > > URL: https://svnweb.freebsd.org/changeset/base/287653 > > > > Log: > > Revert $FreeBSD$. > > > > [...] > > @@ -1,4 +1,4 @@ > > -/* $NetBSD: ip_state.c,v 1.4 2012/12/20 21:42:28 christos Exp $ */ > > +/* $FreeBSD$ */ > > > > /* > > * Copyright (C) 2012 by Darren Reed. > > If this file is part of the contrib sources, don't we usually keep both > ident strings (helps to keep track of future NetBSD revisions, etc.)? But it did have a $FreeBSD$ id at r255332. I inadvertently removed it in r287651. Index: ip_state.c =================================================================== --- ip_state.c (revision 255332) +++ ip_state.c (revision 287651) @@ -1,4 +1,4 @@ -/* $FreeBSD$ */ +/* $NetBSD: ip_state.c,v 1.4 2012/12/20 21:42:28 christos Exp $ */ /* * Copyright (C) 2012 by Darren Reed. @@ -1054,7 +1054,7 @@ /* to pointers and adjusts running stats for the hash table as appropriate. */ /* */ /* This function can fail if the filter rule has had a population policy of */ -/* IP addresses used with stateful filteirng assigned to it. */ +/* IP addresses used with stateful filtering assigned to it. */ /* */ /* Locking: it is assumed that some kind of lock on ipf_state is held. */ /* Exits with is_lock initialised and held - *EVEN IF ERROR*. */ @@ -1081,7 +1081,7 @@ } /* - * If we could trust is_hv, then the modulous would not be needed, + * If we could trust is_hv, then the modulus would not be needed, * but when running with IPFILTER_SYNC, this stops bad values. */ hv = is->is_hv % softs->ipf_state_size; @@ -1672,6 +1672,10 @@ SBUMPD(ipf_state_stats, iss_bucket_full); return 4; } + + /* + * No existing state; create new + */ KMALLOC(is, ipstate_t *); if (is == NULL) { SBUMPD(ipf_state_stats, iss_nomem); @@ -1683,7 +1687,7 @@ is->is_rule = fr; /* - * Do not do the modulous here, it is done in ipf_state_insert(). + * Do not do the modulus here, it is done in ipf_state_insert(). */ if (fr != NULL) { ipftq_t *tq; @@ -1711,7 +1715,7 @@ /* * It may seem strange to set is_ref to 2, but if stsave is not NULL * then a copy of the pointer is being stored somewhere else and in - * the end, it will expect to be able to do osmething with it. + * the end, it will expect to be able to do something with it. */ is->is_me = stsave; if (stsave != NULL) { -- Cheers, Cy Schubert or FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Fri Sep 11 13:54:35 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7836DA00AF3; Fri, 11 Sep 2015 13:54:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5CFBA14A4; Fri, 11 Sep 2015 13:54:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BDsZ7e063113; Fri, 11 Sep 2015 13:54:35 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BDsYwg063109; Fri, 11 Sep 2015 13:54:34 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201509111354.t8BDsYwg063109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 11 Sep 2015 13:54:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287669 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 13:54:35 -0000 Author: tuexen Date: Fri Sep 11 13:54:33 2015 New Revision: 287669 URL: https://svnweb.freebsd.org/changeset/base/287669 Log: Ensure that ERROR chunks are always padded by implementing this in the routine, which queues an ERROR chunk, instead on relyinh on the callers to do so. Since one caller missed this, this actially fixes a bug. MFC after: 1 week Modified: head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Fri Sep 11 13:32:55 2015 (r287668) +++ head/sys/netinet/sctp_constants.h Fri Sep 11 13:54:33 2015 (r287669) @@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$"); */ #define SCTP_LARGEST_INIT_ACCEPTED (65535 - 2048) +/* Largest length of a chunk */ +#define SCTP_MAX_CHUNK_LENGTH 0xffff /* Number of addresses where we just skip the counting */ #define SCTP_COUNT_LIMIT 40 Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Fri Sep 11 13:32:55 2015 (r287668) +++ head/sys/netinet/sctp_indata.c Fri Sep 11 13:54:33 2015 (r287669) @@ -2513,11 +2513,7 @@ sctp_process_data(struct mbuf **mm, int SCTP_BUF_LEN(merr) = sizeof(*phd); SCTP_BUF_NEXT(merr) = SCTP_M_COPYM(m, *offset, chk_length, M_NOWAIT); if (SCTP_BUF_NEXT(merr)) { - if (sctp_pad_lastmbuf(SCTP_BUF_NEXT(merr), SCTP_SIZE32(chk_length) - chk_length, NULL) == NULL) { - sctp_m_freem(merr); - } else { - sctp_queue_op_err(stcb, merr); - } + sctp_queue_op_err(stcb, merr); } else { sctp_m_freem(merr); } Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Fri Sep 11 13:32:55 2015 (r287668) +++ head/sys/netinet/sctp_input.c Fri Sep 11 13:54:33 2015 (r287669) @@ -5602,16 +5602,12 @@ process_control_chunks: SCTP_BUF_LEN(mm) = sizeof(*phd); SCTP_BUF_NEXT(mm) = SCTP_M_COPYM(m, *offset, len, M_NOWAIT); if (SCTP_BUF_NEXT(mm)) { - if (sctp_pad_lastmbuf(SCTP_BUF_NEXT(mm), SCTP_SIZE32(len) - len, NULL) == NULL) { - sctp_m_freem(mm); - } else { #ifdef SCTP_MBUF_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { - sctp_log_mbc(SCTP_BUF_NEXT(mm), SCTP_MBUF_ICOPY); - } -#endif - sctp_queue_op_err(stcb, mm); + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { + sctp_log_mbc(SCTP_BUF_NEXT(mm), SCTP_MBUF_ICOPY); } +#endif + sctp_queue_op_err(stcb, mm); } else { sctp_m_freem(mm); } Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Fri Sep 11 13:32:55 2015 (r287668) +++ head/sys/netinet/sctp_output.c Fri Sep 11 13:54:33 2015 (r287669) @@ -8850,9 +8850,37 @@ sctp_queue_op_err(struct sctp_tcb *stcb, */ struct sctp_chunkhdr *hdr; struct sctp_tmit_chunk *chk; - struct mbuf *mat; + struct mbuf *mat, *last_mbuf; + uint32_t chunk_length; + uint16_t padding_length; SCTP_TCB_LOCK_ASSERT(stcb); + SCTP_BUF_PREPEND(op_err, sizeof(struct sctp_chunkhdr), M_NOWAIT); + if (op_err == NULL) { + return; + } + last_mbuf = NULL; + chunk_length = 0; + for (mat = op_err; mat != NULL; mat = SCTP_BUF_NEXT(mat)) { + chunk_length += SCTP_BUF_LEN(mat); + if (SCTP_BUF_NEXT(mat) == NULL) { + last_mbuf = mat; + } + } + if (chunk_length > SCTP_MAX_CHUNK_LENGTH) { + sctp_m_freem(op_err); + return; + } + padding_length = chunk_length % 4; + if (padding_length != 0) { + padding_length = 4 - padding_length; + } + if (padding_length != 0) { + if (sctp_add_pad_tombuf(last_mbuf, padding_length) == NULL) { + sctp_m_freem(op_err); + return; + } + } sctp_alloc_a_chunk(stcb, chk); if (chk == NULL) { /* no memory */ @@ -8860,15 +8888,7 @@ sctp_queue_op_err(struct sctp_tcb *stcb, return; } chk->copy_by_ref = 0; - SCTP_BUF_PREPEND(op_err, sizeof(struct sctp_chunkhdr), M_NOWAIT); - if (op_err == NULL) { - sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); - return; - } - chk->send_size = 0; - for (mat = op_err; mat != NULL; mat = SCTP_BUF_NEXT(mat)) { - chk->send_size += SCTP_BUF_LEN(mat); - } + chk->send_size = (uint16_t) chunk_length; chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; chk->asoc = &stcb->asoc; @@ -8878,9 +8898,7 @@ sctp_queue_op_err(struct sctp_tcb *stcb, hdr->chunk_type = SCTP_OPERATION_ERROR; hdr->chunk_flags = 0; hdr->chunk_length = htons(chk->send_size); - TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, - chk, - sctp_next); + TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); chk->asoc->ctrl_queue_cnt++; } From owner-svn-src-head@freebsd.org Fri Sep 11 14:33:07 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A8969CCFF1; Fri, 11 Sep 2015 14:33:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 18AC81CFE; Fri, 11 Sep 2015 14:33:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BEX6hZ079691; Fri, 11 Sep 2015 14:33:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BEX6mS079689; Fri, 11 Sep 2015 14:33:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509111433.t8BEX6mS079689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 11 Sep 2015 14:33:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287670 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 14:33:07 -0000 Author: mav Date: Fri Sep 11 14:33:05 2015 New Revision: 287670 URL: https://svnweb.freebsd.org/changeset/base/287670 Log: Close races between device close and request processing. All requests arriving for processing after OFFLINE flag set are rejected with BUSY status. Races around OFFLINE flag setting are closed by calling taskqueue_drain_all(). Modified: head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Fri Sep 11 13:54:33 2015 (r287669) +++ head/sys/cam/ctl/ctl_backend_block.c Fri Sep 11 14:33:05 2015 (r287670) @@ -1615,33 +1615,32 @@ ctl_be_block_dispatch(struct ctl_be_bloc static void ctl_be_block_worker(void *context, int pending) { - struct ctl_be_block_lun *be_lun; - struct ctl_be_block_softc *softc; + struct ctl_be_block_lun *be_lun = (struct ctl_be_block_lun *)context; + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; union ctl_io *io; - - be_lun = (struct ctl_be_block_lun *)context; - softc = be_lun->softc; + struct ctl_be_block_io *beio; DPRINTF("entered\n"); - - mtx_lock(&be_lun->queue_lock); + /* + * Fetch and process I/Os from all queues. If we detect LUN + * CTL_LUN_FLAG_OFFLINE status here -- it is result of a race, + * so make response maximally opaque to not confuse initiator. + */ for (;;) { + mtx_lock(&be_lun->queue_lock); io = (union ctl_io *)STAILQ_FIRST(&be_lun->datamove_queue); if (io != NULL) { - struct ctl_be_block_io *beio; - DPRINTF("datamove queue\n"); - STAILQ_REMOVE(&be_lun->datamove_queue, &io->io_hdr, ctl_io_hdr, links); - mtx_unlock(&be_lun->queue_lock); - beio = (struct ctl_be_block_io *)PRIV(io)->ptr; - + if (cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) { + ctl_set_busy(&io->scsiio); + ctl_complete_beio(beio); + return; + } be_lun->dispatch(be_lun, beio); - - mtx_lock(&be_lun->queue_lock); continue; } io = (union ctl_io *)STAILQ_FIRST(&be_lun->config_write_queue); @@ -1650,8 +1649,12 @@ ctl_be_block_worker(void *context, int p STAILQ_REMOVE(&be_lun->config_write_queue, &io->io_hdr, ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); + if (cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) { + ctl_set_busy(&io->scsiio); + ctl_config_write_done(io); + return; + } ctl_be_block_cw_dispatch(be_lun, io); - mtx_lock(&be_lun->queue_lock); continue; } io = (union ctl_io *)STAILQ_FIRST(&be_lun->config_read_queue); @@ -1660,25 +1663,26 @@ ctl_be_block_worker(void *context, int p STAILQ_REMOVE(&be_lun->config_read_queue, &io->io_hdr, ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); + if (cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) { + ctl_set_busy(&io->scsiio); + ctl_config_read_done(io); + return; + } ctl_be_block_cr_dispatch(be_lun, io); - mtx_lock(&be_lun->queue_lock); continue; } io = (union ctl_io *)STAILQ_FIRST(&be_lun->input_queue); if (io != NULL) { DPRINTF("input queue\n"); - STAILQ_REMOVE(&be_lun->input_queue, &io->io_hdr, ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); - - /* - * We must drop the lock, since this routine and - * its children may sleep. - */ + if (cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) { + ctl_set_busy(&io->scsiio); + ctl_data_submit_done(io); + return; + } ctl_be_block_dispatch(be_lun, io); - - mtx_lock(&be_lun->queue_lock); continue; } @@ -1686,9 +1690,9 @@ ctl_be_block_worker(void *context, int p * If we get here, there is no work left in the queues, so * just break out and let the task queue go to sleep. */ + mtx_unlock(&be_lun->queue_lock); break; } - mtx_unlock(&be_lun->queue_lock); } /* @@ -2443,6 +2447,7 @@ ctl_be_block_rm(struct ctl_be_block_soft { struct ctl_lun_rm_params *params; struct ctl_be_block_lun *be_lun; + struct ctl_be_lun *cbe_lun; int retval; params = &req->reqdata.rm; @@ -2460,18 +2465,24 @@ ctl_be_block_rm(struct ctl_be_block_soft params->lun_id); goto bailout_error; } + cbe_lun = &be_lun->cbe_lun; - retval = ctl_disable_lun(&be_lun->cbe_lun); - + retval = ctl_disable_lun(cbe_lun); if (retval != 0) { snprintf(req->error_str, sizeof(req->error_str), "error %d returned from ctl_disable_lun() for " "LUN %d", retval, params->lun_id); goto bailout_error; + } + if (be_lun->vn != NULL) { + cbe_lun->flags |= CTL_LUN_FLAG_OFFLINE; + ctl_lun_offline(cbe_lun); + taskqueue_drain_all(be_lun->io_taskqueue); + ctl_be_block_close(be_lun); } - retval = ctl_invalidate_lun(&be_lun->cbe_lun); + retval = ctl_invalidate_lun(cbe_lun); if (retval != 0) { snprintf(req->error_str, sizeof(req->error_str), "error %d returned from ctl_invalidate_lun() for " @@ -2480,15 +2491,12 @@ ctl_be_block_rm(struct ctl_be_block_soft } mtx_lock(&softc->lock); - be_lun->flags |= CTL_BE_BLOCK_LUN_WAITING; - while ((be_lun->flags & CTL_BE_BLOCK_LUN_UNCONFIGURED) == 0) { retval = msleep(be_lun, &softc->lock, PCATCH, "ctlblk", 0); if (retval == EINTR) break; } - be_lun->flags &= ~CTL_BE_BLOCK_LUN_WAITING; if ((be_lun->flags & CTL_BE_BLOCK_LUN_UNCONFIGURED) == 0) { @@ -2503,18 +2511,15 @@ ctl_be_block_rm(struct ctl_be_block_soft softc->num_luns--; mtx_unlock(&softc->lock); - taskqueue_drain(be_lun->io_taskqueue, &be_lun->io_task); - + taskqueue_drain_all(be_lun->io_taskqueue); taskqueue_free(be_lun->io_taskqueue); - ctl_be_block_close(be_lun); - if (be_lun->disk_stats != NULL) devstat_remove_entry(be_lun->disk_stats); uma_zdestroy(be_lun->lun_zone); - ctl_free_opts(&be_lun->cbe_lun.options); + ctl_free_opts(&cbe_lun->options); free(be_lun->dev_path, M_CTLBLK); mtx_destroy(&be_lun->queue_lock); mtx_destroy(&be_lun->io_lock); @@ -2679,7 +2684,7 @@ ctl_be_block_modify(struct ctl_be_block_ if (be_lun->vn != NULL) { cbe_lun->flags |= CTL_LUN_FLAG_OFFLINE; ctl_lun_offline(cbe_lun); - pause("CTL LUN offline", hz / 8); // XXX + taskqueue_drain_all(be_lun->io_taskqueue); error = ctl_be_block_close(be_lun); } else error = 0; Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Fri Sep 11 13:54:33 2015 (r287669) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Fri Sep 11 14:33:05 2015 (r287670) @@ -507,7 +507,7 @@ ctl_backend_ramdisk_rm(struct ctl_be_ram mtx_unlock(&softc->lock); if (retval == 0) { - taskqueue_drain(be_lun->io_taskqueue, &be_lun->io_task); + taskqueue_drain_all(be_lun->io_taskqueue); taskqueue_free(be_lun->io_taskqueue); ctl_free_opts(&be_lun->cbe_lun.options); mtx_destroy(&be_lun->queue_lock); From owner-svn-src-head@freebsd.org Fri Sep 11 14:47:36 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E813A01678; Fri, 11 Sep 2015 14:47:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FF311363; Fri, 11 Sep 2015 14:47:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BElaoH083933; Fri, 11 Sep 2015 14:47:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BElaAu083932; Fri, 11 Sep 2015 14:47:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509111447.t8BElaAu083932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 11 Sep 2015 14:47:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287671 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 14:47:36 -0000 Author: mav Date: Fri Sep 11 14:47:35 2015 New Revision: 287671 URL: https://svnweb.freebsd.org/changeset/base/287671 Log: Make ctld restart on primary HA node less invasive for secondary. Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Fri Sep 11 14:33:05 2015 (r287670) +++ head/sys/cam/ctl/ctl.c Fri Sep 11 14:47:35 2015 (r287671) @@ -1746,12 +1746,12 @@ ctl_serialize_other_sc_cmd(struct ctl_sc lun = NULL; if (lun == NULL) { /* - * Why isn't LUN defined? The other side wouldn't - * send a cmd if the LUN is undefined. + * The other node would not send this request to us unless + * received announce that we are primary node for this LUN. + * If this LUN does not exist now, it is probably result of + * a race, so respond to initiator in the most opaque way. */ - printf("%s: Bad JUJU!, LUN is NULL!\n", __func__); - - ctl_set_unsupported_lun(ctsio); + ctl_set_busy(ctsio); ctl_copy_sense_data_back((union ctl_io *)ctsio, &msg_info); msg_info.hdr.original_sc = ctsio->io_hdr.original_sc; msg_info.hdr.serializing_sc = NULL; From owner-svn-src-head@freebsd.org Fri Sep 11 15:20:04 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0A29A02765; Fri, 11 Sep 2015 15:20:04 +0000 (UTC) (envelope-from ken@kdm.org) Received: from mithlond.kdm.org (mithlond.kdm.org [96.89.93.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "A1-33714", Issuer "A1-33714" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 595B81D05; Fri, 11 Sep 2015 15:20:04 +0000 (UTC) (envelope-from ken@kdm.org) Received: from mithlond.kdm.org (localhost [127.0.0.1]) by mithlond.kdm.org (8.15.2/8.14.9) with ESMTPS id t8BFEKSt012626 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 11 Sep 2015 11:14:20 -0400 (EDT) (envelope-from ken@mithlond.kdm.org) Received: (from ken@localhost) by mithlond.kdm.org (8.15.2/8.14.9/Submit) id t8BFEKG6012625; Fri, 11 Sep 2015 11:14:20 -0400 (EDT) (envelope-from ken) Date: Fri, 11 Sep 2015 11:14:20 -0400 From: "Kenneth D. Merry" To: Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r287621 - in head/sys: cam/ctl conf modules/ctl Message-ID: <20150911151420.GA12580@mithlond.kdm.org> References: <201509101240.t8ACeWgq081999@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201509101240.t8ACeWgq081999@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (mithlond.kdm.org [127.0.0.1]); Fri, 11 Sep 2015 11:14:20 -0400 (EDT) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS autolearn=ham autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mithlond.kdm.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 15:20:04 -0000 On Thu, Sep 10, 2015 at 12:40:32 +0000, Alexander Motin wrote: > Author: mav > Date: Thu Sep 10 12:40:31 2015 > New Revision: 287621 > URL: https://svnweb.freebsd.org/changeset/base/287621 > > Log: > Reimplement CTL High Availability. > > CTL HA functionality was originally implemented by Copan many years ago, > but large part of the sources was never published. This change includes > clean room implementation of the missing code and fixes for many bugs. > > This code supports dual-node HA with ALUA in four modes: > - Active/Unavailable without interlink between nodes; > - Active/Standby with second node handling only basic LUN discovery and > reservation, synchronizing with the first node through the interlink; > - Active/Active with both nodes processing commands and accessing the > backing storage, synchronizing with the first node through the interlink; > - Active/Active with second node working as proxy, transfering all > commands to the first node for execution through the interlink. > > Unlike original Copan's implementation, depending on specific hardware, > this code uses simple custom TCP-based protocol for interlink. It has > no authentication, so it should never be enabled on public interfaces. > > The code may still need some polishing, but generally it is functional. > > Relnotes: yes > Sponsored by: iXsystems, Inc. Wow, very cool! Thank you for doing that, and thanks to iX for sponsoring it! I was hoping that someone would pick up the HA work years ago when I put in those stubs, and I'm very glad that you have done the work! This will be great functionality for FreeBSD! Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-head@freebsd.org Fri Sep 11 15:24:22 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1D80A029C1; Fri, 11 Sep 2015 15:24:22 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0135.outbound.protection.outlook.com [157.56.111.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85D0D1232; Fri, 11 Sep 2015 15:24:20 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from BLUPR05MB769.namprd05.prod.outlook.com (10.141.209.19) by BLUPR05MB087.namprd05.prod.outlook.com (10.255.214.18) with Microsoft SMTP Server (TLS) id 15.1.256.15; Fri, 11 Sep 2015 15:24:14 +0000 Received: from BY1PR0501CA0019.namprd05.prod.outlook.com (10.162.139.29) by BLUPR05MB769.namprd05.prod.outlook.com (10.141.209.19) with Microsoft SMTP Server (TLS) id 15.1.262.15; Fri, 11 Sep 2015 15:24:13 +0000 Received: from BL2FFO11FD049.protection.gbl (2a01:111:f400:7c09::104) by BY1PR0501CA0019.outlook.office365.com (2a01:111:e400:4821::29) with Microsoft SMTP Server (TLS) id 15.1.268.17 via Frontend Transport; Fri, 11 Sep 2015 15:24:12 +0000 Authentication-Results: spf=softfail (sender IP is 66.129.239.17) smtp.mailfrom=juniper.net; freebsd.org; dkim=none (message not signed) header.d=none;freebsd.org; dmarc=none action=none header.from=juniper.net;freebsd.org; dkim=none (message not signed) header.d=none;freebsd.org; dmarc=none action=none header.from=juniper.net; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.17 as permitted sender) Received: from p-emfe01a-sac.jnpr.net (66.129.239.17) by BL2FFO11FD049.mail.protection.outlook.com (10.173.161.211) with Microsoft SMTP Server (TLS) id 15.1.262.18 via Frontend Transport; Fri, 11 Sep 2015 15:24:12 +0000 Received: from magenta.juniper.net (172.17.27.123) by p-emfe01a-sac.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.123.3; Fri, 11 Sep 2015 08:24:10 -0700 Received: from chaos.jnpr.net (chaos.jnpr.net [172.21.16.28]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id t8BFOAD98271; Fri, 11 Sep 2015 08:24:10 -0700 (PDT) (envelope-from sjg@juniper.net) Received: from chaos (localhost [IPv6:::1]) by chaos.jnpr.net (Postfix) with ESMTP id DA400580A9; Fri, 11 Sep 2015 08:24:09 -0700 (PDT) To: Julian Elischer CC: , , , Subject: Re: svn commit: r287636 - head/share/mk In-Reply-To: <55F2529E.5080105@freebsd.org> References: <201509110019.t8B0JocS082576@repo.freebsd.org> <55F2529E.5080105@freebsd.org> Comments: In-reply-to: Julian Elischer message dated "Fri, 11 Sep 2015 12:03:42 +0800." From: "Simon J. Gerraty" X-Mailer: MH-E 8.6; nmh 1.6; GNU Emacs 24.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <12313.1441985049.1@chaos> Content-Transfer-Encoding: quoted-printable Date: Fri, 11 Sep 2015 08:24:09 -0700 Message-ID: <13099.1441985049@chaos> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD049; 1:qp9swUb7q3curf9U67tn6AtPhfjPYeHCiKpSu2Mb/0Qa6+UqcuC8/P8sa5og9ZvMtGfLJtdiey+1alZ8ML49ZJ71PHe16EZFEkv7Ue/+h/l/pPIjWZb0MU8DKFvroFK87luj9iCV54dcFRoJCMuChblTym5uUSg+C8WkCoz1HTiVw+FZTyqYYPPG7L5zdi7T5EyFjKxwVXO3yKNp2TEqGxbFAv9YjK0qWTqDl1lOu4gRzhnGfLW6Ychcd/PKYzJ2LoBakwLBO7V3CgiimaUnNacoYc+S2YpwzNN+N/oW+MU2/wbffQt1S6eG98ptf08V8D9TSA3r674WQg2djLGjUg== X-Forefront-Antispam-Report: CIP:66.129.239.17; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(199003)(189002)(24454002)(19580395003)(81156007)(97756001)(64706001)(57986006)(50986999)(47776003)(6806004)(19580405001)(5007970100001)(68736005)(97736004)(23726002)(46406003)(77156002)(77096005)(106466001)(76506005)(105596002)(4001540100001)(62966003)(69596002)(450100001)(76176999)(50226001)(92566002)(5001960100002)(110136002)(11100500001)(2950100001)(189998001)(107886002)(86362001)(5001920100001)(87936001)(33716001)(5001860100001)(50466002)(46102003)(5001830100001)(117636001)(4001430100001)(62816006)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR05MB769; H:p-emfe01a-sac.jnpr.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB769; 2:6QICEVLAcqngeoS74vEJHLciHGCXol9cZ4fU4YhJnXE4b6jFljuDPX8siCF9XXX6RkWIGw+QbHOtqcep9z/Cry6ysKcXuTPWB+w+e2WAcXIUqhGTH5h+p0PcWDn8Ioqtr1r4zhDXsf2yu63E8ZnU0b6zpu/0We7KeP3UoILIIGU=; 3:5hQ0pQDnn3VqqqDNY7iH7dEGshWj2d9bPxf7QqnUQm0syurOa1B3me8GKfwUkP6iKqV/t3I2Do7CFNSeydfkR9pm7mzQiy/+9uEox80oFfsXSO78TCOmvDPSEghl+XJPU9kWugv5dQrvlYN9zanohLco43pG5fgK6YjaREUjJSYNhfriTpMyloInMVmC4Icx48q4bcX4vXdOq5cJUG8C3lSi9Sg7IQTzt4s423WMwjw=; 25:Chl2dfxZJHHU5BjmIaGeu4tpprnYmJM+SVy2NZwsvPO8J752ZtrqbFUfJdirxkRDFMMHB6lcfbYEHEMDN8RGzhTXGIdGW3T4sg7apKI0RD8zR7QMaMaYjCH7tZhhgIwsMSssWphKO+oHrzlyMAL1t6nz3THEkhezTEJJyAFTOdq1IITh1hfj8ulm1pZXbT+20aWX1r9FJ3fYG/jTtwaIgkeN0l47WPo378wCyS/ULI+nXkiXn1fHjjusM3cfuHN7IdHWFVwKGUinAmvDN8NIBA== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BLUPR05MB769; UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BLUPR05MB087; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB769; 20:m5A5iSWndOcduumWseKZK4ATwPhHDNcDQnKl9vt07my12J5Z/51lu1zNt7c/hg6ne+dF2PqoHGY7ZaqZkWocwq00DNjnheY/S/3cb1KrOBilYOrY43LbDtJLbI2JsYnmFNqx1/5/QmKm4NGWOaxFqqYNNbz9MYDXG3A6QtLtWHUCLnaEYKLCWZjAJ/YqiuxOTBr2P7XRb31F+Ly3GidsNwaCpRmsL+LAOOnvbuCzk2fSHLAcoRTIC9Ffxg3Z2P9fkO5a6HsFRtfxCYZJiTazXw8qc/CY/pcXyFkE8E/HiwuW2iG2ur+IEeMFSm1yNpNjDLRttGqaXBm0VtaDfNB5+sjz74sLBs2lqpg0B98sa6XJTWpNN1KFjnhWYVn4aMCoRPvqs5s8OEmkr5Otc59JNAxHPtIXpqe4W2XAccM6uIhYvrmhIxg4u6KEko1W1NbAXQ2ft1GmsUgAzfKjBsNVogKxUenc3k/1lygvN+01Y9FVoQ/7Ldd0wgLyL+4dZHq4; 4:2tRpU1Xa1AaBcsuGBYGaJ8qQ0UHDOnBA982dgi9pKvIs+WSHz4agb+m5hh6WjZ63OIog4F7xl6Vcy3im8CBeD9k65M6uqE0SBcX91FpdS0rj/guPiCbnUO6Gd5aYrKEICk4E60sd04eKLqFNUzeNMUMEmYao3nE/KYE+pTxoXY1XynJXz1AhlKNpv8Z5DzSa563IuUo69RNwxJKuBVpXQo5ZWT3l5qjNi87K99Nik4kl7k31yISpd7ty+CueH10WlTzDHTIv43YmnH0cOpn+RC4Igfe91wBT09hkmbSQBQFyORok+uoNsQraYzi+S8FW X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(8121501046)(3002001); SRVR:BLUPR05MB769; BCL:0; PCL:0; RULEID:; SRVR:BLUPR05MB769; X-Forefront-PRVS: 06968FD8C4 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR05MB769; 23:WthKQEH4Kuh3LSJ6AmrbzEjQiGQluhask9GV6YgKHE?= =?us-ascii?Q?/BKVsezFSoIGmvN10va31Y+dAZhA+TIaq9v63XPtc7LFb46KuieJVC18Bz+2?= =?us-ascii?Q?xT/LEpfzyBK3Meq1QP++Nq53N7H4SCvsktwQaFAyq5JvCU6yCgYi35WMOcnL?= =?us-ascii?Q?fA/NQZWDgIAVySPa8ObTyTBjR9YzOy8jGYhyNttbEx5l+9QTNBrJQcyCrZTw?= =?us-ascii?Q?4CsrK/NciLm45lfnImYvWp6sBno4mFmDu8vJ6j/TG0WMDOtRSMGUYJIj9kIH?= =?us-ascii?Q?YuPn01lMDHhYDkmpACMGVWf9q0A0AP9RYpYRIEg+rr2CYg1ib7jVIdzo6EvL?= =?us-ascii?Q?RKJcKmAbeuNsPBq1eNVBdmOFlsSt8ZoYsywXYsyBea3Prdw66Tq1Vh4lf/yf?= =?us-ascii?Q?1GM7q/YwmYzR8ikPtiprXRuxDd9ewoCoIic+4Argg+Vn+2J0tKm746dQaOel?= =?us-ascii?Q?el5+9KhPKn9+3VEw8HkWf6Jzj/A5pnm+uY/yTjGmCfdnfqrO7IkDXNsLyvzA?= =?us-ascii?Q?77R3CJ2zdmQvFq7Uwam5TjcuhTAKIYx6QgOnEXSm/70FTPrjNLaX3SLZPLEj?= =?us-ascii?Q?ARNIRRpK4Yz/Wp4Kif1kqGhJPbL6FSSELp9/PRDYcEde3FG0bBmBby42YtEs?= =?us-ascii?Q?eyi04CycbsxlSRGJSJTV2JUHrL78HaDjBn7Zj953g4miVUw/iBzLmcpMHs7Q?= =?us-ascii?Q?eI1YTRcaycjkWFW5Z5uVyLn2WNjKpNtWrpPbeu+BZNPvzT+7douoL2XALb6q?= =?us-ascii?Q?Cg6eCgXzLSY7/a+INXKLAKWv5DY21v+tVUeSocZ6ADkJRK5Re//pYfEO40Y8?= =?us-ascii?Q?GdyMpVcIA1hAmtE7hhRpOGy3gWCiOMI+auYrRlkkH5lQt+AKmFMgtN9OrB8n?= =?us-ascii?Q?5YHVxj9tw2C/Qu8eti1U3S6kv7b2WkOsPBPq1dggm4y6GNrUqZD3WJQ/Mwzw?= =?us-ascii?Q?eZLIt24xzX72jRskZl7moR25duD4Rd7cXgEkA7dVUV7KYjdmHe8McngRCWlQ?= =?us-ascii?Q?dduro4tPnBlBaB29Te7r9HVqmYipBvU2csf1VjsmmWgiPG6VUGinT7TPjmW+?= =?us-ascii?Q?s5+shmluiTapQtTeZ2jviyQzDEP+3PIn+uetxOwIn4MX5NISY9e97ClhxnYc?= =?us-ascii?Q?8PTofmmkY69XKhXG6wyyjx864qIcTsXxVq+V6EvER6iHCnqhbHGmO4W1GusX?= =?us-ascii?Q?U8fBL8gJJJbbrccUbWjWpU9gT6RnPqpRhMjTofUnr41hKeO2rhY+8Ldd2qPd?= =?us-ascii?Q?Y3/qORb3f1i1dDLOnPUovO+WFq5Sply5R9kMeykiCbM2flxtqKpzVpQXOUwu?= =?us-ascii?Q?tMk1CXIC0fS8t8O8gwq80=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB769; 5:t+jS4VZoiPz67r283eI4RsYhjPGzFyNabwJtz7JY/vwpkkpn8JcDLDsEuVBVjgYEe2tBGfNcB9X/5HrE/dh6j9hFrzwiHoihyI9Pya+Cwlw36F7GVSCX/kDli/s7mDM4oj4LOPLvwJwLahMnK+VyqA==; 24:t7qjIhoAsPg0jBrIluaY3BYmTgYRmfT7OLHk0rQDgneUTCLaXkTkaz8QsfhRq//K2K/6eLkSoltO8xn2ECRbLjmH4haUKlCRTlcL7UsNEtA=; 20:lRxxotnMMBr6M39XsaqShek522MzNWudpbDVTuatqHbQRl9G45HOSY8weM8kZF39/qSJwU2jIcyCmkwostQq2w== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2015 15:24:12.4913 (UTC) X-MS-Exchange-CrossTenant-Id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bea78b3c-4cdb-4130-854a-1d193232e5f4; Ip=[66.129.239.17]; Helo=[p-emfe01a-sac.jnpr.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB769 X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB087; 2:n72wZ1Ng9sMVxn8yGb+YZXXDI4+IeIggVyBbemL5gobMNQzPzwgDTPRb2Fkd5YGAOAR8Dei6GkiYd0SIt1n96A+Kwg7VQ+M5WC+WhE5G1RwbOwrycXlntn5a1qYtNbcxMGjoT3HpsUCnaXthzMW74DQex8V2vlVhHk/LQdl6qYk=; 3:gcTW8nFjuDhOEgZbfVY3OuO43hX/JV7ESA5PG5fbZ2K2KjoWt9BH4oVEXA0pADfnJCMCEGbmW8judKO02g4uZxn5kjiJpVw3kG0iSrNx7dgDyWlxmeqq4b/5fMxvu2St+L/1wq9ZiGWAiD0pbX6tyL3nAEyFCV6dvWDhlpE2JqLovcLHGRzrX99p8QspOsHyE/fcrN5/QQQLEvGyyiibCUr/FgXxTcX7odKltmC7crc=; 25:zJ+l/du5pAm4bOUjSEkIZ2XJ6TIPqAEVRGMQorKYTQPvRpoHhttZ5hmnA1zFOgc+eY0ESm3XGBefEuUfe94p3yG6U2pTl7g2Q6VMxGUQq9d5Acy0FFT0qMRKBH9zl13o4W2BjAOv6iyJODe2NnxDhqSI7AbbVRzNG1uVDuW8yjJl339zBHlHwreOkTD3Q//9wD/8QAbgy33BG4qIfvzWCqgyMy7zQSUBlIO4PR/82oiG+RC2zI8wHpBQz7U5osNqzLmY7G2BwPQx9TCVR6WhaQ==; 23:XzHW0uCNxH+e9u2ixUN5ScuCmpL5yi1OP7F8Mc/H4uqqqMM3IHXOaiQasFKe7BQy57syjwSDySuBkW2oKgYPIzsjPljOzP4jvi/1JLhjYyrfm+Q6lLDDHDu6XT8v7eNMV3rv1gcIseVoM1DXez0hH9orOKsinq2/2gSSnjuMsfOTM2yOFibzmB4Tfnd957DG X-OriginatorOrg: juniper.net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 15:24:22 -0000 Julian Elischer wrote: > > If MAKEOBJDIR is empty or not a suitable value (no '/') > > set a default that works. > = > if not suitable.. it should error (with a really explicit error > message), not do something else.. How about: $ MAKEOBJDIR=3D'obj.${MACHINE}' make -C bin/cat -DWITH_META_MODE -V .OBJDI= R make: "/b/sjg/work/FreeBSD/current/src/share/mk/local.meta.sys.mk" line 29: Cannot use MAKEOBJDIR=3Dobj.amd64 Unset MAKEOBJDIR to get default: MAKEOBJDIR=3D'${.CURDIR:S,${SRCTOP},${OB= JTOP},}' $ Index: share/mk/local.meta.sys.mk =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- share/mk/local.meta.sys.mk (revision 287636) +++ share/mk/local.meta.sys.mk (working copy) @@ -16,15 +16,19 @@ MAKEOBJDIRPREFIX=3D .export MAKEOBJDIRPREFIX .endif -.if empty(MAKEOBJDIR) || ${MAKEOBJDIR:M*/*} =3D=3D "" +_default_makeobjdir=3D$${.CURDIR:S,$${SRCTOP},$${OBJTOP},} +.if empty(MAKEOBJDIR) # OBJTOP set below -MAKEOBJDIR=3D$${.CURDIR:S,$${SRCTOP},$${OBJTOP},} +MAKEOBJDIR=3D${_default_makeobjdir} # export but do not track .export-env MAKEOBJDIR # now for our own use MAKEOBJDIR=3D ${.CURDIR:S,${SRCTOP},${OBJTOP},} .endif +.if ${MAKEOBJDIR:M*/*} =3D=3D "" +.error Cannot use MAKEOBJDIR=3D${MAKEOBJDIR}${.newline}Unset MAKEOBJDIR t= o get default: MAKEOBJDIR=3D'${_default_makeobjdir}' .endif +.endif .if !empty(SB) SB_OBJROOT ?=3D ${SB}/obj/ # this is what we use below From owner-svn-src-head@freebsd.org Fri Sep 11 15:51:21 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB567A01765; Fri, 11 Sep 2015 15:51:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCAA313B9; Fri, 11 Sep 2015 15:51:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BFpLMV011755; Fri, 11 Sep 2015 15:51:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BFpLOC011754; Fri, 11 Sep 2015 15:51:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509111551.t8BFpLOC011754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 11 Sep 2015 15:51:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287673 - head/sys/dev/drm2/radeon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 15:51:21 -0000 Author: avg Date: Fri Sep 11 15:51:20 2015 New Revision: 287673 URL: https://svnweb.freebsd.org/changeset/base/287673 Log: radeon_suspend_kms: don't mess with pci state that's managed by the bus The pci bus driver handles the power state, it also manages configuration state saving and restoring for its child devices. Thus a PCI device driver does not have to worry about those things. In fact, I observe a hard system hang when trying to suspend a system with active radeonkms driver where both the bus driver and radeonkms driver try to do the same thing. I suspect that it could be because of an access to a PCI configuration register after the device is placed into D3 state. Reviewed by: dumbbell, jhb MFC after: 13 days Differential Revision: https://reviews.freebsd.org/D3561 Modified: head/sys/dev/drm2/radeon/radeon_device.c Modified: head/sys/dev/drm2/radeon/radeon_device.c ============================================================================== --- head/sys/dev/drm2/radeon/radeon_device.c Fri Sep 11 15:37:05 2015 (r287672) +++ head/sys/dev/drm2/radeon/radeon_device.c Fri Sep 11 15:51:20 2015 (r287673) @@ -1342,14 +1342,10 @@ int radeon_suspend_kms(struct drm_device radeon_agp_suspend(rdev); - pci_save_state(device_get_parent(dev->dev)); #ifdef FREEBSD_WIP if (state.event == PM_EVENT_SUSPEND) { /* Shut down the device */ pci_disable_device(dev->pdev); -#endif /* FREEBSD_WIP */ - pci_set_powerstate(dev->dev, PCI_POWERSTATE_D3); -#ifdef FREEBSD_WIP } console_lock(); #endif /* FREEBSD_WIP */ @@ -1380,10 +1376,6 @@ int radeon_resume_kms(struct drm_device #ifdef FREEBSD_WIP console_lock(); -#endif /* FREEBSD_WIP */ - pci_set_powerstate(device_get_parent(dev->dev), PCI_POWERSTATE_D0); - pci_restore_state(device_get_parent(dev->dev)); -#ifdef FREEBSD_WIP if (pci_enable_device(dev->pdev)) { console_unlock(); return -1; From owner-svn-src-head@freebsd.org Fri Sep 11 16:47:51 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ABDBA01346; Fri, 11 Sep 2015 16:47:51 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3FAB1892; Fri, 11 Sep 2015 16:47:50 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1ZaRUD-000FFw-HW; Fri, 11 Sep 2015 19:47:41 +0300 Date: Fri, 11 Sep 2015 19:47:41 +0300 From: Slawa Olhovchenkov To: Adrian Chadd Cc: John-Mark Gurney , "src-committers@freebsd.org" , Ed Maste , "svn-src-all@freebsd.org" , Eric van Gyzen , "svn-src-head@freebsd.org" , Warner Losh Subject: Re: svn commit: r287606 - head/sys/kern Message-ID: <20150911164741.GQ3158@zxy.spb.ru> References: <201509100405.t8A45xrJ070199@repo.freebsd.org> <20150910175324.GW33167@funkthat.com> <55F1E06F.7000008@FreeBSD.org> <20150910211417.GY33167@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 16:47:51 -0000 On Thu, Sep 10, 2015 at 03:11:39PM -0700, Adrian Chadd wrote: > Hi, > > Fixed a couple of bugs, and: > > https://reviews.freebsd.org/D3630 May be you also can be sanitize and standartize enviroment for services started from init and from sheell? Currently some enviroment will be different if service started manual, from interactive shell and if all worked in this cases something may be broken after reboot. Rebooting for debug is not cute. From owner-svn-src-head@freebsd.org Fri Sep 11 16:49:53 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAB37A0144C; Fri, 11 Sep 2015 16:49:53 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC0491A67; Fri, 11 Sep 2015 16:49:53 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BGnrln034850; Fri, 11 Sep 2015 16:49:53 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BGnrml034848; Fri, 11 Sep 2015 16:49:53 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201509111649.t8BGnrml034848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 11 Sep 2015 16:49:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287674 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 16:49:53 -0000 Author: cy Date: Fri Sep 11 16:49:52 2015 New Revision: 287674 URL: https://svnweb.freebsd.org/changeset/base/287674 Log: Fix ipfilter bug 3600459 NAT bucket count wrong. Obtained from: ipfilter cvs repo r1.48.2.25 MFC after: 2 weeks Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c head/sys/contrib/ipfilter/netinet/ip_state.c Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Sep 11 15:51:20 2015 (r287673) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Sep 11 16:49:52 2015 (r287674) @@ -1104,6 +1104,18 @@ ipf_checkv4sum(fin) return -1; } if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { + /* UDP may have zero checksum */ + if (fin->fin_p == IPPROTO_UDP && (fin->fin_flx & (FI_FRAG|FI_SHORT|FI_BAD)) == 0) { + udphdr_t *udp = fin->fin_dp; + if (udp->uh_sum == 0) { + /* we're good no matter what the hardware checksum flags + and csum_data say (handling of csum_data for zero UDP + checksum is not consistent across all drivers) */ + fin->fin_cksum = 1; + return 0; + } + } + if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) sum = m->m_pkthdr.csum_data; else Modified: head/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_state.c Fri Sep 11 15:51:20 2015 (r287673) +++ head/sys/contrib/ipfilter/netinet/ip_state.c Fri Sep 11 16:49:52 2015 (r287674) @@ -3646,7 +3646,8 @@ ipf_state_del(softc, is, why) is->is_me = NULL; is->is_ref--; } - if (is->is_ref > 1) { + is->is_ref--; + if (is->is_ref > 0) { int refs; is->is_ref--; From owner-svn-src-head@freebsd.org Fri Sep 11 16:52:14 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7AD6CA016B7; Fri, 11 Sep 2015 16:52:14 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C4441F49; Fri, 11 Sep 2015 16:52:14 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BGqEgf038608; Fri, 11 Sep 2015 16:52:14 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BGqEOJ038607; Fri, 11 Sep 2015 16:52:14 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201509111652.t8BGqEOJ038607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 11 Sep 2015 16:52:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287675 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 16:52:14 -0000 Author: cy Date: Fri Sep 11 16:52:13 2015 New Revision: 287675 URL: https://svnweb.freebsd.org/changeset/base/287675 Log: Revert ip_fil_freebsd.c -r287674. This should not have gone in yet. Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Sep 11 16:49:52 2015 (r287674) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Sep 11 16:52:13 2015 (r287675) @@ -1104,18 +1104,6 @@ ipf_checkv4sum(fin) return -1; } if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { - /* UDP may have zero checksum */ - if (fin->fin_p == IPPROTO_UDP && (fin->fin_flx & (FI_FRAG|FI_SHORT|FI_BAD)) == 0) { - udphdr_t *udp = fin->fin_dp; - if (udp->uh_sum == 0) { - /* we're good no matter what the hardware checksum flags - and csum_data say (handling of csum_data for zero UDP - checksum is not consistent across all drivers) */ - fin->fin_cksum = 1; - return 0; - } - } - if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) sum = m->m_pkthdr.csum_data; else From owner-svn-src-head@freebsd.org Fri Sep 11 17:15:00 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E84C7A02398; Fri, 11 Sep 2015 17:14:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D84CC113E; Fri, 11 Sep 2015 17:14:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BHExHw047256; Fri, 11 Sep 2015 17:14:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BHExXt047253; Fri, 11 Sep 2015 17:14:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201509111714.t8BHExXt047253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 11 Sep 2015 17:14:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287679 - in head/contrib/libc++: . include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 17:15:00 -0000 Author: dim Date: Fri Sep 11 17:14:58 2015 New Revision: 287679 URL: https://svnweb.freebsd.org/changeset/base/287679 Log: Since contrib/libc++'s ancestry was never correct, subversion 1.8 and higher cannot merge to it from the vendor area. Re-bootstrap the ancestry by doing (apologies to your retinas): * svn rm contrib/libc++ * svn cp ^/vendor/libc++/dist@276792 contrib/libc++ * svn cp ^/head/contrib/libc++/FREEBSD-upgrade@287629 contrib/libc++ * svn cp ^/head/contrib/libc++/include/__bit_reference@287629 contrib/libc++/include * svn cp ^/head/contrib/libc++/include/__config@287629 contrib/libc++/include * svn cp ^/head/contrib/libc++/include/__tree@287629 contrib/libc++/include * svn cp ^/head/contrib/libc++/include/algorithm@287629 contrib/libc++/include * svn cp ^/head/contrib/libc++/include/stdexcept@287629 contrib/libc++/include * svn cp ^/head/contrib/libc++/include/type_traits@287629 contrib/libc++/include * svn pd -R svn:mergeinfo contrib/libc++ * svn ps -F mergeinfo.txt contrib/libc++ Added: head/contrib/libc++/FREEBSD-upgrade - copied unchanged from r287629, head/contrib/libc++/FREEBSD-upgrade Replaced: - copied from r276792, vendor/libc++/dist/ head/contrib/libc++/include/__bit_reference - copied unchanged from r287629, head/contrib/libc++/include/__bit_reference head/contrib/libc++/include/__config - copied unchanged from r287629, head/contrib/libc++/include/__config head/contrib/libc++/include/__tree - copied unchanged from r287629, head/contrib/libc++/include/__tree head/contrib/libc++/include/algorithm - copied unchanged from r287629, head/contrib/libc++/include/algorithm head/contrib/libc++/include/stdexcept - copied unchanged from r287629, head/contrib/libc++/include/stdexcept head/contrib/libc++/include/type_traits - copied unchanged from r287629, head/contrib/libc++/include/type_traits Directory Properties: head/contrib/libc++/ (props changed) Copied: head/contrib/libc++/FREEBSD-upgrade (from r287629, head/contrib/libc++/FREEBSD-upgrade) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libc++/FREEBSD-upgrade Fri Sep 11 17:14:58 2015 (r287679, copy of r287629, head/contrib/libc++/FREEBSD-upgrade) @@ -0,0 +1,8 @@ +$FreeBSD$ + +The FreeBSD copy of libc++. This contains everything from the include and +source directories upstream, with the exception of the support/win32 directory, +which is only required for building on Windows (FreeBSD is not Windows). + +To update, bring in anything new in source or include that is not +platform-dependent (unless the platform in question is FreeBSD, obviously). Copied: head/contrib/libc++/include/__bit_reference (from r287629, head/contrib/libc++/include/__bit_reference) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libc++/include/__bit_reference Fri Sep 11 17:14:58 2015 (r287679, copy of r287629, head/contrib/libc++/include/__bit_reference) @@ -0,0 +1,1286 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___BIT_REFERENCE +#define _LIBCPP___BIT_REFERENCE + +#include <__config> +#include + +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template class __bit_iterator; +template class __bit_const_reference; + +template +struct __has_storage_type +{ + static const bool value = false; +}; + +template ::value> +class __bit_reference +{ + typedef typename _Cp::__storage_type __storage_type; + typedef typename _Cp::__storage_pointer __storage_pointer; + + __storage_pointer __seg_; + __storage_type __mask_; + +#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC) + friend typename _Cp::__self; +#else + friend class _Cp::__self; +#endif + friend class __bit_const_reference<_Cp>; + friend class __bit_iterator<_Cp, false>; +public: + _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT + {return static_cast(*__seg_ & __mask_);} + _LIBCPP_INLINE_VISIBILITY bool operator ~() const _NOEXCEPT + {return !static_cast(*this);} + + _LIBCPP_INLINE_VISIBILITY + __bit_reference& operator=(bool __x) _NOEXCEPT + { + if (__x) + *__seg_ |= __mask_; + else + *__seg_ &= ~__mask_; + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + __bit_reference& operator=(const __bit_reference& __x) _NOEXCEPT + {return operator=(static_cast(__x));} + + _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;} + _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT + {return __bit_iterator<_Cp, false>(__seg_, static_cast(__ctz(__mask_)));} +private: + _LIBCPP_INLINE_VISIBILITY + __bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT + : __seg_(__s), __mask_(__m) {} +}; + +template +class __bit_reference<_Cp, false> +{ +}; + +template +inline _LIBCPP_INLINE_VISIBILITY +void +swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) _NOEXCEPT +{ + bool __t = __x; + __x = __y; + __y = __t; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +void +swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT +{ + bool __t = __x; + __x = __y; + __y = __t; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +void +swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT +{ + bool __t = __x; + __x = __y; + __y = __t; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +void +swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT +{ + bool __t = __x; + __x = __y; + __y = __t; +} + +template +class __bit_const_reference +{ + typedef typename _Cp::__storage_type __storage_type; + typedef typename _Cp::__const_storage_pointer __storage_pointer; + + __storage_pointer __seg_; + __storage_type __mask_; + +#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC) + friend typename _Cp::__self; +#else + friend class _Cp::__self; +#endif + friend class __bit_iterator<_Cp, true>; +public: + _LIBCPP_INLINE_VISIBILITY + __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT + : __seg_(__x.__seg_), __mask_(__x.__mask_) {} + + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT + {return static_cast(*__seg_ & __mask_);} + + _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT + {return __bit_iterator<_Cp, true>(__seg_, static_cast(__ctz(__mask_)));} +private: + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR + __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT + : __seg_(__s), __mask_(__m) {} + + __bit_const_reference& operator=(const __bit_const_reference& __x); +}; + +// find + +template +__bit_iterator<_Cp, _IsConst> +__find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) +{ + typedef __bit_iterator<_Cp, _IsConst> _It; + typedef typename _It::__storage_type __storage_type; + static const unsigned __bits_per_word = _It::__bits_per_word; + // do first partial word + if (__first.__ctz_ != 0) + { + __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); + __storage_type __dn = _VSTD::min(__clz_f, __n); + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __storage_type __b = *__first.__seg_ & __m; + if (__b) + return _It(__first.__seg_, static_cast(_VSTD::__ctz(__b))); + if (__n == __dn) + return __first + __n; + __n -= __dn; + ++__first.__seg_; + } + // do middle whole words + for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) + if (*__first.__seg_) + return _It(__first.__seg_, static_cast(_VSTD::__ctz(*__first.__seg_))); + // do last partial word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b = *__first.__seg_ & __m; + if (__b) + return _It(__first.__seg_, static_cast(_VSTD::__ctz(__b))); + } + return _It(__first.__seg_, static_cast(__n)); +} + +template +__bit_iterator<_Cp, _IsConst> +__find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) +{ + typedef __bit_iterator<_Cp, _IsConst> _It; + typedef typename _It::__storage_type __storage_type; + static const unsigned __bits_per_word = _It::__bits_per_word; + // do first partial word + if (__first.__ctz_ != 0) + { + __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); + __storage_type __dn = _VSTD::min(__clz_f, __n); + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __storage_type __b = ~*__first.__seg_ & __m; + if (__b) + return _It(__first.__seg_, static_cast(_VSTD::__ctz(__b))); + if (__n == __dn) + return __first + __n; + __n -= __dn; + ++__first.__seg_; + } + // do middle whole words + for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) + { + __storage_type __b = ~*__first.__seg_; + if (__b) + return _It(__first.__seg_, static_cast(_VSTD::__ctz(__b))); + } + // do last partial word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b = ~*__first.__seg_ & __m; + if (__b) + return _It(__first.__seg_, static_cast(_VSTD::__ctz(__b))); + } + return _It(__first.__seg_, static_cast(__n)); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +__bit_iterator<_Cp, _IsConst> +find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) +{ + if (static_cast(__value_)) + return __find_bool_true(__first, static_cast(__last - __first)); + return __find_bool_false(__first, static_cast(__last - __first)); +} + +// count + +template +typename __bit_iterator<_Cp, _IsConst>::difference_type +__count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) +{ + typedef __bit_iterator<_Cp, _IsConst> _It; + typedef typename _It::__storage_type __storage_type; + typedef typename _It::difference_type difference_type; + static const unsigned __bits_per_word = _It::__bits_per_word; + difference_type __r = 0; + // do first partial word + if (__first.__ctz_ != 0) + { + __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); + __storage_type __dn = _VSTD::min(__clz_f, __n); + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __r = _VSTD::__pop_count(*__first.__seg_ & __m); + __n -= __dn; + ++__first.__seg_; + } + // do middle whole words + for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) + __r += _VSTD::__pop_count(*__first.__seg_); + // do last partial word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __r += _VSTD::__pop_count(*__first.__seg_ & __m); + } + return __r; +} + +template +typename __bit_iterator<_Cp, _IsConst>::difference_type +__count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) +{ + typedef __bit_iterator<_Cp, _IsConst> _It; + typedef typename _It::__storage_type __storage_type; + typedef typename _It::difference_type difference_type; + static const unsigned __bits_per_word = _It::__bits_per_word; + difference_type __r = 0; + // do first partial word + if (__first.__ctz_ != 0) + { + __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); + __storage_type __dn = _VSTD::min(__clz_f, __n); + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __r = _VSTD::__pop_count(~*__first.__seg_ & __m); + __n -= __dn; + ++__first.__seg_; + } + // do middle whole words + for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) + __r += _VSTD::__pop_count(~*__first.__seg_); + // do last partial word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __r += _VSTD::__pop_count(~*__first.__seg_ & __m); + } + return __r; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +typename __bit_iterator<_Cp, _IsConst>::difference_type +count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) +{ + if (static_cast(__value_)) + return __count_bool_true(__first, static_cast(__last - __first)); + return __count_bool_false(__first, static_cast(__last - __first)); +} + +// fill_n + +template +void +__fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) +{ + typedef __bit_iterator<_Cp, false> _It; + typedef typename _It::__storage_type __storage_type; + static const unsigned __bits_per_word = _It::__bits_per_word; + // do first partial word + if (__first.__ctz_ != 0) + { + __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); + __storage_type __dn = _VSTD::min(__clz_f, __n); + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + *__first.__seg_ &= ~__m; + __n -= __dn; + ++__first.__seg_; + } + // do middle whole words + __storage_type __nw = __n / __bits_per_word; + _VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type)); + __n -= __nw * __bits_per_word; + // do last partial word + if (__n > 0) + { + __first.__seg_ += __nw; + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + *__first.__seg_ &= ~__m; + } +} + +template +void +__fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) +{ + typedef __bit_iterator<_Cp, false> _It; + typedef typename _It::__storage_type __storage_type; + static const unsigned __bits_per_word = _It::__bits_per_word; + // do first partial word + if (__first.__ctz_ != 0) + { + __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); + __storage_type __dn = _VSTD::min(__clz_f, __n); + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + *__first.__seg_ |= __m; + __n -= __dn; + ++__first.__seg_; + } + // do middle whole words + __storage_type __nw = __n / __bits_per_word; + _VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type)); + __n -= __nw * __bits_per_word; + // do last partial word + if (__n > 0) + { + __first.__seg_ += __nw; + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + *__first.__seg_ |= __m; + } +} + +template +inline _LIBCPP_INLINE_VISIBILITY +void +fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_) +{ + if (__n > 0) + { + if (__value_) + __fill_n_true(__first, __n); + else + __fill_n_false(__first, __n); + } +} + +// fill + +template +inline _LIBCPP_INLINE_VISIBILITY +void +fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_) +{ + _VSTD::fill_n(__first, static_cast(__last - __first), __value_); +} + +// copy + +template +__bit_iterator<_Cp, false> +__copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, + __bit_iterator<_Cp, false> __result) +{ + typedef __bit_iterator<_Cp, _IsConst> _In; + typedef typename _In::difference_type difference_type; + typedef typename _In::__storage_type __storage_type; + static const unsigned __bits_per_word = _In::__bits_per_word; + difference_type __n = __last - __first; + if (__n > 0) + { + // do first word + if (__first.__ctz_ != 0) + { + unsigned __clz = __bits_per_word - __first.__ctz_; + difference_type __dn = _VSTD::min(static_cast(__clz), __n); + __n -= __dn; + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn)); + __storage_type __b = *__first.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b; + __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; + __result.__ctz_ = static_cast((__dn + __result.__ctz_) % __bits_per_word); + ++__first.__seg_; + // __first.__ctz_ = 0; + } + // __first.__ctz_ == 0; + // do middle words + __storage_type __nw = __n / __bits_per_word; + _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_), + _VSTD::__to_raw_pointer(__first.__seg_), + __nw * sizeof(__storage_type)); + __n -= __nw * __bits_per_word; + __result.__seg_ += __nw; + // do last word + if (__n > 0) + { + __first.__seg_ += __nw; + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b = *__first.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b; + __result.__ctz_ = static_cast(__n); + } + } + return __result; +} + +template +__bit_iterator<_Cp, false> +__copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, + __bit_iterator<_Cp, false> __result) +{ + typedef __bit_iterator<_Cp, _IsConst> _In; + typedef typename _In::difference_type difference_type; + typedef typename _In::__storage_type __storage_type; + static const unsigned __bits_per_word = _In::__bits_per_word; + difference_type __n = __last - __first; + if (__n > 0) + { + // do first word + if (__first.__ctz_ != 0) + { + unsigned __clz_f = __bits_per_word - __first.__ctz_; + difference_type __dn = _VSTD::min(static_cast(__clz_f), __n); + __n -= __dn; + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __storage_type __b = *__first.__seg_ & __m; + unsigned __clz_r = __bits_per_word - __result.__ctz_; + __storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r); + __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); + *__result.__seg_ &= ~__m; + if (__result.__ctz_ > __first.__ctz_) + *__result.__seg_ |= __b << (__result.__ctz_ - __first.__ctz_); + else + *__result.__seg_ |= __b >> (__first.__ctz_ - __result.__ctz_); + __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word; + __result.__ctz_ = static_cast((__ddn + __result.__ctz_) % __bits_per_word); + __dn -= __ddn; + if (__dn > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __dn); + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b >> (__first.__ctz_ + __ddn); + __result.__ctz_ = static_cast(__dn); + } + ++__first.__seg_; + // __first.__ctz_ = 0; + } + // __first.__ctz_ == 0; + // do middle words + unsigned __clz_r = __bits_per_word - __result.__ctz_; + __storage_type __m = ~__storage_type(0) << __result.__ctz_; + for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_) + { + __storage_type __b = *__first.__seg_; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b << __result.__ctz_; + ++__result.__seg_; + *__result.__seg_ &= __m; + *__result.__seg_ |= __b >> __clz_r; + } + // do last word + if (__n > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b = *__first.__seg_ & __m; + __storage_type __dn = _VSTD::min(__n, static_cast(__clz_r)); + __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn)); + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b << __result.__ctz_; + __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; + __result.__ctz_ = static_cast((__dn + __result.__ctz_) % __bits_per_word); + __n -= __dn; + if (__n > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __n); + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b >> __dn; + __result.__ctz_ = static_cast(__n); + } + } + } + return __result; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +__bit_iterator<_Cp, false> +copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) +{ + if (__first.__ctz_ == __result.__ctz_) + return __copy_aligned(__first, __last, __result); + return __copy_unaligned(__first, __last, __result); +} + +// copy_backward + +template +__bit_iterator<_Cp, false> +__copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, + __bit_iterator<_Cp, false> __result) +{ + typedef __bit_iterator<_Cp, _IsConst> _In; + typedef typename _In::difference_type difference_type; + typedef typename _In::__storage_type __storage_type; + static const unsigned __bits_per_word = _In::__bits_per_word; + difference_type __n = __last - __first; + if (__n > 0) + { + // do first word + if (__last.__ctz_ != 0) + { + difference_type __dn = _VSTD::min(static_cast(__last.__ctz_), __n); + __n -= __dn; + unsigned __clz = __bits_per_word - __last.__ctz_; + __storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz); + __storage_type __b = *__last.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b; + __result.__ctz_ = static_cast(((-__dn & (__bits_per_word - 1)) + + __result.__ctz_) % __bits_per_word); + // __last.__ctz_ = 0 + } + // __last.__ctz_ == 0 || __n == 0 + // __result.__ctz_ == 0 || __n == 0 + // do middle words + __storage_type __nw = __n / __bits_per_word; + __result.__seg_ -= __nw; + __last.__seg_ -= __nw; + _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_), + _VSTD::__to_raw_pointer(__last.__seg_), + __nw * sizeof(__storage_type)); + __n -= __nw * __bits_per_word; + // do last word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) << (__bits_per_word - __n); + __storage_type __b = *--__last.__seg_ & __m; + *--__result.__seg_ &= ~__m; + *__result.__seg_ |= __b; + __result.__ctz_ = static_cast(-__n & (__bits_per_word - 1)); + } + } + return __result; +} + +template +__bit_iterator<_Cp, false> +__copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, + __bit_iterator<_Cp, false> __result) +{ + typedef __bit_iterator<_Cp, _IsConst> _In; + typedef typename _In::difference_type difference_type; + typedef typename _In::__storage_type __storage_type; + static const unsigned __bits_per_word = _In::__bits_per_word; + difference_type __n = __last - __first; + if (__n > 0) + { + // do first word + if (__last.__ctz_ != 0) + { + difference_type __dn = _VSTD::min(static_cast(__last.__ctz_), __n); + __n -= __dn; + unsigned __clz_l = __bits_per_word - __last.__ctz_; + __storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_l); + __storage_type __b = *__last.__seg_ & __m; + unsigned __clz_r = __bits_per_word - __result.__ctz_; + __storage_type __ddn = _VSTD::min(__dn, static_cast(__result.__ctz_)); + if (__ddn > 0) + { + __m = (~__storage_type(0) << (__result.__ctz_ - __ddn)) & (~__storage_type(0) >> __clz_r); + *__result.__seg_ &= ~__m; + if (__result.__ctz_ > __last.__ctz_) + *__result.__seg_ |= __b << (__result.__ctz_ - __last.__ctz_); + else + *__result.__seg_ |= __b >> (__last.__ctz_ - __result.__ctz_); + __result.__ctz_ = static_cast(((-__ddn & (__bits_per_word - 1)) + + __result.__ctz_) % __bits_per_word); + __dn -= __ddn; + } + if (__dn > 0) + { + // __result.__ctz_ == 0 + --__result.__seg_; + __result.__ctz_ = static_cast(-__dn & (__bits_per_word - 1)); + __m = ~__storage_type(0) << __result.__ctz_; + *__result.__seg_ &= ~__m; + __last.__ctz_ -= __dn + __ddn; + *__result.__seg_ |= __b << (__result.__ctz_ - __last.__ctz_); + } + // __last.__ctz_ = 0 + } + // __last.__ctz_ == 0 || __n == 0 + // __result.__ctz_ != 0 || __n == 0 + // do middle words + unsigned __clz_r = __bits_per_word - __result.__ctz_; + __storage_type __m = ~__storage_type(0) >> __clz_r; + for (; __n >= __bits_per_word; __n -= __bits_per_word) + { + __storage_type __b = *--__last.__seg_; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b >> __clz_r; + *--__result.__seg_ &= __m; + *__result.__seg_ |= __b << __result.__ctz_; + } + // do last word + if (__n > 0) + { + __m = ~__storage_type(0) << (__bits_per_word - __n); + __storage_type __b = *--__last.__seg_ & __m; + __clz_r = __bits_per_word - __result.__ctz_; + __storage_type __dn = _VSTD::min(__n, static_cast(__result.__ctz_)); + __m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r); + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b >> (__bits_per_word - __result.__ctz_); + __result.__ctz_ = static_cast(((-__dn & (__bits_per_word - 1)) + + __result.__ctz_) % __bits_per_word); + __n -= __dn; + if (__n > 0) + { + // __result.__ctz_ == 0 + --__result.__seg_; + __result.__ctz_ = static_cast(-__n & (__bits_per_word - 1)); + __m = ~__storage_type(0) << __result.__ctz_; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b << (__result.__ctz_ - (__bits_per_word - __n - __dn)); + } + } + } + return __result; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +__bit_iterator<_Cp, false> +copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) +{ + if (__last.__ctz_ == __result.__ctz_) + return __copy_backward_aligned(__first, __last, __result); + return __copy_backward_unaligned(__first, __last, __result); +} + +// move + +template +inline _LIBCPP_INLINE_VISIBILITY +__bit_iterator<_Cp, false> +move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) +{ + return _VSTD::copy(__first, __last, __result); +} + +// move_backward + +template +inline _LIBCPP_INLINE_VISIBILITY +__bit_iterator<_Cp, false> +move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) +{ + return _VSTD::copy_backward(__first, __last, __result); +} + +// swap_ranges + +template +__bit_iterator<__C2, false> +__swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last, + __bit_iterator<__C2, false> __result) +{ + typedef __bit_iterator<__C1, false> _I1; + typedef typename _I1::difference_type difference_type; + typedef typename _I1::__storage_type __storage_type; + static const unsigned __bits_per_word = _I1::__bits_per_word; + difference_type __n = __last - __first; + if (__n > 0) + { + // do first word + if (__first.__ctz_ != 0) + { + unsigned __clz = __bits_per_word - __first.__ctz_; + difference_type __dn = _VSTD::min(static_cast(__clz), __n); + __n -= __dn; + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn)); + __storage_type __b1 = *__first.__seg_ & __m; + *__first.__seg_ &= ~__m; + __storage_type __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b1; + *__first.__seg_ |= __b2; + __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; + __result.__ctz_ = static_cast((__dn + __result.__ctz_) % __bits_per_word); + ++__first.__seg_; + // __first.__ctz_ = 0; + } + // __first.__ctz_ == 0; + // do middle words + for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_, ++__result.__seg_) + swap(*__first.__seg_, *__result.__seg_); + // do last word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b1 = *__first.__seg_ & __m; + *__first.__seg_ &= ~__m; + __storage_type __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b1; + *__first.__seg_ |= __b2; + __result.__ctz_ = static_cast(__n); + } + } + return __result; +} + +template +__bit_iterator<__C2, false> +__swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last, + __bit_iterator<__C2, false> __result) +{ + typedef __bit_iterator<__C1, false> _I1; + typedef typename _I1::difference_type difference_type; + typedef typename _I1::__storage_type __storage_type; + static const unsigned __bits_per_word = _I1::__bits_per_word; + difference_type __n = __last - __first; + if (__n > 0) + { + // do first word + if (__first.__ctz_ != 0) + { + unsigned __clz_f = __bits_per_word - __first.__ctz_; + difference_type __dn = _VSTD::min(static_cast(__clz_f), __n); + __n -= __dn; + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __storage_type __b1 = *__first.__seg_ & __m; + *__first.__seg_ &= ~__m; + unsigned __clz_r = __bits_per_word - __result.__ctz_; + __storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r); + __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); + __storage_type __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + if (__result.__ctz_ > __first.__ctz_) + { + unsigned __s = __result.__ctz_ - __first.__ctz_; + *__result.__seg_ |= __b1 << __s; + *__first.__seg_ |= __b2 >> __s; + } + else + { + unsigned __s = __first.__ctz_ - __result.__ctz_; + *__result.__seg_ |= __b1 >> __s; + *__first.__seg_ |= __b2 << __s; + } + __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word; + __result.__ctz_ = static_cast((__ddn + __result.__ctz_) % __bits_per_word); + __dn -= __ddn; + if (__dn > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __dn); + __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + unsigned __s = __first.__ctz_ + __ddn; + *__result.__seg_ |= __b1 >> __s; + *__first.__seg_ |= __b2 << __s; + __result.__ctz_ = static_cast(__dn); + } + ++__first.__seg_; + // __first.__ctz_ = 0; + } + // __first.__ctz_ == 0; + // do middle words + __storage_type __m = ~__storage_type(0) << __result.__ctz_; + unsigned __clz_r = __bits_per_word - __result.__ctz_; + for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_) + { + __storage_type __b1 = *__first.__seg_; + __storage_type __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b1 << __result.__ctz_; + *__first.__seg_ = __b2 >> __result.__ctz_; + ++__result.__seg_; + __b2 = *__result.__seg_ & ~__m; + *__result.__seg_ &= __m; + *__result.__seg_ |= __b1 >> __clz_r; + *__first.__seg_ |= __b2 << __clz_r; + } + // do last word + if (__n > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b1 = *__first.__seg_ & __m; + *__first.__seg_ &= ~__m; + __storage_type __dn = _VSTD::min<__storage_type>(__n, __clz_r); + __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn)); + __storage_type __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b1 << __result.__ctz_; + *__first.__seg_ |= __b2 >> __result.__ctz_; + __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; + __result.__ctz_ = static_cast((__dn + __result.__ctz_) % __bits_per_word); + __n -= __dn; + if (__n > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __n); + __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b1 >> __dn; + *__first.__seg_ |= __b2 << __dn; + __result.__ctz_ = static_cast(__n); + } + } + } + return __result; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +__bit_iterator<__C2, false> +swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __last1, + __bit_iterator<__C2, false> __first2) +{ + if (__first1.__ctz_ == __first2.__ctz_) + return __swap_ranges_aligned(__first1, __last1, __first2); + return __swap_ranges_unaligned(__first1, __last1, __first2); +} + +// rotate + +template +struct __bit_array +{ + typedef typename _Cp::difference_type difference_type; + typedef typename _Cp::__storage_type __storage_type; + typedef typename _Cp::__storage_pointer __storage_pointer; + typedef typename _Cp::iterator iterator; + static const unsigned __bits_per_word = _Cp::__bits_per_word; + static const unsigned _Np = 4; + + difference_type __size_; + __storage_type __word_[_Np]; + + _LIBCPP_INLINE_VISIBILITY static difference_type capacity() + {return static_cast(_Np * __bits_per_word);} + _LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {} + _LIBCPP_INLINE_VISIBILITY iterator begin() + { + return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]), 0); + } + _LIBCPP_INLINE_VISIBILITY iterator end() + { + return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]) + __size_ / __bits_per_word, + static_cast(__size_ % __bits_per_word)); + } +}; + +template +__bit_iterator<_Cp, false> +rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last) +{ + typedef __bit_iterator<_Cp, false> _I1; + typedef typename _I1::difference_type difference_type; + difference_type __d1 = __middle - __first; + difference_type __d2 = __last - __middle; + _I1 __r = __first + __d2; + while (__d1 != 0 && __d2 != 0) + { + if (__d1 <= __d2) + { + if (__d1 <= __bit_array<_Cp>::capacity()) + { + __bit_array<_Cp> __b(__d1); + _VSTD::copy(__first, __middle, __b.begin()); + _VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first)); + break; + } + else + { + __bit_iterator<_Cp, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle); + __first = __middle; + __middle = __mp; + __d2 -= __d1; + } + } + else + { + if (__d2 <= __bit_array<_Cp>::capacity()) + { + __bit_array<_Cp> __b(__d2); + _VSTD::copy(__middle, __last, __b.begin()); + _VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last)); + break; + } + else + { + __bit_iterator<_Cp, false> __mp = __first + __d2; + _VSTD::swap_ranges(__first, __mp, __middle); + __first = __mp; + __d1 -= __d2; + } + } + } + return __r; +} + +// equal + +template +bool +__equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, + __bit_iterator<_Cp, _IC2> __first2) +{ + typedef __bit_iterator<_Cp, _IC1> _It; + typedef typename _It::difference_type difference_type; + typedef typename _It::__storage_type __storage_type; + static const unsigned __bits_per_word = _It::__bits_per_word; + difference_type __n = __last1 - __first1; + if (__n > 0) + { + // do first word + if (__first1.__ctz_ != 0) + { + unsigned __clz_f = __bits_per_word - __first1.__ctz_; + difference_type __dn = _VSTD::min(static_cast(__clz_f), __n); + __n -= __dn; + __storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __storage_type __b = *__first1.__seg_ & __m; + unsigned __clz_r = __bits_per_word - __first2.__ctz_; + __storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r); + __m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); + if (__first2.__ctz_ > __first1.__ctz_) + { + if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_))) + return false; + } + else + { + if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_))) + return false; + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Sep 11 18:47:46 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 861CD9CD035; Fri, 11 Sep 2015 18:47:46 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x230.google.com (mail-ig0-x230.google.com [IPv6:2607:f8b0:4001:c05::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 184471EB7; Fri, 11 Sep 2015 18:47:46 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by igcpb10 with SMTP id pb10so51735685igc.1; Fri, 11 Sep 2015 11:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=q3dR+oesc4XbdZ5u5sEo++AorLtitSSEcfhAMO4pZik=; b=X4H+r6Ax7uANRUITgIWwPUH0qHso5XkuFTbJ17aNKFCVU9WI+8B3MXLQ3IO7Hh6SrG PtT18G9Gq9/sEMi/cqyNVVswUbJzu8fb7AXnyep2OQ6AcD4JW4hDQai4UzXWbRXvof6C chuibk8nCcefXT3MpBqW5e3M1uHnkUL1ltoyj8vj/uzsuGjJYMK9BBTzZWjqPfpTEzEc k9KbkH4BvivAZbi2KoLDOlq4AhcuFAQTnMSGqf/p2NE6cQjMtSYAYbcxu5wgT5Du5Bpv +ek1TjaJcd6COaKRTfQAdhSHv7J2Ex0ZHFueaFj3hy0TVE6Wwt5Oe3746o15lVoLUc7G jRBg== MIME-Version: 1.0 X-Received: by 10.50.40.8 with SMTP id t8mr6495489igk.37.1441997265090; Fri, 11 Sep 2015 11:47:45 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.28.208 with HTTP; Fri, 11 Sep 2015 11:47:44 -0700 (PDT) In-Reply-To: <20150911164741.GQ3158@zxy.spb.ru> References: <201509100405.t8A45xrJ070199@repo.freebsd.org> <20150910175324.GW33167@funkthat.com> <55F1E06F.7000008@FreeBSD.org> <20150910211417.GY33167@funkthat.com> <20150911164741.GQ3158@zxy.spb.ru> Date: Fri, 11 Sep 2015 11:47:44 -0700 X-Google-Sender-Auth: JhVxCyS6A8Q7pdqQodpBp20HM-E Message-ID: Subject: Re: svn commit: r287606 - head/sys/kern From: Adrian Chadd To: Slawa Olhovchenkov Cc: John-Mark Gurney , "src-committers@freebsd.org" , Ed Maste , "svn-src-all@freebsd.org" , Eric van Gyzen , "svn-src-head@freebsd.org" , Warner Losh Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 18:47:46 -0000 Hi, That would be nice. Maybe after this particular bug is fixed though. -a On 11 September 2015 at 09:47, Slawa Olhovchenkov wrote: > On Thu, Sep 10, 2015 at 03:11:39PM -0700, Adrian Chadd wrote: > >> Hi, >> >> Fixed a couple of bugs, and: >> >> https://reviews.freebsd.org/D3630 > > May be you also can be sanitize and standartize enviroment for > services started from init and from sheell? > > Currently some enviroment will be different if service started manual, > from interactive shell and if all worked in this cases something may > be broken after reboot. Rebooting for debug is not cute. From owner-svn-src-head@freebsd.org Fri Sep 11 20:39:41 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F222AA0163A; Fri, 11 Sep 2015 20:39:41 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E34161A69; Fri, 11 Sep 2015 20:39:41 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BKdfZx033277; Fri, 11 Sep 2015 20:39:41 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BKdfe8033276; Fri, 11 Sep 2015 20:39:41 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112039.t8BKdfe8033276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 20:39:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287683 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 20:39:42 -0000 Author: dteske Date: Fri Sep 11 20:39:41 2015 New Revision: 287683 URL: https://svnweb.freebsd.org/changeset/base/287683 Log: Ignore error results from newaliases(1) MFC after: 3 days X-MFC-to: stable/10 Modified: head/usr.sbin/bsdinstall/scripts/config Modified: head/usr.sbin/bsdinstall/scripts/config ============================================================================== --- head/usr.sbin/bsdinstall/scripts/config Fri Sep 11 17:24:19 2015 (r287682) +++ head/usr.sbin/bsdinstall/scripts/config Fri Sep 11 20:39:41 2015 (r287683) @@ -45,6 +45,8 @@ cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHR # Set up other things from installed config chroot $BSDINSTALL_CHROOT /usr/bin/newaliases > /dev/null 2>&1 +exit $SUCCESS + ################################################################################ # END ################################################################################ From owner-svn-src-head@freebsd.org Fri Sep 11 20:42:27 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01757A0186E; Fri, 11 Sep 2015 20:42:27 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [IPv6:2001:470:1f05:b76::196]) by mx1.freebsd.org (Postfix) with ESMTP id E2B0E1DCF; Fri, 11 Sep 2015 20:42:26 +0000 (UTC) (envelope-from bright@mu.org) Received: from Alfreds-MacBook-Pro.local (173-228-14-211.dedicated.static.sonic.net [173.228.14.211]) by elvis.mu.org (Postfix) with ESMTPSA id 4F4D3345A8F5; Fri, 11 Sep 2015 13:42:26 -0700 (PDT) Subject: Re: svn commit: r287606 - head/sys/kern To: Adrian Chadd , Warner Losh References: <201509100405.t8A45xrJ070199@repo.freebsd.org> Cc: Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Alfred Perlstein Message-ID: <55F33D96.8060300@mu.org> Date: Fri, 11 Sep 2015 13:46:14 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 20:42:27 -0000 64k hard is too low a number for large memory machines. -Alfred On 9/10/15 9:18 AM, Adrian Chadd wrote: > On 10 September 2015 at 09:04, Warner Losh wrote: >> >> On Thu, Sep 10, 2015 at 9:53 AM, Ed Maste wrote: >>> On 10 September 2015 at 04:05, Adrian Chadd wrote: >>>> Author: adrian >>>> Date: Thu Sep 10 04:05:58 2015 >>>> New Revision: 287606 >>>> URL: https://svnweb.freebsd.org/changeset/base/287606 >>>> >>>> Log: >>>> Also make kern.maxfilesperproc a boot time tunable. >>>> ... >>>> TODO: >>> Also "we" should >>> * Submit patches upstream or to the ports tree to use closefrom >> >> I thought the consensus was that we'd fix things to have fewer FDs >> by default, but instead allow individual processes to raise it via the >> usual methods. > I'm looking at how to do this in a somewhat sensible fashion. Right > now we just have openfiles=unlimited; in /etc/login.conf which seems a > little odd. I don't know yet if that affects the default set that > services started via /etc/rc get - init gets the whole default > maxfilesperproc and stuff seems to inherit from that unless told > otherwise. > > I think the more sensible default would be: > > * set /etc/login.conf to some much lower values - say, 4k soft, 64k hard; > * root can always override its settings up to kern.maxfilesperproc; > * modify /etc/rc to set some default rlimits as appropriate; > * introduce configuration options ({daemon_rlimit_XXX}?) in > /etc/rc.conf that lets someone override what the default rlimits > should be for a given process,, as (and I'm not making this up) if you > run 'service XXX restart' from a root login you get the rlimits from > the shell, which may differ from the system startup. > > That way we can setup various services to have higher openfile limits > via /etc/rc.conf entries for those services rather than having to hack > each startup script. It also means that no matter what is running > 'service XXX YYY' as root, you'll get the 'correct'(er) rlimits. > > Thoughts? > > > -adrian > From owner-svn-src-head@freebsd.org Fri Sep 11 20:45:42 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BD76A01A46; Fri, 11 Sep 2015 20:45:42 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D0EF10E3; Fri, 11 Sep 2015 20:45:42 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BKjglF037245; Fri, 11 Sep 2015 20:45:42 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BKjg5u037244; Fri, 11 Sep 2015 20:45:42 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112045.t8BKjg5u037244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 20:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287685 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 20:45:42 -0000 Author: dteske Date: Fri Sep 11 20:45:41 2015 New Revision: 287685 URL: https://svnweb.freebsd.org/changeset/base/287685 Log: Remove use of return outside of function MFC after: 3 days X-MFC-to: stable/10 Modified: head/usr.sbin/bsdinstall/scripts/docsinstall Modified: head/usr.sbin/bsdinstall/scripts/docsinstall ============================================================================== --- head/usr.sbin/bsdinstall/scripts/docsinstall Fri Sep 11 20:43:14 2015 (r287684) +++ head/usr.sbin/bsdinstall/scripts/docsinstall Fri Sep 11 20:45:41 2015 (r287685) @@ -159,7 +159,7 @@ for lang in $selected; do docsets="$docsets $lang-freebsd-doc" done -ASSUME_ALWAYS_YES=YES chroot $BSDINSTALL_CHROOT pkg install $docsets || return $FAILURE +ASSUME_ALWAYS_YES=YES chroot $BSDINSTALL_CHROOT pkg install $docsets ################################################################################ # END From owner-svn-src-head@freebsd.org Fri Sep 11 20:56:37 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F0FBA01ED2; Fri, 11 Sep 2015 20:56:37 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3AAB18DC; Fri, 11 Sep 2015 20:56:36 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BKuaYT041352; Fri, 11 Sep 2015 20:56:36 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BKuaqq041351; Fri, 11 Sep 2015 20:56:36 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112056.t8BKuaqq041351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 20:56:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287686 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 20:56:37 -0000 Author: dteske Date: Fri Sep 11 20:56:36 2015 New Revision: 287686 URL: https://svnweb.freebsd.org/changeset/base/287686 Log: Produce meaningful exit code MFC after: 3 days X-MFC-to: stable/10 Modified: head/usr.sbin/bsdinstall/scripts/hostname Modified: head/usr.sbin/bsdinstall/scripts/hostname ============================================================================== --- head/usr.sbin/bsdinstall/scripts/hostname Fri Sep 11 20:45:41 2015 (r287685) +++ head/usr.sbin/bsdinstall/scripts/hostname Fri Sep 11 20:56:36 2015 (r287686) @@ -43,6 +43,9 @@ if [ $? -eq $DIALOG_CANCEL ]; then exit exec 3>&- echo "hostname=\"$HOSTNAME\"" > $BSDINSTALL_TMPETC/rc.conf.hostname -if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then +retval=$? +if [ "$BSDINSTALL_CONFIGCURRENT" ]; then hostname -s "$HOSTNAME" + retval=$? fi +exit $retval From owner-svn-src-head@freebsd.org Fri Sep 11 20:58:02 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 366E1A01F8C; Fri, 11 Sep 2015 20:58:02 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 278B71A44; Fri, 11 Sep 2015 20:58:02 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BKw2ZJ041461; Fri, 11 Sep 2015 20:58:02 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BKw1LI041456; Fri, 11 Sep 2015 20:58:01 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112058.t8BKw1LI041456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 20:58:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287687 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 20:58:02 -0000 Author: dteske Date: Fri Sep 11 20:58:00 2015 New Revision: 287687 URL: https://svnweb.freebsd.org/changeset/base/287687 Log: Update copyrights MFC after: 3 days X-MFC-to: stable/10 Modified: head/usr.sbin/bsdinstall/scripts/config head/usr.sbin/bsdinstall/scripts/docsinstall head/usr.sbin/bsdinstall/scripts/hostname Modified: head/usr.sbin/bsdinstall/scripts/config ============================================================================== --- head/usr.sbin/bsdinstall/scripts/config Fri Sep 11 20:56:36 2015 (r287686) +++ head/usr.sbin/bsdinstall/scripts/config Fri Sep 11 20:58:00 2015 (r287687) @@ -1,7 +1,7 @@ #!/bin/sh #- # Copyright (c) 2011 Nathan Whitehorn -# Copyright (c) 2013 Devin Teske +# Copyright (c) 2013-2015 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without Modified: head/usr.sbin/bsdinstall/scripts/docsinstall ============================================================================== --- head/usr.sbin/bsdinstall/scripts/docsinstall Fri Sep 11 20:56:36 2015 (r287686) +++ head/usr.sbin/bsdinstall/scripts/docsinstall Fri Sep 11 20:58:00 2015 (r287687) @@ -1,7 +1,7 @@ #!/bin/sh #- # Copyright (c) 2011 Marc Fonvieille -# Copyright (c) 2013 Devin Teske +# Copyright (c) 2013-2015 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without Modified: head/usr.sbin/bsdinstall/scripts/hostname ============================================================================== --- head/usr.sbin/bsdinstall/scripts/hostname Fri Sep 11 20:56:36 2015 (r287686) +++ head/usr.sbin/bsdinstall/scripts/hostname Fri Sep 11 20:58:00 2015 (r287687) @@ -1,6 +1,7 @@ #!/bin/sh #- # Copyright (c) 2011 Nathan Whitehorn +# Copyright (c) 2015 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without From owner-svn-src-head@freebsd.org Fri Sep 11 20:59:14 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1DBBA0202F; Fri, 11 Sep 2015 20:59:14 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A33D11BEF; Fri, 11 Sep 2015 20:59:14 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BKxEu4041555; Fri, 11 Sep 2015 20:59:14 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BKxEWq041554; Fri, 11 Sep 2015 20:59:14 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112059.t8BKxEWq041554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 20:59:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287688 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 20:59:14 -0000 Author: dteske Date: Fri Sep 11 20:59:13 2015 New Revision: 287688 URL: https://svnweb.freebsd.org/changeset/base/287688 Log: Explicitly exit with success MFC after: 3 days X-MFC-to: stable/10 Modified: head/usr.sbin/bsdinstall/scripts/jail Modified: head/usr.sbin/bsdinstall/scripts/jail ============================================================================== --- head/usr.sbin/bsdinstall/scripts/jail Fri Sep 11 20:58:00 2015 (r287687) +++ head/usr.sbin/bsdinstall/scripts/jail Fri Sep 11 20:59:13 2015 (r287688) @@ -1,7 +1,7 @@ #!/bin/sh #- # Copyright (c) 2011 Nathan Whitehorn -# Copyright (c) 2013 Devin Teske +# Copyright (c) 2013-2015 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -125,6 +125,7 @@ cp /etc/localtime $1/etc bsdinstall entropy f_dprintf "Installation Completed at %s" "$(date)" +exit $SUCCESS ################################################################################ # END From owner-svn-src-head@freebsd.org Fri Sep 11 21:01:26 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8E5DA02104; Fri, 11 Sep 2015 21:01:26 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA31C1EE5; Fri, 11 Sep 2015 21:01:26 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BL1QxN044813; Fri, 11 Sep 2015 21:01:26 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BL1Q5F044812; Fri, 11 Sep 2015 21:01:26 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112101.t8BL1Q5F044812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 21:01:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287689 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 21:01:27 -0000 Author: dteske Date: Fri Sep 11 21:01:26 2015 New Revision: 287689 URL: https://svnweb.freebsd.org/changeset/base/287689 Log: Explicitly exit with success MFC after: 3 days X-MFC-to: stable/10 Modified: head/usr.sbin/bsdinstall/scripts/keymap Modified: head/usr.sbin/bsdinstall/scripts/keymap ============================================================================== --- head/usr.sbin/bsdinstall/scripts/keymap Fri Sep 11 20:59:13 2015 (r287688) +++ head/usr.sbin/bsdinstall/scripts/keymap Fri Sep 11 21:01:26 2015 (r287689) @@ -1,7 +1,7 @@ #!/bin/sh #- # Copyright (c) 2011 Nathan Whitehorn -# Copyright (c) 2013 Devin Teske +# Copyright (c) 2013-2015 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -231,6 +231,7 @@ while :; do done f_quietly f_keymap_kbdcontrol "$keymap" +exit $SUCCESS ################################################################################ # END From owner-svn-src-head@freebsd.org Fri Sep 11 21:02:08 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F80CA02229; Fri, 11 Sep 2015 21:02:08 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x229.google.com (mail-ig0-x229.google.com [IPv6:2607:f8b0:4001:c05::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 097501FB7; Fri, 11 Sep 2015 21:02:08 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by igbkq10 with SMTP id kq10so50922111igb.0; Fri, 11 Sep 2015 14:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=+ojmE/u/GBKupzjdwOCoAe0+/JASJOQrHP3s4F4jkk4=; b=pdAXsCmiovkyon7s4kr6t9leYgue8dM8NB28yl3882gUpeplC7cts4hVrw0W0gCTwV DyHy4CF8aY9MC+zPQtYjE1cLRosF/DOqZypdpUfhnbqBFeDF67OQLjdRsepTkZYwWLo2 3nyPbhQ2PsafEamRYrY7GkYURKc1Bz7TsQB6yH3AcCSRHEmdpyc/lCUHv+8k6ahLD51M F+aaiejnP6WhbaAxEysiuq0yFsvalL6QjDvDBSxh/My9msECf4gAfE3QUgj6GMFPO9hY kkPCU26cj7iPNVs6Al57ACAZXGGLAgf3zSwk0TD5N6q8b+GCguv+LFoBO545luorx6E+ +PPQ== MIME-Version: 1.0 X-Received: by 10.50.1.44 with SMTP id 12mr249256igj.61.1442005326755; Fri, 11 Sep 2015 14:02:06 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.28.208 with HTTP; Fri, 11 Sep 2015 14:02:06 -0700 (PDT) In-Reply-To: <55F33D96.8060300@mu.org> References: <201509100405.t8A45xrJ070199@repo.freebsd.org> <55F33D96.8060300@mu.org> Date: Fri, 11 Sep 2015 14:02:06 -0700 X-Google-Sender-Auth: tDGzqp-uZslaIEBsubXjZw9AlAo Message-ID: Subject: Re: svn commit: r287606 - head/sys/kern From: Adrian Chadd To: Alfred Perlstein Cc: Warner Losh , Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 21:02:08 -0000 On 11 September 2015 at 13:46, Alfred Perlstein wrote: > 64k hard is too low a number for large memory machines. Root can always bump it up all the way to kern.maxfilesperproc. I'm also a big fan of having the description of config of service stuff be in /etc/rc.conf, rather than splattered around the place. So I also like the idea of _rlimit_openfiles="xxxx" so it can be clearly overridden for services that require it. I'm open to other suggestions! -adrian > -Alfred > > > On 9/10/15 9:18 AM, Adrian Chadd wrote: >> >> On 10 September 2015 at 09:04, Warner Losh wrote: >>> >>> >>> On Thu, Sep 10, 2015 at 9:53 AM, Ed Maste wrote: >>>> >>>> On 10 September 2015 at 04:05, Adrian Chadd wrote: >>>>> >>>>> Author: adrian >>>>> Date: Thu Sep 10 04:05:58 2015 >>>>> New Revision: 287606 >>>>> URL: https://svnweb.freebsd.org/changeset/base/287606 >>>>> >>>>> Log: >>>>> Also make kern.maxfilesperproc a boot time tunable. >>>>> ... >>>>> TODO: >>>> >>>> Also "we" should >>>> * Submit patches upstream or to the ports tree to use closefrom >>> >>> >>> I thought the consensus was that we'd fix things to have fewer FDs >>> by default, but instead allow individual processes to raise it via the >>> usual methods. >> >> I'm looking at how to do this in a somewhat sensible fashion. Right >> now we just have openfiles=unlimited; in /etc/login.conf which seems a >> little odd. I don't know yet if that affects the default set that >> services started via /etc/rc get - init gets the whole default >> maxfilesperproc and stuff seems to inherit from that unless told >> otherwise. >> >> I think the more sensible default would be: >> >> * set /etc/login.conf to some much lower values - say, 4k soft, 64k hard; >> * root can always override its settings up to kern.maxfilesperproc; >> * modify /etc/rc to set some default rlimits as appropriate; >> * introduce configuration options ({daemon_rlimit_XXX}?) in >> /etc/rc.conf that lets someone override what the default rlimits >> should be for a given process,, as (and I'm not making this up) if you >> run 'service XXX restart' from a root login you get the rlimits from >> the shell, which may differ from the system startup. >> >> That way we can setup various services to have higher openfile limits >> via /etc/rc.conf entries for those services rather than having to hack >> each startup script. It also means that no matter what is running >> 'service XXX YYY' as root, you'll get the 'correct'(er) rlimits. >> >> Thoughts? >> >> >> -adrian >> > From owner-svn-src-head@freebsd.org Fri Sep 11 21:08:48 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7F7BA023CC; Fri, 11 Sep 2015 21:08:47 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC8561295; Fri, 11 Sep 2015 21:08:47 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BL8lJC045668; Fri, 11 Sep 2015 21:08:47 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BL8lAr045666; Fri, 11 Sep 2015 21:08:47 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112108.t8BL8lAr045666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 21:08:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287690 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 21:08:48 -0000 Author: dteske Date: Fri Sep 11 21:08:46 2015 New Revision: 287690 URL: https://svnweb.freebsd.org/changeset/base/287690 Log: Produce meaningful exit code MFC after: 3 days X-MFC-to: stable/10 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Fri Sep 11 21:01:26 2015 (r287689) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Fri Sep 11 21:08:46 2015 (r287690) @@ -1,7 +1,7 @@ #!/bin/sh #- # Copyright (c) 2011 Nathan Whitehorn -# Copyright (c) 2013 Devin Teske +# Copyright (c) 2013-2015 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -80,16 +80,20 @@ echo $INTERFACE $IF_CONFIG | printf("ifconfig_%s=\"%s\inet %s netmask %s\"\n", $1, prefix, $2, $3); printf("defaultrouter=\"%s\"\n", $4); }' >> $BSDINSTALL_TMPETC/._rc.conf.net +retval=$? -if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then +if [ "$BSDINSTALL_CONFIGCURRENT" ]; then . $BSDINSTALL_TMPETC/._rc.conf.net ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE` - if [ -n "${defaultrouter}" ]; then + if [ "$defaultrouter" ]; then route delete -inet default route add -inet default $defaultrouter + retval=$? fi fi +exit $retval + ################################################################################ # END ################################################################################ Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Fri Sep 11 21:01:26 2015 (r287689) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Fri Sep 11 21:08:46 2015 (r287690) @@ -2,7 +2,7 @@ #- # Copyright (c) 2011 Nathan Whitehorn # Copyright (c) 2011 The FreeBSD Foundation -# Copyright (c) 2013 Devin Teske +# Copyright (c) 2013-2015 Devin Teske # All rights reserved. # # Portions of this software were developed by Bjoern Zeeb @@ -141,16 +141,20 @@ BEGIN { } printf("ifconfig_%s_ipv6=\"inet6 %s\"\n", iface, $1); }' >> $BSDINSTALL_TMPETC/._rc.conf.net +retval=$? -if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then +if [ "$BSDINSTALL_CONFIGCURRENT" ]; then . $BSDINSTALL_TMPETC/._rc.conf.net ifconfig ${INTERFACE} `eval echo \\\$ifconfig_${INTERFACE}_ipv6` - if [ -n "${ipv6_defaultrouter}" ]; then + if [ "$ipv6_defaultrouter" ]; then route delete -inet6 default route add -inet6 default ${ipv6_defaultrouter} + retval=$? fi fi +exit $retval + ################################################################################ # END ################################################################################ From owner-svn-src-head@freebsd.org Fri Sep 11 21:09:40 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FE45A02441; Fri, 11 Sep 2015 21:09:40 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1107313DE; Fri, 11 Sep 2015 21:09:40 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BL9d4q045746; Fri, 11 Sep 2015 21:09:39 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BL9duU045745; Fri, 11 Sep 2015 21:09:39 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112109.t8BL9duU045745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 21:09:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287691 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 21:09:40 -0000 Author: dteske Date: Fri Sep 11 21:09:39 2015 New Revision: 287691 URL: https://svnweb.freebsd.org/changeset/base/287691 Log: Remove trailing newline at EOF MFC after: 3 days X-MFC-to: stable/10 Modified: head/usr.sbin/bsdinstall/scripts/rootpass Modified: head/usr.sbin/bsdinstall/scripts/rootpass ============================================================================== --- head/usr.sbin/bsdinstall/scripts/rootpass Fri Sep 11 21:08:46 2015 (r287690) +++ head/usr.sbin/bsdinstall/scripts/rootpass Fri Sep 11 21:09:39 2015 (r287691) @@ -34,4 +34,3 @@ echo echo "Please select a password for the system management account (root):" chroot $BSDINSTALL_CHROOT passwd root 2>&1 - From owner-svn-src-head@freebsd.org Fri Sep 11 21:12:42 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0373A02641; Fri, 11 Sep 2015 21:12:42 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A151118FE; Fri, 11 Sep 2015 21:12:42 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BLCg4L049539; Fri, 11 Sep 2015 21:12:42 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BLCgiM049538; Fri, 11 Sep 2015 21:12:42 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112112.t8BLCgiM049538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 21:12:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287692 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 21:12:42 -0000 Author: dteske Date: Fri Sep 11 21:12:41 2015 New Revision: 287692 URL: https://svnweb.freebsd.org/changeset/base/287692 Log: Better to reset trap and explicitly exit success MFC after: 3 days X-MFC-to: stable/10 Modified: head/usr.sbin/bsdinstall/scripts/script Modified: head/usr.sbin/bsdinstall/scripts/script ============================================================================== --- head/usr.sbin/bsdinstall/scripts/script Fri Sep 11 21:09:39 2015 (r287691) +++ head/usr.sbin/bsdinstall/scripts/script Fri Sep 11 21:12:41 2015 (r287692) @@ -129,7 +129,8 @@ bsdinstall umount f_dprintf "Installation Completed at %s" "$( date )" -trap true EXIT +trap - EXIT +exit $SUCCESS ################################################################################ # END From owner-svn-src-head@freebsd.org Fri Sep 11 21:13:35 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5FFAA026C9; Fri, 11 Sep 2015 21:13:35 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6F4E1A4F; Fri, 11 Sep 2015 21:13:35 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BLDZHQ049619; Fri, 11 Sep 2015 21:13:35 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BLDZg5049618; Fri, 11 Sep 2015 21:13:35 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112113.t8BLDZg5049618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 21:13:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287693 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 21:13:35 -0000 Author: dteske Date: Fri Sep 11 21:13:34 2015 New Revision: 287693 URL: https://svnweb.freebsd.org/changeset/base/287693 Log: Update copyright MFC after: 3 days X-MFC-to: stable/10 Modified: head/usr.sbin/bsdinstall/scripts/script Modified: head/usr.sbin/bsdinstall/scripts/script ============================================================================== --- head/usr.sbin/bsdinstall/scripts/script Fri Sep 11 21:12:41 2015 (r287692) +++ head/usr.sbin/bsdinstall/scripts/script Fri Sep 11 21:13:34 2015 (r287693) @@ -1,7 +1,7 @@ #!/bin/sh #- # Copyright (c) 2013 Nathan Whitehorn -# Copyright (c) 2013 Devin Teske +# Copyright (c) 2013-2015 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without From owner-svn-src-head@freebsd.org Fri Sep 11 21:14:49 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 884F5A0275D; Fri, 11 Sep 2015 21:14:49 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 797C21BD8; Fri, 11 Sep 2015 21:14:49 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BLEn5x049714; Fri, 11 Sep 2015 21:14:49 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BLEnva049713; Fri, 11 Sep 2015 21:14:49 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112114.t8BLEnva049713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 21:14:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287694 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 21:14:49 -0000 Author: dteske Date: Fri Sep 11 21:14:48 2015 New Revision: 287694 URL: https://svnweb.freebsd.org/changeset/base/287694 Log: Use a variable for readability MFC after: 3 days X-MFC-to: stable/10 Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig ============================================================================== --- head/usr.sbin/bsdinstall/scripts/wlanconfig Fri Sep 11 21:13:34 2015 (r287693) +++ head/usr.sbin/bsdinstall/scripts/wlanconfig Fri Sep 11 21:14:48 2015 (r287694) @@ -1,7 +1,7 @@ #!/bin/sh #- # Copyright (c) 2011 Nathan Whitehorn -# Copyright (c) 2013 Devin Teske +# Copyright (c) 2013-2015 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -168,7 +168,7 @@ if [ "$BSDINSTALL_CONFIGCURRENT" ]; then f_dprintf "%s" "$output" fi -exit 0 +exit $SUCCESS ################################################################################ # END From owner-svn-src-head@freebsd.org Fri Sep 11 21:18:22 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2B01A02866; Fri, 11 Sep 2015 21:18:22 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93A7B1D62; Fri, 11 Sep 2015 21:18:22 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BLIM8S049900; Fri, 11 Sep 2015 21:18:22 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BLIMGl049899; Fri, 11 Sep 2015 21:18:22 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112118.t8BLIMGl049899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 21:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287695 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 21:18:22 -0000 Author: dteske Date: Fri Sep 11 21:18:21 2015 New Revision: 287695 URL: https://svnweb.freebsd.org/changeset/base/287695 Log: Replace `return' outside of function with exit MFC after: 3 days X-MFC-to: stable/10 Pointy hat to: me Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Fri Sep 11 21:14:48 2015 (r287694) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Fri Sep 11 21:18:21 2015 (r287695) @@ -1647,7 +1647,7 @@ while :; do esac done -return $SUCCESS +exit $SUCCESS ################################################################################ # END From owner-svn-src-head@freebsd.org Fri Sep 11 21:45:42 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DD6CA01416; Fri, 11 Sep 2015 21:45:42 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E8F319F6; Fri, 11 Sep 2015 21:45:42 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BLjfxT061991; Fri, 11 Sep 2015 21:45:41 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BLjfkJ061990; Fri, 11 Sep 2015 21:45:41 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112145.t8BLjfkJ061990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 21:45:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287696 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 21:45:42 -0000 Author: dteske Date: Fri Sep 11 21:45:41 2015 New Revision: 287696 URL: https://svnweb.freebsd.org/changeset/base/287696 Log: The /mkisoimages.sh script in release knows how to add extra bits from an "xtra-bits-dir". This feature is unusable from release/Makefile. Add an XTRADIR setting to use it. Differential Revision: https://reviews.freebsd.org/D3633 Reviewed by: kmacy MFC after: 3 weeks X-MFC-to: stable/10 Relnotes: yes Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Fri Sep 11 21:18:21 2015 (r287695) +++ head/release/Makefile Fri Sep 11 21:45:41 2015 (r287696) @@ -21,6 +21,7 @@ # (by default, the directory above this one) # PORTSDIR: location of ports tree to distribute (default: /usr/ports) # DOCDIR: location of doc tree (default: /usr/doc) +# XTRADIR: xtra-bits-dir argument for /mkisoimages.sh # NOPKG: if set, do not distribute third-party packages # NOPORTS: if set, do not distribute ports tree # NOSRC: if set, do not distribute source tree @@ -242,13 +243,13 @@ dvd: packagesystem release.iso: disc1.iso disc1.iso: disc1 - sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_CD ${.TARGET} disc1 + sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_CD ${.TARGET} disc1 ${XTRADIR} dvd1.iso: dvd pkg-stage - sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_DVD ${.TARGET} dvd + sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_DVD ${.TARGET} dvd ${XTRADIR} bootonly.iso: bootonly - sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_BO ${.TARGET} bootonly + sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_BO ${.TARGET} bootonly ${XTRADIR} memstick: memstick.img memstick.img: disc1 From owner-svn-src-head@freebsd.org Fri Sep 11 22:42:26 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F00E7A02DA6; Fri, 11 Sep 2015 22:42:26 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E08F5130F; Fri, 11 Sep 2015 22:42:26 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BMgQ5N086632; Fri, 11 Sep 2015 22:42:26 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BMgQ8i086631; Fri, 11 Sep 2015 22:42:26 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201509112242.t8BMgQ8i086631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 11 Sep 2015 22:42:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287697 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 22:42:27 -0000 Author: dteske Date: Fri Sep 11 22:42:26 2015 New Revision: 287697 URL: https://svnweb.freebsd.org/changeset/base/287697 Log: Whitespace alignment MFC after: 3 weeks X-MFC-to: stable/10 X-MFC-with: 287696 Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Fri Sep 11 21:45:41 2015 (r287696) +++ head/release/Makefile Fri Sep 11 22:42:26 2015 (r287697) @@ -21,7 +21,7 @@ # (by default, the directory above this one) # PORTSDIR: location of ports tree to distribute (default: /usr/ports) # DOCDIR: location of doc tree (default: /usr/doc) -# XTRADIR: xtra-bits-dir argument for /mkisoimages.sh +# XTRADIR: xtra-bits-dir argument for /mkisoimages.sh # NOPKG: if set, do not distribute third-party packages # NOPORTS: if set, do not distribute ports tree # NOSRC: if set, do not distribute source tree From owner-svn-src-head@freebsd.org Fri Sep 11 22:43:36 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91B44A02E29; Fri, 11 Sep 2015 22:43:36 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8201914B3; Fri, 11 Sep 2015 22:43:36 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8BMhaTS086729; Fri, 11 Sep 2015 22:43:36 GMT (envelope-from avatar@FreeBSD.org) Received: (from avatar@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8BMha5E086728; Fri, 11 Sep 2015 22:43:36 GMT (envelope-from avatar@FreeBSD.org) Message-Id: <201509112243.t8BMha5E086728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avatar set sender to avatar@FreeBSD.org using -f From: Tai-hwa Liang Date: Fri, 11 Sep 2015 22:43:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287698 - head/sys/gnu/fs/reiserfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 22:43:36 -0000 Author: avatar Date: Fri Sep 11 22:43:35 2015 New Revision: 287698 URL: https://svnweb.freebsd.org/changeset/base/287698 Log: Fixing a memory leak on module unloading. MFC after: 3 weeks Modified: head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Modified: head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c ============================================================================== --- head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Fri Sep 11 22:42:26 2015 (r287697) +++ head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Fri Sep 11 22:43:35 2015 (r287698) @@ -1022,6 +1022,7 @@ uint32_t find_hash_out(struct reiserfs_m } } while (0); + free(ip, M_REISERFSNODE); pathrelse(&path); return (hash); } From owner-svn-src-head@freebsd.org Fri Sep 11 22:51:04 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE152A01195; Fri, 11 Sep 2015 22:51:04 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [IPv6:2001:470:1f05:b76::196]) by mx1.freebsd.org (Postfix) with ESMTP id 96FF3192A; Fri, 11 Sep 2015 22:51:04 +0000 (UTC) (envelope-from bright@mu.org) Received: from [10.2.98.58] (173-228-14-211.dedicated.static.sonic.net [173.228.14.211]) by elvis.mu.org (Postfix) with ESMTPSA id 4C8F8345A8FA; Fri, 11 Sep 2015 15:51:04 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r287606 - head/sys/kern From: Alfred Perlstein X-Mailer: iPhone Mail (12H321) In-Reply-To: Date: Fri, 11 Sep 2015 15:51:03 -0700 Cc: Warner Losh , Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <201509100405.t8A45xrJ070199@repo.freebsd.org> <55F33D96.8060300@mu.org> To: Adrian Chadd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 22:51:04 -0000 The idea is sane defaults. Surely 256k makes sense for a machine with that m= uch memory.=20 Sent from my iPhone > On Sep 11, 2015, at 2:02 PM, Adrian Chadd wrote: >=20 >> On 11 September 2015 at 13:46, Alfred Perlstein wrote: >> 64k hard is too low a number for large memory machines. >=20 > Root can always bump it up all the way to kern.maxfilesperproc. >=20 > I'm also a big fan of having the description of config of service > stuff be in /etc/rc.conf, rather than splattered around the place. So > I also like the idea of _rlimit_openfiles=3D"xxxx" so it can be > clearly overridden for services that require it. >=20 > I'm open to other suggestions! >=20 >=20 >=20 > -adrian >=20 >> -Alfred >>=20 >>=20 >>> On 9/10/15 9:18 AM, Adrian Chadd wrote: >>>=20 >>>> On 10 September 2015 at 09:04, Warner Losh wrote: >>>>=20 >>>>=20 >>>>> On Thu, Sep 10, 2015 at 9:53 AM, Ed Maste wrote: >>>>>=20 >>>>>> On 10 September 2015 at 04:05, Adrian Chadd wrot= e: >>>>>>=20 >>>>>> Author: adrian >>>>>> Date: Thu Sep 10 04:05:58 2015 >>>>>> New Revision: 287606 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/287606 >>>>>>=20 >>>>>> Log: >>>>>> Also make kern.maxfilesperproc a boot time tunable. >>>>>> ... >>>>>> TODO: >>>>>=20 >>>>> Also "we" should >>>>> * Submit patches upstream or to the ports tree to use closefrom >>>>=20 >>>>=20 >>>> I thought the consensus was that we'd fix things to have fewer FDs >>>> by default, but instead allow individual processes to raise it via the >>>> usual methods. >>>=20 >>> I'm looking at how to do this in a somewhat sensible fashion. Right >>> now we just have openfiles=3Dunlimited; in /etc/login.conf which seems a= >>> little odd. I don't know yet if that affects the default set that >>> services started via /etc/rc get - init gets the whole default >>> maxfilesperproc and stuff seems to inherit from that unless told >>> otherwise. >>>=20 >>> I think the more sensible default would be: >>>=20 >>> * set /etc/login.conf to some much lower values - say, 4k soft, 64k har= d; >>> * root can always override its settings up to kern.maxfilesperproc; >>> * modify /etc/rc to set some default rlimits as appropriate; >>> * introduce configuration options ({daemon_rlimit_XXX}?) in >>> /etc/rc.conf that lets someone override what the default rlimits >>> should be for a given process,, as (and I'm not making this up) if you >>> run 'service XXX restart' from a root login you get the rlimits from >>> the shell, which may differ from the system startup. >>>=20 >>> That way we can setup various services to have higher openfile limits >>> via /etc/rc.conf entries for those services rather than having to hack >>> each startup script. It also means that no matter what is running >>> 'service XXX YYY' as root, you'll get the 'correct'(er) rlimits. >>>=20 >>> Thoughts? >>>=20 >>>=20 >>> -adrian >=20 From owner-svn-src-head@freebsd.org Sat Sep 12 08:24:26 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9E62A01585; Sat, 12 Sep 2015 08:24:26 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A8AD1D2C; Sat, 12 Sep 2015 08:24:26 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8C8OQdV032594; Sat, 12 Sep 2015 08:24:26 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8C8OQba032593; Sat, 12 Sep 2015 08:24:26 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509120824.t8C8OQba032593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 12 Sep 2015 08:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287701 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 08:24:26 -0000 Author: bapt Date: Sat Sep 12 08:24:25 2015 New Revision: 287701 URL: https://svnweb.freebsd.org/changeset/base/287701 Log: Regression: fix pw usermod -d Mark the user has having been edited if -d option is passed to usermod and so the request change of home directory actually happen PR: 203052 Reported by: lenzi.sergio@gmail.com MFC after: 2 days Modified: head/usr.sbin/pw/pw_user.c Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Sat Sep 12 02:36:17 2015 (r287700) +++ head/usr.sbin/pw/pw_user.c Sat Sep 12 08:24:25 2015 (r287701) @@ -1694,6 +1694,7 @@ pw_user_mod(int argc, char **argv, char if (homedir && strcmp(pwd->pw_dir, homedir) != 0) { pwd->pw_dir = homedir; + edited = true; if (fstatat(conf.rootfd, pwd->pw_dir, &st, 0) == -1) { if (!createhome) warnx("WARNING: home `%s' does not exist", From owner-svn-src-head@freebsd.org Sat Sep 12 08:35:53 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43942A01B66; Sat, 12 Sep 2015 08:35:53 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 325FF113D; Sat, 12 Sep 2015 08:35:53 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8C8Zrud036738; Sat, 12 Sep 2015 08:35:53 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8C8Zqpw036732; Sat, 12 Sep 2015 08:35:52 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509120835.t8C8Zqpw036732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 12 Sep 2015 08:35:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287702 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 08:35:53 -0000 Author: delphij Date: Sat Sep 12 08:35:51 2015 New Revision: 287702 URL: https://svnweb.freebsd.org/changeset/base/287702 Log: MFV r287624: 5987 zfs prefetch code needs work Rewrite the ZFS prefetch code to detect only forward, sequential streams. The following kstats have been added: kstat.zfs.misc.arcstats.sync_wait_for_async How many sync reads have waited for async read to complete. (less is better) kstat.zfs.misc.arcstats.demand_hit_predictive_prefetch How many demand read didn't have to wait for I/O because of predictive prefetch. (more is better) zfetch kstats have been similified to hits, misses, and max_streams, with max_streams representing times when we were not able to create new stream because we already have the maximum number of sequences for a file. The sysctl variable/loader tunable vfs.zfs.zfetch.block_cap have been replaced by vfs.zfs.zfetch.max_distance, which controls maximum bytes to prefetch per stream. illumos/illumos-gate@cf6106c8a0d6598b045811f9650d66e07eb332af Illumos ZFS issues: 5987 zfs prefetch code needs work https://www.illumos.org/issues/5987 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_zfetch.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Sep 12 08:24:25 2015 (r287701) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Sep 12 08:35:51 2015 (r287702) @@ -213,7 +213,7 @@ static int arc_min_prefetch_lifespan; int arc_lotsfree_percent = 10; static int arc_dead; -extern int zfs_prefetch_disable; +extern boolean_t zfs_prefetch_disable; /* * The arc has filled available memory and has now warmed up. @@ -582,6 +582,8 @@ typedef struct arc_stats { kstat_named_t arcstat_meta_limit; kstat_named_t arcstat_meta_max; kstat_named_t arcstat_meta_min; + kstat_named_t arcstat_sync_wait_for_async; + kstat_named_t arcstat_demand_hit_predictive_prefetch; } arc_stats_t; static arc_stats_t arc_stats = { @@ -680,7 +682,9 @@ static arc_stats_t arc_stats = { { "arc_meta_used", KSTAT_DATA_UINT64 }, { "arc_meta_limit", KSTAT_DATA_UINT64 }, { "arc_meta_max", KSTAT_DATA_UINT64 }, - { "arc_meta_min", KSTAT_DATA_UINT64 } + { "arc_meta_min", KSTAT_DATA_UINT64 }, + { "sync_wait_for_async", KSTAT_DATA_UINT64 }, + { "demand_hit_predictive_prefetch", KSTAT_DATA_UINT64 }, }; #define ARCSTAT(stat) (arc_stats.stat.value.ui64) @@ -4250,6 +4254,36 @@ top: if (HDR_IO_IN_PROGRESS(hdr)) { + if ((hdr->b_flags & ARC_FLAG_PRIO_ASYNC_READ) && + priority == ZIO_PRIORITY_SYNC_READ) { + /* + * This sync read must wait for an + * in-progress async read (e.g. a predictive + * prefetch). Async reads are queued + * separately at the vdev_queue layer, so + * this is a form of priority inversion. + * Ideally, we would "inherit" the demand + * i/o's priority by moving the i/o from + * the async queue to the synchronous queue, + * but there is currently no mechanism to do + * so. Track this so that we can evaluate + * the magnitude of this potential performance + * problem. + * + * Note that if the prefetch i/o is already + * active (has been issued to the device), + * the prefetch improved performance, because + * we issued it sooner than we would have + * without the prefetch. + */ + DTRACE_PROBE1(arc__sync__wait__for__async, + arc_buf_hdr_t *, hdr); + ARCSTAT_BUMP(arcstat_sync_wait_for_async); + } + if (hdr->b_flags & ARC_FLAG_PREDICTIVE_PREFETCH) { + hdr->b_flags &= ~ARC_FLAG_PREDICTIVE_PREFETCH; + } + if (*arc_flags & ARC_FLAG_WAIT) { cv_wait(&hdr->b_l1hdr.b_cv, hash_lock); mutex_exit(hash_lock); @@ -4258,7 +4292,7 @@ top: ASSERT(*arc_flags & ARC_FLAG_NOWAIT); if (done) { - arc_callback_t *acb = NULL; + arc_callback_t *acb = NULL; acb = kmem_zalloc(sizeof (arc_callback_t), KM_SLEEP); @@ -4283,6 +4317,19 @@ top: hdr->b_l1hdr.b_state == arc_mfu); if (done) { + if (hdr->b_flags & ARC_FLAG_PREDICTIVE_PREFETCH) { + /* + * This is a demand read which does not have to + * wait for i/o because we did a predictive + * prefetch i/o for it, which has completed. + */ + DTRACE_PROBE1( + arc__demand__hit__predictive__prefetch, + arc_buf_hdr_t *, hdr); + ARCSTAT_BUMP( + arcstat_demand_hit_predictive_prefetch); + hdr->b_flags &= ~ARC_FLAG_PREDICTIVE_PREFETCH; + } add_reference(hdr, hash_lock, private); /* * If this block is already in use, create a new @@ -4345,12 +4392,16 @@ top: goto top; /* restart the IO request */ } - /* if this is a prefetch, we don't have a reference */ - if (*arc_flags & ARC_FLAG_PREFETCH) { + /* + * If there is a callback, we pass our reference to + * it; otherwise we remove our reference. + */ + if (done == NULL) { (void) remove_reference(hdr, hash_lock, private); - hdr->b_flags |= ARC_FLAG_PREFETCH; } + if (*arc_flags & ARC_FLAG_PREFETCH) + hdr->b_flags |= ARC_FLAG_PREFETCH; if (*arc_flags & ARC_FLAG_L2CACHE) hdr->b_flags |= ARC_FLAG_L2CACHE; if (*arc_flags & ARC_FLAG_L2COMPRESS) @@ -4373,11 +4424,13 @@ top: ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); - /* if this is a prefetch, we don't have a reference */ + /* + * If there is a callback, we pass a reference to it. + */ + if (done != NULL) + add_reference(hdr, hash_lock, private); if (*arc_flags & ARC_FLAG_PREFETCH) hdr->b_flags |= ARC_FLAG_PREFETCH; - else - add_reference(hdr, hash_lock, private); if (*arc_flags & ARC_FLAG_L2CACHE) hdr->b_flags |= ARC_FLAG_L2CACHE; if (*arc_flags & ARC_FLAG_L2COMPRESS) @@ -4395,6 +4448,8 @@ top: arc_access(hdr, hash_lock); } + if (*arc_flags & ARC_FLAG_PREDICTIVE_PREFETCH) + hdr->b_flags |= ARC_FLAG_PREDICTIVE_PREFETCH; ASSERT(!GHOST_STATE(hdr->b_l1hdr.b_state)); acb = kmem_zalloc(sizeof (arc_callback_t), KM_SLEEP); @@ -4437,6 +4492,11 @@ top: curthread->td_ru.ru_inblock++; #endif + if (priority == ZIO_PRIORITY_ASYNC_READ) + hdr->b_flags |= ARC_FLAG_PRIO_ASYNC_READ; + else + hdr->b_flags &= ~ARC_FLAG_PRIO_ASYNC_READ; + if (vd != NULL && l2arc_ndev != 0 && !(l2arc_norw && devw)) { /* * Read from the L2ARC if the following are true: Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Sep 12 08:24:25 2015 (r287701) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Sep 12 08:35:51 2015 (r287702) @@ -618,7 +618,7 @@ dbuf_read_done(zio_t *zio, arc_buf_t *bu } static void -dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t *flags) +dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) { dnode_t *dn; zbookmark_phys_t zb; @@ -664,7 +664,6 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t db->db.db_size, db, type)); bzero(db->db.db_data, db->db.db_size); db->db_state = DB_CACHED; - *flags |= DB_RF_CACHED; mutex_exit(&db->db_mtx); return; } @@ -687,10 +686,8 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t (void) arc_read(zio, db->db_objset->os_spa, db->db_blkptr, dbuf_read_done, db, ZIO_PRIORITY_SYNC_READ, - (*flags & DB_RF_CANFAIL) ? ZIO_FLAG_CANFAIL : ZIO_FLAG_MUSTSUCCEED, + (flags & DB_RF_CANFAIL) ? ZIO_FLAG_CANFAIL : ZIO_FLAG_MUSTSUCCEED, &aflags, &zb); - if (aflags & ARC_FLAG_CACHED) - *flags |= DB_RF_CACHED; } int @@ -723,8 +720,7 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio if (db->db_state == DB_CACHED) { mutex_exit(&db->db_mtx); if (prefetch) - dmu_zfetch(&dn->dn_zfetch, db->db.db_offset, - db->db.db_size, TRUE); + dmu_zfetch(&dn->dn_zfetch, db->db_blkid, 1); if ((flags & DB_RF_HAVESTRUCT) == 0) rw_exit(&dn->dn_struct_rwlock); DB_DNODE_EXIT(db); @@ -733,13 +729,12 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio if (zio == NULL) zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); - dbuf_read_impl(db, zio, &flags); + dbuf_read_impl(db, zio, flags); /* dbuf_read_impl has dropped db_mtx for us */ if (prefetch) - dmu_zfetch(&dn->dn_zfetch, db->db.db_offset, - db->db.db_size, flags & DB_RF_CACHED); + dmu_zfetch(&dn->dn_zfetch, db->db_blkid, 1); if ((flags & DB_RF_HAVESTRUCT) == 0) rw_exit(&dn->dn_struct_rwlock); @@ -758,8 +753,7 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio */ mutex_exit(&db->db_mtx); if (prefetch) - dmu_zfetch(&dn->dn_zfetch, db->db.db_offset, - db->db.db_size, TRUE); + dmu_zfetch(&dn->dn_zfetch, db->db_blkid, 1); if ((flags & DB_RF_HAVESTRUCT) == 0) rw_exit(&dn->dn_struct_rwlock); DB_DNODE_EXIT(db); @@ -2059,6 +2053,9 @@ dbuf_prefetch(dnode_t *dn, int64_t level ASSERT(blkid != DMU_BONUS_BLKID); ASSERT(RW_LOCK_HELD(&dn->dn_struct_rwlock)); + if (blkid > dn->dn_maxblkid) + return; + if (dnode_block_freed(dn, blkid)) return; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Sep 12 08:24:25 2015 (r287701) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Sep 12 08:35:51 2015 (r287702) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. */ /* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Copyright (c) 2013, Joyent, Inc. All rights reserved. */ @@ -389,7 +389,7 @@ dmu_spill_hold_by_bonus(dmu_buf_t *bonus */ static int dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length, - int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp, uint32_t flags) + boolean_t read, void *tag, int *numbufsp, dmu_buf_t ***dbpp, uint32_t flags) { dmu_buf_t **dbp; uint64_t blkid, nblks, i; @@ -399,15 +399,19 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, ASSERT(length <= DMU_MAX_ACCESS); - dbuf_flags = DB_RF_CANFAIL | DB_RF_NEVERWAIT | DB_RF_HAVESTRUCT; - if (flags & DMU_READ_NO_PREFETCH || length > zfetch_array_rd_sz) - dbuf_flags |= DB_RF_NOPREFETCH; + /* + * Note: We directly notify the prefetch code of this read, so that + * we can tell it about the multi-block read. dbuf_read() only knows + * about the one block it is accessing. + */ + dbuf_flags = DB_RF_CANFAIL | DB_RF_NEVERWAIT | DB_RF_HAVESTRUCT | + DB_RF_NOPREFETCH; rw_enter(&dn->dn_struct_rwlock, RW_READER); if (dn->dn_datablkshift) { int blkshift = dn->dn_datablkshift; - nblks = (P2ROUNDUP(offset+length, 1ULL<> blkshift; + nblks = (P2ROUNDUP(offset + length, 1ULL << blkshift) - + P2ALIGN(offset, 1ULL << blkshift)) >> blkshift; } else { if (offset + length > dn->dn_datablksz) { zfs_panic_recover("zfs: accessing past end of object " @@ -426,13 +430,14 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, zio = zio_root(dn->dn_objset->os_spa, NULL, NULL, ZIO_FLAG_CANFAIL); blkid = dbuf_whichblock(dn, 0, offset); for (i = 0; i < nblks; i++) { - dmu_buf_impl_t *db = dbuf_hold(dn, blkid+i, tag); + dmu_buf_impl_t *db = dbuf_hold(dn, blkid + i, tag); if (db == NULL) { rw_exit(&dn->dn_struct_rwlock); dmu_buf_rele_array(dbp, nblks, tag); zio_nowait(zio); return (SET_ERROR(EIO)); } + /* initiate async i/o */ if (read) (void) dbuf_read(db, zio, dbuf_flags); @@ -442,6 +447,11 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, #endif dbp[i] = &db->db; } + + if ((flags & DMU_READ_NO_PREFETCH) == 0 && read && + length < zfetch_array_rd_sz) { + dmu_zfetch(&dn->dn_zfetch, blkid, nblks); + } rw_exit(&dn->dn_struct_rwlock); /* wait for async i/o */ @@ -495,7 +505,8 @@ dmu_buf_hold_array(objset_t *os, uint64_ int dmu_buf_hold_array_by_bonus(dmu_buf_t *db_fake, uint64_t offset, - uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp) + uint64_t length, boolean_t read, void *tag, int *numbufsp, + dmu_buf_t ***dbpp) { dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; dnode_t *dn; @@ -543,9 +554,6 @@ dmu_prefetch(objset_t *os, uint64_t obje uint64_t blkid; int nblks, err; - if (zfs_prefetch_disable) - return; - if (len == 0) { /* they're interested in the bonus buffer */ dn = DMU_META_DNODE(os); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Sat Sep 12 08:24:25 2015 (r287701) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Sat Sep 12 08:35:51 2015 (r287702) @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. */ #include @@ -36,19 +36,20 @@ #include /* - * I'm against tune-ables, but these should probably exist as tweakable globals - * until we can get this working the way we want it to. + * This tunable disables predictive prefetch. Note that it leaves "prescient" + * prefetch (e.g. prefetch for zfs send) intact. Unlike predictive prefetch, + * prescient prefetch never issues i/os that end up not being needed, + * so it can't hurt performance. */ - -int zfs_prefetch_disable = 0; +boolean_t zfs_prefetch_disable = B_FALSE; /* max # of streams per zfetch */ uint32_t zfetch_max_streams = 8; /* min time before stream reclaim */ uint32_t zfetch_min_sec_reap = 2; -/* max number of blocks to fetch at a time */ -uint32_t zfetch_block_cap = 256; -/* number of bytes in a array_read at which we stop prefetching (1Mb) */ +/* max bytes to prefetch per stream (default 8MB) */ +uint32_t zfetch_max_distance = 8 * 1024 * 1024; +/* number of bytes in a array_read at which we stop prefetching (1MB) */ uint64_t zfetch_array_rd_sz = 1024 * 1024; SYSCTL_DECL(_vfs_zfs); @@ -59,198 +60,32 @@ SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, m &zfetch_max_streams, 0, "Max # of streams per zfetch"); SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, min_sec_reap, CTLFLAG_RWTUN, &zfetch_min_sec_reap, 0, "Min time before stream reclaim"); -SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, block_cap, CTLFLAG_RWTUN, - &zfetch_block_cap, 0, "Max number of blocks to fetch at a time"); +SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_distance, CTLFLAG_RWTUN, + &zfetch_max_distance, 0, "Max bytes to prefetch per stream"); SYSCTL_UQUAD(_vfs_zfs_zfetch, OID_AUTO, array_rd_sz, CTLFLAG_RWTUN, &zfetch_array_rd_sz, 0, "Number of bytes in a array_read at which we stop prefetching"); -/* forward decls for static routines */ -static boolean_t dmu_zfetch_colinear(zfetch_t *, zstream_t *); -static void dmu_zfetch_dofetch(zfetch_t *, zstream_t *); -static uint64_t dmu_zfetch_fetch(dnode_t *, uint64_t, uint64_t); -static uint64_t dmu_zfetch_fetchsz(dnode_t *, uint64_t, uint64_t); -static boolean_t dmu_zfetch_find(zfetch_t *, zstream_t *, int); -static int dmu_zfetch_stream_insert(zfetch_t *, zstream_t *); -static zstream_t *dmu_zfetch_stream_reclaim(zfetch_t *); -static void dmu_zfetch_stream_remove(zfetch_t *, zstream_t *); -static int dmu_zfetch_streams_equal(zstream_t *, zstream_t *); - typedef struct zfetch_stats { kstat_named_t zfetchstat_hits; kstat_named_t zfetchstat_misses; - kstat_named_t zfetchstat_colinear_hits; - kstat_named_t zfetchstat_colinear_misses; - kstat_named_t zfetchstat_stride_hits; - kstat_named_t zfetchstat_stride_misses; - kstat_named_t zfetchstat_reclaim_successes; - kstat_named_t zfetchstat_reclaim_failures; - kstat_named_t zfetchstat_stream_resets; - kstat_named_t zfetchstat_stream_noresets; - kstat_named_t zfetchstat_bogus_streams; + kstat_named_t zfetchstat_max_streams; } zfetch_stats_t; static zfetch_stats_t zfetch_stats = { { "hits", KSTAT_DATA_UINT64 }, { "misses", KSTAT_DATA_UINT64 }, - { "colinear_hits", KSTAT_DATA_UINT64 }, - { "colinear_misses", KSTAT_DATA_UINT64 }, - { "stride_hits", KSTAT_DATA_UINT64 }, - { "stride_misses", KSTAT_DATA_UINT64 }, - { "reclaim_successes", KSTAT_DATA_UINT64 }, - { "reclaim_failures", KSTAT_DATA_UINT64 }, - { "streams_resets", KSTAT_DATA_UINT64 }, - { "streams_noresets", KSTAT_DATA_UINT64 }, - { "bogus_streams", KSTAT_DATA_UINT64 }, + { "max_streams", KSTAT_DATA_UINT64 }, }; -#define ZFETCHSTAT_INCR(stat, val) \ - atomic_add_64(&zfetch_stats.stat.value.ui64, (val)); - -#define ZFETCHSTAT_BUMP(stat) ZFETCHSTAT_INCR(stat, 1); +#define ZFETCHSTAT_BUMP(stat) \ + atomic_inc_64(&zfetch_stats.stat.value.ui64); kstat_t *zfetch_ksp; -/* - * Given a zfetch structure and a zstream structure, determine whether the - * blocks to be read are part of a co-linear pair of existing prefetch - * streams. If a set is found, coalesce the streams, removing one, and - * configure the prefetch so it looks for a strided access pattern. - * - * In other words: if we find two sequential access streams that are - * the same length and distance N appart, and this read is N from the - * last stream, then we are probably in a strided access pattern. So - * combine the two sequential streams into a single strided stream. - * - * Returns whether co-linear streams were found. - */ -static boolean_t -dmu_zfetch_colinear(zfetch_t *zf, zstream_t *zh) -{ - zstream_t *z_walk; - zstream_t *z_comp; - - if (! rw_tryenter(&zf->zf_rwlock, RW_WRITER)) - return (0); - - if (zh == NULL) { - rw_exit(&zf->zf_rwlock); - return (0); - } - - for (z_walk = list_head(&zf->zf_stream); z_walk; - z_walk = list_next(&zf->zf_stream, z_walk)) { - for (z_comp = list_next(&zf->zf_stream, z_walk); z_comp; - z_comp = list_next(&zf->zf_stream, z_comp)) { - int64_t diff; - - if (z_walk->zst_len != z_walk->zst_stride || - z_comp->zst_len != z_comp->zst_stride) { - continue; - } - - diff = z_comp->zst_offset - z_walk->zst_offset; - if (z_comp->zst_offset + diff == zh->zst_offset) { - z_walk->zst_offset = zh->zst_offset; - z_walk->zst_direction = diff < 0 ? -1 : 1; - z_walk->zst_stride = - diff * z_walk->zst_direction; - z_walk->zst_ph_offset = - zh->zst_offset + z_walk->zst_stride; - dmu_zfetch_stream_remove(zf, z_comp); - mutex_destroy(&z_comp->zst_lock); - kmem_free(z_comp, sizeof (zstream_t)); - - dmu_zfetch_dofetch(zf, z_walk); - - rw_exit(&zf->zf_rwlock); - return (1); - } - - diff = z_walk->zst_offset - z_comp->zst_offset; - if (z_walk->zst_offset + diff == zh->zst_offset) { - z_walk->zst_offset = zh->zst_offset; - z_walk->zst_direction = diff < 0 ? -1 : 1; - z_walk->zst_stride = - diff * z_walk->zst_direction; - z_walk->zst_ph_offset = - zh->zst_offset + z_walk->zst_stride; - dmu_zfetch_stream_remove(zf, z_comp); - mutex_destroy(&z_comp->zst_lock); - kmem_free(z_comp, sizeof (zstream_t)); - - dmu_zfetch_dofetch(zf, z_walk); - - rw_exit(&zf->zf_rwlock); - return (1); - } - } - } - - rw_exit(&zf->zf_rwlock); - return (0); -} - -/* - * Given a zstream_t, determine the bounds of the prefetch. Then call the - * routine that actually prefetches the individual blocks. - */ -static void -dmu_zfetch_dofetch(zfetch_t *zf, zstream_t *zs) -{ - uint64_t prefetch_tail; - uint64_t prefetch_limit; - uint64_t prefetch_ofst; - uint64_t prefetch_len; - uint64_t blocks_fetched; - - zs->zst_stride = MAX((int64_t)zs->zst_stride, zs->zst_len); - zs->zst_cap = MIN(zfetch_block_cap, 2 * zs->zst_cap); - - prefetch_tail = MAX((int64_t)zs->zst_ph_offset, - (int64_t)(zs->zst_offset + zs->zst_stride)); - /* - * XXX: use a faster division method? - */ - prefetch_limit = zs->zst_offset + zs->zst_len + - (zs->zst_cap * zs->zst_stride) / zs->zst_len; - - while (prefetch_tail < prefetch_limit) { - prefetch_ofst = zs->zst_offset + zs->zst_direction * - (prefetch_tail - zs->zst_offset); - - prefetch_len = zs->zst_len; - - /* - * Don't prefetch beyond the end of the file, if working - * backwards. - */ - if ((zs->zst_direction == ZFETCH_BACKWARD) && - (prefetch_ofst > prefetch_tail)) { - prefetch_len += prefetch_ofst; - prefetch_ofst = 0; - } - - /* don't prefetch more than we're supposed to */ - if (prefetch_len > zs->zst_len) - break; - - blocks_fetched = dmu_zfetch_fetch(zf->zf_dnode, - prefetch_ofst, zs->zst_len); - - prefetch_tail += zs->zst_stride; - /* stop if we've run out of stuff to prefetch */ - if (blocks_fetched < zs->zst_len) - break; - } - zs->zst_ph_offset = prefetch_tail; - zs->zst_last = ddi_get_lbolt(); -} - void zfetch_init(void) { - zfetch_ksp = kstat_create("zfs", 0, "zfetchstats", "misc", KSTAT_TYPE_NAMED, sizeof (zfetch_stats) / sizeof (kstat_named_t), KSTAT_FLAG_VIRTUAL); @@ -278,285 +113,41 @@ zfetch_fini(void) void dmu_zfetch_init(zfetch_t *zf, dnode_t *dno) { - if (zf == NULL) { + if (zf == NULL) return; - } zf->zf_dnode = dno; - zf->zf_stream_cnt = 0; - zf->zf_alloc_fail = 0; list_create(&zf->zf_stream, sizeof (zstream_t), - offsetof(zstream_t, zst_node)); + offsetof(zstream_t, zs_node)); rw_init(&zf->zf_rwlock, NULL, RW_DEFAULT, NULL); } -/* - * This function computes the actual size, in blocks, that can be prefetched, - * and fetches it. - */ -static uint64_t -dmu_zfetch_fetch(dnode_t *dn, uint64_t blkid, uint64_t nblks) -{ - uint64_t fetchsz; - uint64_t i; - - fetchsz = dmu_zfetch_fetchsz(dn, blkid, nblks); - - for (i = 0; i < fetchsz; i++) { - dbuf_prefetch(dn, 0, blkid + i, ZIO_PRIORITY_ASYNC_READ, - ARC_FLAG_PREFETCH); - } - - return (fetchsz); -} - -/* - * this function returns the number of blocks that would be prefetched, based - * upon the supplied dnode, blockid, and nblks. This is used so that we can - * update streams in place, and then prefetch with their old value after the - * fact. This way, we can delay the prefetch, but subsequent accesses to the - * stream won't result in the same data being prefetched multiple times. - */ -static uint64_t -dmu_zfetch_fetchsz(dnode_t *dn, uint64_t blkid, uint64_t nblks) -{ - uint64_t fetchsz; - - if (blkid > dn->dn_maxblkid) { - return (0); - } - - /* compute fetch size */ - if (blkid + nblks + 1 > dn->dn_maxblkid) { - fetchsz = (dn->dn_maxblkid - blkid) + 1; - ASSERT(blkid + fetchsz - 1 <= dn->dn_maxblkid); - } else { - fetchsz = nblks; - } - - - return (fetchsz); -} - -/* - * given a zfetch and a zstream structure, see if there is an associated zstream - * for this block read. If so, it starts a prefetch for the stream it - * located and returns true, otherwise it returns false - */ -static boolean_t -dmu_zfetch_find(zfetch_t *zf, zstream_t *zh, int prefetched) +static void +dmu_zfetch_stream_remove(zfetch_t *zf, zstream_t *zs) { - zstream_t *zs; - int64_t diff; - int reset = !prefetched; - int rc = 0; - - if (zh == NULL) - return (0); - - /* - * XXX: This locking strategy is a bit coarse; however, it's impact has - * yet to be tested. If this turns out to be an issue, it can be - * modified in a number of different ways. - */ - - rw_enter(&zf->zf_rwlock, RW_READER); -top: - - for (zs = list_head(&zf->zf_stream); zs; - zs = list_next(&zf->zf_stream, zs)) { - - /* - * XXX - should this be an assert? - */ - if (zs->zst_len == 0) { - /* bogus stream */ - ZFETCHSTAT_BUMP(zfetchstat_bogus_streams); - continue; - } - - /* - * We hit this case when we are in a strided prefetch stream: - * we will read "len" blocks before "striding". - */ - if (zh->zst_offset >= zs->zst_offset && - zh->zst_offset < zs->zst_offset + zs->zst_len) { - if (prefetched) { - /* already fetched */ - ZFETCHSTAT_BUMP(zfetchstat_stride_hits); - rc = 1; - goto out; - } else { - ZFETCHSTAT_BUMP(zfetchstat_stride_misses); - } - } - - /* - * This is the forward sequential read case: we increment - * len by one each time we hit here, so we will enter this - * case on every read. - */ - if (zh->zst_offset == zs->zst_offset + zs->zst_len) { - - reset = !prefetched && zs->zst_len > 1; - - if (mutex_tryenter(&zs->zst_lock) == 0) { - rc = 1; - goto out; - } - - if (zh->zst_offset != zs->zst_offset + zs->zst_len) { - mutex_exit(&zs->zst_lock); - goto top; - } - zs->zst_len += zh->zst_len; - diff = zs->zst_len - zfetch_block_cap; - if (diff > 0) { - zs->zst_offset += diff; - zs->zst_len = zs->zst_len > diff ? - zs->zst_len - diff : 0; - } - zs->zst_direction = ZFETCH_FORWARD; - - break; - - /* - * Same as above, but reading backwards through the file. - */ - } else if (zh->zst_offset == zs->zst_offset - zh->zst_len) { - /* backwards sequential access */ - - reset = !prefetched && zs->zst_len > 1; - - if (mutex_tryenter(&zs->zst_lock) == 0) { - rc = 1; - goto out; - } - - if (zh->zst_offset != zs->zst_offset - zh->zst_len) { - mutex_exit(&zs->zst_lock); - goto top; - } - - zs->zst_offset = zs->zst_offset > zh->zst_len ? - zs->zst_offset - zh->zst_len : 0; - zs->zst_ph_offset = zs->zst_ph_offset > zh->zst_len ? - zs->zst_ph_offset - zh->zst_len : 0; - zs->zst_len += zh->zst_len; - - diff = zs->zst_len - zfetch_block_cap; - if (diff > 0) { - zs->zst_ph_offset = zs->zst_ph_offset > diff ? - zs->zst_ph_offset - diff : 0; - zs->zst_len = zs->zst_len > diff ? - zs->zst_len - diff : zs->zst_len; - } - zs->zst_direction = ZFETCH_BACKWARD; - - break; - - } else if ((zh->zst_offset - zs->zst_offset - zs->zst_stride < - zs->zst_len) && (zs->zst_len != zs->zst_stride)) { - /* strided forward access */ - - if (mutex_tryenter(&zs->zst_lock) == 0) { - rc = 1; - goto out; - } - - if ((zh->zst_offset - zs->zst_offset - zs->zst_stride >= - zs->zst_len) || (zs->zst_len == zs->zst_stride)) { - mutex_exit(&zs->zst_lock); - goto top; - } - - zs->zst_offset += zs->zst_stride; - zs->zst_direction = ZFETCH_FORWARD; - - break; - - } else if ((zh->zst_offset - zs->zst_offset + zs->zst_stride < - zs->zst_len) && (zs->zst_len != zs->zst_stride)) { - /* strided reverse access */ - - if (mutex_tryenter(&zs->zst_lock) == 0) { - rc = 1; - goto out; - } - - if ((zh->zst_offset - zs->zst_offset + zs->zst_stride >= - zs->zst_len) || (zs->zst_len == zs->zst_stride)) { - mutex_exit(&zs->zst_lock); - goto top; - } - - zs->zst_offset = zs->zst_offset > zs->zst_stride ? - zs->zst_offset - zs->zst_stride : 0; - zs->zst_ph_offset = (zs->zst_ph_offset > - (2 * zs->zst_stride)) ? - (zs->zst_ph_offset - (2 * zs->zst_stride)) : 0; - zs->zst_direction = ZFETCH_BACKWARD; - - break; - } - } - - if (zs) { - if (reset) { - zstream_t *remove = zs; - - ZFETCHSTAT_BUMP(zfetchstat_stream_resets); - rc = 0; - mutex_exit(&zs->zst_lock); - rw_exit(&zf->zf_rwlock); - rw_enter(&zf->zf_rwlock, RW_WRITER); - /* - * Relocate the stream, in case someone removes - * it while we were acquiring the WRITER lock. - */ - for (zs = list_head(&zf->zf_stream); zs; - zs = list_next(&zf->zf_stream, zs)) { - if (zs == remove) { - dmu_zfetch_stream_remove(zf, zs); - mutex_destroy(&zs->zst_lock); - kmem_free(zs, sizeof (zstream_t)); - break; - } - } - } else { - ZFETCHSTAT_BUMP(zfetchstat_stream_noresets); - rc = 1; - dmu_zfetch_dofetch(zf, zs); - mutex_exit(&zs->zst_lock); - } - } -out: - rw_exit(&zf->zf_rwlock); - return (rc); + ASSERT(RW_WRITE_HELD(&zf->zf_rwlock)); + list_remove(&zf->zf_stream, zs); + mutex_destroy(&zs->zs_lock); + kmem_free(zs, sizeof (*zs)); } /* - * Clean-up state associated with a zfetch structure. This frees allocated - * structure members, empties the zf_stream tree, and generally makes things - * nice. This doesn't free the zfetch_t itself, that's left to the caller. + * Clean-up state associated with a zfetch structure (e.g. destroy the + * streams). This doesn't free the zfetch_t itself, that's left to the caller. */ void -dmu_zfetch_rele(zfetch_t *zf) +dmu_zfetch_fini(zfetch_t *zf) { - zstream_t *zs; - zstream_t *zs_next; + zstream_t *zs; ASSERT(!RW_LOCK_HELD(&zf->zf_rwlock)); - for (zs = list_head(&zf->zf_stream); zs; zs = zs_next) { - zs_next = list_next(&zf->zf_stream, zs); - - list_remove(&zf->zf_stream, zs); - mutex_destroy(&zs->zst_lock); - kmem_free(zs, sizeof (zstream_t)); - } + rw_enter(&zf->zf_rwlock, RW_WRITER); + while ((zs = list_head(&zf->zf_stream)) != NULL) + dmu_zfetch_stream_remove(zf, zs); + rw_exit(&zf->zf_rwlock); list_destroy(&zf->zf_stream); rw_destroy(&zf->zf_rwlock); @@ -564,103 +155,55 @@ dmu_zfetch_rele(zfetch_t *zf) } /* - * Given a zfetch and zstream structure, insert the zstream structure into the - * AVL tree contained within the zfetch structure. Peform the appropriate - * book-keeping. It is possible that another thread has inserted a stream which - * matches one that we are about to insert, so we must be sure to check for this - * case. If one is found, return failure, and let the caller cleanup the - * duplicates. + * If there aren't too many streams already, create a new stream. + * The "blkid" argument is the next block that we expect this stream to access. + * While we're here, clean up old streams (which haven't been + * accessed for at least zfetch_min_sec_reap seconds). */ -static int -dmu_zfetch_stream_insert(zfetch_t *zf, zstream_t *zs) +static void +dmu_zfetch_stream_create(zfetch_t *zf, uint64_t blkid) { - zstream_t *zs_walk; - zstream_t *zs_next; + zstream_t *zs_next; + int numstreams = 0; ASSERT(RW_WRITE_HELD(&zf->zf_rwlock)); - for (zs_walk = list_head(&zf->zf_stream); zs_walk; zs_walk = zs_next) { - zs_next = list_next(&zf->zf_stream, zs_walk); - - if (dmu_zfetch_streams_equal(zs_walk, zs)) { - return (0); - } - } - - list_insert_head(&zf->zf_stream, zs); - zf->zf_stream_cnt++; - return (1); -} - - -/* - * Walk the list of zstreams in the given zfetch, find an old one (by time), and - * reclaim it for use by the caller. - */ -static zstream_t * -dmu_zfetch_stream_reclaim(zfetch_t *zf) -{ - zstream_t *zs; - clock_t ticks; - - ticks = zfetch_min_sec_reap * hz; - if (! rw_tryenter(&zf->zf_rwlock, RW_WRITER)) - return (0); - - for (zs = list_head(&zf->zf_stream); zs; - zs = list_next(&zf->zf_stream, zs)) { - - if (ddi_get_lbolt() - zs->zst_last > ticks) - break; + /* + * Clean up old streams. + */ + for (zstream_t *zs = list_head(&zf->zf_stream); + zs != NULL; zs = zs_next) { + zs_next = list_next(&zf->zf_stream, zs); + if (((gethrtime() - zs->zs_atime) / NANOSEC) > + zfetch_min_sec_reap) + dmu_zfetch_stream_remove(zf, zs); + else + numstreams++; } - if (zs) { - dmu_zfetch_stream_remove(zf, zs); - mutex_destroy(&zs->zst_lock); - bzero(zs, sizeof (zstream_t)); - } else { - zf->zf_alloc_fail++; + /* + * The maximum number of streams is normally zfetch_max_streams, + * but for small files we lower it such that it's at least possible + * for all the streams to be non-overlapping. + * + * If we are already at the maximum number of streams for this file, + * even after removing old streams, then don't create this stream. + */ + uint32_t max_streams = MAX(1, MIN(zfetch_max_streams, + zf->zf_dnode->dn_maxblkid * zf->zf_dnode->dn_datablksz / + zfetch_max_distance)); + if (numstreams >= max_streams) { + ZFETCHSTAT_BUMP(zfetchstat_max_streams); + return; } - rw_exit(&zf->zf_rwlock); - - return (zs); -} - -/* - * Given a zfetch and zstream structure, remove the zstream structure from its - * container in the zfetch structure. Perform the appropriate book-keeping. - */ -static void -dmu_zfetch_stream_remove(zfetch_t *zf, zstream_t *zs) -{ - ASSERT(RW_WRITE_HELD(&zf->zf_rwlock)); - - list_remove(&zf->zf_stream, zs); - zf->zf_stream_cnt--; -} - -static int -dmu_zfetch_streams_equal(zstream_t *zs1, zstream_t *zs2) -{ - if (zs1->zst_offset != zs2->zst_offset) - return (0); - - if (zs1->zst_len != zs2->zst_len) - return (0); - if (zs1->zst_stride != zs2->zst_stride) - return (0); + zstream_t *zs = kmem_zalloc(sizeof (*zs), KM_SLEEP); + zs->zs_blkid = blkid; + zs->zs_pf_blkid = blkid; + zs->zs_atime = gethrtime(); + mutex_init(&zs->zs_lock, NULL, MUTEX_DEFAULT, NULL); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Sep 12 08:50:44 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BF6DA02180; Sat, 12 Sep 2015 08:50:44 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D23161972; Sat, 12 Sep 2015 08:50:43 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8C8ohrc041813; Sat, 12 Sep 2015 08:50:43 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8C8ohb0041812; Sat, 12 Sep 2015 08:50:43 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509120850.t8C8ohb0041812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 12 Sep 2015 08:50:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287703 - head/sys/cddl/contrib/opensolaris/common/avl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 08:50:44 -0000 Author: delphij Date: Sat Sep 12 08:50:43 2015 New Revision: 287703 URL: https://svnweb.freebsd.org/changeset/base/287703 Log: MFV r287684: 6091 avl_add doesn't assert on non-debug builds Use assfail() from libuutil instead of ASSERT() in userland AVL avl_add. illumos/illumos-gate@faa2b6be2fc102adf9ed584fc1a667b4ddf50d78 Illumos issues: 6091 avl_add doesn't assert on non-debug builds https://www.illumos.org/issues/6091 Modified: head/sys/cddl/contrib/opensolaris/common/avl/avl.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/common/avl/avl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/avl/avl.c Sat Sep 12 08:35:51 2015 (r287702) +++ head/sys/cddl/contrib/opensolaris/common/avl/avl.c Sat Sep 12 08:50:43 2015 (r287703) @@ -25,6 +25,7 @@ /* * Copyright (c) 2014 by Delphix. All rights reserved. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ /* @@ -635,14 +636,17 @@ avl_add(avl_tree_t *tree, void *new_node /* * This is unfortunate. We want to call panic() here, even for * non-DEBUG kernels. In userland, however, we can't depend on anything - * in libc or else the rtld build process gets confused. So, all we can - * do in userland is resort to a normal ASSERT(). + * in libc or else the rtld build process gets confused. + * Thankfully, rtld provides us with its own assfail() so we can use + * that here. We use assfail() directly to get a nice error message + * in the core - much like what panic() does for crashdumps. */ if (avl_find(tree, new_node, &where) != NULL) #ifdef _KERNEL panic("avl_find() succeeded inside avl_add()"); #else - ASSERT(0); + (void) assfail("avl_find() succeeded inside avl_add()", + __FILE__, __LINE__); #endif avl_insert(tree, new_node, where); } From owner-svn-src-head@freebsd.org Sat Sep 12 08:54:25 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1AC1A0234C; Sat, 12 Sep 2015 08:54:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B1DF41CB9; Sat, 12 Sep 2015 08:54:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8C8sPIW044933; Sat, 12 Sep 2015 08:54:25 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8C8sPGY044932; Sat, 12 Sep 2015 08:54:25 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201509120854.t8C8sPGY044932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 12 Sep 2015 08:54:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287704 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 08:54:25 -0000 Author: trasz Date: Sat Sep 12 08:54:24 2015 New Revision: 287704 URL: https://svnweb.freebsd.org/changeset/base/287704 Log: Point potential geom_fox(4) users to gmultipath(8). MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/share/man/man4/geom_fox.4 Modified: head/share/man/man4/geom_fox.4 ============================================================================== --- head/share/man/man4/geom_fox.4 Sat Sep 12 08:50:43 2015 (r287703) +++ head/share/man/man4/geom_fox.4 Sat Sep 12 08:54:24 2015 (r287704) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 2, 2005 +.Dd September 12, 2015 .Dt GEOM_FOX 4 .Os .Sh NAME @@ -46,6 +46,13 @@ module at boot time, place the following geom_fox_load="YES" .Ed .Sh DESCRIPTION +.Bf -symbolic +This driver is obsolete. +Users are advised to use +.Xr gmultipath 8 +instead. +.Ef +.Pp The intent of the .Nm framework is to provide basic multipathing support to access direct From owner-svn-src-head@freebsd.org Sat Sep 12 09:28:03 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBAA3A02347; Sat, 12 Sep 2015 09:28:03 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBAC81B4B; Sat, 12 Sep 2015 09:28:03 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8C9S3I9057433; Sat, 12 Sep 2015 09:28:03 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8C9S3x4057432; Sat, 12 Sep 2015 09:28:03 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509120928.t8C9S3x4057432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 12 Sep 2015 09:28:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287705 - head/cddl/contrib/opensolaris/cmd/sgs/tools/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 09:28:03 -0000 Author: delphij Date: Sat Sep 12 09:28:02 2015 New Revision: 287705 URL: https://svnweb.freebsd.org/changeset/base/287705 Log: Fix build (r287703). Lesson learned: no matter how a change looks like an innocent one, always do a build test first. Pointy hat to: delphij Modified: head/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c Modified: head/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c Sat Sep 12 08:54:24 2015 (r287704) +++ head/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c Sat Sep 12 09:28:02 2015 (r287705) @@ -132,6 +132,8 @@ typedef struct msg_string { static msg_string *msg_head; static msg_string *msg_tail; +int aok; + /* * message_append() is responsible for both inserting strings into * the master Str_tbl as well as maintaining a list of the From owner-svn-src-head@freebsd.org Sat Sep 12 09:56:24 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96B38A02EFF; Sat, 12 Sep 2015 09:56:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 865D81993; Sat, 12 Sep 2015 09:56:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8C9uOkV069706; Sat, 12 Sep 2015 09:56:24 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8C9uOhZ069704; Sat, 12 Sep 2015 09:56:24 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509120956.t8C9uOhZ069704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 12 Sep 2015 09:56:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287706 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 09:56:24 -0000 Author: delphij Date: Sat Sep 12 09:56:23 2015 New Revision: 287706 URL: https://svnweb.freebsd.org/changeset/base/287706 Log: MFV r287699: 6214 zpools going south In r286570 (MFV of r277426) an unprotected write to b_flags to set the compression mode was introduced. This would open a race window where data is partially decompressed, modified, checksummed and written to the pool, resulting in pool corruption due to the partial decompression. Prevent this by reintroducing b_compress illumos/illumos-gate@d4cd038c92c36fd0ae35945831a8fc2975b5272c Illumos issues: 6214 zpools going south https://www.illumos.org/issues/6214 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Sep 12 09:28:02 2015 (r287705) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Sep 12 09:56:23 2015 (r287706) @@ -848,6 +848,7 @@ typedef struct l2arc_buf_hdr { uint64_t b_daddr; /* disk address, offset byte */ /* real alloc'd buffer size depending on b_compress applied */ int32_t b_asize; + uint8_t b_compress; list_node_t b_l2node; } l2arc_buf_hdr_t; @@ -927,15 +928,6 @@ static arc_buf_hdr_t arc_eviction_hdr; #define HDR_HAS_L1HDR(hdr) ((hdr)->b_flags & ARC_FLAG_HAS_L1HDR) #define HDR_HAS_L2HDR(hdr) ((hdr)->b_flags & ARC_FLAG_HAS_L2HDR) -/* For storing compression mode in b_flags */ -#define HDR_COMPRESS_OFFSET 24 -#define HDR_COMPRESS_NBITS 7 - -#define HDR_GET_COMPRESS(hdr) ((enum zio_compress)BF32_GET(hdr->b_flags, \ - HDR_COMPRESS_OFFSET, HDR_COMPRESS_NBITS)) -#define HDR_SET_COMPRESS(hdr, cmp) BF32_SET(hdr->b_flags, \ - HDR_COMPRESS_OFFSET, HDR_COMPRESS_NBITS, (cmp)) - /* * Other sizes */ @@ -2226,7 +2218,7 @@ arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr * separately compressed buffer, so there's nothing to free (it * points to the same buffer as the arc_buf_t's b_data field). */ - if (HDR_GET_COMPRESS(hdr) == ZIO_COMPRESS_OFF) { + if (hdr->b_l2hdr.b_compress == ZIO_COMPRESS_OFF) { hdr->b_l1hdr.b_tmp_cdata = NULL; return; } @@ -2235,12 +2227,12 @@ arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr * There's nothing to free since the buffer was all zero's and * compressed to a zero length buffer. */ - if (HDR_GET_COMPRESS(hdr) == ZIO_COMPRESS_EMPTY) { + if (hdr->b_l2hdr.b_compress == ZIO_COMPRESS_EMPTY) { ASSERT3P(hdr->b_l1hdr.b_tmp_cdata, ==, NULL); return; } - ASSERT(L2ARC_IS_VALID_COMPRESS(HDR_GET_COMPRESS(hdr))); + ASSERT(L2ARC_IS_VALID_COMPRESS(hdr->b_l2hdr.b_compress)); arc_buf_free_on_write(hdr->b_l1hdr.b_tmp_cdata, hdr->b_size, zio_data_buf_free); @@ -4464,7 +4456,7 @@ top: (vd = hdr->b_l2hdr.b_dev->l2ad_vdev) != NULL) { devw = hdr->b_l2hdr.b_dev->l2ad_writing; addr = hdr->b_l2hdr.b_daddr; - b_compress = HDR_GET_COMPRESS(hdr); + b_compress = hdr->b_l2hdr.b_compress; b_asize = hdr->b_l2hdr.b_asize; /* * Lock out device removal. @@ -6025,6 +6017,8 @@ l2arc_read_done(zio_t *zio) if (cb->l2rcb_compress != ZIO_COMPRESS_OFF) l2arc_decompress_zio(zio, hdr, cb->l2rcb_compress); ASSERT(zio->io_data != NULL); + ASSERT3U(zio->io_size, ==, hdr->b_size); + ASSERT3U(BP_GET_LSIZE(&cb->l2rcb_bp), ==, hdr->b_size); /* * Check this survived the L2ARC journey. @@ -6061,7 +6055,7 @@ l2arc_read_done(zio_t *zio) ASSERT(!pio || pio->io_child_type == ZIO_CHILD_LOGICAL); zio_nowait(zio_read(pio, cb->l2rcb_spa, &cb->l2rcb_bp, - buf->b_data, zio->io_size, arc_read_done, buf, + buf->b_data, hdr->b_size, arc_read_done, buf, zio->io_priority, cb->l2rcb_flags, &cb->l2rcb_zb)); } } @@ -6378,7 +6372,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de * can't access without holding the ARC list locks * (which we want to avoid during compression/writing). */ - HDR_SET_COMPRESS(hdr, ZIO_COMPRESS_OFF); + hdr->b_l2hdr.b_compress = ZIO_COMPRESS_OFF; hdr->b_l2hdr.b_asize = hdr->b_size; hdr->b_l1hdr.b_tmp_cdata = hdr->b_l1hdr.b_buf->b_data; @@ -6580,7 +6574,7 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr) l2arc_buf_hdr_t *l2hdr = &hdr->b_l2hdr; ASSERT(HDR_HAS_L1HDR(hdr)); - ASSERT(HDR_GET_COMPRESS(hdr) == ZIO_COMPRESS_OFF); + ASSERT3S(l2hdr->b_compress, ==, ZIO_COMPRESS_OFF); ASSERT(hdr->b_l1hdr.b_tmp_cdata != NULL); len = l2hdr->b_asize; @@ -6592,7 +6586,7 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr) if (csize == 0) { /* zero block, indicate that there's nothing to write */ zio_data_buf_free(cdata, len); - HDR_SET_COMPRESS(hdr, ZIO_COMPRESS_EMPTY); + l2hdr->b_compress = ZIO_COMPRESS_EMPTY; l2hdr->b_asize = 0; hdr->b_l1hdr.b_tmp_cdata = NULL; ARCSTAT_BUMP(arcstat_l2_compress_zeros); @@ -6610,7 +6604,7 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr) bzero((char *)cdata + csize, rounded - csize); csize = rounded; } - HDR_SET_COMPRESS(hdr, ZIO_COMPRESS_LZ4); + l2hdr->b_compress = ZIO_COMPRESS_LZ4; l2hdr->b_asize = csize; hdr->b_l1hdr.b_tmp_cdata = cdata; ARCSTAT_BUMP(arcstat_l2_compress_successes); @@ -6697,7 +6691,8 @@ l2arc_decompress_zio(zio_t *zio, arc_buf static void l2arc_release_cdata_buf(arc_buf_hdr_t *hdr) { - enum zio_compress comp = HDR_GET_COMPRESS(hdr); + ASSERT(HDR_HAS_L2HDR(hdr)); + enum zio_compress comp = hdr->b_l2hdr.b_compress; ASSERT(HDR_HAS_L1HDR(hdr)); ASSERT(comp == ZIO_COMPRESS_OFF || L2ARC_IS_VALID_COMPRESS(comp)); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sat Sep 12 09:28:02 2015 (r287705) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sat Sep 12 09:56:23 2015 (r287706) @@ -88,21 +88,6 @@ typedef enum arc_flags /* Flags specifying whether optional hdr struct fields are defined */ ARC_FLAG_HAS_L1HDR = 1 << 19, ARC_FLAG_HAS_L2HDR = 1 << 20, - - - /* - * The arc buffer's compression mode is stored in the top 7 bits of the - * flags field, so these dummy flags are included so that MDB can - * interpret the enum properly. - */ - ARC_FLAG_COMPRESS_0 = 1 << 24, - ARC_FLAG_COMPRESS_1 = 1 << 25, - ARC_FLAG_COMPRESS_2 = 1 << 26, - ARC_FLAG_COMPRESS_3 = 1 << 27, - ARC_FLAG_COMPRESS_4 = 1 << 28, - ARC_FLAG_COMPRESS_5 = 1 << 29, - ARC_FLAG_COMPRESS_6 = 1 << 30 - } arc_flags_t; struct arc_buf { From owner-svn-src-head@freebsd.org Sat Sep 12 10:23:25 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B5B4A01CF1; Sat, 12 Sep 2015 10:23:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B12F1ABA; Sat, 12 Sep 2015 10:23:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CANP1Z082165; Sat, 12 Sep 2015 10:23:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CANOmx082162; Sat, 12 Sep 2015 10:23:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509121023.t8CANOmx082162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Sep 2015 10:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287707 - in head: share/man/man4 sys/cam/ctl usr.sbin/ctladm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 10:23:25 -0000 Author: mav Date: Sat Sep 12 10:23:23 2015 New Revision: 287707 URL: https://svnweb.freebsd.org/changeset/base/287707 Log: CTL documentation update, mostly for HA. Modified: head/share/man/man4/ctl.4 head/sys/cam/ctl/README.ctl.txt head/usr.sbin/ctladm/ctladm.8 Modified: head/share/man/man4/ctl.4 ============================================================================== --- head/share/man/man4/ctl.4 Sat Sep 12 09:56:23 2015 (r287706) +++ head/share/man/man4/ctl.4 Sat Sep 12 10:23:23 2015 (r287707) @@ -1,4 +1,5 @@ .\" Copyright (c) 2013 Edward Tomasz Napierala +.\" Copyright (c) 2015 Alexander Motin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -23,7 +24,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd August 9, 2015 +.Dd September 12, 2015 .Dt CTL 4 .Os .Sh NAME @@ -80,6 +81,8 @@ Mode sense/select support .It Error injection support .It +High Availability clustering support with ALUA +.It All I/O handled in-kernel, no userland context switch overhead .El .Pp @@ -99,9 +102,57 @@ log commands with errors; .It 2 log all commands; .It 4 -log received data for commands except READ/WRITE. +log data for commands other then READ/WRITE. .El Defaults to 0. +.It Va kern.cam.ctl.ha_id +Specifies unique position of this node within High Availability cluster. +Default is 0 -- no HA, 1 and 2 -- HA enabled at specified position. +.It Va kern.cam.ctl.ha_mode +Specifies High Availability cluster operation mode: +.Bl -tag -offset indent -compact +.It 0 +Active/Standby -- primary node has backend access and processes requests, +while secondary can only do basic LUN discovery and reservation; +.It 1 +Active/Active -- both nodes have backend access and process requests, +while secondary node synchronizes processing with primary one; +.It 2 +Active/Active -- primary node has backend access and processes requests, +while secondary node forwards all requests and data to primary one; +.El +All above modes require established connection between HA cluster nodes. +If connection is not configured, secondary node will report Unavailable +state; if configured but not established -- Transitioning state. +Defaults to 0. +.It Va kern.cam.ctl.ha_peer +String value, specifying method to establish connection to peer HA node. +Can be "listen IP:port", "connect IP:port" or empty. +.It Va kern.cam.ctl.ha_link +Reports present state of connection between HA cluster nodes: +.Bl -tag -offset indent -compact +.It 0 +not configured; +.It 1 +configured but not established; +.It 2 +established. +.El +.It Va kern.cam.ctl.ha_role +Specifies default role of this node: +.Bl -tag -offset indent -compact +.It 0 +primary; +.It 1 +secondary. +.El +This role can be overriden on per-LUN basis using "ha_role" LUN option, +so that for one LUN one node is primary, while for another -- another. +Role change from primary to secondary for HA modes 0 and 2 closes backends, +the opposite change -- opens. +If there is no primary node (both nodes are secondary, or secondary node has +no connection to primary one), secondary node(s) report Transitioning state. +State with two primary nodes is illegal (split brain condition). .It Va kern.cam.ctl.iscsi.debug Verbosity level for log messages from the kernel part of iSCSI target. Set to 0 to disable logging or 1 to warn about potential problems. @@ -132,5 +183,7 @@ subsystem first appeared in .Sh AUTHORS The .Nm -subsystem was written by +subsystem was originally written by .An Kenneth Merry Aq Mt ken@FreeBSD.org . +Later work was done by +.An Alexander Motin Aq Mt mav@FreeBSD.org . Modified: head/sys/cam/ctl/README.ctl.txt ============================================================================== --- head/sys/cam/ctl/README.ctl.txt Sat Sep 12 09:56:23 2015 (r287706) +++ head/sys/cam/ctl/README.ctl.txt Sat Sep 12 10:23:23 2015 (r287707) @@ -40,25 +40,24 @@ Features: - Support for multiple ports - Support for multiple simultaneous initiators - Support for multiple simultaneous backing stores + - Support for VMWare VAAI: COMPARE AND WRITE, XCOPY, WRITE SAME and + UNMAP commands + - Support for Microsoft ODX: POPULATE TOKEN/WRITE USING TOKEN, WRITE SAME + and UNMAP commands - Persistent reservation support - Mode sense/select support - Error injection support - - High Availability support + - High Availability clustering support with ALUA - All I/O handled in-kernel, no userland context switch overhead. Configuring and Running CTL: =========================== - - After applying the CTL patchset to your tree, build world and install it - on your target system. - - - Add 'device ctl' to your kernel configuration file. + - Add 'device ctl' to your kernel configuration file or load the module. - If you're running with a 8Gb or 4Gb Qlogic FC board, add - 'options ISP_TARGET_MODE' to your kernel config file. Keep in mind that - the isp(4) driver can run in target or initiator mode, but not both on - the same machine. 'device ispfw' or loading the ispfw module is also - recommended. + 'options ISP_TARGET_MODE' to your kernel config file. 'device ispfw' or + loading the ispfw module is also recommended. - Rebuild and install a new kernel. Modified: head/usr.sbin/ctladm/ctladm.8 ============================================================================== --- head/usr.sbin/ctladm/ctladm.8 Sat Sep 12 09:56:23 2015 (r287706) +++ head/usr.sbin/ctladm/ctladm.8 Sat Sep 12 10:23:23 2015 (r287707) @@ -1,5 +1,6 @@ .\" .\" Copyright (c) 2003 Silicon Graphics International Corp. +.\" Copyright (c) 2015 Alexander Motin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -34,7 +35,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd September 10, 2015 +.Dd September 12, 2015 .Dt CTLADM 8 .Os .Sh NAME @@ -964,6 +965,9 @@ Specifies LUN NAA identifier. Either EUI or NAA identifier should be set to UNIQUE value to allow EXTENDED COPY command access the LUN. Non-unique LUN identifiers may lead to data corruption. +.It Va ha_role +Setting to "primary" or "secondary" overrides default role of the node +in HA cluster, set by kern.cam.ctl.ha_role sysctl. .It Va insecure_tpc Setting to "on" allows EXTENDED COPY command sent to this LUN access other LUNs on this host, not accessible otherwise. @@ -995,7 +999,6 @@ Specify physical block size and offset o .It Va ublockoffset Specify UNMAP block size and offset of the device. .It Va rpm -.It Va rpm Specifies medium rotation rate of the device: 0 -- not reported, 1 -- non-rotating (SSD), >1024 -- value in revolutions per minute. .It Va formfactor From owner-svn-src-head@freebsd.org Sat Sep 12 12:46:05 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFAEDA013C8; Sat, 12 Sep 2015 12:46:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 953F81975; Sat, 12 Sep 2015 12:46:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CCk52w039527; Sat, 12 Sep 2015 12:46:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CCk5Oa039526; Sat, 12 Sep 2015 12:46:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509121246.t8CCk5Oa039526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Sep 2015 12:46:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287711 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 12:46:05 -0000 Author: mav Date: Sat Sep 12 12:46:04 2015 New Revision: 287711 URL: https://svnweb.freebsd.org/changeset/base/287711 Log: Some HA polishing. Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sat Sep 12 12:03:02 2015 (r287710) +++ head/sys/cam/ctl/ctl.c Sat Sep 12 12:46:04 2015 (r287711) @@ -673,7 +673,10 @@ ctl_isc_ha_link_down(struct ctl_softc *s mtx_lock(&softc->ctl_lock); STAILQ_FOREACH(lun, &softc->lun_list, links) { mtx_lock(&lun->lun_lock); - lun->flags &= ~CTL_LUN_PEER_SC_PRIMARY; + if (lun->flags & CTL_LUN_PEER_SC_PRIMARY) { + lun->flags &= ~CTL_LUN_PEER_SC_PRIMARY; + ctl_est_ua_all(lun, -1, CTL_UA_ASYM_ACC_CHANGE); + } mtx_unlock(&lun->lun_lock); mtx_unlock(&softc->ctl_lock); @@ -700,8 +703,11 @@ ctl_isc_ua(struct ctl_softc *softc, unio struct ctl_lun *lun; uint32_t iid = ctl_get_initindex(&msg->hdr.nexus); + mtx_lock(&softc->ctl_lock); if (msg->hdr.nexus.targ_lun < CTL_MAX_LUNS && - (lun = softc->ctl_luns[msg->hdr.nexus.targ_lun]) != NULL) { + (lun = softc->ctl_luns[msg->hdr.nexus.targ_mapped_lun]) != NULL) { + mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); if (msg->ua.ua_all) { if (msg->ua.ua_set) ctl_est_ua_all(lun, iid, msg->ua.ua_type); @@ -713,7 +719,9 @@ ctl_isc_ua(struct ctl_softc *softc, unio else ctl_clr_ua(lun, iid, msg->ua.ua_type); } - } + mtx_unlock(&lun->lun_lock); + } else + mtx_unlock(&softc->ctl_lock); } static void @@ -722,58 +730,69 @@ ctl_isc_lun_sync(struct ctl_softc *softc struct ctl_lun *lun; struct ctl_ha_msg_lun_pr_key pr_key; int i, k; + ctl_lun_flags oflags; + uint32_t targ_lun; - lun = softc->ctl_luns[msg->hdr.nexus.targ_lun]; - if (lun == NULL) { - CTL_DEBUG_PRINT(("%s: Unknown LUN %d\n", __func__, - msg->hdr.nexus.targ_lun)); + targ_lun = msg->hdr.nexus.targ_mapped_lun; + mtx_lock(&softc->ctl_lock); + if ((targ_lun >= CTL_MAX_LUNS) || + ((lun = softc->ctl_luns[targ_lun]) == NULL)) { + mtx_unlock(&softc->ctl_lock); + return; + } + mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); + if (lun->flags & CTL_LUN_DISABLED) { + mtx_unlock(&lun->lun_lock); + return; + } + i = (lun->lun_devid != NULL) ? lun->lun_devid->len : 0; + if (msg->lun.lun_devid_len != i || (i > 0 && + memcmp(&msg->lun.data[0], lun->lun_devid->data, i) != 0)) { + mtx_unlock(&lun->lun_lock); + printf("%s: Received conflicting HA LUN %d\n", + __func__, msg->hdr.nexus.targ_lun); + return; } else { - mtx_lock(&lun->lun_lock); - i = (lun->lun_devid != NULL) ? lun->lun_devid->len : 0; - if (msg->lun.lun_devid_len != i || (i > 0 && - memcmp(&msg->lun.data[0], lun->lun_devid->data, i) != 0)) { - mtx_unlock(&lun->lun_lock); - printf("%s: Received conflicting HA LUN %d\n", - __func__, msg->hdr.nexus.targ_lun); - return; - } else { - /* Record whether peer is primary. */ - if ((msg->lun.flags & CTL_LUN_PRIMARY_SC) && - (msg->lun.flags & CTL_LUN_DISABLED) == 0) - lun->flags |= CTL_LUN_PEER_SC_PRIMARY; - else - lun->flags &= ~CTL_LUN_PEER_SC_PRIMARY; - - /* If peer is primary and we are not -- use data */ - if ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 && - (lun->flags & CTL_LUN_PEER_SC_PRIMARY)) { - lun->PRGeneration = msg->lun.pr_generation; - lun->pr_res_idx = msg->lun.pr_res_idx; - lun->res_type = msg->lun.pr_res_type; - lun->pr_key_count = msg->lun.pr_key_count; - for (k = 0; k < CTL_MAX_INITIATORS; k++) - ctl_clr_prkey(lun, k); - for (k = 0; k < msg->lun.pr_key_count; k++) { - memcpy(&pr_key, &msg->lun.data[i], - sizeof(pr_key)); - ctl_alloc_prkey(lun, pr_key.pr_iid); - ctl_set_prkey(lun, pr_key.pr_iid, - pr_key.pr_key); - i += sizeof(pr_key); - } + /* Record whether peer is primary. */ + oflags = lun->flags; + if ((msg->lun.flags & CTL_LUN_PRIMARY_SC) && + (msg->lun.flags & CTL_LUN_DISABLED) == 0) + lun->flags |= CTL_LUN_PEER_SC_PRIMARY; + else + lun->flags &= ~CTL_LUN_PEER_SC_PRIMARY; + if (oflags != lun->flags) + ctl_est_ua_all(lun, -1, CTL_UA_ASYM_ACC_CHANGE); + + /* If peer is primary and we are not -- use data */ + if ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 && + (lun->flags & CTL_LUN_PEER_SC_PRIMARY)) { + lun->PRGeneration = msg->lun.pr_generation; + lun->pr_res_idx = msg->lun.pr_res_idx; + lun->res_type = msg->lun.pr_res_type; + lun->pr_key_count = msg->lun.pr_key_count; + for (k = 0; k < CTL_MAX_INITIATORS; k++) + ctl_clr_prkey(lun, k); + for (k = 0; k < msg->lun.pr_key_count; k++) { + memcpy(&pr_key, &msg->lun.data[i], + sizeof(pr_key)); + ctl_alloc_prkey(lun, pr_key.pr_iid); + ctl_set_prkey(lun, pr_key.pr_iid, + pr_key.pr_key); + i += sizeof(pr_key); } - - mtx_unlock(&lun->lun_lock); - CTL_DEBUG_PRINT(("%s: Known LUN %d, peer is %s\n", - __func__, msg->hdr.nexus.targ_lun, - (msg->lun.flags & CTL_LUN_PRIMARY_SC) ? - "primary" : "secondary")); - - /* If we are primary but peer doesn't know -- notify */ - if ((lun->flags & CTL_LUN_PRIMARY_SC) && - (msg->lun.flags & CTL_LUN_PEER_SC_PRIMARY) == 0) - ctl_isc_announce_lun(lun); } + + mtx_unlock(&lun->lun_lock); + CTL_DEBUG_PRINT(("%s: Known LUN %d, peer is %s\n", + __func__, msg->hdr.nexus.targ_lun, + (msg->lun.flags & CTL_LUN_PRIMARY_SC) ? + "primary" : "secondary")); + + /* If we are primary but peer doesn't know -- notify */ + if ((lun->flags & CTL_LUN_PRIMARY_SC) && + (msg->lun.flags & CTL_LUN_PEER_SC_PRIMARY) == 0) + ctl_isc_announce_lun(lun); } } @@ -1730,20 +1749,24 @@ ctl_serialize_other_sc_cmd(struct ctl_sc softc = control_softc; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; + mtx_lock(&softc->ctl_lock); if ((targ_lun < CTL_MAX_LUNS) && ((lun = softc->ctl_luns[targ_lun]) != NULL)) { + mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); /* * If the LUN is invalid, pretend that it doesn't exist. * It will go away as soon as all pending I/O has been * completed. */ - mtx_lock(&lun->lun_lock); if (lun->flags & CTL_LUN_DISABLED) { mtx_unlock(&lun->lun_lock); lun = NULL; } - } else + } else { + mtx_unlock(&softc->ctl_lock); lun = NULL; + } if (lun == NULL) { /* * The other node would not send this request to us unless @@ -2514,6 +2537,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, if (lun == NULL) { mtx_unlock(&softc->ctl_lock); sync_info->status = CTL_GS_SYNC_NO_LUN; + break; } /* * Get or set the sync interval. We're not bounds checking @@ -4531,8 +4555,8 @@ ctl_lun_primary(struct ctl_be_lun *be_lu mtx_lock(&lun->lun_lock); lun->flags |= CTL_LUN_PRIMARY_SC; - mtx_unlock(&lun->lun_lock); ctl_est_ua_all(lun, -1, CTL_UA_ASYM_ACC_CHANGE); + mtx_unlock(&lun->lun_lock); ctl_isc_announce_lun(lun); return (0); } @@ -4544,8 +4568,8 @@ ctl_lun_secondary(struct ctl_be_lun *be_ mtx_lock(&lun->lun_lock); lun->flags &= ~CTL_LUN_PRIMARY_SC; - mtx_unlock(&lun->lun_lock); ctl_est_ua_all(lun, -1, CTL_UA_ASYM_ACC_CHANGE); + mtx_unlock(&lun->lun_lock); ctl_isc_announce_lun(lun); return (0); } @@ -8383,10 +8407,19 @@ ctl_hndl_per_res_out_on_other_sc(union c uint32_t targ_lun; softc = control_softc; - targ_lun = msg->hdr.nexus.targ_mapped_lun; - lun = softc->ctl_luns[targ_lun]; + mtx_lock(&softc->ctl_lock); + if ((targ_lun >= CTL_MAX_LUNS) || + ((lun = softc->ctl_luns[targ_lun]) == NULL)) { + mtx_unlock(&softc->ctl_lock); + return; + } mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); + if (lun->flags & CTL_LUN_DISABLED) { + mtx_unlock(&lun->lun_lock); + return; + } switch(msg->pr.pr_info.action) { case CTL_PR_REG_KEY: ctl_alloc_prkey(lun, msg->pr.pr_info.residx); From owner-svn-src-head@freebsd.org Sat Sep 12 13:53:41 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD62BA02114; Sat, 12 Sep 2015 13:53:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CEE2C15FA; Sat, 12 Sep 2015 13:53:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CDrfOB068418; Sat, 12 Sep 2015 13:53:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CDrfES068417; Sat, 12 Sep 2015 13:53:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509121353.t8CDrfES068417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Sep 2015 13:53:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287712 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 13:53:42 -0000 Author: mav Date: Sat Sep 12 13:53:41 2015 New Revision: 287712 URL: https://svnweb.freebsd.org/changeset/base/287712 Log: Correct RTPG bitmask. Modified: head/sys/cam/ctl/ctl_cmd_table.c Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Sat Sep 12 12:46:04 2015 (r287711) +++ head/sys/cam/ctl/ctl_cmd_table.c Sat Sep 12 13:53:41 2015 (r287712) @@ -486,7 +486,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, - 12, {0x0a, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + 12, {0xea, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 0B */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, From owner-svn-src-head@freebsd.org Sat Sep 12 14:20:12 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F129A02BBC; Sat, 12 Sep 2015 14:20:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 307C510E2; Sat, 12 Sep 2015 14:20:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CEKCmA077174; Sat, 12 Sep 2015 14:20:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CEKCHn077173; Sat, 12 Sep 2015 14:20:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509121420.t8CEKCHn077173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Sep 2015 14:20:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287714 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 14:20:12 -0000 Author: mav Date: Sat Sep 12 14:20:11 2015 New Revision: 287714 URL: https://svnweb.freebsd.org/changeset/base/287714 Log: Report that we have no limit on POPULATE TOKEN segment size. Modified: head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Sat Sep 12 14:19:45 2015 (r287713) +++ head/sys/cam/ctl/ctl_tpc.c Sat Sep 12 14:20:11 2015 (r287714) @@ -394,8 +394,7 @@ ctl_inquiry_evpd_tpc(struct ctl_scsiio * scsi_ulto2b(0, rtfb_ptr->optimal_length_granularity); scsi_u64to8b(0, rtfb_ptr->maximum_bytes); scsi_u64to8b(0, rtfb_ptr->optimal_bytes); - scsi_u64to8b(TPC_MAX_IOCHUNK_SIZE, - rtfb_ptr->optimal_bytes_to_token_per_segment); + scsi_u64to8b(UINT64_MAX, rtfb_ptr->optimal_bytes_to_token_per_segment); scsi_u64to8b(TPC_MAX_IOCHUNK_SIZE, rtfb_ptr->optimal_bytes_from_token_per_segment); From owner-svn-src-head@freebsd.org Sat Sep 12 16:30:03 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33D3DA02529; Sat, 12 Sep 2015 16:30:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24AEB1A29; Sat, 12 Sep 2015 16:30:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CGU2pd030773; Sat, 12 Sep 2015 16:30:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CGU2H7030771; Sat, 12 Sep 2015 16:30:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509121630.t8CGU2H7030771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Sep 2015 16:30:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287715 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 16:30:03 -0000 Author: mav Date: Sat Sep 12 16:30:01 2015 New Revision: 287715 URL: https://svnweb.freebsd.org/changeset/base/287715 Log: Improve XCOPY error reporting. Modified: head/sys/cam/ctl/ctl_tpc.c head/sys/cam/ctl/ctl_tpc_local.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Sat Sep 12 14:20:11 2015 (r287714) +++ head/sys/cam/ctl/ctl_tpc.c Sat Sep 12 16:30:01 2015 (r287715) @@ -1589,6 +1589,10 @@ ctl_extended_copy_lid1(struct ctl_scsiio cdb = (struct scsi_extended_copy *)ctsio->cdb; len = scsi_4btoul(cdb->length); + if (len == 0) { + ctl_set_success(ctsio); + goto done; + } if (len < sizeof(struct scsi_extended_copy_lid1_data) || len > sizeof(struct scsi_extended_copy_lid1_data) + TPC_MAX_LIST + TPC_MAX_INLINE) { @@ -1619,20 +1623,22 @@ ctl_extended_copy_lid1(struct ctl_scsiio lencscd = scsi_2btoul(data->cscd_list_length); lenseg = scsi_4btoul(data->segment_list_length); leninl = scsi_4btoul(data->inline_data_length); - if (len < sizeof(struct scsi_extended_copy_lid1_data) + - lencscd + lenseg + leninl || - leninl > TPC_MAX_INLINE) { - ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0, - /*field*/ 2, /*bit_valid*/ 0, /*bit*/ 0); - goto done; - } if (lencscd > TPC_MAX_CSCDS * sizeof(struct scsi_ec_cscd)) { ctl_set_sense(ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, /*asc*/ 0x26, /*ascq*/ 0x06, SSD_ELEM_NONE); goto done; } - if (lencscd + lenseg > TPC_MAX_LIST) { + if (lenseg > TPC_MAX_SEGS * sizeof(struct scsi_ec_segment)) { + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x26, /*ascq*/ 0x08, SSD_ELEM_NONE); + goto done; + } + if (lencscd + lenseg > TPC_MAX_LIST || + leninl > TPC_MAX_INLINE || + len < sizeof(struct scsi_extended_copy_lid1_data) + + lencscd + lenseg + leninl) { ctl_set_param_len_error(ctsio); goto done; } @@ -1716,6 +1722,10 @@ ctl_extended_copy_lid4(struct ctl_scsiio cdb = (struct scsi_extended_copy *)ctsio->cdb; len = scsi_4btoul(cdb->length); + if (len == 0) { + ctl_set_success(ctsio); + goto done; + } if (len < sizeof(struct scsi_extended_copy_lid4_data) || len > sizeof(struct scsi_extended_copy_lid4_data) + TPC_MAX_LIST + TPC_MAX_INLINE) { @@ -1746,20 +1756,22 @@ ctl_extended_copy_lid4(struct ctl_scsiio lencscd = scsi_2btoul(data->cscd_list_length); lenseg = scsi_2btoul(data->segment_list_length); leninl = scsi_2btoul(data->inline_data_length); - if (len < sizeof(struct scsi_extended_copy_lid4_data) + - lencscd + lenseg + leninl || - leninl > TPC_MAX_INLINE) { - ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0, - /*field*/ 2, /*bit_valid*/ 0, /*bit*/ 0); - goto done; - } if (lencscd > TPC_MAX_CSCDS * sizeof(struct scsi_ec_cscd)) { ctl_set_sense(ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, /*asc*/ 0x26, /*ascq*/ 0x06, SSD_ELEM_NONE); goto done; } - if (lencscd + lenseg > TPC_MAX_LIST) { + if (lenseg > TPC_MAX_SEGS * sizeof(struct scsi_ec_segment)) { + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x26, /*ascq*/ 0x08, SSD_ELEM_NONE); + goto done; + } + if (lencscd + lenseg > TPC_MAX_LIST || + leninl > TPC_MAX_INLINE || + len < sizeof(struct scsi_extended_copy_lid1_data) + + lencscd + lenseg + leninl) { ctl_set_param_len_error(ctsio); goto done; } Modified: head/sys/cam/ctl/ctl_tpc_local.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc_local.c Sat Sep 12 14:20:11 2015 (r287714) +++ head/sys/cam/ctl/ctl_tpc_local.c Sat Sep 12 16:30:01 2015 (r287715) @@ -281,7 +281,8 @@ tpcl_resolve(struct ctl_softc *softc, in struct ctl_lun *lun; uint64_t lunid = UINT64_MAX; - if (cscd->type_code != EC_CSCD_ID) + if (cscd->type_code != EC_CSCD_ID || + (cscd->luidt_pdt & EC_LUIDT_MASK) != EC_LUIDT_LUN) return (lunid); cscdid = (struct scsi_ec_cscd_id *)cscd; From owner-svn-src-head@freebsd.org Sat Sep 12 16:46:42 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31569A02C88; Sat, 12 Sep 2015 16:46:42 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 222801206; Sat, 12 Sep 2015 16:46:42 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CGkgED038959; Sat, 12 Sep 2015 16:46:42 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CGkfD1038958; Sat, 12 Sep 2015 16:46:42 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201509121646.t8CGkfD1038958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sat, 12 Sep 2015 16:46:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287716 - head/sys/dev/dwc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 16:46:42 -0000 Author: loos Date: Sat Sep 12 16:46:41 2015 New Revision: 287716 URL: https://svnweb.freebsd.org/changeset/base/287716 Log: Do not call mii_mediachg() from NIC interrupt handler. This fixes the link instability on banana pi (A20). Suggested by: yongari Modified: head/sys/dev/dwc/if_dwc.c Modified: head/sys/dev/dwc/if_dwc.c ============================================================================== --- head/sys/dev/dwc/if_dwc.c Sat Sep 12 16:30:01 2015 (r287715) +++ head/sys/dev/dwc/if_dwc.c Sat Sep 12 16:46:41 2015 (r287716) @@ -821,10 +821,8 @@ dwc_intr(void *arg) DWC_LOCK(sc); reg = READ4(sc, INTERRUPT_STATUS); - if (reg) { - mii_mediachg(sc->mii_softc); + if (reg) READ4(sc, SGMII_RGMII_SMII_CTRL_STATUS); - } reg = READ4(sc, DMA_STATUS); if (reg & DMA_STATUS_NIS) { From owner-svn-src-head@freebsd.org Sat Sep 12 17:08:53 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31773A0364B; Sat, 12 Sep 2015 17:08:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E1DC1598; Sat, 12 Sep 2015 17:08:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CH8rrY048716; Sat, 12 Sep 2015 17:08:53 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CH8pXU048651; Sat, 12 Sep 2015 17:08:51 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201509121708.t8CH8pXU048651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 12 Sep 2015 17:08:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287717 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 17:08:53 -0000 Author: tuexen Date: Sat Sep 12 17:08:51 2015 New Revision: 287717 URL: https://svnweb.freebsd.org/changeset/base/287717 Log: Cleanup the handling of error causes for ERROR chunks. This fixes an inconsistency of the padding handling. The final padding is now considered to be a chunk padding. MFC after: 1 week Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_header.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Sat Sep 12 16:46:41 2015 (r287716) +++ head/sys/netinet/sctp.h Sat Sep 12 17:08:51 2015 (r287717) @@ -388,33 +388,32 @@ struct sctp_error_cause { } SCTP_PACKED; struct sctp_error_invalid_stream { - struct sctp_error_cause cause; /* code=SCTP_ERROR_INVALID_STREAM */ + struct sctp_error_cause cause; /* code=SCTP_CAUSE_INVALID_STREAM */ uint16_t stream_id; /* stream id of the DATA in error */ uint16_t reserved; } SCTP_PACKED; struct sctp_error_missing_param { - struct sctp_error_cause cause; /* code=SCTP_ERROR_MISSING_PARAM */ + struct sctp_error_cause cause; /* code=SCTP_CAUSE_MISSING_PARAM */ uint32_t num_missing_params; /* number of missing parameters */ - /* uint16_t param_type's follow */ + uint16_t type[]; } SCTP_PACKED; struct sctp_error_stale_cookie { - struct sctp_error_cause cause; /* code=SCTP_ERROR_STALE_COOKIE */ + struct sctp_error_cause cause; /* code=SCTP_CAUSE_STALE_COOKIE */ uint32_t stale_time; /* time in usec of staleness */ } SCTP_PACKED; struct sctp_error_out_of_resource { - struct sctp_error_cause cause; /* code=SCTP_ERROR_OUT_OF_RESOURCES */ + struct sctp_error_cause cause; /* code=SCTP_CAUSE_OUT_OF_RESOURCES */ } SCTP_PACKED; struct sctp_error_unresolv_addr { - struct sctp_error_cause cause; /* code=SCTP_ERROR_UNRESOLVABLE_ADDR */ - + struct sctp_error_cause cause; /* code=SCTP_CAUSE_UNRESOLVABLE_ADDR */ } SCTP_PACKED; struct sctp_error_unrecognized_chunk { - struct sctp_error_cause cause; /* code=SCTP_ERROR_UNRECOG_CHUNK */ + struct sctp_error_cause cause; /* code=SCTP_CAUSE_UNRECOG_CHUNK */ struct sctp_chunkhdr ch;/* header from chunk in error */ } SCTP_PACKED; @@ -423,6 +422,11 @@ struct sctp_error_no_user_data { uint32_t tsn; /* TSN of the empty data chunk */ } SCTP_PACKED; +struct sctp_error_auth_invalid_hmac { + struct sctp_error_cause cause; /* code=SCTP_CAUSE_UNSUPPORTED_HMACID */ + uint16_t hmac_id; +} SCTP_PACKED; + /* * Main SCTP chunk types we place these here so natd and f/w's in user land * can find them. Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Sat Sep 12 16:46:41 2015 (r287716) +++ head/sys/netinet/sctp_auth.c Sat Sep 12 17:08:51 2015 (r287717) @@ -1651,8 +1651,8 @@ sctp_handle_auth(struct sctp_tcb *stcb, /* is the indicated HMAC supported? */ if (!sctp_auth_is_supported_hmac(stcb->asoc.local_hmacs, hmac_id)) { - struct mbuf *m_err; - struct sctp_auth_invalid_hmac *err; + struct mbuf *op_err; + struct sctp_error_auth_invalid_hmac *cause; SCTP_STAT_INCR(sctps_recvivalhmacid); SCTPDBG(SCTP_DEBUG_AUTH1, @@ -1662,20 +1662,19 @@ sctp_handle_auth(struct sctp_tcb *stcb, * report this in an Error Chunk: Unsupported HMAC * Identifier */ - m_err = sctp_get_mbuf_for_msg(sizeof(*err), 0, M_NOWAIT, - 1, MT_HEADER); - if (m_err != NULL) { + op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_error_auth_invalid_hmac), + 0, M_NOWAIT, 1, MT_HEADER); + if (op_err != NULL) { /* pre-reserve some space */ - SCTP_BUF_RESV_UF(m_err, sizeof(struct sctp_chunkhdr)); + SCTP_BUF_RESV_UF(op_err, sizeof(struct sctp_chunkhdr)); /* fill in the error */ - err = mtod(m_err, struct sctp_auth_invalid_hmac *); - bzero(err, sizeof(*err)); - err->ph.param_type = htons(SCTP_CAUSE_UNSUPPORTED_HMACID); - err->ph.param_length = htons(sizeof(*err)); - err->hmac_id = ntohs(hmac_id); - SCTP_BUF_LEN(m_err) = sizeof(*err); + cause = mtod(op_err, struct sctp_error_auth_invalid_hmac *); + cause->cause.code = htons(SCTP_CAUSE_UNSUPPORTED_HMACID); + cause->cause.length = htons(sizeof(struct sctp_error_auth_invalid_hmac)); + cause->hmac_id = ntohs(hmac_id); + SCTP_BUF_LEN(op_err) = sizeof(struct sctp_error_auth_invalid_hmac); /* queue it */ - sctp_queue_op_err(stcb, m_err); + sctp_queue_op_err(stcb, op_err); } return (-1); } Modified: head/sys/netinet/sctp_header.h ============================================================================== --- head/sys/netinet/sctp_header.h Sat Sep 12 16:46:41 2015 (r287716) +++ head/sys/netinet/sctp_header.h Sat Sep 12 17:08:51 2015 (r287717) @@ -202,34 +202,6 @@ struct sctp_state_cookie { /* this is ou */ } SCTP_PACKED; - -/* Used for NAT state error cause */ -struct sctp_missing_nat_state { - uint16_t cause; - uint16_t length; - uint8_t data[]; -} SCTP_PACKED; - - -struct sctp_inv_mandatory_param { - uint16_t cause; - uint16_t length; - uint32_t num_param; - uint16_t param; - /* - * We include this to 0 it since only a missing cookie will cause - * this error. - */ - uint16_t resv; -} SCTP_PACKED; - -struct sctp_unresolv_addr { - uint16_t cause; - uint16_t length; - uint16_t addr_type; - uint16_t reserved; /* Only one invalid addr type */ -} SCTP_PACKED; - /* state cookie parameter */ struct sctp_state_cookie_param { struct sctp_paramhdr ph; @@ -370,28 +342,11 @@ struct sctp_shutdown_complete_chunk { struct sctp_chunkhdr ch; } SCTP_PACKED; -/* Oper error holding a stale cookie */ -struct sctp_stale_cookie_msg { - struct sctp_paramhdr ph;/* really an error cause */ - uint32_t time_usec; -} SCTP_PACKED; - struct sctp_adaptation_layer_indication { struct sctp_paramhdr ph; uint32_t indication; } SCTP_PACKED; -struct sctp_cookie_while_shutting_down { - struct sctphdr sh; - struct sctp_chunkhdr ch; - struct sctp_paramhdr ph;/* really an error cause */ -} SCTP_PACKED; - -struct sctp_shutdown_complete_msg { - struct sctphdr sh; - struct sctp_shutdown_complete_chunk shut_cmp; -} SCTP_PACKED; - /* * draft-ietf-tsvwg-addip-sctp */ @@ -554,12 +509,6 @@ struct sctp_auth_chunk { uint8_t hmac[]; } SCTP_PACKED; -struct sctp_auth_invalid_hmac { - struct sctp_paramhdr ph; - uint16_t hmac_id; - uint16_t padding; -} SCTP_PACKED; - /* * we pre-reserve enough room for a ECNE or CWR AND a SACK with no missing * pieces. If ENCE is missing we could have a couple of blocks. This way we Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sat Sep 12 16:46:41 2015 (r287716) +++ head/sys/netinet/sctp_indata.c Sat Sep 12 17:08:51 2015 (r287717) @@ -1426,30 +1426,25 @@ sctp_process_a_data_chunk(struct sctp_tc } strmno = ntohs(ch->dp.stream_id); if (strmno >= asoc->streamincnt) { - struct sctp_paramhdr *phdr; - struct mbuf *mb; + struct sctp_error_invalid_stream *cause; - mb = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) * 2), + op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_error_invalid_stream), 0, M_NOWAIT, 1, MT_DATA); - if (mb != NULL) { + if (op_err != NULL) { /* add some space up front so prepend will work well */ - SCTP_BUF_RESV_UF(mb, sizeof(struct sctp_chunkhdr)); - phdr = mtod(mb, struct sctp_paramhdr *); + SCTP_BUF_RESV_UF(op_err, sizeof(struct sctp_chunkhdr)); + cause = mtod(op_err, struct sctp_error_invalid_stream *); /* * Error causes are just param's and this one has * two back to back phdr, one with the error type * and size, the other with the streamid and a rsvd */ - SCTP_BUF_LEN(mb) = (sizeof(struct sctp_paramhdr) * 2); - phdr->param_type = htons(SCTP_CAUSE_INVALID_STREAM); - phdr->param_length = - htons(sizeof(struct sctp_paramhdr) * 2); - phdr++; - /* We insert the stream in the type field */ - phdr->param_type = ch->dp.stream_id; - /* And set the length to 0 for the rsvd field */ - phdr->param_length = 0; - sctp_queue_op_err(stcb, mb); + SCTP_BUF_LEN(op_err) = sizeof(struct sctp_error_invalid_stream); + cause->cause.code = htons(SCTP_CAUSE_INVALID_STREAM); + cause->cause.length = htons(sizeof(struct sctp_error_invalid_stream)); + cause->stream_id = ch->dp.stream_id; + cause->reserved = htons(0); + sctp_queue_op_err(stcb, op_err); } SCTP_STAT_INCR(sctps_badsid); SCTP_TCB_LOCK_ASSERT(stcb); @@ -2492,30 +2487,21 @@ sctp_process_data(struct mbuf **mm, int /* unknown chunk type, use bit rules */ if (ch->ch.chunk_type & 0x40) { /* Add a error report to the queue */ - struct mbuf *merr; - struct sctp_paramhdr *phd; + struct mbuf *op_err; + struct sctp_gen_error_cause *cause; - merr = sctp_get_mbuf_for_msg(sizeof(*phd), 0, M_NOWAIT, 1, MT_DATA); - if (merr) { - phd = mtod(merr, struct sctp_paramhdr *); - /* - * We cheat and use param - * type since we did not - * bother to define a error - * cause struct. They are - * the same basic format - * with different names. - */ - phd->param_type = - htons(SCTP_CAUSE_UNRECOG_CHUNK); - phd->param_length = - htons(chk_length + sizeof(*phd)); - SCTP_BUF_LEN(merr) = sizeof(*phd); - SCTP_BUF_NEXT(merr) = SCTP_M_COPYM(m, *offset, chk_length, M_NOWAIT); - if (SCTP_BUF_NEXT(merr)) { - sctp_queue_op_err(stcb, merr); + op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_gen_error_cause), + 0, M_NOWAIT, 1, MT_DATA); + if (op_err != NULL) { + cause = mtod(op_err, struct sctp_gen_error_cause *); + cause->code = htons(SCTP_CAUSE_UNRECOG_CHUNK); + cause->length = htons(chk_length + sizeof(struct sctp_gen_error_cause)); + SCTP_BUF_LEN(op_err) = sizeof(struct sctp_gen_error_cause); + SCTP_BUF_NEXT(op_err) = SCTP_M_COPYM(m, *offset, chk_length, M_NOWAIT); + if (SCTP_BUF_NEXT(op_err) != NULL) { + sctp_queue_op_err(stcb, op_err); } else { - sctp_m_freem(merr); + sctp_m_freem(op_err); } } } Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Sep 12 16:46:41 2015 (r287716) +++ head/sys/netinet/sctp_input.c Sat Sep 12 17:08:51 2015 (r287717) @@ -530,25 +530,21 @@ sctp_process_init_ack(struct mbuf *m, in * abandon the peer, its broke. */ if (retval == -3) { + size_t len; + + len = sizeof(struct sctp_error_missing_param) + sizeof(uint16_t); /* We abort with an error of missing mandatory param */ - op_err = sctp_generate_cause(SCTP_CAUSE_MISSING_PARAM, ""); - if (op_err) { - /* - * Expand beyond to include the mandatory - * param cookie - */ - struct sctp_inv_mandatory_param *mp; + op_err = sctp_get_mbuf_for_msg(len, 0, M_NOWAIT, 1, MT_DATA); + if (op_err != NULL) { + struct sctp_error_missing_param *cause; - SCTP_BUF_LEN(op_err) = - sizeof(struct sctp_inv_mandatory_param); - mp = mtod(op_err, - struct sctp_inv_mandatory_param *); + SCTP_BUF_LEN(op_err) = len; + cause = mtod(op_err, struct sctp_error_missing_param *); /* Subtract the reserved param */ - mp->length = - htons(sizeof(struct sctp_inv_mandatory_param) - 2); - mp->num_param = htonl(1); - mp->param = htons(SCTP_STATE_COOKIE); - mp->resv = 0; + cause->cause.code = htons(SCTP_CAUSE_MISSING_PARAM); + cause->cause.length = htons(len); + cause->num_missing_params = htonl(1); + cause->type[0] = htons(SCTP_STATE_COOKIE); } sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, src, dst, sh, op_err, @@ -781,10 +777,10 @@ sctp_handle_abort(struct sctp_abort_chun * Need to check the cause codes for our two magic nat * aborts which don't kill the assoc necessarily. */ - struct sctp_missing_nat_state *natc; + struct sctp_gen_error_cause *cause; - natc = (struct sctp_missing_nat_state *)(abort + 1); - error = ntohs(natc->cause); + cause = (struct sctp_gen_error_cause *)(abort + 1); + error = ntohs(cause->code); if (error == SCTP_CAUSE_NAT_COLLIDING_STATE) { SCTPDBG(SCTP_DEBUG_INPUT2, "Received Colliding state abort flags:%x\n", abort->ch.chunk_flags); @@ -2558,27 +2554,27 @@ sctp_handle_cookie_echo(struct mbuf *m, if (timevalcmp(&now, &time_expires, >)) { /* cookie is stale! */ struct mbuf *op_err; - struct sctp_stale_cookie_msg *scm; + struct sctp_error_stale_cookie *cause; uint32_t tim; - op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_stale_cookie_msg), + op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_error_stale_cookie), 0, M_NOWAIT, 1, MT_DATA); if (op_err == NULL) { /* FOOBAR */ return (NULL); } /* Set the len */ - SCTP_BUF_LEN(op_err) = sizeof(struct sctp_stale_cookie_msg); - scm = mtod(op_err, struct sctp_stale_cookie_msg *); - scm->ph.param_type = htons(SCTP_CAUSE_STALE_COOKIE); - scm->ph.param_length = htons((sizeof(struct sctp_paramhdr) + + SCTP_BUF_LEN(op_err) = sizeof(struct sctp_error_stale_cookie); + cause = mtod(op_err, struct sctp_error_stale_cookie *); + cause->cause.code = htons(SCTP_CAUSE_STALE_COOKIE); + cause->cause.length = htons((sizeof(struct sctp_paramhdr) + (sizeof(uint32_t)))); /* seconds to usec */ tim = (now.tv_sec - time_expires.tv_sec) * 1000000; /* add in usec */ if (tim == 0) tim = now.tv_usec - cookie->time_entered.tv_usec; - scm->time_usec = htonl(tim); + cause->stale_time = htonl(tim); sctp_send_operr_to(src, dst, sh, cookie->peers_vtag, op_err, mflowtype, mflowid, l_inp->fibnum, vrf_id, port); @@ -5581,35 +5577,27 @@ process_control_chunks: unknown_chunk: /* it's an unknown chunk! */ if ((ch->chunk_type & 0x40) && (stcb != NULL)) { - struct mbuf *mm; - struct sctp_paramhdr *phd; + struct sctp_gen_error_cause *cause; int len; - mm = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), + op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_gen_error_cause), 0, M_NOWAIT, 1, MT_DATA); - if (mm) { + if (op_err != NULL) { len = min(SCTP_SIZE32(chk_length), (uint32_t) (length - *offset)); - phd = mtod(mm, struct sctp_paramhdr *); - /* - * We cheat and use param type since - * we did not bother to define a - * error cause struct. They are the - * same basic format with different - * names. - */ - phd->param_type = htons(SCTP_CAUSE_UNRECOG_CHUNK); - phd->param_length = htons(len + sizeof(*phd)); - SCTP_BUF_LEN(mm) = sizeof(*phd); - SCTP_BUF_NEXT(mm) = SCTP_M_COPYM(m, *offset, len, M_NOWAIT); - if (SCTP_BUF_NEXT(mm)) { + cause = mtod(op_err, struct sctp_gen_error_cause *); + cause->code = htons(SCTP_CAUSE_UNRECOG_CHUNK); + cause->length = htons(len + sizeof(struct sctp_gen_error_cause)); + SCTP_BUF_LEN(op_err) = sizeof(struct sctp_gen_error_cause); + SCTP_BUF_NEXT(op_err) = SCTP_M_COPYM(m, *offset, len, M_NOWAIT); + if (SCTP_BUF_NEXT(op_err) != NULL) { #ifdef SCTP_MBUF_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { sctp_log_mbc(SCTP_BUF_NEXT(mm), SCTP_MBUF_ICOPY); } #endif - sctp_queue_op_err(stcb, mm); + sctp_queue_op_err(stcb, op_err); } else { - sctp_m_freem(mm); + sctp_m_freem(op_err); } } } From owner-svn-src-head@freebsd.org Sat Sep 12 17:35:35 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BB66A02307; Sat, 12 Sep 2015 17:35:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 0CFD21197; Sat, 12 Sep 2015 17:35:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id UAA26287; Sat, 12 Sep 2015 20:35:25 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Zaohx-000N1l-6l; Sat, 12 Sep 2015 20:35:25 +0300 Subject: Re: svn commit: r287705 - head/cddl/contrib/opensolaris/cmd/sgs/tools/common To: Xin LI , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201509120928.t8C9S3x4057432@repo.freebsd.org> From: Andriy Gapon Message-ID: <55F4620A.8020609@FreeBSD.org> Date: Sat, 12 Sep 2015 20:34:02 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <201509120928.t8C9S3x4057432@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 17:35:35 -0000 On 12/09/2015 12:28, Xin LI wrote: > Author: delphij > Date: Sat Sep 12 09:28:02 2015 > New Revision: 287705 > URL: https://svnweb.freebsd.org/changeset/base/287705 > > Log: > Fix build (r287703). Lesson learned: no matter how a change looks like an > innocent one, always do a build test first. > > Pointy hat to: delphij > > Modified: > head/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c What's sgsmsg anyway? What is "SGS subsystem"? Have anybody ever used this utility? > Modified: head/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c Sat Sep 12 08:54:24 2015 (r287704) > +++ head/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c Sat Sep 12 09:28:02 2015 (r287705) > @@ -132,6 +132,8 @@ typedef struct msg_string { > static msg_string *msg_head; > static msg_string *msg_tail; > > +int aok; > + > /* > * message_append() is responsible for both inserting strings into > * the master Str_tbl as well as maintaining a list of the > -- Andriy Gapon From owner-svn-src-head@freebsd.org Sat Sep 12 17:53:50 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EAB7A02B22; Sat, 12 Sep 2015 17:53:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F9B01BB5; Sat, 12 Sep 2015 17:53:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CHro6a070191; Sat, 12 Sep 2015 17:53:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CHroiD070190; Sat, 12 Sep 2015 17:53:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509121753.t8CHroiD070190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Sep 2015 17:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287718 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 17:53:50 -0000 Author: mav Date: Sat Sep 12 17:53:49 2015 New Revision: 287718 URL: https://svnweb.freebsd.org/changeset/base/287718 Log: Decode WRITE ATOMIC(16) command. Modified: head/sys/cam/scsi/scsi_all.c Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Sat Sep 12 17:08:51 2015 (r287717) +++ head/sys/cam/scsi/scsi_all.c Sat Sep 12 17:53:49 2015 (r287718) @@ -509,7 +509,8 @@ static struct op_table_entry scsi_op_cod /* 99 */ /* 9A */ /* 9B */ - /* 9C */ + /* 9C O WRITE ATOMIC(16) */ + { 0x9C, D, "WRITE ATOMIC(16)" }, /* 9D */ /* XXX KDM ALL for this? op-num.txt defines it for none.. */ /* 9E SERVICE ACTION IN(16) */ From owner-svn-src-head@freebsd.org Sat Sep 12 18:00:07 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 770FDA02D1D; Sat, 12 Sep 2015 18:00:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 64E791D5F; Sat, 12 Sep 2015 18:00:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CI070H070555; Sat, 12 Sep 2015 18:00:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CI07wH070554; Sat, 12 Sep 2015 18:00:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201509121800.t8CI07wH070554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 12 Sep 2015 18:00:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287719 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 18:00:07 -0000 Author: tuexen Date: Sat Sep 12 18:00:06 2015 New Revision: 287719 URL: https://svnweb.freebsd.org/changeset/base/287719 Log: Address a compile warning. MFC after: 1 week Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Sep 12 17:53:49 2015 (r287718) +++ head/sys/netinet/sctp_input.c Sat Sep 12 18:00:06 2015 (r287719) @@ -530,9 +530,9 @@ sctp_process_init_ack(struct mbuf *m, in * abandon the peer, its broke. */ if (retval == -3) { - size_t len; + uint16_t len; - len = sizeof(struct sctp_error_missing_param) + sizeof(uint16_t); + len = (uint16_t) (sizeof(struct sctp_error_missing_param) + sizeof(uint16_t)); /* We abort with an error of missing mandatory param */ op_err = sctp_get_mbuf_for_msg(len, 0, M_NOWAIT, 1, MT_DATA); if (op_err != NULL) { From owner-svn-src-head@freebsd.org Sat Sep 12 18:29:06 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A561AA029BC; Sat, 12 Sep 2015 18:29:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 966C21B41; Sat, 12 Sep 2015 18:29:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CIT6cq082608; Sat, 12 Sep 2015 18:29:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CIT6Uc082607; Sat, 12 Sep 2015 18:29:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509121829.t8CIT6Uc082607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Sep 2015 18:29:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287720 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 18:29:06 -0000 Author: mav Date: Sat Sep 12 18:29:05 2015 New Revision: 287720 URL: https://svnweb.freebsd.org/changeset/base/287720 Log: Fix false CTL_UA_RES_RELEASE on secondary HA node. Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sat Sep 12 18:00:06 2015 (r287719) +++ head/sys/cam/ctl/ctl.c Sat Sep 12 18:29:05 2015 (r287720) @@ -8404,7 +8404,7 @@ ctl_hndl_per_res_out_on_other_sc(union c struct ctl_lun *lun; struct ctl_softc *softc; int i; - uint32_t targ_lun; + uint32_t residx, targ_lun; softc = control_softc; targ_lun = msg->hdr.nexus.targ_mapped_lun; @@ -8420,6 +8420,7 @@ ctl_hndl_per_res_out_on_other_sc(union c mtx_unlock(&lun->lun_lock); return; } + residx = ctl_get_initindex(&msg->hdr.nexus); switch(msg->pr.pr_info.action) { case CTL_PR_REG_KEY: ctl_alloc_prkey(lun, msg->pr.pr_info.residx); @@ -8484,8 +8485,9 @@ ctl_hndl_per_res_out_on_other_sc(union c if (lun->res_type != SPR_TYPE_EX_AC && lun->res_type != SPR_TYPE_WR_EX) { for (i = softc->init_min; i < softc->init_max; i++) - if (ctl_get_prkey(lun, i) != 0) - ctl_est_ua(lun, i, CTL_UA_RES_RELEASE); + if (i == residx || ctl_get_prkey(lun, i) == 0) + continue; + ctl_est_ua(lun, i, CTL_UA_RES_RELEASE); } lun->flags &= ~CTL_LUN_PR_RESERVED; From owner-svn-src-head@freebsd.org Sat Sep 12 19:23:21 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78806A03EE7; Sat, 12 Sep 2015 19:23:21 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: from mail-qg0-f46.google.com (mail-qg0-f46.google.com [209.85.192.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3958D15C7; Sat, 12 Sep 2015 19:23:20 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: by qgt47 with SMTP id 47so87525594qgt.2; Sat, 12 Sep 2015 12:23:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=SMlGSndKM3Y0RPSoT/+lnAN8vw+kkxofpSM2njJhMrg=; b=IPEICzSyDrl7cZe5TWGY91ovD38ih91ACtoOWJQdfAnEn4WPDwDXpeRv/Tv0oYK4l8 7SGPlNcCkzEmRE4tbjcEU1EAVFdJwoRwTuqTlQ3HDuVPAxREulqJaYurJiBfggZB7ARO chpK5YJAKYvaiwpvUPLzS8xdUkW+6GxtZLRzJr8nayGI8xksoMjTqvTLAH9U5X+U+tM3 IPsaedg77q9P4TMtGvifdhwj92L0KLkPx7Ql+OIBSfK0piPHD1S9ycW9ti8dr283eiU3 PM1iTNUKoOEfI+6DyQnkZMMV29WQVUWsOSw6ljZUMa+lUaItT1fJb9tLx+13eb/Z54Wg OkXQ== X-Received: by 10.140.30.138 with SMTP id d10mr8540826qgd.80.1442085794653; Sat, 12 Sep 2015 12:23:14 -0700 (PDT) Received: from mail-qg0-f54.google.com (mail-qg0-f54.google.com. [209.85.192.54]) by smtp.gmail.com with ESMTPSA id 78sm2554674qhh.27.2015.09.12.12.23.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Sep 2015 12:23:14 -0700 (PDT) Received: by qgev79 with SMTP id v79so87470045qge.0; Sat, 12 Sep 2015 12:23:14 -0700 (PDT) X-Received: by 10.140.104.33 with SMTP id z30mr8687796qge.0.1442085794225; Sat, 12 Sep 2015 12:23:14 -0700 (PDT) MIME-Version: 1.0 References: <201509041607.t84G7S6f029313@repo.freebsd.org> <20150904161813.GX68814@strugglingcoder.info> In-Reply-To: <20150904161813.GX68814@strugglingcoder.info> From: Eric Joyner Date: Sat, 12 Sep 2015 19:23:04 +0000 Message-ID: Subject: Re: svn commit: r287465 - head/sys/dev/e1000 To: hiren panchasara , Sean Bruno Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 19:23:21 -0000 For the errata, the (lack of) details are in the specification updates for HW like I210, I211, 82575 etc. It would be in the ones updated in August 2015. On Fri, Sep 4, 2015 at 9:18 AM hiren panchasara wrote: > + erj > > On 09/04/15 at 04:07P, Sean Bruno wrote: > > Author: sbruno > > Date: Fri Sep 4 16:07:27 2015 > > New Revision: 287465 > > URL: https://svnweb.freebsd.org/changeset/base/287465 > > > > Log: > > igb(4): Update and fix HW errata > > - HW errata workaround for IPv6 offload w/ extension headers > It would be useful to know what is the actual problem here. > > > - Edited start of if_igb.c (Device IDs / #includes) to match ixgbe/ixl > I'd also prefer if such changes come via separate commits. :-) > > > > > Differential Revision: https://reviews.freebsd.org/D3165 > > Submitted by: erj > > MFC after: 1 month > > Sponsored by: Intel Corporation > > > > Modified: > > head/sys/dev/e1000/if_igb.c > > head/sys/dev/e1000/if_igb.h > > [skip] > > Cheers, > Hiren > From owner-svn-src-head@freebsd.org Sat Sep 12 20:06:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2B27A030C8; Sat, 12 Sep 2015 20:06:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93917184B; Sat, 12 Sep 2015 20:06:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CK6Neg023150; Sat, 12 Sep 2015 20:06:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CK6N9u023149; Sat, 12 Sep 2015 20:06:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509122006.t8CK6N9u023149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Sep 2015 20:06:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287721 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 20:06:23 -0000 Author: mav Date: Sat Sep 12 20:06:22 2015 New Revision: 287721 URL: https://svnweb.freebsd.org/changeset/base/287721 Log: Add HA support for CTL_TASK_I_T_NEXUS_RESET. Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sat Sep 12 18:29:05 2015 (r287720) +++ head/sys/cam/ctl/ctl.c Sat Sep 12 20:06:22 2015 (r287721) @@ -11516,13 +11516,24 @@ ctl_i_t_nexus_reset(union ctl_io *io) struct ctl_lun *lun; uint32_t initidx; + if (!(io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC)) { + union ctl_ha_msg msg_info; + + msg_info.hdr.nexus = io->io_hdr.nexus; + msg_info.task.task_action = CTL_TASK_I_T_NEXUS_RESET; + msg_info.hdr.msg_type = CTL_MSG_MANAGE_TASKS; + msg_info.hdr.original_sc = NULL; + msg_info.hdr.serializing_sc = NULL; + ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg_info, + sizeof(msg_info.task), M_WAITOK); + } + initidx = ctl_get_initindex(&io->io_hdr.nexus); mtx_lock(&softc->ctl_lock); STAILQ_FOREACH(lun, &softc->lun_list, links) { mtx_lock(&lun->lun_lock); ctl_abort_tasks_lun(lun, io->io_hdr.nexus.targ_port, - io->io_hdr.nexus.initid, - (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) != 0); + io->io_hdr.nexus.initid, 1); #ifdef CTL_WITH_CA ctl_clear_mask(lun->have_ca, initidx); #endif From owner-svn-src-head@freebsd.org Sat Sep 12 20:45:11 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21B11A03F4D; Sat, 12 Sep 2015 20:45:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12FB8104A; Sat, 12 Sep 2015 20:45:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CKjAGk040130; Sat, 12 Sep 2015 20:45:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CKjA4K040128; Sat, 12 Sep 2015 20:45:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509122045.t8CKjA4K040128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Sep 2015 20:45:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287724 - in head/sys/cam: ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 20:45:11 -0000 Author: mav Date: Sat Sep 12 20:45:09 2015 New Revision: 287724 URL: https://svnweb.freebsd.org/changeset/base/287724 Log: Check for obsolete NUL bin in CSCD descriptor. Modified: head/sys/cam/ctl/ctl_tpc_local.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/ctl/ctl_tpc_local.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc_local.c Sat Sep 12 20:36:39 2015 (r287723) +++ head/sys/cam/ctl/ctl_tpc_local.c Sat Sep 12 20:45:09 2015 (r287724) @@ -282,7 +282,8 @@ tpcl_resolve(struct ctl_softc *softc, in uint64_t lunid = UINT64_MAX; if (cscd->type_code != EC_CSCD_ID || - (cscd->luidt_pdt & EC_LUIDT_MASK) != EC_LUIDT_LUN) + (cscd->luidt_pdt & EC_LUIDT_MASK) != EC_LUIDT_LUN || + (cscd->luidt_pdt & EC_NUL) != 0) return (lunid); cscdid = (struct scsi_ec_cscd_id *)cscd; Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Sat Sep 12 20:36:39 2015 (r287723) +++ head/sys/cam/scsi/scsi_all.h Sat Sep 12 20:45:09 2015 (r287724) @@ -1666,6 +1666,7 @@ struct scsi_ec_cscd uint8_t type_code; #define EC_CSCD_EXT 0xff uint8_t luidt_pdt; +#define EC_NUL 0x20 #define EC_LUIDT_MASK 0xc0 #define EC_LUIDT_LUN 0x00 #define EC_LUIDT_PROXY_TOKEN 0x40 From owner-svn-src-head@freebsd.org Sat Sep 12 21:23:25 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A45BBA02164; Sat, 12 Sep 2015 21:23:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92C8E13C9; Sat, 12 Sep 2015 21:23:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CLNPLb056337; Sat, 12 Sep 2015 21:23:25 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CLNPfq056336; Sat, 12 Sep 2015 21:23:25 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201509122123.t8CLNPfq056336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 12 Sep 2015 21:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287725 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 21:23:25 -0000 Author: tuexen Date: Sat Sep 12 21:23:24 2015 New Revision: 287725 URL: https://svnweb.freebsd.org/changeset/base/287725 Log: Fix compilation issue introduced in r287717. Thanks to bz@ for making me aware of it. MFC after: 1 week Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Sep 12 20:45:09 2015 (r287724) +++ head/sys/netinet/sctp_input.c Sat Sep 12 21:23:24 2015 (r287725) @@ -5592,7 +5592,7 @@ process_control_chunks: if (SCTP_BUF_NEXT(op_err) != NULL) { #ifdef SCTP_MBUF_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { - sctp_log_mbc(SCTP_BUF_NEXT(mm), SCTP_MBUF_ICOPY); + sctp_log_mbc(SCTP_BUF_NEXT(op_err), SCTP_MBUF_ICOPY); } #endif sctp_queue_op_err(stcb, op_err); From owner-svn-src-head@freebsd.org Sat Sep 12 22:45:18 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77B57A03F5F; Sat, 12 Sep 2015 22:45:18 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [65.19.130.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.strugglingcoder.info", Issuer "mail.strugglingcoder.info" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 63B321030; Sat, 12 Sep 2015 22:45:17 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id DEBA7C05AF; Sat, 12 Sep 2015 15:45:16 -0700 (PDT) Date: Sat, 12 Sep 2015 15:45:16 -0700 From: hiren panchasara To: Eric Joyner Cc: Sean Bruno , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r287465 - head/sys/dev/e1000 Message-ID: <20150912224516.GU64965@strugglingcoder.info> References: <201509041607.t84G7S6f029313@repo.freebsd.org> <20150904161813.GX68814@strugglingcoder.info> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dRgc669pgRVB2OqT" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 22:45:18 -0000 --dRgc669pgRVB2OqT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 09/12/15 at 07:23P, Eric Joyner wrote: > For the errata, the (lack of) details are in the specification updates for > HW like I210, I211, 82575 etc. It would be in the ones updated in August > 2015. Yes, I (we) know erratas are there in the h/w specs. Point is, which exact errata problem are you fixing here so I can go look up the spec for more detail. Errata number/name and exact spec should also be quoted for less ambiguity. (Think about someone having to debug this code 5 years down the road.) Cheers, Hiren >=20 > On Fri, Sep 4, 2015 at 9:18 AM hiren panchasara > wrote: >=20 > > + erj > > > > On 09/04/15 at 04:07P, Sean Bruno wrote: > > > Author: sbruno > > > Date: Fri Sep 4 16:07:27 2015 > > > New Revision: 287465 > > > URL: https://svnweb.freebsd.org/changeset/base/287465 > > > > > > Log: > > > igb(4): Update and fix HW errata > > > - HW errata workaround for IPv6 offload w/ extension headers > > It would be useful to know what is the actual problem here. > > > > > - Edited start of if_igb.c (Device IDs / #includes) to match ixgbe/= ixl > > I'd also prefer if such changes come via separate commits. :-) > > > > > > > > Differential Revision: https://reviews.freebsd.org/D3165 > > > Submitted by: erj > > > MFC after: 1 month > > > Sponsored by: Intel Corporation > > > > > > Modified: > > > head/sys/dev/e1000/if_igb.c > > > head/sys/dev/e1000/if_igb.h > > > > [skip] > > > > Cheers, > > Hiren > > --dRgc669pgRVB2OqT Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJV9Kr5XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/lxScIAIuJYVZ0K0uguGYU6/OQvjCC tDWsiwxLql3OneTcy5tj5jUQA6SVq6RMPFnms2QKNduaa1Bbv+yt9XRCujYeTcOJ 6f3S59TCKi1Su4uITpTzDIkNPkLQ6ng0aAaJZhT4XE8GXkN9kDezOOVmblzDnCmf Cer+aGTXNq4W9f/NcbMI/JSrJkDJyYoH8pRhVPY1j/SG/PQl4dtMpo2VFXorILSR 0xH1VvQlvCKgAWKgYvzWVqVwURbNByZjmuluoj9PS4xb4s6b0Cj8gZvWIiGC/bn+ VQWiOQgc+cGLdCBLiFkvFqtkUBFHTAUeNt2VDCML/fAuIIpqt3xXU7/P4uqf5OY= =K5aS -----END PGP SIGNATURE----- --dRgc669pgRVB2OqT-- From owner-svn-src-head@freebsd.org Sat Sep 12 22:49:35 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48917A020AA; Sat, 12 Sep 2015 22:49:35 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 386B411B3; Sat, 12 Sep 2015 22:49:35 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CMnZew089076; Sat, 12 Sep 2015 22:49:35 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CMnXpH089068; Sat, 12 Sep 2015 22:49:33 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201509122249.t8CMnXpH089068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sat, 12 Sep 2015 22:49:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287726 - in head/sys: conf sparc64/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 22:49:35 -0000 Author: marius Date: Sat Sep 12 22:49:32 2015 New Revision: 287726 URL: https://svnweb.freebsd.org/changeset/base/287726 Log: - Factor out the common and generic parts of the sparc64 host-PCI-bridge drivers into the revived sys/sparc64/pci/ofw_pci.c, previously already serving a similar purpose. This has been done with sun4v in mind, which explains a) the otherwise not that obvious scheme employed and b) why reusing sys/powerpc/ofw/ofw_pci.c was even lesser an option. - Add a workaround for QEMU once again not emulating real machines, in this case by not providing the OFW_PCI_CS_MEM64 range. [1] Submitted by: jhb [1] MFC after: 1 week Added: head/sys/sparc64/pci/ofw_pci.c - copied, changed from r170929, head/sys/sparc64/pci/ofw_pci.c Modified: head/sys/conf/files.sparc64 head/sys/sparc64/pci/fire.c head/sys/sparc64/pci/firereg.h head/sys/sparc64/pci/firevar.h head/sys/sparc64/pci/ofw_pci.h head/sys/sparc64/pci/psycho.c head/sys/sparc64/pci/psychoreg.h head/sys/sparc64/pci/psychovar.h head/sys/sparc64/pci/schizo.c head/sys/sparc64/pci/schizoreg.h head/sys/sparc64/pci/schizovar.h Modified: head/sys/conf/files.sparc64 ============================================================================== --- head/sys/conf/files.sparc64 Sat Sep 12 21:23:24 2015 (r287725) +++ head/sys/conf/files.sparc64 Sat Sep 12 22:49:32 2015 (r287726) @@ -82,6 +82,7 @@ sparc64/isa/isa_dma.c optional isa sparc64/isa/ofw_isa.c optional ebus | isa sparc64/pci/apb.c optional pci sparc64/pci/fire.c optional pci +sparc64/pci/ofw_pci.c optional pci sparc64/pci/ofw_pcib.c optional pci sparc64/pci/ofw_pcib_subr.c optional pci sparc64/pci/ofw_pcibus.c optional pci Modified: head/sys/sparc64/pci/fire.c ============================================================================== --- head/sys/sparc64/pci/fire.c Sat Sep 12 21:23:24 2015 (r287725) +++ head/sys/sparc64/pci/fire.c Sat Sep 12 22:49:32 2015 (r287726) @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -68,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -111,19 +109,14 @@ static driver_filter_t fire_xcb; /* * Methods */ -static bus_activate_resource_t fire_activate_resource; -static bus_adjust_resource_t fire_adjust_resource; static pcib_alloc_msi_t fire_alloc_msi; static pcib_alloc_msix_t fire_alloc_msix; static bus_alloc_resource_t fire_alloc_resource; static device_attach_t fire_attach; -static bus_get_dma_tag_t fire_get_dma_tag; -static ofw_bus_get_node_t fire_get_node; static pcib_map_msi_t fire_map_msi; static pcib_maxslots_t fire_maxslots; static device_probe_t fire_probe; static pcib_read_config_t fire_read_config; -static bus_read_ivar_t fire_read_ivar; static pcib_release_msi_t fire_release_msi; static pcib_release_msix_t fire_release_msix; static pcib_route_interrupt_t fire_route_interrupt; @@ -140,15 +133,15 @@ static device_method_t fire_methods[] = DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ - DEVMETHOD(bus_read_ivar, fire_read_ivar), + DEVMETHOD(bus_read_ivar, ofw_pci_read_ivar), DEVMETHOD(bus_setup_intr, fire_setup_intr), DEVMETHOD(bus_teardown_intr, fire_teardown_intr), DEVMETHOD(bus_alloc_resource, fire_alloc_resource), - DEVMETHOD(bus_activate_resource, fire_activate_resource), + DEVMETHOD(bus_activate_resource, ofw_pci_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_adjust_resource, fire_adjust_resource), + DEVMETHOD(bus_adjust_resource, ofw_pci_adjust_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_get_dma_tag, fire_get_dma_tag), + DEVMETHOD(bus_get_dma_tag, ofw_pci_get_dma_tag), /* pcib interface */ DEVMETHOD(pcib_maxslots, fire_maxslots), @@ -162,7 +155,7 @@ static device_method_t fire_methods[] = DEVMETHOD(pcib_map_msi, fire_map_msi), /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_node, fire_get_node), + DEVMETHOD(ofw_bus_get_node, ofw_pci_get_node), DEVMETHOD_END }; @@ -296,7 +289,7 @@ fire_attach(device_t dev) struct ofw_pci_msi_eq_to_devino msi_eq_to_devino; struct fire_msiqarg *fmqa; struct timecounter *tc; - struct ofw_pci_ranges *range; + bus_dma_tag_t dmat; uint64_t ino_bitmap, val; phandle_t node; uint32_t prop, prop_array[2]; @@ -310,7 +303,6 @@ fire_attach(device_t dev) mode = desc->fd_mode; sc->sc_dev = dev; - sc->sc_node = node; sc->sc_mode = mode; sc->sc_flags = 0; @@ -715,79 +707,21 @@ fire_attach(device_t dev) sc->sc_is.is_bushandle = rman_get_bushandle(sc->sc_mem_res[FIRE_PCI]); sc->sc_is.is_iommu = FO_PCI_MMU; val = FIRE_PCI_READ_8(sc, FO_PCI_MMU + IMR_CTL); - iommu_init(device_get_nameunit(sc->sc_dev), &sc->sc_is, 7, -1, 0); + iommu_init(device_get_nameunit(dev), &sc->sc_is, 7, -1, 0); #ifdef FIRE_DEBUG device_printf(dev, "FO_PCI_MMU + IMR_CTL 0x%016llx -> 0x%016llx\n", (long long unsigned)val, (long long unsigned)sc->sc_is.is_cr); #endif - - /* Initialize memory and I/O rmans. */ - sc->sc_pci_io_rman.rm_type = RMAN_ARRAY; - sc->sc_pci_io_rman.rm_descr = "Fire PCI I/O Ports"; - if (rman_init(&sc->sc_pci_io_rman) != 0 || - rman_manage_region(&sc->sc_pci_io_rman, 0, FO_IO_SIZE) != 0) - panic("%s: failed to set up I/O rman", __func__); - sc->sc_pci_mem_rman.rm_type = RMAN_ARRAY; - sc->sc_pci_mem_rman.rm_descr = "Fire PCI Memory"; - if (rman_init(&sc->sc_pci_mem_rman) != 0 || - rman_manage_region(&sc->sc_pci_mem_rman, 0, FO_MEM_SIZE) != 0) - panic("%s: failed to set up memory rman", __func__); - - i = OF_getprop_alloc(node, "ranges", sizeof(*range), (void **)&range); - /* - * Make sure that the expected ranges are present. The - * OFW_PCI_CS_MEM64 one is not currently used though. - */ - if (i != FIRE_NRANGE) - panic("%s: unsupported number of ranges", __func__); - /* - * Find the addresses of the various bus spaces. - * There should not be multiple ones of one kind. - * The physical start addresses of the ranges are the configuration, - * memory and I/O handles. - */ - for (i = 0; i < FIRE_NRANGE; i++) { - j = OFW_PCI_RANGE_CS(&range[i]); - if (sc->sc_pci_bh[j] != 0) - panic("%s: duplicate range for space %d", - __func__, j); - sc->sc_pci_bh[j] = OFW_PCI_RANGE_PHYS(&range[i]); - } - free(range, M_OFWPROP); - - /* Allocate our tags. */ - sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, PCI_IO_BUS_SPACE); - if (sc->sc_pci_iot == NULL) - panic("%s: could not allocate PCI I/O tag", __func__); - sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, PCI_CONFIG_BUS_SPACE); - if (sc->sc_pci_cfgt == NULL) - panic("%s: could not allocate PCI configuration space tag", - __func__); + /* Create our DMA tag. */ if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0x100000000, sc->sc_is.is_pmaxaddr, ~0, NULL, NULL, sc->sc_is.is_pmaxaddr, - 0xff, 0xffffffff, 0, NULL, NULL, &sc->sc_pci_dmat) != 0) + 0xff, 0xffffffff, 0, NULL, NULL, &dmat) != 0) panic("%s: could not create PCI DMA tag", __func__); - /* Customize the tag. */ - sc->sc_pci_dmat->dt_cookie = &sc->sc_is; - sc->sc_pci_dmat->dt_mt = &sc->sc_dma_methods; + dmat->dt_cookie = &sc->sc_is; + dmat->dt_mt = &sc->sc_dma_methods; - /* - * Get the bus range from the firmware. - * NB: Neither Fire nor Oberon support PCI bus reenumeration. - */ - i = OF_getprop(node, "bus-range", (void *)prop_array, - sizeof(prop_array)); - if (i == -1) - panic("%s: could not get bus-range", __func__); - if (i != sizeof(prop_array)) - panic("%s: broken bus-range (%d)", __func__, i); - sc->sc_pci_secbus = prop_array[0]; - sc->sc_pci_subbus = prop_array[1]; - if (bootverbose != 0) - device_printf(dev, "bus range %u to %u; PCI bus %d\n", - sc->sc_pci_secbus, sc->sc_pci_subbus, sc->sc_pci_secbus); - - ofw_bus_setup_iinfo(node, &sc->sc_pci_iinfo, sizeof(ofw_pci_intr_t)); + if (ofw_pci_attach_common(dev, dmat, FO_IO_SIZE, FO_MEM_SIZE) != 0) + panic("%s: ofw_pci_attach_common() failed", __func__); #define FIRE_SYSCTL_ADD_UINT(name, arg, desc) \ SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), \ @@ -1390,136 +1324,44 @@ static uint32_t fire_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, int width) { - struct fire_softc *sc; - bus_space_handle_t bh; - u_long offset = 0; - uint32_t r, wrd; - int i; - uint16_t shrt; - uint8_t byte; - - sc = device_get_softc(dev); - if (bus < sc->sc_pci_secbus || bus > sc->sc_pci_subbus || - slot > PCI_SLOTMAX || func > PCI_FUNCMAX || reg > PCIE_REGMAX) - return (-1); - - offset = FO_CONF_OFF(bus, slot, func, reg); - bh = sc->sc_pci_bh[OFW_PCI_CS_CONFIG]; - switch (width) { - case 1: - i = bus_space_peek_1(sc->sc_pci_cfgt, bh, offset, &byte); - r = byte; - break; - case 2: - i = bus_space_peek_2(sc->sc_pci_cfgt, bh, offset, &shrt); - r = shrt; - break; - case 4: - i = bus_space_peek_4(sc->sc_pci_cfgt, bh, offset, &wrd); - r = wrd; - break; - default: - panic("%s: bad width", __func__); - /* NOTREACHED */ - } - if (i) { -#ifdef FIRE_DEBUG - printf("%s: read data error reading: %d.%d.%d: 0x%x\n", - __func__, bus, slot, func, reg); -#endif - r = -1; - } - return (r); + return (ofw_pci_read_config_common(dev, PCIE_REGMAX, FO_CONF_OFF(bus, + slot, func, reg), bus, slot, func, reg, width)); } static void fire_write_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, uint32_t val, int width) { - struct fire_softc *sc; - bus_space_handle_t bh; - u_long offset = 0; - - sc = device_get_softc(dev); - if (bus < sc->sc_pci_secbus || bus > sc->sc_pci_subbus || - slot > PCI_SLOTMAX || func > PCI_FUNCMAX || reg > PCIE_REGMAX) - return; - offset = FO_CONF_OFF(bus, slot, func, reg); - bh = sc->sc_pci_bh[OFW_PCI_CS_CONFIG]; - switch (width) { - case 1: - bus_space_write_1(sc->sc_pci_cfgt, bh, offset, val); - break; - case 2: - bus_space_write_2(sc->sc_pci_cfgt, bh, offset, val); - break; - case 4: - bus_space_write_4(sc->sc_pci_cfgt, bh, offset, val); - break; - default: - panic("%s: bad width", __func__); - /* NOTREACHED */ - } + ofw_pci_write_config_common(dev, PCIE_REGMAX, FO_CONF_OFF(bus, slot, + func, reg), bus, slot, func, reg, val, width); } static int fire_route_interrupt(device_t bridge, device_t dev, int pin) { - struct fire_softc *sc; - struct ofw_pci_register reg; - ofw_pci_intr_t pintr, mintr; - - sc = device_get_softc(bridge); - pintr = pin; - if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, - ®, sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), - NULL) != 0) - return (mintr); - - device_printf(bridge, "could not route pin %d for device %d.%d\n", - pin, pci_get_slot(dev), pci_get_function(dev)); - return (PCI_INVALID_IRQ); -} - -static int -fire_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) -{ - struct fire_softc *sc; + ofw_pci_intr_t mintr; - sc = device_get_softc(dev); - switch (which) { - case PCIB_IVAR_DOMAIN: - *result = device_get_unit(dev); - return (0); - case PCIB_IVAR_BUS: - *result = sc->sc_pci_secbus; - return (0); - } - return (ENOENT); + mintr = ofw_pci_route_interrupt_common(bridge, dev, pin); + if (!PCI_INTERRUPT_VALID(mintr)) + device_printf(bridge, + "could not route pin %d for device %d.%d\n", + pin, pci_get_slot(dev), pci_get_function(dev)); + return (mintr); } static void fire_dmamap_sync(bus_dma_tag_t dt __unused, bus_dmamap_t map, bus_dmasync_op_t op) { - static u_char buf[VIS_BLOCKSIZE] __aligned(VIS_BLOCKSIZE); - register_t reg, s; if ((map->dm_flags & DMF_LOADED) == 0) return; - if ((op & BUS_DMASYNC_POSTREAD) != 0) { - s = intr_disable(); - reg = rd(fprs); - wr(fprs, reg | FPRS_FEF, 0); - __asm __volatile("stda %%f0, [%0] %1" - : : "r" (buf), "n" (ASI_BLK_COMMIT_S)); - membar(Sync); - wr(fprs, reg, 0); - intr_restore(s); - } else if ((op & BUS_DMASYNC_PREWRITE) != 0) + if ((op & BUS_DMASYNC_POSTREAD) != 0) + ofw_pci_dmamap_sync_stst_order_common(); + else if ((op & BUS_DMASYNC_PREWRITE) != 0) membar(Sync); } @@ -2013,121 +1855,13 @@ fire_alloc_resource(device_t bus, device u_long start, u_long end, u_long count, u_int flags) { struct fire_softc *sc; - struct resource *rv; - struct rman *rm; - sc = device_get_softc(bus); - switch (type) { - case SYS_RES_IRQ: - /* - * XXX: Don't accept blank ranges for now, only single - * interrupts. The other case should not happen with - * the MI PCI code... - * XXX: This may return a resource that is out of the - * range that was specified. Is this correct...? - */ - if (start != end) - panic("%s: XXX: interrupt range", __func__); - if (*rid == 0) - start = end = INTMAP_VEC(sc->sc_ign, end); - return (bus_generic_alloc_resource(bus, child, type, rid, - start, end, count, flags)); - case SYS_RES_MEMORY: - rm = &sc->sc_pci_mem_rman; - break; - case SYS_RES_IOPORT: - rm = &sc->sc_pci_io_rman; - break; - default: - return (NULL); - } - - rv = rman_reserve_resource(rm, start, end, count, flags & ~RF_ACTIVE, - child); - if (rv == NULL) - return (NULL); - rman_set_rid(rv, *rid); - - if ((flags & RF_ACTIVE) != 0 && bus_activate_resource(child, type, - *rid, rv) != 0) { - rman_release_resource(rv); - return (NULL); + if (type == SYS_RES_IRQ && *rid == 0) { + sc = device_get_softc(bus); + start = end = INTMAP_VEC(sc->sc_ign, end); } - return (rv); -} - -static int -fire_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - struct fire_softc *sc; - struct bus_space_tag *tag; - - sc = device_get_softc(bus); - switch (type) { - case SYS_RES_IRQ: - return (bus_generic_activate_resource(bus, child, type, rid, - r)); - case SYS_RES_MEMORY: - tag = sparc64_alloc_bus_tag(r, PCI_MEMORY_BUS_SPACE); - if (tag == NULL) - return (ENOMEM); - rman_set_bustag(r, tag); - rman_set_bushandle(r, sc->sc_pci_bh[OFW_PCI_CS_MEM32] + - rman_get_start(r)); - break; - case SYS_RES_IOPORT: - rman_set_bustag(r, sc->sc_pci_iot); - rman_set_bushandle(r, sc->sc_pci_bh[OFW_PCI_CS_IO] + - rman_get_start(r)); - break; - } - return (rman_activate_resource(r)); -} - -static int -fire_adjust_resource(device_t bus, device_t child, int type, - struct resource *r, u_long start, u_long end) -{ - struct fire_softc *sc; - struct rman *rm; - - sc = device_get_softc(bus); - switch (type) { - case SYS_RES_IRQ: - return (bus_generic_adjust_resource(bus, child, type, r, - start, end)); - case SYS_RES_MEMORY: - rm = &sc->sc_pci_mem_rman; - break; - case SYS_RES_IOPORT: - rm = &sc->sc_pci_io_rman; - break; - default: - return (EINVAL); - } - if (rman_is_region_manager(r, rm) == 0) - return (EINVAL); - return (rman_adjust_resource(r, start, end)); -} - -static bus_dma_tag_t -fire_get_dma_tag(device_t bus, device_t child __unused) -{ - struct fire_softc *sc; - - sc = device_get_softc(bus); - return (sc->sc_pci_dmat); -} - -static phandle_t -fire_get_node(device_t bus, device_t child __unused) -{ - struct fire_softc *sc; - - sc = device_get_softc(bus); - /* We only have one child, the PCI bus, which needs our own node. */ - return (sc->sc_node); + return (ofw_pci_alloc_resource(bus, child, type, rid, start, end, + count, flags)); } static u_int Modified: head/sys/sparc64/pci/firereg.h ============================================================================== --- head/sys/sparc64/pci/firereg.h Sat Sep 12 21:23:24 2015 (r287725) +++ head/sys/sparc64/pci/firereg.h Sat Sep 12 22:49:32 2015 (r287726) @@ -30,7 +30,6 @@ #define _SPARC64_PCI_FIREREG_H_ #define FIRE_NINTR 3 /* 2 OFW + 1 MSIq */ -#define FIRE_NRANGE 4 #define FIRE_NREG 2 #define FIRE_PCI 0 Modified: head/sys/sparc64/pci/firevar.h ============================================================================== --- head/sys/sparc64/pci/firevar.h Sat Sep 12 21:23:24 2015 (r287725) +++ head/sys/sparc64/pci/firevar.h Sat Sep 12 22:49:32 2015 (r287726) @@ -32,6 +32,12 @@ #define _SPARC64_PCI_FIREVAR_H_ struct fire_softc { + /* + * This is here so that we can hook up the common bus interface + * methods in ofw_pci.c directly. + */ + struct ofw_pci_softc sc_ops; + struct iommu_state sc_is; struct bus_dma_methods sc_dma_methods; @@ -42,13 +48,6 @@ struct fire_softc { struct resource *sc_irq_res[FIRE_NINTR]; void *sc_ihand[FIRE_NINTR]; - struct rman sc_pci_mem_rman; - struct rman sc_pci_io_rman; - bus_space_handle_t sc_pci_bh[FIRE_NRANGE]; - bus_space_tag_t sc_pci_cfgt; - bus_space_tag_t sc_pci_iot; - bus_dma_tag_t sc_pci_dmat; - device_t sc_dev; uint64_t *sc_msiq; @@ -66,8 +65,6 @@ struct fire_softc { uint32_t sc_msiq_first; uint32_t sc_msiq_ino_first; - phandle_t sc_node; - u_int sc_mode; #define FIRE_MODE_FIRE 0 #define FIRE_MODE_OBERON 1 @@ -87,11 +84,6 @@ struct fire_softc { uint32_t sc_stats_tlu_oe_rx_err; uint32_t sc_stats_tlu_oe_tx_err; uint32_t sc_stats_ubc_dmardue; - - uint8_t sc_pci_secbus; - uint8_t sc_pci_subbus; - - struct ofw_bus_iinfo sc_pci_iinfo; }; #endif /* !_SPARC64_PCI_FIREVAR_H_ */ Copied and modified: head/sys/sparc64/pci/ofw_pci.c (from r170929, head/sys/sparc64/pci/ofw_pci.c) ============================================================================== --- head/sys/sparc64/pci/ofw_pci.c Mon Jun 18 21:46:07 2007 (r170929, copy source) +++ head/sys/sparc64/pci/ofw_pci.c Sat Sep 12 22:49:32 2015 (r287726) @@ -1,6 +1,7 @@ /*- * Copyright (c) 1999, 2000 Matthew R. Green * Copyright (c) 2001 - 2003 by Thomas Moestl + * Copyright (c) 2005 - 2015 by Marius Strobl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,42 +36,371 @@ __FBSDID("$FreeBSD$"); #include "opt_ofw_pci.h" #include -#include #include #include +#include +#include +#include +#include #include +#include +#include + +#include #include +#include +#include +#include +#include #include -static uint8_t pci_bus_cnt; -static phandle_t *pci_bus_map; -static int pci_bus_map_sz; - -#define PCI_BUS_MAP_INC 10 - -uint8_t -ofw_pci_alloc_busno(phandle_t node) -{ - phandle_t *om; - int osz; - uint8_t n; - - n = pci_bus_cnt++; - /* Establish a mapping between bus numbers and device nodes. */ - if (n >= pci_bus_map_sz) { - osz = pci_bus_map_sz; - om = pci_bus_map; - pci_bus_map_sz = n + PCI_BUS_MAP_INC; - pci_bus_map = malloc(sizeof(*pci_bus_map) * pci_bus_map_sz, - M_DEVBUF, M_WAITOK | M_ZERO); - if (om != NULL) { - bcopy(om, pci_bus_map, sizeof(*om) * osz); - free(om, M_DEVBUF); +int +ofw_pci_attach_common(device_t dev, bus_dma_tag_t dmat, u_long iosize, + u_long memsize) +{ + struct ofw_pci_softc *sc; + struct ofw_pci_ranges *range; + phandle_t node; + uint32_t prop_array[2]; + u_int i, j, nrange; + + sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); + sc->sc_node = node; + sc->sc_pci_dmat = dmat; + + /* Initialize memory and I/O rmans. */ + sc->sc_pci_io_rman.rm_type = RMAN_ARRAY; + sc->sc_pci_io_rman.rm_descr = "PCI I/O Ports"; + if (rman_init(&sc->sc_pci_io_rman) != 0 || + rman_manage_region(&sc->sc_pci_io_rman, 0, iosize) != 0) { + device_printf(dev, "failed to set up I/O rman\n"); + return (ENXIO); + } + sc->sc_pci_mem_rman.rm_type = RMAN_ARRAY; + sc->sc_pci_mem_rman.rm_descr = "PCI Memory"; + if (rman_init(&sc->sc_pci_mem_rman) != 0 || + rman_manage_region(&sc->sc_pci_mem_rman, 0, memsize) != 0) { + device_printf(dev, "failed to set up memory rman\n"); + return (ENXIO); + } + + /* + * Find the addresses of the various bus spaces. The physical + * start addresses of the ranges are the configuration, I/O and + * memory handles. There should not be multiple ones of one kind. + */ + nrange = OF_getprop_alloc(node, "ranges", sizeof(*range), + (void **)&range); + for (i = 0; i < nrange; i++) { + j = OFW_PCI_RANGE_CS(&range[i]); + if (sc->sc_pci_bh[j] != 0) { + device_printf(dev, "duplicate range for space %d\n", + j); + free(range, M_OFWPROP); + return (EINVAL); } + sc->sc_pci_bh[j] = OFW_PCI_RANGE_PHYS(&range[i]); + } + free(range, M_OFWPROP); + + /* + * Make sure that the expected ranges are actually present. + * The OFW_PCI_CS_MEM64 one is not currently used. + */ + if (sc->sc_pci_bh[OFW_PCI_CS_CONFIG] == 0) { + device_printf(dev, "missing CONFIG range\n"); + return (ENXIO); + } + if (sc->sc_pci_bh[OFW_PCI_CS_IO] == 0) { + device_printf(dev, "missing IO range\n"); + return (ENXIO); + } + if (sc->sc_pci_bh[OFW_PCI_CS_MEM32] == 0) { + device_printf(dev, "missing MEM32 range\n"); + return (ENXIO); + } + + /* Allocate our tags. */ + sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, PCI_IO_BUS_SPACE); + if (sc->sc_pci_iot == NULL) { + device_printf(dev, "could not allocate PCI I/O tag\n"); + return (ENXIO); + } + sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, PCI_CONFIG_BUS_SPACE); + if (sc->sc_pci_cfgt == NULL) { + device_printf(dev, + "could not allocate PCI configuration space tag\n"); + return (ENXIO); + } + + /* + * Get the bus range from the firmware. + */ + i = OF_getprop(node, "bus-range", (void *)prop_array, + sizeof(prop_array)); + if (i == -1) { + device_printf(dev, "could not get bus-range\n"); + return (ENXIO); + } + if (i != sizeof(prop_array)) { + device_printf(dev, "broken bus-range (%d)", i); + return (EINVAL); + } + sc->sc_pci_secbus = prop_array[0]; + sc->sc_pci_subbus = prop_array[1]; + if (bootverbose != 0) + device_printf(dev, "bus range %u to %u; PCI bus %d\n", + sc->sc_pci_secbus, sc->sc_pci_subbus, sc->sc_pci_secbus); + + ofw_bus_setup_iinfo(node, &sc->sc_pci_iinfo, sizeof(ofw_pci_intr_t)); + + return (0); +} + +uint32_t +ofw_pci_read_config_common(device_t dev, u_int regmax, u_long offset, + u_int bus, u_int slot, u_int func, u_int reg, int width) +{ + struct ofw_pci_softc *sc; + bus_space_handle_t bh; + uint32_t r, wrd; + int i; + uint16_t shrt; + uint8_t byte; + + sc = device_get_softc(dev); + if (bus < sc->sc_pci_secbus || bus > sc->sc_pci_subbus || + slot > PCI_SLOTMAX || func > PCI_FUNCMAX || reg > regmax) + return (-1); + + bh = sc->sc_pci_bh[OFW_PCI_CS_CONFIG]; + switch (width) { + case 1: + i = bus_space_peek_1(sc->sc_pci_cfgt, bh, offset, &byte); + r = byte; + break; + case 2: + i = bus_space_peek_2(sc->sc_pci_cfgt, bh, offset, &shrt); + r = shrt; + break; + case 4: + i = bus_space_peek_4(sc->sc_pci_cfgt, bh, offset, &wrd); + r = wrd; + break; + default: + panic("%s: bad width %d", __func__, width); + /* NOTREACHED */ + } + + if (i) { +#ifdef OFW_PCI_DEBUG + printf("%s: read data error reading: %d.%d.%d: 0x%x\n", + __func__, bus, slot, func, reg); +#endif + r = -1; + } + return (r); +} + +void +ofw_pci_write_config_common(device_t dev, u_int regmax, u_long offset, + u_int bus, u_int slot, u_int func, u_int reg, uint32_t val, int width) +{ + struct ofw_pci_softc *sc; + bus_space_handle_t bh; + + sc = device_get_softc(dev); + if (bus < sc->sc_pci_secbus || bus > sc->sc_pci_subbus || + slot > PCI_SLOTMAX || func > PCI_FUNCMAX || reg > regmax) + return; + + bh = sc->sc_pci_bh[OFW_PCI_CS_CONFIG]; + switch (width) { + case 1: + bus_space_write_1(sc->sc_pci_cfgt, bh, offset, val); + break; + case 2: + bus_space_write_2(sc->sc_pci_cfgt, bh, offset, val); + break; + case 4: + bus_space_write_4(sc->sc_pci_cfgt, bh, offset, val); + break; + default: + panic("%s: bad width %d", __func__, width); + /* NOTREACHED */ + } +} + +ofw_pci_intr_t +ofw_pci_route_interrupt_common(device_t bridge, device_t dev, int pin) +{ + struct ofw_pci_softc *sc; + struct ofw_pci_register reg; + ofw_pci_intr_t pintr, mintr; + + sc = device_get_softc(bridge); + pintr = pin; + if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, + ®, sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), + NULL) != 0) + return (mintr); + return (PCI_INVALID_IRQ); +} + +void +ofw_pci_dmamap_sync_stst_order_common(void) +{ + static u_char buf[VIS_BLOCKSIZE] __aligned(VIS_BLOCKSIZE); + register_t reg, s; + + s = intr_disable(); + reg = rd(fprs); + wr(fprs, reg | FPRS_FEF, 0); + __asm __volatile("stda %%f0, [%0] %1" + : : "r" (buf), "n" (ASI_BLK_COMMIT_S)); + membar(Sync); + wr(fprs, reg, 0); + intr_restore(s); +} + +int +ofw_pci_read_ivar(device_t dev, device_t child __unused, int which, + uintptr_t *result) +{ + struct ofw_pci_softc *sc; + + switch (which) { + case PCIB_IVAR_DOMAIN: + *result = device_get_unit(dev); + return (0); + case PCIB_IVAR_BUS: + sc = device_get_softc(dev); + *result = sc->sc_pci_secbus; + return (0); + } + return (ENOENT); +} + +struct resource * +ofw_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + struct ofw_pci_softc *sc; + struct resource *rv; + struct rman *rm; + + sc = device_get_softc(bus); + switch (type) { + case SYS_RES_IRQ: + /* + * XXX: Don't accept blank ranges for now, only single + * interrupts. The other case should not happen with + * the MI PCI code ... + * XXX: This may return a resource that is out of the + * range that was specified. Is this correct ...? + */ + if (start != end) + panic("%s: XXX: interrupt range", __func__); + return (bus_generic_alloc_resource(bus, child, type, rid, + start, end, count, flags)); + case SYS_RES_MEMORY: + rm = &sc->sc_pci_mem_rman; + break; + case SYS_RES_IOPORT: + rm = &sc->sc_pci_io_rman; + break; + default: + return (NULL); + } + + rv = rman_reserve_resource(rm, start, end, count, flags & ~RF_ACTIVE, + child); + if (rv == NULL) + return (NULL); + rman_set_rid(rv, *rid); + + if ((flags & RF_ACTIVE) != 0 && bus_activate_resource(child, type, + *rid, rv) != 0) { + rman_release_resource(rv); + return (NULL); } - pci_bus_map[n] = node; - return (n); + return (rv); +} + +int +ofw_pci_activate_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + struct ofw_pci_softc *sc; + struct bus_space_tag *tag; + + sc = device_get_softc(bus); + switch (type) { + case SYS_RES_IRQ: + return (bus_generic_activate_resource(bus, child, type, rid, + r)); + case SYS_RES_MEMORY: + tag = sparc64_alloc_bus_tag(r, PCI_MEMORY_BUS_SPACE); + if (tag == NULL) + return (ENOMEM); + rman_set_bustag(r, tag); + rman_set_bushandle(r, sc->sc_pci_bh[OFW_PCI_CS_MEM32] + + rman_get_start(r)); + break; + case SYS_RES_IOPORT: + rman_set_bustag(r, sc->sc_pci_iot); + rman_set_bushandle(r, sc->sc_pci_bh[OFW_PCI_CS_IO] + + rman_get_start(r)); + break; + } + return (rman_activate_resource(r)); +} + +int +ofw_pci_adjust_resource(device_t bus, device_t child, int type, + struct resource *r, u_long start, u_long end) +{ + struct ofw_pci_softc *sc; + struct rman *rm; + + sc = device_get_softc(bus); + switch (type) { + case SYS_RES_IRQ: + return (bus_generic_adjust_resource(bus, child, type, r, + start, end)); + case SYS_RES_MEMORY: + rm = &sc->sc_pci_mem_rman; + break; + case SYS_RES_IOPORT: + rm = &sc->sc_pci_io_rman; + break; + default: + return (EINVAL); + } + if (rman_is_region_manager(r, rm) == 0) + return (EINVAL); + return (rman_adjust_resource(r, start, end)); +} + +bus_dma_tag_t +ofw_pci_get_dma_tag(device_t bus, device_t child __unused) +{ + struct ofw_pci_softc *sc; + + sc = device_get_softc(bus); + return (sc->sc_pci_dmat); +} + +phandle_t +ofw_pci_get_node(device_t bus, device_t child __unused) +{ + struct ofw_pci_softc *sc; + + sc = device_get_softc(bus); + /* We only have one child, the PCI bus, which needs our own node. */ + return (sc->sc_node); } Modified: head/sys/sparc64/pci/ofw_pci.h ============================================================================== --- head/sys/sparc64/pci/ofw_pci.h Sat Sep 12 21:23:24 2015 (r287725) +++ head/sys/sparc64/pci/ofw_pci.h Sat Sep 12 22:49:32 2015 (r287726) @@ -62,6 +62,8 @@ #ifndef _SPARC64_PCI_OFW_PCI_H_ #define _SPARC64_PCI_OFW_PCI_H_ +#include + #include #include "ofw_pci_if.h" @@ -73,6 +75,7 @@ typedef uint32_t ofw_pci_intr_t; #define OFW_PCI_CS_IO 0x01 #define OFW_PCI_CS_MEM32 0x02 #define OFW_PCI_CS_MEM64 0x03 +#define OFW_PCI_NUM_CS 4 /* OFW device types */ #define OFW_TYPE_PCI "pci" @@ -124,4 +127,44 @@ struct ofw_pci_ranges { /* default values */ #define OFW_PCI_LATENCY 64 +/* + * Common and generic parts of host-PCI-bridge support + */ + +struct ofw_pci_softc { + struct rman sc_pci_mem_rman; + struct rman sc_pci_io_rman; + + bus_space_handle_t sc_pci_bh[OFW_PCI_NUM_CS]; + bus_space_tag_t sc_pci_cfgt; + bus_space_tag_t sc_pci_iot; + bus_dma_tag_t sc_pci_dmat; + + struct ofw_bus_iinfo sc_pci_iinfo; + + phandle_t sc_node; + + uint8_t sc_pci_secbus; + uint8_t sc_pci_subbus; +}; + +int ofw_pci_attach_common(device_t dev, bus_dma_tag_t dmat, u_long iosize, + u_long memsize); +uint32_t ofw_pci_read_config_common(device_t dev, u_int regmax, u_long offset, + u_int bus, u_int slot, u_int func, u_int reg, int width); +void ofw_pci_write_config_common(device_t dev, u_int regmax, u_long offset, + u_int bus, u_int slot, u_int func, u_int reg, uint32_t val, int width); +ofw_pci_intr_t ofw_pci_route_interrupt_common(device_t bridge, device_t dev, + int pin); + +void ofw_pci_dmamap_sync_stst_order_common(void); + +bus_activate_resource_t ofw_pci_activate_resource; +bus_adjust_resource_t ofw_pci_adjust_resource; +bus_alloc_resource_t ofw_pci_alloc_resource; +bus_get_dma_tag_t ofw_pci_get_dma_tag; +bus_read_ivar_t ofw_pci_read_ivar; + +ofw_bus_get_node_t ofw_pci_get_node; + #endif /* ! _SPARC64_PCI_OFW_PCI_H_ */ Modified: head/sys/sparc64/pci/psycho.c ============================================================================== --- head/sys/sparc64/pci/psycho.c Sat Sep 12 21:23:24 2015 (r287725) +++ head/sys/sparc64/pci/psycho.c Sat Sep 12 22:49:32 2015 (r287726) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Sep 12 23:10:35 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF876A02A0B; Sat, 12 Sep 2015 23:10:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C528D1A61; Sat, 12 Sep 2015 23:10:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8CNAZVF097718; Sat, 12 Sep 2015 23:10:35 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8CNAZVj097717; Sat, 12 Sep 2015 23:10:35 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509122310.t8CNAZVj097717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 12 Sep 2015 23:10:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287727 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 23:10:36 -0000 Author: adrian Date: Sat Sep 12 23:10:34 2015 New Revision: 287727 URL: https://svnweb.freebsd.org/changeset/base/287727 Log: if_rsu debug fixes: * use an ath/iwn style debug bitmap - it's still global rather than per-device, but it's better than debug levels * disable bgscan - it just makes things unstable/unpredictable for now. Tested: * if_rsu - RTL8712 cut 3, STA mode Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Sat Sep 12 22:49:32 2015 (r287726) +++ head/sys/dev/usb/wlan/if_rsu.c Sat Sep 12 23:10:34 2015 (r287727) @@ -26,6 +26,7 @@ __FBSDID("$FreeBSD$"); * o h/w crypto * o hostap / ibss / mesh */ + #include #include #include @@ -74,8 +75,27 @@ static int rsu_debug = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, rsu, CTLFLAG_RW, 0, "USB rsu"); SYSCTL_INT(_hw_usb_rsu, OID_AUTO, debug, CTLFLAG_RWTUN, &rsu_debug, 0, "Debug level"); +#define RSU_DPRINTF(_sc, _flg, ...) \ + do \ + if (((_flg) == (RSU_DEBUG_ANY)) || (rsu_debug & (_flg))) \ + device_printf((_sc)->sc_dev, __VA_ARGS__); \ + while (0) +#else +#define RSU_DPRINTF(_sc, _flg, ...) #endif +#define RSU_DEBUG_ANY 0xffffffff +#define RSU_DEBUG_TX 0x00000001 +#define RSU_DEBUG_RX 0x00000002 +#define RSU_DEBUG_RESET 0x00000004 +#define RSU_DEBUG_CALIB 0x00000008 +#define RSU_DEBUG_STATE 0x00000010 +#define RSU_DEBUG_SCAN 0x00000020 +#define RSU_DEBUG_FWCMD 0x00000040 +#define RSU_DEBUG_TXDONE 0x00000080 +#define RSU_DEBUG_FW 0x00000100 +#define RSU_DEBUG_FWDBG 0x00000200 + static const STRUCT_USB_HOST_ID rsu_devs[] = { #define RSU_HT_NOT_SUPPORTED 0 #define RSU_HT_SUPPORTED 1 @@ -342,7 +362,9 @@ rsu_attach(device_t self) /* Set device capabilities. */ ic->ic_caps = IEEE80211_C_STA | /* station mode */ +#if 0 IEEE80211_C_BGSCAN | /* Background scan. */ +#endif IEEE80211_C_SHPREAMBLE | /* Short preamble supported. */ IEEE80211_C_SHSLOT | /* Short slot time supported. */ IEEE80211_C_WPA; /* WPA/RSN. */ @@ -866,7 +888,9 @@ rsu_fw_cmd(struct rsu_softc *sc, uint8_t /* Copy command payload. */ memcpy(&cmd[1], buf, len); - DPRINTFN(2, "Tx cmd code=0x%x len=0x%x\n", code, cmdsz); + RSU_DPRINTF(sc, RSU_DEBUG_TX, + "%s: Tx cmd code=0x%x len=0x%x\n", + __func__, code, cmdsz); data->buflen = xferlen; STAILQ_INSERT_TAIL(&sc->sc_tx_pending[which], data, next); usbd_transfer_start(sc->sc_xfer[which]); @@ -881,7 +905,8 @@ rsu_calib_task(void *arg, int pending __ struct rsu_softc *sc = arg; uint32_t reg; - DPRINTFN(6, "running calibration task\n"); + RSU_DPRINTF(sc, RSU_DEBUG_CALIB, "%s: running calibration task\n", + __func__); RSU_LOCK(sc); #ifdef notyet @@ -897,7 +922,8 @@ rsu_calib_task(void *arg, int pending __ /* Read current signal level. */ if (rsu_fw_iocmd(sc, 0xf4000001) == 0) { reg = rsu_read_4(sc, R92S_IOCMD_DATA); - DPRINTFN(8, "RSSI=%d%%\n", reg >> 4); + RSU_DPRINTF(sc, RSU_DEBUG_CALIB, "%s: RSSI=%d%%\n", + __func__, reg >> 4); } if (sc->sc_calibrating) taskqueue_enqueue_timeout(taskqueue_thread, &sc->calib_task, hz); @@ -916,7 +942,9 @@ rsu_newstate(struct ieee80211vap *vap, e int error, startcal = 0; ostate = vap->iv_state; - DPRINTF("%s -> %s\n", ieee80211_state_name[ostate], + RSU_DPRINTF(sc, RSU_DEBUG_STATE, "%s: %s -> %s\n", + __func__, + ieee80211_state_name[ostate], ieee80211_state_name[nstate]); IEEE80211_UNLOCK(ic); @@ -1039,7 +1067,9 @@ rsu_join_bss(struct rsu_softc *sc, struc /* Let the FW decide the opmode based on the capinfo field. */ opmode = NDIS802_11AUTOUNKNOWN; - DPRINTF("setting operating mode to %d\n", opmode); + RSU_DPRINTF(sc, RSU_DEBUG_RESET, + "%s: setting operating mode to %d\n", + __func__, opmode); error = rsu_fw_cmd(sc, R92S_CMD_SET_OPMODE, &opmode, sizeof(opmode)); if (error != 0) return (error); @@ -1050,7 +1080,9 @@ rsu_join_bss(struct rsu_softc *sc, struc auth.dot1x = (ni->ni_authmode == IEEE80211_AUTH_8021X); } else auth.mode = R92S_AUTHMODE_OPEN; - DPRINTF("setting auth mode to %d\n", auth.mode); + RSU_DPRINTF(sc, RSU_DEBUG_RESET, + "%s: setting auth mode to %d\n", + __func__, auth.mode); error = rsu_fw_cmd(sc, R92S_CMD_SET_AUTH, &auth, sizeof(auth)); if (error != 0) return (error); @@ -1071,6 +1103,7 @@ rsu_join_bss(struct rsu_softc *sc, struc bss->config.bintval = htole32(ni->ni_intval); bss->config.dsconfig = htole32(ieee80211_chan2ieee(ic, ni->ni_chan)); bss->inframode = htole32(NDIS802_11INFRASTRUCTURE); + /* XXX verify how this is supposed to look! */ memcpy(bss->supprates, ni->ni_rates.rs_rates, ni->ni_rates.rs_nrates); /* Write the fixed fields of the beacon frame. */ @@ -1087,7 +1120,9 @@ rsu_join_bss(struct rsu_softc *sc, struc frm = ieee80211_add_htcap(frm, ni); bss->ieslen = htole32(frm - (uint8_t *)fixed); bss->len = htole32(((frm - buf) + 3) & ~3); - DPRINTF("sending join bss command to %s chan %d\n", + RSU_DPRINTF(sc, RSU_DEBUG_RESET | RSU_DEBUG_FWCMD, + "%s: sending join bss command to %s chan %d\n", + __func__, ether_sprintf(bss->macaddr), le32toh(bss->config.dsconfig)); return (rsu_fw_cmd(sc, R92S_CMD_JOIN_BSS, buf, sizeof(buf))); } @@ -1098,7 +1133,8 @@ rsu_disconnect(struct rsu_softc *sc) uint32_t zero = 0; /* :-) */ /* Disassociate from our current BSS. */ - DPRINTF("sending disconnect command\n"); + RSU_DPRINTF(sc, RSU_DEBUG_STATE | RSU_DEBUG_FWCMD, + "%s: sending disconnect command\n", __func__); return (rsu_fw_cmd(sc, R92S_CMD_DISCONNECT, &zero, sizeof(zero))); } @@ -1118,13 +1154,16 @@ rsu_event_survey(struct rsu_softc *sc, u if (__predict_false(len < sizeof(*bss) + le32toh(bss->ieslen))) return; - DPRINTFN(2, "found BSS %s: len=%d chan=%d inframode=%d " + RSU_DPRINTF(sc, RSU_DEBUG_SCAN, + "%s: found BSS %s: len=%d chan=%d inframode=%d " "networktype=%d privacy=%d\n", + __func__, ether_sprintf(bss->macaddr), le32toh(bss->len), le32toh(bss->config.dsconfig), le32toh(bss->inframode), le32toh(bss->networktype), le32toh(bss->privacy)); /* Build a fake beacon frame to let net80211 do all the parsing. */ + /* XXX TODO: just call the new scan API methods! */ pktlen = sizeof(*wh) + le32toh(bss->ieslen); if (__predict_false(pktlen > MCLBYTES)) return; @@ -1200,15 +1239,17 @@ rsu_rx_event(struct rsu_softc *sc, uint8 struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); - DPRINTFN(4, "Rx event code=%d len=%d\n", code, len); + RSU_DPRINTF(sc, RSU_DEBUG_RX, + "%s: Rx event code=%d len=%d\n", __func__, code, len); switch (code) { case R92S_EVT_SURVEY: if (vap->iv_state == IEEE80211_S_SCAN) rsu_event_survey(sc, buf, len); break; case R92S_EVT_SURVEY_DONE: - DPRINTF("site survey pass %d done, found %d BSS\n", - sc->sc_scan_pass, le32toh(*(uint32_t *)buf)); + RSU_DPRINTF(sc, RSU_DEBUG_SCAN, + "%s: site survey pass %d done, found %d BSS\n", + __func__, sc->sc_scan_pass, le32toh(*(uint32_t *)buf)); if (vap->iv_state != IEEE80211_S_SCAN) break; /* Ignore if not scanning. */ if (sc->sc_scan_pass == 0 && vap->iv_des_nssid != 0) { @@ -1239,15 +1280,16 @@ XXX and disrupts the WLAN traffic. Disab break; #endif case R92S_EVT_WPS_PBC: - DPRINTF("WPS PBC pushed.\n"); + RSU_DPRINTF(sc, RSU_DEBUG_RX | RSU_DEBUG_FWCMD, + "%s: WPS PBC pushed.\n", __func__); break; case R92S_EVT_FWDBG: - if (vap->iv_ifp->if_flags & IFF_DEBUG) { - buf[60] = '\0'; - printf("FWDBG: %s\n", (char *)buf); - } + buf[60] = '\0'; + RSU_DPRINTF(sc, RSU_DEBUG_FWDBG, "FWDBG: %s\n", (char *)buf); break; default: + RSU_DPRINTF(sc, RSU_DEBUG_ANY, "%s: unhandled code (%d)\n", + __func__, code); break; } } @@ -1258,7 +1300,7 @@ rsu_rx_multi_event(struct rsu_softc *sc, struct r92s_fw_cmd_hdr *cmd; int cmdsz; - DPRINTFN(6, "Rx events len=%d\n", len); + RSU_DPRINTF(sc, RSU_DEBUG_RX, "%s: Rx events len=%d\n", __func__, len); /* Skip Rx status. */ buf += sizeof(struct r92s_rx_stat); @@ -1339,7 +1381,9 @@ rsu_rx_frame(struct rsu_softc *sc, uint8 else *rssi = 0; - DPRINTFN(5, "Rx frame len=%d rate=%d infosz=%d rssi=%d\n", + RSU_DPRINTF(sc, RSU_DEBUG_RX, + "%s: Rx frame len=%d rate=%d infosz=%d rssi=%d\n", + __func__, pktlen, rate, infosz, *rssi); m = m_get2(pktlen, M_NOWAIT, MT_DATA, M_PKTHDR); @@ -1401,7 +1445,8 @@ rsu_rx_multi_frame(struct rsu_softc *sc, /* Get the number of encapsulated frames. */ stat = (struct r92s_rx_stat *)buf; npkts = MS(le32toh(stat->rxdw2), R92S_RXDW2_PKTCNT); - DPRINTFN(6, "Rx %d frames in one chunk\n", npkts); + RSU_DPRINTF(sc, RSU_DEBUG_RX, + "%s: Rx %d frames in one chunk\n", __func__, npkts); /* Process all of them. */ while (npkts-- > 0) { @@ -1540,6 +1585,13 @@ tr_setup: static void rsu_txeof(struct usb_xfer *xfer, struct rsu_data *data) { +#ifdef USB_DEBUG + struct rsu_softc *sc = usbd_xfer_softc(xfer); +#endif + + RSU_DPRINTF(sc, RSU_DEBUG_TXDONE, "%s: called; data=%p\n", + __func__, + data); if (data->m) { /* XXX status? */ @@ -1564,7 +1616,8 @@ rsu_bulk_tx_callback_sub(struct usb_xfer data = STAILQ_FIRST(&sc->sc_tx_active[which]); if (data == NULL) goto tr_setup; - DPRINTF("transfer done %p\n", data); + RSU_DPRINTF(sc, RSU_DEBUG_TXDONE, "%s: transfer done %p\n", + __func__, data); STAILQ_REMOVE_HEAD(&sc->sc_tx_active[which], next); rsu_txeof(xfer, data); STAILQ_INSERT_TAIL(&sc->sc_tx_inactive, data, next); @@ -1573,13 +1626,17 @@ rsu_bulk_tx_callback_sub(struct usb_xfer tr_setup: data = STAILQ_FIRST(&sc->sc_tx_pending[which]); if (data == NULL) { - DPRINTF("empty pending queue sc %p\n", sc); + RSU_DPRINTF(sc, RSU_DEBUG_TXDONE, + "%s: empty pending queue sc %p\n", __func__, sc); return; } STAILQ_REMOVE_HEAD(&sc->sc_tx_pending[which], next); STAILQ_INSERT_TAIL(&sc->sc_tx_active[which], data, next); usbd_xfer_set_frame_data(xfer, 0, data->buf, data->buflen); - DPRINTF("submitting transfer %p\n", data); + RSU_DPRINTF(sc, RSU_DEBUG_TXDONE, + "%s: submitting transfer %p\n", + __func__, + data); usbd_transfer_submit(xfer); break; default: @@ -1631,6 +1688,9 @@ rsu_tx_start(struct rsu_softc *sc, struc wh = mtod(m0, struct ieee80211_frame *); type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; + RSU_DPRINTF(sc, RSU_DEBUG_TX, "%s: data=%p, m=%p\n", + __func__, data, m0); + if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { k = ieee80211_crypto_encap(ni, m0); if (k == NULL) { @@ -1704,6 +1764,7 @@ rsu_tx_start(struct rsu_softc *sc, struc tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags); ieee80211_radiotap_tx(vap, m0); } + xferlen = sizeof(*txd) + m0->m_pkthdr.len; m_copydata(m0, 0, m0->m_pkthdr.len, (caddr_t)&txd[1]); @@ -1979,7 +2040,9 @@ rsu_power_on_bcut(struct rsu_softc *sc) rsu_ms_delay(sc); } if (ntries == 20) { - DPRINTF("TxDMA is not ready\n"); + RSU_DPRINTF(sc, RSU_DEBUG_RESET | RSU_DEBUG_TX, + "%s: TxDMA is not ready\n", + __func__); /* Reset TxDMA. */ reg = rsu_read_1(sc, R92S_CR); rsu_write_1(sc, R92S_CR, reg & ~R92S_CR_TXDMA_EN); @@ -2041,7 +2104,9 @@ rsu_fw_loadsection(struct rsu_softc *sc, txd->txdw0 |= htole32(SM(R92S_TXDW0_PKTLEN, mlen)); memcpy(&txd[1], buf, mlen); data->buflen = sizeof(*txd) + mlen; - DPRINTF("starting transfer %p\n", data); + RSU_DPRINTF(sc, RSU_DEBUG_TX | RSU_DEBUG_FW | RSU_DEBUG_RESET, + "%s: starting transfer %p\n", + __func__, data); STAILQ_INSERT_TAIL(&sc->sc_tx_pending[which], data, next); buf += mlen; len -= mlen; @@ -2063,7 +2128,9 @@ rsu_load_firmware(struct rsu_softc *sc) int ntries, error; if (rsu_read_1(sc, R92S_TCR) & R92S_TCR_FWRDY) { - DPRINTF("Firmware already loaded\n"); + RSU_DPRINTF(sc, RSU_DEBUG_FW | RSU_DEBUG_RESET, + "%s: Firmware already loaded\n", + __func__); return (0); } @@ -2319,7 +2386,9 @@ rsu_init(struct rsu_softc *sc) /* It really takes 1.5 seconds for the firmware to boot: */ usb_pause_mtx(&sc->sc_mtx, (3 * hz) / 2); - DPRINTF("setting MAC address to %s\n", ether_sprintf(macaddr)); + RSU_DPRINTF(sc, RSU_DEBUG_RESET, "%s: setting MAC address to %s\n", + __func__, + ether_sprintf(macaddr)); error = rsu_fw_cmd(sc, R92S_CMD_SET_MAC_ADDRESS, macaddr, IEEE80211_ADDR_LEN); if (error != 0) { @@ -2330,9 +2399,11 @@ rsu_init(struct rsu_softc *sc) rsu_write_1(sc, R92S_USB_HRPWM, R92S_USB_HRPWM_PS_ST_ACTIVE | R92S_USB_HRPWM_PS_ALL_ON); + /* XXX non-configurable psmode? */ memset(&cmd, 0, sizeof(cmd)); cmd.mode = R92S_PS_MODE_ACTIVE; - DPRINTF("setting ps mode to %d\n", cmd.mode); + RSU_DPRINTF(sc, RSU_DEBUG_RESET, "%s: setting ps mode to %d\n", + __func__, cmd.mode); error = rsu_fw_cmd(sc, R92S_CMD_SET_PWR_MODE, &cmd, sizeof(cmd)); if (error != 0) { device_printf(sc->sc_dev, "could not set PS mode\n");